MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / createGUI

Method createGUI

src/org/opensourcephysics/tools/Launcher.java:1405–2102  ·  view source on GitHub ↗

Creates the GUI. @param splash true to show the splash screen

(boolean splash)

Source from the content-addressed store, hash-verified

1403 * @param splash true to show the splash screen
1404 */
1405 protected void createGUI(boolean splash) {
1406 // create applet GUI items
1407 appletGUI(); // added by W. Christian
1408 // get existing frames
1409 Frame[] frames = Frame.getFrames();
1410 for (int i = 0, n = frames.length; i < n; i++) {
1411 existingFrames.add(frames[i]);
1412 }
1413 // instantiate the OSPLog and Translator
1414 OSPLog.getOSPLog();
1415 OSPRuntime.getTranslator();
1416 // set up the undo system
1417 undoManager = new LauncherUndo(this);
1418 undoSupport = new UndoableEditSupport();
1419 undoSupport.addUndoableEditListener(undoManager);
1420 // create the frame
1421 if (contentPane == null) {
1422 frame = new LauncherFrame();
1423 existingFrames.add(frame);
1424 if (splash && !OSPRuntime.isApplet) {
1425 splash();
1426 }
1427 xmlInspector = new JDialog(frame, false);
1428 xmlInspector.setSize(new java.awt.Dimension(600, 300));
1429 tableInspector = new XMLTableInspector(true, false);
1430 // center inspectors on screen
1431 Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
1432 int x = (dim.width - xmlInspector.getBounds().width) / 2;
1433 int y = (dim.height - xmlInspector.getBounds().height) / 2;
1434 xmlInspector.setLocation(x, y);
1435 x = (dim.width - tableInspector.getBounds().width) / 2;
1436 y = (dim.height - tableInspector.getBounds().height) / 2;
1437 tableInspector.setLocation(x, y);
1438 contentPane = new JPanel(new BorderLayout());
1439 contentPane.setPreferredSize(new Dimension(wInit, hInit));
1440 frame.setContentPane(contentPane);
1441 frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
1442 }
1443 // create xml inspector
1444 // create navigation bar
1445 navbar = new JToolBar();
1446 navbar.setFloatable(false);
1447 navbar.setBorder(BorderFactory.createEtchedBorder());
1448 navButton = new JButton(navOpenIcon);
1449 navButton.setBorder(BorderFactory.createEmptyBorder());
1450 navButton.setBorderPainted(false);
1451 navButton.setOpaque(false);
1452 navButton.addActionListener(new ActionListener() {
1453 @Override
1454 public void actionPerformed(ActionEvent e) {
1455 if (navbar.getComponentCount() > 1) {
1456 navbar.remove(backButton);
1457 navbar.remove(forwardButton);
1458 navbar.remove(navSpacer);
1459 if (navbarAddOns != null) {
1460 for (Component c : navbarAddOns) {
1461 if (c != null) {
1462 navbar.remove(c);

Callers 1

LauncherMethod · 0.95

Calls 15

appletGUIMethod · 0.95
getOSPLogMethod · 0.95
getTranslatorMethod · 0.95
splashMethod · 0.95
isWebStartMethod · 0.95
getInstalledLocalesMethod · 0.95
getDisplayLanguageMethod · 0.95
addListenerMethod · 0.95
getNameMethod · 0.95
getLaunchJarPathMethod · 0.95

Tested by

no test coverage detected