Code cleanup for Jskad's Tibetan font converter GUI.
This commit is contained in:
parent
896344f2d1
commit
dd22e161a5
3 changed files with 25 additions and 30 deletions
|
@ -38,25 +38,23 @@ class ConvertDialog extends JDialog
|
||||||
private static final boolean debug = false;
|
private static final boolean debug = false;
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
FontConversion controller;
|
private FontConversion controller;
|
||||||
|
|
||||||
Box fileBox, buttonBox;
|
private Box fileBox, buttonBox;
|
||||||
|
|
||||||
JPanel content, choicePanel;
|
private JPanel content;
|
||||||
|
|
||||||
JComboBox choices;
|
JPanel getContentPanel() { return content; }
|
||||||
|
|
||||||
|
private JComboBox choices;
|
||||||
|
|
||||||
private JComboBox warningLevels;
|
private JComboBox warningLevels;
|
||||||
|
|
||||||
JTextField oldTextField, newTextField;
|
private JTextField oldTextField, newTextField;
|
||||||
|
|
||||||
JButton browseOld, browseNew, convert, cancel, openDocOld, openDocNew, about;
|
private JButton browseOld, browseNew, convert, cancel, openDocOld, openDocNew, about;
|
||||||
|
|
||||||
JLabel oldLabel, newLabel;
|
private JFileChooser jfc;
|
||||||
|
|
||||||
String[] choiceNames;
|
|
||||||
|
|
||||||
JFileChooser jfc;
|
|
||||||
|
|
||||||
private static final String BROWSENEW = "Browse...";
|
private static final String BROWSENEW = "Browse...";
|
||||||
private static final String BROWSEOLD = BROWSENEW;
|
private static final String BROWSEOLD = BROWSENEW;
|
||||||
|
@ -98,8 +96,7 @@ class ConvertDialog extends JDialog
|
||||||
content.add(temp);
|
content.add(temp);
|
||||||
|
|
||||||
temp = new JPanel(new FlowLayout(FlowLayout.CENTER,5,5));
|
temp = new JPanel(new FlowLayout(FlowLayout.CENTER,5,5));
|
||||||
oldLabel = new JLabel("Original File: ");
|
temp.add(new JLabel("Original File: "));
|
||||||
temp.add(oldLabel);
|
|
||||||
|
|
||||||
oldTextField = new JTextField(25);
|
oldTextField = new JTextField(25);
|
||||||
JPanel tfTemp = new JPanel();
|
JPanel tfTemp = new JPanel();
|
||||||
|
@ -115,8 +112,7 @@ class ConvertDialog extends JDialog
|
||||||
content.add(temp);
|
content.add(temp);
|
||||||
|
|
||||||
temp = new JPanel(new FlowLayout(FlowLayout.CENTER,5,5));
|
temp = new JPanel(new FlowLayout(FlowLayout.CENTER,5,5));
|
||||||
newLabel = new JLabel("Converted File: ");
|
temp.add(new JLabel("Converted File: "));
|
||||||
temp.add(newLabel);
|
|
||||||
|
|
||||||
newTextField = new JTextField(25);
|
newTextField = new JTextField(25);
|
||||||
tfTemp = new JPanel();
|
tfTemp = new JPanel();
|
||||||
|
@ -158,8 +154,7 @@ class ConvertDialog extends JDialog
|
||||||
|
|
||||||
private void setChoices(String[] choices)
|
private void setChoices(String[] choices)
|
||||||
{
|
{
|
||||||
choiceNames = choices;
|
this.choices = new JComboBox(choices);
|
||||||
this.choices = new JComboBox(choiceNames);
|
|
||||||
this.choices.addActionListener(tal);
|
this.choices.addActionListener(tal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,27 +174,16 @@ public class ConverterGUI implements FontConversion, FontConverterConstants {
|
||||||
returnCode = 0;
|
returnCode = 0;
|
||||||
try {
|
try {
|
||||||
final ConvertDialog convDialog;
|
final ConvertDialog convDialog;
|
||||||
String[] choices = new String[]{
|
|
||||||
ACIP_TO_UNI,
|
|
||||||
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
|
|
||||||
};
|
|
||||||
if (null == owner) {
|
if (null == owner) {
|
||||||
convDialog
|
convDialog
|
||||||
= new ConvertDialog(new ConverterGUI(),
|
= new ConvertDialog(new ConverterGUI(),
|
||||||
choices,
|
CHOICES,
|
||||||
true);
|
true);
|
||||||
} else {
|
} else {
|
||||||
convDialog
|
convDialog
|
||||||
= new ConvertDialog(owner,
|
= new ConvertDialog(owner,
|
||||||
new ConverterGUI(),
|
new ConverterGUI(),
|
||||||
choices,
|
CHOICES,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,17 @@ interface FontConverterConstants
|
||||||
final String FIND_ALL_NON_TMW = "Find all non-TMW";
|
final String FIND_ALL_NON_TMW = "Find all non-TMW";
|
||||||
final String FIND_ALL_NON_TM = "Find all non-TM";
|
final String FIND_ALL_NON_TM = "Find all non-TM";
|
||||||
|
|
||||||
|
final String[] CHOICES = new String[]{
|
||||||
|
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
|
||||||
|
};
|
||||||
|
|
||||||
final String suggested_WYLIE_prefix = "THDL_Wylie_";
|
final String suggested_WYLIE_prefix = "THDL_Wylie_";
|
||||||
final String suggested_TO_TMW_prefix = "TMW_";
|
final String suggested_TO_TMW_prefix = "TMW_";
|
||||||
final String suggested_TO_UNI_prefix = "Uni_";
|
final String suggested_TO_UNI_prefix = "Uni_";
|
||||||
|
|
Loading…
Reference in a new issue