1717
1818package org .flossware .platform .swing ;
1919
20- import java .awt .*;
20+ import java .awt .BorderLayout ;
21+ import java .awt .Color ;
22+ import java .awt .FlowLayout ;
23+ import java .awt .Font ;
2124import java .awt .event .WindowAdapter ;
2225import java .awt .event .WindowEvent ;
2326import java .nio .file .Paths ;
2629import java .util .concurrent .ScheduledExecutorService ;
2730import java .util .concurrent .TimeUnit ;
2831
29- import javax .swing .*;
32+ import javax .swing .BorderFactory ;
33+ import javax .swing .JButton ;
34+ import javax .swing .JFileChooser ;
35+ import javax .swing .JFrame ;
36+ import javax .swing .JLabel ;
37+ import javax .swing .JOptionPane ;
38+ import javax .swing .JPanel ;
39+ import javax .swing .JScrollPane ;
40+ import javax .swing .JSeparator ;
41+ import javax .swing .JTable ;
42+ import javax .swing .ListSelectionModel ;
43+ import javax .swing .SwingConstants ;
44+ import javax .swing .SwingUtilities ;
3045import javax .swing .table .DefaultTableModel ;
3146
3247import org .flossware .platform .api .ApplicationState ;
@@ -70,10 +85,10 @@ public class SwingConsole {
7085 private static final Logger LOGGER = LoggerFactory .getLogger (SwingConsole .class );
7186
7287 private final PlatformManager platformManager ;
73- private final Frame frame ;
74- private final Table applicationTable ;
88+ private final JFrame frame ;
89+ private final JTable applicationTable ;
7590 private final DefaultTableModel tableModel ;
76- private final Label statusLabel ;
91+ private final JLabel statusLabel ;
7792 private final ScheduledExecutorService refreshExecutor ;
7893
7994 /**
@@ -87,7 +102,7 @@ public SwingConsole(PlatformManager platformManager) {
87102 }
88103
89104 this .platformManager = platformManager ;
90- this .frame = new Frame ("JPlatform Management Console" );
105+ this .frame = new JFrame ("JPlatform Management Console" );
91106 this .tableModel =
92107 new DefaultTableModel (
93108 new String [] {"Application ID" , "State" , "CPU Time (ms)" , "Heap (MB)" , "Threads" }, 0 ) {
@@ -96,8 +111,8 @@ public boolean isCellEditable(int row, int column) {
96111 return false ; // Read-only table
97112 }
98113 };
99- this .applicationTable = new Table (tableModel );
100- this .statusLabel = new Label ("Ready" );
114+ this .applicationTable = new JTable (tableModel );
115+ this .statusLabel = new JLabel ("Ready" );
101116 this .refreshExecutor =
102117 Executors .newSingleThreadScheduledExecutor (
103118 r -> {
@@ -126,29 +141,29 @@ public void windowClosed(WindowEvent e) {
126141 frame .setLayout (new BorderLayout ());
127142
128143 // Title panel
129- Panel titlePanel = new Panel ();
144+ JPanel titlePanel = new JPanel ();
130145 titlePanel .setBackground (new Color (41 , 128 , 185 ));
131- Label titleLabel = new Label ("JPlatform Management Console" );
146+ JLabel titleLabel = new JLabel ("JPlatform Management Console" );
132147 titleLabel .setFont (new Font ("Arial" , Font .BOLD , 20 ));
133148 titleLabel .setForeground (Color .WHITE );
134149 titlePanel .add (titleLabel );
135150 frame .add (titlePanel , BorderLayout .NORTH );
136151
137152 // Center panel with table
138- ScrollPane scrollPane = new ScrollPane (applicationTable );
153+ JScrollPane scrollPane = new JScrollPane (applicationTable );
139154 applicationTable .setSelectionMode (ListSelectionModel .SINGLE_SELECTION );
140155 applicationTable .setRowHeight (25 );
141156 applicationTable .getTableHeader ().setFont (new Font ("Arial" , Font .BOLD , 12 ));
142157 frame .add (scrollPane , BorderLayout .CENTER );
143158
144159 // Button panel
145- Panel buttonPanel = new Panel (new FlowLayout (FlowLayout .LEFT ));
160+ JPanel buttonPanel = new JPanel (new FlowLayout (FlowLayout .LEFT ));
146161
147- Button deployButton = new Button ("Deploy" );
148- Button startButton = new Button ("Start" );
149- Button stopButton = new Button ("Stop" );
150- Button undeployButton = new Button ("Undeploy" );
151- Button refreshButton = new Button ("Refresh" );
162+ JButton deployButton = new JButton ("Deploy" );
163+ JButton startButton = new JButton ("Start" );
164+ JButton stopButton = new JButton ("Stop" );
165+ JButton undeployButton = new JButton ("Undeploy" );
166+ JButton refreshButton = new JButton ("Refresh" );
152167
153168 deployButton .addActionListener (e -> deployApplication ());
154169 startButton .addActionListener (e -> startSelectedApplication ());
@@ -160,13 +175,13 @@ public void windowClosed(WindowEvent e) {
160175 buttonPanel .add (startButton );
161176 buttonPanel .add (stopButton );
162177 buttonPanel .add (undeployButton );
163- buttonPanel .add (new Separator (SwingConstants .VERTICAL ));
178+ buttonPanel .add (new JSeparator (SwingConstants .VERTICAL ));
164179 buttonPanel .add (refreshButton );
165180
166181 frame .add (buttonPanel , BorderLayout .SOUTH );
167182
168183 // Status bar
169- Panel statusPanel = new Panel (new BorderLayout ());
184+ JPanel statusPanel = new JPanel (new BorderLayout ());
170185 statusPanel .setBorder (BorderFactory .createEtchedBorder ());
171186 statusLabel .setBorder (BorderFactory .createEmptyBorder (2 , 5 , 2 , 5 ));
172187 statusPanel .add (statusLabel , BorderLayout .WEST );
@@ -415,7 +430,7 @@ public void shutdown() {
415430 *
416431 * @return the main frame
417432 */
418- Frame getFrame () {
433+ JFrame getFrame () {
419434 return frame ;
420435 }
421436
@@ -433,7 +448,7 @@ DefaultTableModel getTableModel() {
433448 *
434449 * @return the status label
435450 */
436- Label getStatusLabel () {
451+ JLabel getStatusLabel () {
437452 return statusLabel ;
438453 }
439454}
0 commit comments