|
@@ -31,6 +31,20 @@ import java.awt.Window.Type;
|
|
import javax.swing.JInternalFrame;
|
|
import javax.swing.JInternalFrame;
|
|
import java.awt.BorderLayout;
|
|
import java.awt.BorderLayout;
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JPanel;
|
|
|
|
+import javax.swing.JTextField;
|
|
|
|
+import javax.swing.JToolBar;
|
|
|
|
+import javax.swing.JButton;
|
|
|
|
+import javax.swing.JList;
|
|
|
|
+import javax.swing.ListSelectionModel;
|
|
|
|
+import javax.swing.AbstractListModel;
|
|
|
|
+import java.awt.Choice;
|
|
|
|
+import javax.swing.JComboBox;
|
|
|
|
+import javax.swing.DefaultComboBoxModel;
|
|
|
|
+import javax.swing.GroupLayout;
|
|
|
|
+import javax.swing.GroupLayout.Alignment;
|
|
|
|
+import java.awt.GridBagLayout;
|
|
|
|
+import java.awt.GridBagConstraints;
|
|
|
|
+import java.awt.Font;
|
|
|
|
|
|
public class GUI {
|
|
public class GUI {
|
|
|
|
|
|
@@ -58,6 +72,11 @@ public class GUI {
|
|
private JTable table;
|
|
private JTable table;
|
|
private final JTable table_2 = new JTable();
|
|
private final JTable table_2 = new JTable();
|
|
private Model model;
|
|
private Model model;
|
|
|
|
+ private final JPanel panel = new JPanel();
|
|
|
|
+ private final JTextField textField = new JTextField();
|
|
|
|
+ private final JComboBox comboBox = new JComboBox();
|
|
|
|
+ private final JButton btnAdd = new JButton("Add");
|
|
|
|
+ private final JToolBar toolBar = new JToolBar();
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -73,6 +92,7 @@ public class GUI {
|
|
*/
|
|
*/
|
|
@SuppressWarnings("serial")
|
|
@SuppressWarnings("serial")
|
|
private void initialize() {
|
|
private void initialize() {
|
|
|
|
+ textField.setColumns(10);
|
|
frmCyberPhysical = new JFrame();
|
|
frmCyberPhysical = new JFrame();
|
|
frmCyberPhysical.setTitle("Cyber Physical Systems Model");
|
|
frmCyberPhysical.setTitle("Cyber Physical Systems Model");
|
|
frmCyberPhysical.setBounds(100, 100, 891, 467);
|
|
frmCyberPhysical.setBounds(100, 100, 891, 467);
|
|
@@ -95,9 +115,6 @@ public class GUI {
|
|
menuBar.add(mnNewMenu_3);
|
|
menuBar.add(mnNewMenu_3);
|
|
|
|
|
|
menuBar.add(mnHelp);
|
|
menuBar.add(mnHelp);
|
|
- frmCyberPhysical.getContentPane().setLayout(new BoxLayout(frmCyberPhysical.getContentPane(), BoxLayout.X_AXIS));
|
|
|
|
-
|
|
|
|
- frmCyberPhysical.getContentPane().add(splitPane);
|
|
|
|
|
|
|
|
//Table
|
|
//Table
|
|
String[] columnNames = {"Consumer",
|
|
String[] columnNames = {"Consumer",
|
|
@@ -154,6 +171,7 @@ public class GUI {
|
|
table_2.getColumnModel().getColumn(0).setPreferredWidth(103);
|
|
table_2.getColumnModel().getColumn(0).setPreferredWidth(103);
|
|
table_2.getColumnModel().getColumn(1).setPreferredWidth(107);
|
|
table_2.getColumnModel().getColumn(1).setPreferredWidth(107);
|
|
table_2.getColumnModel().getColumn(2).setPreferredWidth(125);
|
|
table_2.getColumnModel().getColumn(2).setPreferredWidth(125);
|
|
|
|
+ frmCyberPhysical.getContentPane().setLayout(new BorderLayout(0, 0));
|
|
splitPane_2.setDividerLocation(200);
|
|
splitPane_2.setDividerLocation(200);
|
|
|
|
|
|
splitPane.setLeftComponent(scrollPane_1);
|
|
splitPane.setLeftComponent(scrollPane_1);
|
|
@@ -162,6 +180,17 @@ public class GUI {
|
|
|
|
|
|
scrollPane_1.setViewportView(tree);
|
|
scrollPane_1.setViewportView(tree);
|
|
|
|
|
|
|
|
+ scrollPane_1.setColumnHeaderView(panel);
|
|
|
|
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
|
|
|
|
+ toolBar.setFloatable(false);
|
|
|
|
+
|
|
|
|
+ panel.add(toolBar);
|
|
|
|
+ toolBar.add(comboBox);
|
|
|
|
+ comboBox.setModel(new DefaultComboBoxModel(new String[] {"Category", "Object"}));
|
|
|
|
+ toolBar.add(btnAdd);
|
|
|
|
+ panel.add(textField);
|
|
|
|
+ frmCyberPhysical.getContentPane().add(splitPane);
|
|
|
|
+
|
|
mntmOpen.addActionListener(new java.awt.event.ActionListener() {
|
|
mntmOpen.addActionListener(new java.awt.event.ActionListener() {
|
|
@Override
|
|
@Override
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|