diff --git a/src/main/java/ui/window/JDialogSysCAMSBlockDE.java b/src/main/java/ui/window/JDialogSysCAMSBlockDE.java index c14853667a47cf7af561699b1df7e38bed836c52..74eb4a5d94d7c24f02cde19dfc64e834bf30a326 100644 --- a/src/main/java/ui/window/JDialogSysCAMSBlockDE.java +++ b/src/main/java/ui/window/JDialogSysCAMSBlockDE.java @@ -42,10 +42,11 @@ import ui.syscams.*; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -64,12 +65,12 @@ import javax.swing.JTextField; import javax.swing.KeyStroke; /** - * Class JDialogSystemCAMSBlockDE + * Class JDialogSystemCAMSBlockDE * Dialog for managing of SystemC-AMS DE Block * Creation: 26/04/2018 * @version 1.0 26/04/2018 * @author Irina Kit Yan LEE -*/ + */ @SuppressWarnings("serial") @@ -88,7 +89,6 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener { public JDialogSysCAMSBlockDE(SysCAMSBlockDE block) { /** Set JDialog **/ this.setTitle("Setting DE Block Attributes"); - this.setSize(500, 180); this.setLocationRelativeTo(null); this.setVisible(true); this.setAlwaysOnTop(true); @@ -96,14 +96,14 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener { /** Parameters **/ this.block = block; - + getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close"); getRootPane().getActionMap().put("close", new AbstractAction() { public void actionPerformed(ActionEvent e) { - dispose(); + dispose(); } }); - + dialog(); } @@ -128,90 +128,82 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener { GridBagConstraints constraints = new GridBagConstraints(); JPanel attributesBoxPanel = new JPanel(); attributesBoxPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - attributesBoxPanel.setLayout(gridBag); + attributesBoxPanel.setLayout(gridBag); JLabel labelName = new JLabel("Name : "); - constraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); + constraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); gridBag.setConstraints(labelName, constraints); attributesBoxPanel.add(labelName); - if (block.getValue().toString().equals("")) { // name empty + if (block.getValue().toString().equals("")) { // name empty nameTextField = new JTextField(10); } else { nameTextField = new JTextField(block.getValue().toString(), 10); // name not empty } - constraints = new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(nameTextField, constraints); - attributesBoxPanel.add(nameTextField); - - JLabel periodLabel = new JLabel("Period Tp : "); - constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); + constraints = new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); + gridBag.setConstraints(nameTextField, constraints); + attributesBoxPanel.add(nameTextField); + + JLabel periodLabel = new JLabel("Period Tp : "); + constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); gridBag.setConstraints(periodLabel, constraints); attributesBoxPanel.add(periodLabel); - if (block.getPeriod() == -1) { // name empty // port.getName().toString().equals("") || + if (block.getPeriod() == -1) { // name empty // port.getName().toString().equals("") || periodTextField = new JTextField(10); } else { periodTextField = new JTextField("" + block.getPeriod(), 10); // name not empty } - constraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); + constraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); gridBag.setConstraints(periodTextField, constraints); attributesBoxPanel.add(periodTextField); listPeriodString = new String[3]; - listPeriodString[0] = "us"; + listPeriodString[0] = "us"; listPeriodString[1] = "ms"; listPeriodString[2] = "s"; periodComboBoxString = new JComboBox<String>(listPeriodString); if (block.getTime().equals("") || block.getTime().equals("us")) { periodComboBoxString.setSelectedIndex(0); - } else if (block.getTime().equals("ms")){ + } else if (block.getTime().equals("ms")) { periodComboBoxString.setSelectedIndex(1); } else { periodComboBoxString.setSelectedIndex(2); } periodComboBoxString.setActionCommand("time"); periodComboBoxString.addActionListener(this); - constraints = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); + constraints = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); gridBag.setConstraints(periodComboBoxString, constraints); attributesBoxPanel.add(periodComboBoxString); - + attributesBox.add(attributesBoxPanel); - + attributesMainPanel.add(attributesBox, BorderLayout.NORTH); // add box to grid // Down Side - JPanel downPanel = new JPanel(new GridLayout(1, 2)); + JPanel downPanel = new JPanel(new FlowLayout()); JButton saveCloseButton = new JButton("Save and close"); saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); - + mainPanel.add(downPanel, BorderLayout.CENTER); - + pack(); this.getRootPane().setDefaultButton(saveCloseButton); } @@ -238,7 +230,7 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener { } else { block.setPeriod(-1); } - + this.dispose(); } @@ -247,3 +239,4 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener { } } } + diff --git a/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java b/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java index 26adcb7e11655554aba6d84de6d3886704567b57..6be075177a2f9d9edb3b4045bcf6c02a83dfb9e3 100644 --- a/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java +++ b/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java @@ -43,10 +43,10 @@ import ui.util.IconManager; import java.awt.BorderLayout; import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -68,12 +68,12 @@ import javax.swing.JTextField; import javax.swing.KeyStroke; /** - * Class JDialogSystemCAMSBlockTDF - * Dialog for managing of SystemC-AMS TDF Block + * Class JDialogSystemCAMSBlockTDF Dialog for managing of SystemC-AMS TDF Block * Creation: 26/04/2018 + * * @version 1.0 26/04/2018 * @author Irina Kit Yan LEE -*/ + */ @SuppressWarnings("serial") @@ -94,7 +94,6 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener { public JDialogSysCAMSBlockTDF(SysCAMSBlockTDF block) { /** Set JDialog **/ this.setTitle("Setting TDF Block Attributes"); - this.setSize(500, 310); this.setLocationRelativeTo(null); this.setVisible(true); this.setAlwaysOnTop(true); @@ -102,88 +101,88 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener { /** Parameters **/ this.block = block; - + getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close"); - getRootPane().getActionMap().put("close", new AbstractAction() { - public void actionPerformed(ActionEvent e) { - dispose(); - } - }); - + getRootPane().getActionMap().put("close", new AbstractAction() { + public void actionPerformed(ActionEvent e) { + dispose(); + } + }); + dialog(); } - public StringBuffer encode(String data) { - StringBuffer databuf = new StringBuffer(data); - StringBuffer buffer = new StringBuffer(""); - int endline = 0; - int nb_arobase = 0; - int condition = 0; - - for(int pos = 0; pos != data.length(); pos++) { - char c = databuf.charAt(pos); - switch(c) { - case '\n' : - break; - case '\t' : - break; - case '{' : - buffer.append("{\n"); - endline = 1; - nb_arobase++; - break; - case '}' : - if (nb_arobase == 1) { - buffer.append("}\n"); - endline = 0; - } else { - int i = nb_arobase; - while (i >= 1) { - buffer.append("\t"); - i--; - } - buffer.append("}\n"); - endline = 1; - } - nb_arobase--; - break; - case ';' : - if (condition == 1) { - buffer.append(";"); - } else { - buffer.append(";\n"); - endline = 1; - } - break; - case ' ' : - if (endline == 0) { - buffer.append(databuf.charAt(pos)); - } - break; - case '(' : - buffer.append("("); - condition = 1; - break; - case ')' : - buffer.append(")"); - condition = 0; - break; - default : - if (endline == 1) { - endline = 0; - int i = nb_arobase; - while (i >= 1) { - buffer.append("\t"); - i--; - } - } - buffer.append(databuf.charAt(pos)); - break; - } - } - return buffer; - } - + public StringBuffer encode(String data) { + StringBuffer databuf = new StringBuffer(data); + StringBuffer buffer = new StringBuffer(""); + int endline = 0; + int nb_arobase = 0; + int condition = 0; + + for (int pos = 0; pos != data.length(); pos++) { + char c = databuf.charAt(pos); + switch (c) { + case '\n': + break; + case '\t': + break; + case '{': + buffer.append("{\n"); + endline = 1; + nb_arobase++; + break; + case '}': + if (nb_arobase == 1) { + buffer.append("}\n"); + endline = 0; + } else { + int i = nb_arobase; + while (i >= 1) { + buffer.append("\t"); + i--; + } + buffer.append("}\n"); + endline = 1; + } + nb_arobase--; + break; + case ';': + if (condition == 1) { + buffer.append(";"); + } else { + buffer.append(";\n"); + endline = 1; + } + break; + case ' ': + if (endline == 0) { + buffer.append(databuf.charAt(pos)); + } + break; + case '(': + buffer.append("("); + condition = 1; + break; + case ')': + buffer.append(")"); + condition = 0; + break; + default: + if (endline == 1) { + endline = 0; + int i = nb_arobase; + while (i >= 1) { + buffer.append("\t"); + i--; + } + } + buffer.append(databuf.charAt(pos)); + break; + } + } + return buffer; + } + public void dialog() { /** JPanel **/ JPanel mainPanel = new JPanel(new BorderLayout()); @@ -207,93 +206,84 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener { // BorderLayout for Adding Attributes GridBagLayout gridBag = new GridBagLayout(); - GridBagConstraints constraints = new GridBagConstraints(); - JPanel attributesBoxPanel = new JPanel(); - attributesBoxPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); - attributesBoxPanel.setLayout(gridBag); - - JLabel labelName = new JLabel("Name : "); - constraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(labelName, constraints); - attributesBoxPanel.add(labelName); - - if (block.getValue().toString().equals("")) { // name empty + GridBagConstraints constraints = new GridBagConstraints(); + JPanel attributesBoxPanel = new JPanel(); + attributesBoxPanel.setFont(new Font("Helvetica", Font.PLAIN, 14)); + attributesBoxPanel.setLayout(gridBag); + + JLabel labelName = new JLabel("Name : "); + constraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); + gridBag.setConstraints(labelName, constraints); + attributesBoxPanel.add(labelName); + + if (block.getValue().toString().equals("")) { // name empty nameTextField = new JTextField(10); } else { nameTextField = new JTextField(block.getValue().toString(), 10); // name not empty } - constraints = new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(nameTextField, constraints); - attributesBoxPanel.add(nameTextField); - - JLabel periodLabel = new JLabel("Period Tp : "); - constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); + constraints = new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); + gridBag.setConstraints(nameTextField, constraints); + attributesBoxPanel.add(nameTextField); + + JLabel periodLabel = new JLabel("Period Tp : "); + constraints = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); gridBag.setConstraints(periodLabel, constraints); attributesBoxPanel.add(periodLabel); - if (block.getPeriod() == -1) { // name empty // port.getName().toString().equals("") || + if (block.getPeriod() == -1) { // name empty // port.getName().toString().equals("") || periodTextField = new JTextField(10); } else { periodTextField = new JTextField("" + block.getPeriod(), 10); // name not empty } - constraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); - gridBag.setConstraints(periodTextField, constraints); - attributesBoxPanel.add(periodTextField); - - listPeriodString = new String[3]; - listPeriodString[0] = "us"; + constraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); + gridBag.setConstraints(periodTextField, constraints); + attributesBoxPanel.add(periodTextField); + + listPeriodString = new String[3]; + listPeriodString[0] = "us"; listPeriodString[1] = "ms"; listPeriodString[2] = "s"; periodComboBoxString = new JComboBox<String>(listPeriodString); if (block.getTime().equals("") || block.getTime().equals("us")) { periodComboBoxString.setSelectedIndex(0); - } else if (block.getTime().equals("ms")){ + } else if (block.getTime().equals("ms")) { periodComboBoxString.setSelectedIndex(1); } else { periodComboBoxString.setSelectedIndex(2); } periodComboBoxString.setActionCommand("time"); periodComboBoxString.addActionListener(this); - constraints = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, - GridBagConstraints.BOTH, - new Insets(5, 10, 5, 10), 0, 0); + constraints = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(5, 10, 5, 10), 0, 0); gridBag.setConstraints(periodComboBoxString, constraints); attributesBoxPanel.add(periodComboBoxString); attributesBox.add(attributesBoxPanel); // add border to box - + attributesMainPanel.add(attributesBox, BorderLayout.NORTH); // add box to grid // Down Side - JPanel downPanel = new JPanel(new GridLayout(1, 2)); + JPanel downPanel = new JPanel(new FlowLayout()); JButton saveCloseButton = new JButton("Save and close"); saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); - + mainPanel.add(downPanel, BorderLayout.CENTER); - this.getRootPane().setDefaultButton(saveCloseButton); // --- ProcessCode BorderLayout ---// @@ -303,13 +293,13 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener { codeBox.setBorder(BorderFactory.createTitledBorder("Generating code")); JPanel codeBoxPanel = new JPanel(new BorderLayout()); - + codeBoxPanel.add(new JLabel("Behavior function of TDF block : "), BorderLayout.NORTH); - + StringBuffer stringbuf = encode(block.getProcessCode()); String beginString = stringbuf.toString(); finalString = beginString.replaceAll("\t}", "}"); - + processCodeTextArea = new JTextArea(finalString); processCodeTextArea.setSize(100, 100); processCodeTextArea.setTabSize(2); @@ -324,9 +314,10 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener { processScrollPane.setPreferredSize(new Dimension(200, 150)); codeBoxPanel.add(processScrollPane, BorderLayout.SOUTH); - + codeBox.add(codeBoxPanel); processMainPanel.add(codeBox, BorderLayout.PAGE_START); + pack(); } public void actionPerformed(ActionEvent e) { @@ -352,7 +343,7 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener { } else { block.setPeriod(-1); } - + /** Save the process code into listProcessCodeTDF **/ block.setProcessCode(processCodeTextArea.getText()); @@ -364,3 +355,4 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener { } } } + diff --git a/src/main/java/ui/window/JDialogSysCAMSPortConverter.java b/src/main/java/ui/window/JDialogSysCAMSPortConverter.java index d100c9b98395c6a2dfe9a4e0deb3635258c97f26..0609e2e5f0c92766a0b9c366b133a7305f4099ee 100644 --- a/src/main/java/ui/window/JDialogSysCAMSPortConverter.java +++ b/src/main/java/ui/window/JDialogSysCAMSPortConverter.java @@ -42,6 +42,8 @@ import ui.syscams.*; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -94,7 +96,6 @@ public class JDialogSysCAMSPortConverter extends JDialog implements ActionListen public JDialogSysCAMSPortConverter(SysCAMSPortConverter port) { /** Set JDialog **/ this.setTitle("Setting Converter Ports"); - this.setSize(500, 318); this.setLocationRelativeTo(null); this.setVisible(true); this.setAlwaysOnTop(true); @@ -297,22 +298,24 @@ public class JDialogSysCAMSPortConverter extends JDialog implements ActionListen attributesMainPanel.add(box); // add grid to grid // Down Side - JPanel downPanel = new JPanel(new GridLayout(1, 2)); + JPanel downPanel = new JPanel(new FlowLayout()); JButton saveCloseButton = new JButton("Save and close"); saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); - + pack(); this.getRootPane().setDefaultButton(saveCloseButton); } @@ -389,3 +392,4 @@ public class JDialogSysCAMSPortConverter extends JDialog implements ActionListen } } } + diff --git a/src/main/java/ui/window/JDialogSysCAMSPortDE.java b/src/main/java/ui/window/JDialogSysCAMSPortDE.java index 65f8d8f1d4c11f9fc4db725a9a6c366ab899e75a..cabfacf1c24f39d6b3ff29586ae0f87055415ab4 100644 --- a/src/main/java/ui/window/JDialogSysCAMSPortDE.java +++ b/src/main/java/ui/window/JDialogSysCAMSPortDE.java @@ -42,6 +42,8 @@ import ui.syscams.*; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -94,7 +96,6 @@ public class JDialogSysCAMSPortDE extends JDialog implements ActionListener { public JDialogSysCAMSPortDE(SysCAMSPortDE port) { /** Set JDialog **/ this.setTitle("Setting DE Ports"); - this.setSize(500, 318); this.setLocationRelativeTo(null); this.setVisible(true); this.setAlwaysOnTop(true); @@ -293,22 +294,24 @@ public class JDialogSysCAMSPortDE extends JDialog implements ActionListener { attributesMainPanel.add(box); // add grid to grid // Down Side - JPanel downPanel = new JPanel(new GridLayout(1, 2)); + JPanel downPanel = new JPanel(new FlowLayout()); JButton saveCloseButton = new JButton("Save and close"); saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); - + pack(); this.getRootPane().setDefaultButton(saveCloseButton); } @@ -385,3 +388,4 @@ public class JDialogSysCAMSPortDE extends JDialog implements ActionListener { } } } + diff --git a/src/main/java/ui/window/JDialogSysCAMSPortTDF.java b/src/main/java/ui/window/JDialogSysCAMSPortTDF.java index 1ab3815a8c6af46467d9c612c957932ab63ddf81..ee34842628a150a29d868e936542be807a1acfc4 100644 --- a/src/main/java/ui/window/JDialogSysCAMSPortTDF.java +++ b/src/main/java/ui/window/JDialogSysCAMSPortTDF.java @@ -42,6 +42,8 @@ import ui.syscams.*; import ui.util.IconManager; import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -94,7 +96,6 @@ public class JDialogSysCAMSPortTDF extends JDialog implements ActionListener { public JDialogSysCAMSPortTDF(SysCAMSPortTDF port) { /** Set JDialog **/ this.setTitle("Setting TDF Ports"); - this.setSize(500, 318); this.setLocationRelativeTo(null); this.setVisible(true); this.setAlwaysOnTop(true); @@ -293,22 +294,24 @@ public class JDialogSysCAMSPortTDF extends JDialog implements ActionListener { attributesMainPanel.add(box); // add grid to grid // Down Side - JPanel downPanel = new JPanel(new GridLayout(1, 2)); + JPanel downPanel = new JPanel(new FlowLayout()); JButton saveCloseButton = new JButton("Save and close"); saveCloseButton.setIcon(IconManager.imgic25); saveCloseButton.setActionCommand("Save_Close"); saveCloseButton.addActionListener(this); + saveCloseButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(saveCloseButton); JButton cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconManager.imgic27); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); + cancelButton.setPreferredSize(new Dimension(200, 30)); downPanel.add(cancelButton); mainPanel.add(downPanel, BorderLayout.CENTER); - + pack(); this.getRootPane().setDefaultButton(saveCloseButton); } @@ -385,3 +388,4 @@ public class JDialogSysCAMSPortTDF extends JDialog implements ActionListener { } } } +