Added an About button. Code cleanup. Changed the Cancel button to the
Close button.
This commit is contained in:
parent
569fba6467
commit
9e6c3009ac
3 changed files with 57 additions and 57 deletions
|
@ -48,7 +48,7 @@ class ConvertDialog extends JDialog
|
|||
|
||||
JTextField oldTextField, newTextField;
|
||||
|
||||
JButton browseOld, browseNew, convert, cancel, openDoc;
|
||||
JButton browseOld, browseNew, convert, cancel, openDoc, about;
|
||||
|
||||
JLabel type, oldLabel, newLabel;
|
||||
|
||||
|
@ -63,7 +63,8 @@ class ConvertDialog extends JDialog
|
|||
final String BROWSENEW = "Browse";
|
||||
final String BROWSEOLD = BROWSENEW;
|
||||
final String CONVERT = "Convert";
|
||||
final String CANCEL = "Cancel";
|
||||
final String CANCEL = "Close";
|
||||
final String ABOUT = "About";
|
||||
|
||||
private final ThdlActionListener tal = new ThdlActionListener() {
|
||||
public void theRealActionPerformed(ActionEvent e) {
|
||||
|
@ -117,12 +118,11 @@ class ConvertDialog extends JDialog
|
|||
tfTemp.add(newTextField);
|
||||
temp.add(tfTemp);
|
||||
|
||||
if (true) { // DLC
|
||||
if (true) {
|
||||
browseNew = new JButton(BROWSENEW);
|
||||
browseNew.addActionListener(tal);
|
||||
}
|
||||
temp.add(browseNew);
|
||||
// DLC temp.add(new JLabel(" "));
|
||||
content.add(temp);
|
||||
|
||||
buttonBox = Box.createHorizontalBox();
|
||||
|
@ -143,6 +143,11 @@ class ConvertDialog extends JDialog
|
|||
buttonBox.add(Box.createHorizontalGlue());
|
||||
openDoc.setVisible(false);
|
||||
|
||||
about = new JButton(ABOUT);
|
||||
about.addActionListener(tal);
|
||||
buttonBox.add(about);
|
||||
buttonBox.add(Box.createHorizontalGlue());
|
||||
|
||||
content.add(buttonBox);
|
||||
setContentPane(content);
|
||||
pack();
|
||||
|
@ -199,7 +204,9 @@ class ConvertDialog extends JDialog
|
|||
return newFile;
|
||||
}
|
||||
|
||||
public ConvertDialog(FontConversion controller, String[] choices, boolean modal)
|
||||
public ConvertDialog(FontConversion controller,
|
||||
String[] choices,
|
||||
boolean modal)
|
||||
{
|
||||
super(new JDialog(),PROGRAM_TITLE,modal);
|
||||
setController(controller);
|
||||
|
@ -225,11 +232,13 @@ class ConvertDialog extends JDialog
|
|||
oldTextField.setText(fileName);
|
||||
updateNewFileGuess();
|
||||
oldFieldChanged = false;
|
||||
oldFile = jfc.getSelectedFile();
|
||||
oldFile = chosenFile;
|
||||
ThdlOptions.setUserPreference("thdl.Jskad.working.directory",
|
||||
chosenFile.getParentFile().getAbsolutePath());
|
||||
} else if(src.equals(browseNew)) {
|
||||
newTextField.setText(chosenFile.getPath());
|
||||
newFieldChanged = false;
|
||||
newFile = jfc.getSelectedFile();
|
||||
newFile = chosenFile;
|
||||
openDoc.setVisible(false);
|
||||
}
|
||||
} else if(cmd.equals(CONVERT)) {
|
||||
|
@ -238,12 +247,12 @@ class ConvertDialog extends JDialog
|
|||
|
||||
if(oldFieldChanged || getOldFile() == null) {
|
||||
if (debug)
|
||||
System.out.println("DLC: old field changed");
|
||||
System.out.println("old field changed");
|
||||
setOldFile(updateFile(oldFile,oldTextField));
|
||||
}
|
||||
if(newFieldChanged || getNewFile() == null) {
|
||||
if (debug)
|
||||
System.out.println("DLC: new field changed");
|
||||
System.out.println("new field changed");
|
||||
setNewFile(updateFile(newFile,newTextField));
|
||||
}
|
||||
|
||||
|
@ -317,6 +326,11 @@ class ConvertDialog extends JDialog
|
|||
System.runFinalization();
|
||||
this.dispose();
|
||||
System.exit(0);
|
||||
} else if(cmd.equals(ABOUT)) {
|
||||
JOptionPane.showMessageDialog(this,
|
||||
"This Tibetan Converter is Copyright 2003\nTibetan and Himalayan Digital Library and\nis protected by the THDL Open Community\nLicense Version 1.0.\n\nCompiled " + ThdlVersion.getTimeOfCompilation(),
|
||||
"About",
|
||||
JOptionPane.PLAIN_MESSAGE);
|
||||
} else if (cmd.equals("comboBoxChanged")) {
|
||||
updateNewFileGuess();
|
||||
}
|
||||
|
@ -357,22 +371,22 @@ class ConvertDialog extends JDialog
|
|||
String ct = (String)choices.getSelectedItem();
|
||||
if ("Find all non-TMW" == ct) {
|
||||
newFileNamePrefix = "FindAllNonTMW__";
|
||||
} else if ("Find some non-TMW" == ct) {
|
||||
} else if (FIND_SOME_NON_TMW == ct) {
|
||||
newFileNamePrefix = "FindSomeNonTMW__";
|
||||
} else if ("Find some non-TM" == ct) {
|
||||
} else if (FIND_SOME_NON_TM == ct) {
|
||||
newFileNamePrefix = "FindSomeNonTM__";
|
||||
} else if ("Find all non-TM" == ct) {
|
||||
} else if (FIND_ALL_NON_TM == ct) {
|
||||
newFileNamePrefix = "FindAllNonTM__";
|
||||
} else { // conversion {to Wylie or TM} mode
|
||||
if ("TMW to Wylie" == ct) {
|
||||
newFileNamePrefix = "THDL_Wylie_";
|
||||
} else if ("TMW to Unicode" == ct) {
|
||||
newFileNamePrefix = "Uni_";
|
||||
} else if ("TM to TMW" == ct) {
|
||||
newFileNamePrefix = "TMW_";
|
||||
if (TMW_TO_WYLIE == ct) {
|
||||
newFileNamePrefix = suggested_WYLIE_prefix;
|
||||
} else if (TMW_TO_UNI == ct) {
|
||||
newFileNamePrefix = suggested_TO_UNI_prefix;
|
||||
} else if (TM_TO_TMW == ct) {
|
||||
newFileNamePrefix = suggested_TO_TMW_prefix;
|
||||
} else {
|
||||
ThdlDebug.verify("TMW to TM" == ct);
|
||||
newFileNamePrefix = "TM_";
|
||||
ThdlDebug.verify(TMW_TO_TM == ct);
|
||||
newFileNamePrefix = suggested_TO_TM_prefix;
|
||||
}
|
||||
}
|
||||
newTextField.setText(oldFileDirName
|
||||
|
|
|
@ -26,7 +26,7 @@ import javax.swing.JOptionPane;
|
|||
|
||||
/** DLC FIXMEDOC
|
||||
* @author David Chandler */
|
||||
public class ConverterGUI implements FontConversion {
|
||||
public class ConverterGUI implements FontConversion, FontConverterConstants {
|
||||
/** Default constructor; does nothing */
|
||||
ConverterGUI() { }
|
||||
|
||||
|
@ -92,14 +92,14 @@ public class ConverterGUI implements FontConversion {
|
|||
// for these, because they're
|
||||
// used in
|
||||
// TibetanConverter.java too.
|
||||
"TM to TMW",
|
||||
"TMW to Unicode",
|
||||
"TMW to Wylie",
|
||||
"TMW to TM",
|
||||
"Find some non-TMW",
|
||||
"Find some non-TM",
|
||||
"Find all non-TMW",
|
||||
"Find all non-TM"
|
||||
TM_TO_TMW,
|
||||
TMW_TO_UNI,
|
||||
TMW_TO_WYLIE,
|
||||
TMW_TO_TM,
|
||||
FIND_SOME_NON_TMW,
|
||||
FIND_SOME_NON_TM,
|
||||
FIND_ALL_NON_TMW,
|
||||
FIND_ALL_NON_TM
|
||||
},
|
||||
true);
|
||||
|
||||
|
|
|
@ -26,36 +26,22 @@ import java.awt.*;
|
|||
@author Nathaniel Garson, Tibetan and Himalayan Digital Library */
|
||||
interface FontConverterConstants
|
||||
{
|
||||
final String TM_TO_TMW = "TM to TMW";
|
||||
final String TMW_TO_UNI = "TMW to Unicode";
|
||||
final String TMW_TO_WYLIE = "TMW to Wylie";
|
||||
final String TMW_TO_TM = "TMW to TM";
|
||||
final String FIND_SOME_NON_TMW = "Find some non-TMW";
|
||||
final String FIND_SOME_NON_TM = "Find some non-TM";
|
||||
final String FIND_ALL_NON_TMW = "Find all non-TMW";
|
||||
final String FIND_ALL_NON_TM = "Find all non-TM";
|
||||
|
||||
final String suggested_WYLIE_prefix = "THDL_Wylie_";
|
||||
final String suggested_TO_TMW_prefix = "TMW_";
|
||||
final String suggested_TO_UNI_prefix = "Uni_";
|
||||
final String suggested_TO_TM_prefix = "TM_";
|
||||
|
||||
// DLC prune
|
||||
|
||||
// File Constants
|
||||
String HOME_PATH = System.getProperties().getProperty("user.dir");
|
||||
File HOME_FOLDER = new File(HOME_PATH);
|
||||
|
||||
// GUI Constants
|
||||
// Sizes
|
||||
Dimension WIN_SIZE = new Dimension(600,400);
|
||||
|
||||
|
||||
// Colors
|
||||
Color BG_COLOR = Color.white;
|
||||
|
||||
// Data Delimiters
|
||||
String COMMENT_DELIM = "////";
|
||||
String HEADER_DELIM = "<?";
|
||||
String DATA_DELIM = "=";
|
||||
String FONT_NUM_DELIM = ",";
|
||||
|
||||
// Data File Headers
|
||||
String OLD_FONT_HEADER = "old_fonts";
|
||||
String NEW_FONT_HEADER = "new_fonts";
|
||||
String CORRESP_HEADER = "correspondences";
|
||||
String END_OF_SECTION = "EOS";
|
||||
|
||||
// Type Constants
|
||||
public final int TIB_TO_TIB = 0;
|
||||
public final int DIA_TO_UNICODE = 1;
|
||||
|
||||
// String Constants
|
||||
public final String PROGRAM_TITLE = "THDL Font Conversion (with Jskad Technology)";
|
||||
|
||||
|
|
Loading…
Reference in a new issue