- Timestamp:
- 11/12/2019 07:26:10 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/tmcsim/client/CADClient.java (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/client/CADClient.java
r453 r525 1 1 package tmcsim.client; 2 2 3 import java.awt.BorderLayout; 4 import java.awt.Color; 5 import java.awt.Dialog; 6 import java.awt.Font; 7 import java.awt.GraphicsEnvironment; 8 import java.awt.Point; 3 9 import java.awt.event.WindowEvent; 4 10 import java.awt.event.WindowListener; … … 13 19 import java.util.logging.Level; 14 20 import java.util.logging.Logger; 21 import javax.swing.JDialog; 15 22 16 23 import javax.swing.JFrame; 24 import javax.swing.JLabel; 17 25 import javax.swing.JOptionPane; 18 26 import javax.swing.JWindow; 27 import javax.swing.SwingConstants; 19 28 import javax.swing.UIManager; 20 29 … … 136 145 if (!verifyProperties(propertiesFile)) 137 146 System.exit(0); 138 147 // Display a splash screen. Ticket #199. 148 JDialog dlg = createSplashScreen(); 149 dlg.setVisible(true); 150 139 151 connect(cadClientProp.getProperty(PROPERTIES.CAD_SIM_HOST.name).trim(), 140 152 cadClientProp.getProperty(PROPERTIES.CAD_RMI_PORT.name).trim()); … … 218 230 } 219 231 }); 220 232 // Remove the splash screen. 233 dlg.dispose(); 234 221 235 theClientScreenView.initWindow(); 222 236 theClientScreenView.setVisible(false); … … 255 269 } 256 270 }); 257 258 271 cadFrame.setVisible(true); 259 272 } … … 269 282 270 283 ensureProperShutdown(); 271 272 273 284 } 274 285 … … 504 515 505 516 } 506 517 518 /** Create a Splash Screen that displays a "loading" message. 519 * Implements ticket #199 520 * @return a JDialog with a "loading" message. 521 */ 522 private JDialog createSplashScreen() 523 { 524 final int dialogSize = 300; // desired width and height of dialog 525 // create the dialog 526 JDialog dlg = new JDialog(null,"VisiCAD loading",Dialog.ModalityType.MODELESS); 527 // make the dialog background a color similar to the login screen background 528 dlg.getContentPane().setBackground(new Color(78, 162, 210)); 529 // create the text message to be displayed 530 JLabel dlgMsg = new JLabel("Just a moment ...", SwingConstants.CENTER); 531 // configure the font and color of the text message 532 dlgMsg.setFont(new Font("Arial", Font.PLAIN, 22)); 533 dlgMsg.setForeground(Color.white); 534 // Add the msg to the center of the dialog 535 dlg.add(dlgMsg,BorderLayout.CENTER); 536 // Set how big we want the dialog to be 537 dlg.setSize(dialogSize, dialogSize); 538 // Calculate where to place the dialog on the screen 539 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); 540 Point centerPoint = ge.getCenterPoint(); 541 int dx = centerPoint.x - dialogSize/2; 542 int dy = centerPoint.y - dialogSize/2; 543 dlg.setLocation(dx, dy); 544 // return the completely built dialog 545 return dlg; 546 } 547 507 548 public void refresh() { 508 549 theClientGUI.screen.refreshScreens();
Note: See TracChangeset
for help on using the changeset viewer.
