From: CVS by c. <jav...@li...> - 2004-11-30 19:07:35
|
CVS commit by creon1: Added "reload config" button M +23 -0 JavaBot/src/configgenerator/GUIFrontEnd.java 1.11 M +5 -1 JavaBot/src/configgenerator/GeneratorBackEnd.java 1.13 --- JavaBot/src/configgenerator/GUIFrontEnd.java #1.10:1.11 @@ -26,4 +26,5 @@ public class GUIFrontEnd extends JFrame private JButton saveConfigButton; private JButton closeGeneratorButton; + private JButton reloadConfigButton; public GUIFrontEnd() @@ -54,7 +55,16 @@ public class GUIFrontEnd extends JFrame backEnd = new GeneratorBackEnd(); configObjects = backEnd.getConfigObjects(); + reloadConfigButton = new JButton("Reload config"); saveConfigButton = new JButton("Save"); closeGeneratorButton = new JButton("Close"); + reloadConfigButton.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + reloadConfig(); + } + }); + saveConfigButton.addActionListener(new ActionListener() { @@ -117,4 +127,5 @@ public class GUIFrontEnd extends JFrame JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + buttonPanel.add(reloadConfigButton); buttonPanel.add(saveConfigButton); buttonPanel.add(closeGeneratorButton); @@ -134,4 +145,16 @@ public class GUIFrontEnd extends JFrame } + private void reloadConfig() + { + backEnd.initConfigObjects(); + configObjects = backEnd.getConfigObjects(); + + for(int i = 0; i < configObjects.length; i++) + { + tableModel.setValueAt(configObjects[i].getProperty(), i, 0); + tableModel.setValueAt(configObjects[i].getValue(), i, 1); + } + } + private class PropertyEditor extends JDialog { --- JavaBot/src/configgenerator/GeneratorBackEnd.java #1.12:1.13 @@ -28,5 +28,9 @@ public class GeneratorBackEnd servers = new Vector(); - // START CONFIG OBJECTS + initConfigObjects(); + } + + public void initConfigObjects() + { configObjects = new ConfigObject[7]; |