diff options
Diffstat (limited to 'src/JavaGUI/GFEditor2.java')
| -rw-r--r-- | src/JavaGUI/GFEditor2.java | 67 |
1 files changed, 41 insertions, 26 deletions
diff --git a/src/JavaGUI/GFEditor2.java b/src/JavaGUI/GFEditor2.java index 2751c1c18..91fe1fcdc 100644 --- a/src/JavaGUI/GFEditor2.java +++ b/src/JavaGUI/GFEditor2.java @@ -16,8 +16,9 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener, private int[] sizes = {10,12,16,20,25,30,36};
private String[] envfonts;
- private Font[] fontObjs;
- private static int DEFAULT_FONT_SIZE = 12;
+ private Font font;
+ Font[] fontObjs;
+ private static int DEFAULT_FONT_SIZE = 18;
private JComboBox fontList;
private JLabel fontLabel = new JLabel(" Font: ");
private JComboBox sizeList;
@@ -150,6 +151,7 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener, private JRadioButtonMenuItem rbMenuItemUnTyped;
private static JMenuItem fileMenuItem;
private static JCheckBoxMenuItem cbMenuItem;
+ private static JCheckBoxMenuItem treeCbMenuItem;
private static RadioListener myListener ;
private static ButtonGroup group = new ButtonGroup();
private static ButtonGroup languageGroup = new ButtonGroup();
@@ -178,12 +180,12 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener, menuBar.add(viewMenu);
menuBar.add(modeMenu);
- cbMenuItem = new JCheckBoxMenuItem("Tree");
- cbMenuItem.setActionCommand("showTree");
+ treeCbMenuItem = new JCheckBoxMenuItem("Tree");
+ treeCbMenuItem.setActionCommand("showTree");
myListener = new RadioListener();
- cbMenuItem.addActionListener(myListener);
- cbMenuItem.setSelected(true);
- viewMenu.add(cbMenuItem);
+ treeCbMenuItem.addActionListener(myListener);
+ treeCbMenuItem.setSelected(true);
+ viewMenu.add(treeCbMenuItem);
viewMenu.addSeparator();
fileMenuItem = new JMenuItem("Open...");
@@ -275,8 +277,9 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener, output.setSelectionColor(Color.green);
// output.setSelectionColor(Color.white);
// output.setFont(new Font("Arial Unicode MS", Font.PLAIN, 17));
- output.setFont(new Font(null, Font.PLAIN, 17));
- field.setFont(new Font(null, Font.PLAIN, 17));
+ font = new Font(null, Font.PLAIN, 20);
+ output.setFont(font);
+ field.setFont(font);
field.setFocusable(true);
field.addKeyListener(this);
field.addFocusListener(this);
@@ -343,10 +346,16 @@ public class GFEditor2 extends JFrame implements ActionListener, CaretListener, }
sizeList.addActionListener(this);
- upPanel.add(fontLabel);
- upPanel.add(fontList);
+ sizeList.setFont(font);
+ fontList.setFont(font);
+ menu.setFont(font);
+ filter.setFont(font);
+ modify.setFont(font);
+
upPanel.add(sizeLabel);
upPanel.add(sizeList);
+ upPanel.add(fontLabel);
+ upPanel.add(fontList);
tree.setToolTipText("The abstract syntax tree representation of the current editing object");
populateTree(tree);
@@ -959,7 +968,6 @@ System.out.println("encoding "+defaultEncoding); {
boolean abs = true;
Object obj = ae.getSource();
- Font font;
if ( obj == fontList ) {
font = new Font((String)fontList.getSelectedItem(), Font.PLAIN, ((Integer)sizeList.getSelectedItem()).intValue());
@@ -973,6 +981,7 @@ System.out.println("encoding "+defaultEncoding); tree.tree.setFont(font);
list.setFont(font);
sizeList.setFont(font);
+ popup2.setFont(font);
sizeLabel.setFont(font);
save.setFont(font);
fontList.setFont(font);
@@ -1140,8 +1149,8 @@ System.out.println("encoding "+defaultEncoding); treeChanged = true;
newObject = true;
- menu.removeAllItems();
- menu.addItem("New");
+ while (1< menu.getItemCount())
+ menu.removeItemAt(1);
langMenu.removeAll();
AbstractButton ab = null;
@@ -1201,8 +1210,6 @@ System.out.println("encoding "+defaultEncoding); }
submenu.removeAll();
- //menu.removeAllItems();
- //menu.addItem("New");
while (1< menu.getItemCount())
menu.removeItemAt(1);
System.out.println("importing: "+ file.getPath().replace('\\','/'));
@@ -1228,8 +1235,8 @@ System.out.println("encoding "+defaultEncoding); listModel.clear();
tree.clear();
populateTree(tree);
- menu.removeAllItems();
- menu.addItem("New");
+ while (1< menu.getItemCount())
+ menu.removeItemAt(1);
langMenu.removeAll();
AbstractButton ab = null;
@@ -1276,8 +1283,8 @@ System.out.println("encoding "+defaultEncoding); listModel.clear();
tree.clear();
populateTree(tree);
- menu.removeAllItems();
- menu.addItem("New");
+ while (1< menu.getItemCount())
+ menu.removeItemAt(1);
langMenu.removeAll();
AbstractButton ab = null;
@@ -1507,7 +1514,7 @@ System.out.println("encoding "+defaultEncoding); if (action.equals("showTree") ) {
if (!((JCheckBoxMenuItem)e.getSource()).isSelected()){
if (debug) System.out.println("was selected");
- cbMenuItem.setSelected(false);
+ treeCbMenuItem.setSelected(false);
if (((JRadioButtonMenuItem)viewMenu.getItem(2)).isSelected()) {
centerPanel.remove(treePanel);
centerPanel.setLeftComponent(outputPanelUp);
@@ -1519,7 +1526,7 @@ System.out.println("encoding "+defaultEncoding); }
else {
if (debug) System.out.println("was not selected");
- cbMenuItem.setSelected(true);
+ treeCbMenuItem.setSelected(true);
if (((JRadioButtonMenuItem)viewMenu.getItem(2)).isSelected()) {
centerPanel.remove(outputPanelUp);
treePanel.setRightComponent(outputPanelUp);
@@ -1569,10 +1576,11 @@ System.out.println("encoding "+defaultEncoding); send("ml Abs");
}
else
- {
+ if (!action.equals("split")&&!action.equals("combine")&&!action.equals("showTree"))
+ {
System.out.println("sending "+action);
send("ml " + action);
- }
+ }
}
}
}
@@ -2077,9 +2085,15 @@ System.out.println("encoding "+defaultEncoding); {
if (debug3) System.out.println(e.getX() + " " + e.getY());
if (selectedText.length()<5)
- field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, 400, 40);
+ if (treeCbMenuItem.isSelected())
+ field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, 400, 40);
+ else
+ field.setBounds(e.getX(), e.getY()+80, 400, 40);
else
- field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, selectedText.length()*20, 40);
+ if (treeCbMenuItem.isSelected())
+ field.setBounds(e.getX()+(int)Math.round(tree.getBounds().getWidth()), e.getY()+80, selectedText.length()*20, 40);
+ else
+ field.setBounds(e.getX(), e.getY()+80, selectedText.length()*20, 40);
getLayeredPane().add(field, new Integer(1), 0);
field.setText(selectedText);
field.requestFocusInWindow();
@@ -2088,6 +2102,7 @@ System.out.println("encoding "+defaultEncoding); }
void addMenuItem(String name){
menuItem2 = new JMenuItem(name);
+ menuItem2.setFont(font);
menuItem2.setActionCommand("popupMenuItem");
menuItem2.addActionListener(this);
popup2.add(menuItem2);
|
