|
@@ -24,10 +24,15 @@ import javax.swing.JEditorPane;
|
|
|
import javax.swing.JFileChooser;
|
|
|
import javax.swing.table.DefaultTableModel;
|
|
|
import java.awt.Color;
|
|
|
+import java.awt.Component;
|
|
|
+import java.awt.Window.Type;
|
|
|
+import javax.swing.JInternalFrame;
|
|
|
+import java.awt.BorderLayout;
|
|
|
+import javax.swing.JPanel;
|
|
|
|
|
|
public class GUI {
|
|
|
|
|
|
- private JFrame frame;
|
|
|
+ private JFrame frmCyberPhysical;
|
|
|
private final JMenuBar menuBar = new JMenuBar();
|
|
|
private final JMenu mnNewMenu = new JMenu("File");
|
|
|
private final JMenu mnNewMenu_1 = new JMenu("Edit");
|
|
@@ -46,8 +51,6 @@ public class GUI {
|
|
|
private final JTree tree = new JTree();
|
|
|
private final JEditorPane dtrpnHereWillBe = new JEditorPane();
|
|
|
private final JSplitPane splitPane_2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
- private final JSplitPane splitPane_Producer = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
- private final JSplitPane splitPane_Consumer = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
|
|
|
private JTable table;
|
|
|
private final JTable table_2 = new JTable();
|
|
|
|
|
@@ -69,7 +72,7 @@ public class GUI {
|
|
|
public void run() {
|
|
|
try {
|
|
|
GUI window = new GUI();
|
|
|
- window.frame.setVisible(true);
|
|
|
+ window.frmCyberPhysical.setVisible(true);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -89,11 +92,12 @@ public class GUI {
|
|
|
*/
|
|
|
@SuppressWarnings("serial")
|
|
|
private void initialize() {
|
|
|
- frame = new JFrame();
|
|
|
- frame.setBounds(100, 100, 863, 467);
|
|
|
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
+ frmCyberPhysical = new JFrame();
|
|
|
+ frmCyberPhysical.setTitle("Cyber Physical Systems Model");
|
|
|
+ frmCyberPhysical.setBounds(100, 100, 891, 467);
|
|
|
+ frmCyberPhysical.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
|
|
|
- frame.setJMenuBar(menuBar);
|
|
|
+ frmCyberPhysical.setJMenuBar(menuBar);
|
|
|
|
|
|
menuBar.add(mnNewMenu);
|
|
|
|
|
@@ -110,9 +114,9 @@ public class GUI {
|
|
|
menuBar.add(mnNewMenu_3);
|
|
|
|
|
|
menuBar.add(mnHelp);
|
|
|
- frame.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), BoxLayout.X_AXIS));
|
|
|
+ frmCyberPhysical.getContentPane().setLayout(new BoxLayout(frmCyberPhysical.getContentPane(), BoxLayout.X_AXIS));
|
|
|
|
|
|
- frame.getContentPane().add(splitPane);
|
|
|
+ frmCyberPhysical.getContentPane().add(splitPane);
|
|
|
|
|
|
//Table
|
|
|
String[] columnNames = {"Consumer",
|
|
@@ -138,14 +142,22 @@ public class GUI {
|
|
|
|
|
|
splitPane_1.setLeftComponent(tabbedPane);
|
|
|
|
|
|
+ JScrollPane scrollPane = new JScrollPane();
|
|
|
splitPane_1.setRightComponent(splitPane_2);
|
|
|
+ splitPane_2.setLeftComponent(scrollPane);
|
|
|
table = new JTable(data, columnNames);
|
|
|
- splitPane_2.setLeftComponent(splitPane_Producer);
|
|
|
- splitPane_2.setDividerLocation(200);
|
|
|
- splitPane_2.setRightComponent(splitPane_Consumer);
|
|
|
+ scrollPane.setViewportView(table);
|
|
|
|
|
|
- splitPane_Producer.setLeftComponent(new JScrollPane(table));
|
|
|
- splitPane_Consumer.setLeftComponent(new JScrollPane(table_2));
|
|
|
+ table.setFillsViewportHeight(true);
|
|
|
+ table.setModel(new DefaultTableModel(
|
|
|
+ data,
|
|
|
+ columnNames
|
|
|
+ ));
|
|
|
+ table.setCellSelectionEnabled(true);
|
|
|
+ table.setColumnSelectionAllowed(true);
|
|
|
+ JScrollPane scrollPane_3 = new JScrollPane();
|
|
|
+ splitPane_2.setRightComponent(scrollPane_3);
|
|
|
+ scrollPane_3.setViewportView(table_2);
|
|
|
|
|
|
table_2.setFillsViewportHeight(true);
|
|
|
table_2.setModel(new DefaultTableModel(
|
|
@@ -155,19 +167,13 @@ public class GUI {
|
|
|
{"Something Else", "25", "3"},
|
|
|
},
|
|
|
new String[] {
|
|
|
- "Producer", "Name", "Number"
|
|
|
+ "Producer", "Units", "Number"
|
|
|
}
|
|
|
));
|
|
|
table_2.getColumnModel().getColumn(0).setPreferredWidth(103);
|
|
|
table_2.getColumnModel().getColumn(1).setPreferredWidth(107);
|
|
|
table_2.getColumnModel().getColumn(2).setPreferredWidth(125);
|
|
|
- table.setFillsViewportHeight(true);
|
|
|
- table.setModel(new DefaultTableModel(
|
|
|
- data,
|
|
|
- columnNames
|
|
|
- ));
|
|
|
- table.setCellSelectionEnabled(true);
|
|
|
- table.setColumnSelectionAllowed(true);
|
|
|
+ splitPane_2.setDividerLocation(200);
|
|
|
|
|
|
splitPane.setLeftComponent(scrollPane_1);
|
|
|
tree.setEditable(true);
|