List of usage examples for javax.swing WindowConstants EXIT_ON_CLOSE
int EXIT_ON_CLOSE
To view the source code for javax.swing WindowConstants EXIT_ON_CLOSE.
Click Source Link
From source file:org.onebusaway.phone.client.SimplePhoneClient.java
private static void setupGui(AgiClientScriptImpl script) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); KeyPressHandler handler = new KeyPressHandler(script); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.addKeyListener(handler);//from ww w .ja va 2s .c o m JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(4, 3)); panel.add(buttonPanel, BorderLayout.CENTER); String buttons = "123456789*0#"; for (int i = 0; i < buttons.length(); i++) addButton(buttonPanel, script, handler, buttons.charAt(i)); Document document = script.getDocument(); final JTextArea textArea = new JTextArea(document); textArea.setEditable(false); textArea.addKeyListener(handler); document.addDocumentListener(new ScrollDocumentToEnd(textArea)); JScrollPane scrollPane = new JScrollPane(textArea); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setPreferredSize(new Dimension(300, 100)); scrollPane.addKeyListener(handler); panel.add(scrollPane, BorderLayout.SOUTH); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); }
From source file:org.optaplanner.benchmark.impl.aggregator.swingui.BenchmarkAggregatorFrame.java
public void init() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); initPlannerBenchmarkResultList(); setContentPane(createContentPane()); pack(); setLocationRelativeTo(null); }
From source file:org.rivalry.swingui.RivalryUI.java
/** * Application method./*from ww w .ja v a 2 s.c o m*/ * * @param args Application arguments. */ public static final void main(final String[] args) { System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Rivalry UI"); System.out.println("Applying look and feel: " + _uiUserPreferences.getLookAndFeel().getName()); _uiUserPreferences.getLookAndFeel().apply(); EventQueue.invokeLater(new Runnable() { @Override public void run() { final RivalryUI panel = new RivalryUI(); _frame = new JFrame("Rivalry UI"); _frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); _frame.getContentPane().add(panel, BorderLayout.CENTER); _frame.setSize(1900, 600); _frame.setLocationByPlatform(true); _frame.setVisible(true); } }); }
From source file:org.sikuli.ide.SikuliIDE.java
private void initSikuliIDE(String[] args) { prefs = PreferencesUser.getInstance(); if (prefs.getUserType() < 0) { prefs.setUserType(PreferencesUser.NEWBEE); prefs.setIdeSession(""); prefs.setDefaults(prefs.getUserType()); }/*from w w w. j av a 2 s . com*/ ResourceLoader.get().check(Settings.SIKULI_LIB); _windowSize = prefs.getIdeSize(); _windowLocation = prefs.getIdeLocation(); Screen m = (Screen) (new Location(_windowLocation)).getScreen(); if (m == null) { String em = "Remembered window not valid.\nGoing to primary screen"; log(-1, em); Sikulix.popError(em, "IDE has problems ..."); m = Screen.getPrimaryScreen(); _windowSize.width = 0; } Rectangle s = m.getBounds(); if (_windowSize.width == 0 || _windowSize.width > s.width || _windowSize.height > s.height) { if (s.width < 1025) { _windowSize = new Dimension(1024, 700); _windowLocation = new Point(0, 0); } else { _windowSize = new Dimension(s.width - 150, s.height - 100); _windowLocation = new Point(75, 0); } } setSize(_windowSize); setLocation(_windowLocation); Debug.log(3, "IDE: Adding components to window"); initMenuBars(this); final Container c = getContentPane(); c.setLayout(new BorderLayout()); Debug.log(3, "IDE: creating tabbed editor"); initTabPane(); Debug.log(3, "IDE: creating message area"); initMsgPane(prefs.getPrefMoreMessage() == PreferencesUser.HORIZONTAL); // RaiMan not used initSidePane(); // IDE UnitTest Debug.log(3, "IDE: creating combined work window"); JPanel codeAndUnitPane = new JPanel(new BorderLayout(10, 10)); codeAndUnitPane.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0)); codeAndUnitPane.add(tabPane, BorderLayout.CENTER); // RaiMan not used codeAndUnitPane.add(_sidePane, BorderLayout.EAST); if (prefs.getPrefMoreMessage() == PreferencesUser.VERTICAL) { _mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, codeAndUnitPane, msgPane); } else { _mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, codeAndUnitPane, msgPane); } _mainSplitPane.setResizeWeight(0.6); _mainSplitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); Debug.log(3, "IDE: Putting all together"); JPanel editPane = new JPanel(new BorderLayout(0, 0)); JComponent cp = createCommandPane(); if (PreferencesUser.getInstance().getPrefMoreCommandBar()) { editPane.add(cp, BorderLayout.WEST); } editPane.add(_mainSplitPane, BorderLayout.CENTER); c.add(editPane, BorderLayout.CENTER); JToolBar tb = initToolbar(); c.add(tb, BorderLayout.NORTH); // the buttons c.add(initStatusbar(), BorderLayout.SOUTH); c.doLayout(); initShortcutKeys(); initHotkeys(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); initWindowListener(); initTooltip(); autoCheckUpdate(); _inited = true; try { getCurrentCodePane().requestFocus(); } catch (Exception e) { } restoreSession(0); if (tabPane.getTabCount() == 0) { (new FileAction()).doNew(null); } tabPane.setSelectedIndex(0); Debug.log(3, "Sikuli-IDE startup: " + ((new Date()).getTime() - start)); setVisible(true); _mainSplitPane.setDividerLocation(0.6); return; // as breakpoint }
From source file:org.thelq.stackexchange.dbimport.gui.GUI.java
public GUI(Controller passedController) { //Initialize logger logAppender = new GUILogAppender(this); //Set our Look&Feel try {//from w w w . j a v a 2 s . c om if (SystemUtils.IS_OS_WINDOWS) UIManager.setLookAndFeel(new WindowsLookAndFeel()); else UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { log.warn("Defaulting to Swing L&F due to exception", e); } this.controller = passedController; frame = new JFrame(); frame.setTitle("Unified StackExchange Data Dump Importer v" + Controller.VERSION); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); //Setup menu JMenuBar menuBar = new JMenuBar(); menuAdd = new JMenuItem("Add Folders/Archives"); menuAdd.setMnemonic(KeyEvent.VK_F); menuBar.add(menuAdd); frame.setJMenuBar(menuBar); //Primary panel FormLayout primaryLayout = new FormLayout("5dlu, pref:grow, 5dlu, 5dlu, pref", "pref, top:pref, pref, fill:140dlu:grow, pref, fill:80dlu"); PanelBuilder primaryBuilder = new PanelBuilder(primaryLayout) .border(BorderFactory.createEmptyBorder(5, 5, 5, 5)); //DB Config panel primaryBuilder.addSeparator("Database Configuration", CC.xyw(1, 1, 2)); FormLayout configLayout = new FormLayout("pref, 3dlu, pref:grow, 6dlu, pref", "pref, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow, 3dlu, pref:grow"); configLayout.setHonorsVisibility(true); final PanelBuilder configBuilder = new PanelBuilder(configLayout); configBuilder.addLabel("Server", CC.xy(1, 2), dbType = new JComboBox<DatabaseOption>(), CC.xy(3, 2)); configBuilder.add(dbAdvanced = new JCheckBox("Show advanced options"), CC.xy(5, 2)); configBuilder.addLabel("JDBC Connection", CC.xy(1, 4), jdbcString = new JTextField(15), CC.xyw(3, 4, 3)); configBuilder.addLabel("Username", CC.xy(1, 6), username = new JTextField(10), CC.xy(3, 6)); configBuilder.addLabel("Password", CC.xy(1, 8), password = new JPasswordField(10), CC.xy(3, 8)); configBuilder.add(importButton = new JButton("Import"), CC.xywh(5, 6, 1, 3)); //Add hidden JLabel dialectLabel = new JLabel("Dialect"); dialectLabel.setVisible(false); configBuilder.add(dialectLabel, CC.xy(1, 10), dialect = new JTextField(10), CC.xyw(3, 10, 3)); dialect.setVisible(false); JLabel driverLabel = new JLabel("Driver"); driverLabel.setVisible(false); configBuilder.add(driverLabel, CC.xy(1, 12), driver = new JTextField(10) { @Override public void setText(String text) { if (StringUtils.isBlank(text)) log.debug("Text is blank", new RuntimeException("Text " + text + " is blank")); super.setText(text); } }, CC.xyw(3, 12, 3)); driver.setVisible(false); primaryBuilder.add(configBuilder.getPanel(), CC.xy(2, 2)); //Options primaryBuilder.addSeparator("Options", CC.xyw(4, 1, 2)); FormLayout optionsLayout = new FormLayout("pref, 3dlu, pref:grow", ""); DefaultFormBuilder optionsBuilder = new DefaultFormBuilder(optionsLayout); optionsBuilder.append(disableCreateTables = new JCheckBox("Disable Creating Tables"), 3); optionsBuilder.append("Global Table Prefix", globalTablePrefix = new JTextField(7)); optionsBuilder.append("Threads", threads = new JSpinner()); //Save a core for the database int numThreads = Runtime.getRuntime().availableProcessors(); numThreads = (numThreads != 1) ? numThreads - 1 : numThreads; threads.setModel(new SpinnerNumberModel(numThreads, 1, 100, 1)); optionsBuilder.append("Batch Size", batchSize = new JSpinner()); batchSize.setModel(new SpinnerNumberModel(500, 1, 500000, 1)); primaryBuilder.add(optionsBuilder.getPanel(), CC.xy(5, 2)); //Locations primaryBuilder.addSeparator("Dump Locations", CC.xyw(1, 3, 5)); FormLayout locationsLayout = new FormLayout("pref, 15dlu, pref, 5dlu, pref, 5dlu, pref:grow, 2dlu, pref", ""); locationsBuilder = new DefaultFormBuilder(locationsLayout, new ScrollablePanel()).background(Color.WHITE) .lineGapSize(Sizes.ZERO); locationsPane = new JScrollPane(locationsBuilder.getPanel()); locationsPane.getViewport().setBackground(Color.white); locationsPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); locationsPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); primaryBuilder.add(locationsPane, CC.xyw(2, 4, 4)); //Logger primaryBuilder.addSeparator("Log", CC.xyw(1, 5, 5)); loggerText = new JTextPane(); loggerText.setEditable(false); JPanel loggerTextPanel = new JPanel(new BorderLayout()); loggerTextPanel.add(loggerText); JScrollPane loggerPane = new JScrollPane(loggerTextPanel); loggerPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); loggerPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); JPanel loggerPanePanel = new JPanel(new BorderLayout()); loggerPanePanel.add(loggerPane); primaryBuilder.add(loggerPanePanel, CC.xyw(2, 6, 4)); menuAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { //TODO: Allow 7z files but handle corner cases final JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fc.setMultiSelectionEnabled(true); fc.setDialogTitle("Select Folders/Archives"); fc.addChoosableFileFilter(new FileNameExtensionFilter("Archives", "7z", "zip")); fc.addChoosableFileFilter(new FileFilter() { @Getter protected String description = "Folders"; @Override public boolean accept(File file) { return file.isDirectory(); } }); if (fc.showOpenDialog(frame) != JFileChooser.APPROVE_OPTION) return; //Add files and folders in a seperate thread while updating gui in EDT importButton.setEnabled(false); for (File curFile : fc.getSelectedFiles()) { DumpContainer dumpContainer = null; try { if (curFile.isDirectory()) dumpContainer = new FolderDumpContainer(curFile); else dumpContainer = new ArchiveDumpContainer(controller, curFile); controller.addDumpContainer(dumpContainer); } catch (Exception ex) { String type = (dumpContainer != null) ? dumpContainer.getType() : ""; LoggerFactory.getLogger(getClass()).error("Cannot open " + type, ex); String location = (dumpContainer != null) ? Utils.getLongLocation(dumpContainer) : ""; showErrorDialog(ex, "Cannot open " + location, curFile.getAbsolutePath()); continue; } } updateLocations(); importButton.setEnabled(true); } }); //Add options (Could be in a map, but this is cleaner) dbType.addItem(new DatabaseOption().name("MySQL 5.5.3+") .jdbcString("jdbc:mysql://127.0.0.1:3306/stackexchange?rewriteBatchedStatements=true") .dialect("org.hibernate.dialect.MySQL5Dialect").driver("com.mysql.jdbc.Driver")); dbType.addItem(new DatabaseOption().name("PostgreSQL 8.1") .jdbcString("jdbc:postgresql://127.0.0.1:5432/stackexchange") .dialect("org.hibernate.dialect.PostgreSQL81Dialect").driver("org.postgresql.Driver")); dbType.addItem(new DatabaseOption().name("PostgreSQL 8.2+") .jdbcString("jdbc:postgresql://127.0.0.1:5432/stackexchange") .dialect("org.hibernate.dialect.PostgreSQL82Dialect").driver("org.postgresql.Driver")); dbType.addItem(new DatabaseOption().name("SQL Server") .jdbcString("jbdc:jtds:mssql://127.0.0.1:1433/stackexchange") .dialect("org.hibernate.dialect.SQLServerDialect").driver("net.sourceforge.jtds.jdbc.Driver")); dbType.addItem(new DatabaseOption().name("SQL Server 2005+") .jdbcString("jbdc:jtds:mssql://127.0.0.1:1433/stackexchange") .dialect("org.hibernate.dialect.SQLServer2005Dialect").driver("net.sourceforge.jtds.jdbc.Driver")); dbType.addItem(new DatabaseOption().name("SQL Server 2008+") .jdbcString("jbdc:jtds:mssql://127.0.0.1:1433/stackexchange") .dialect("org.hibernate.dialect.SQLServer2008Dialect").driver("net.sourceforge.jtds.jdbc.Driver")); dbType.addItem(new DatabaseOption().name("H2").jdbcString("jdbc:h2:stackexchange") .dialect("org.hibernate.dialect.H2Dialect").driver("org.h2.Driver")); dbType.setSelectedItem(null); dbType.addItemListener(new ItemListener() { boolean shownMysqlWarning = false; public void itemStateChanged(ItemEvent e) { //Don't run this twice for a single select if (e.getStateChange() == ItemEvent.DESELECTED) return; DatabaseOption selectedOption = (DatabaseOption) dbType.getSelectedItem(); if (selectedOption.name().startsWith("MySQL") && !shownMysqlWarning) { //Hide popup so you don't have to click twice on the dialog dbType.setPopupVisible(false); JOptionPane.showMessageDialog(frame, "Warning: Your server must be configured with character_set_server=utf8mb4" + "\nOtherwise, data dumps that contain 4 byte UTF-8 characters will fail", "MySQL Warning", JOptionPane.WARNING_MESSAGE); shownMysqlWarning = true; } setDbOption(selectedOption); } }); //Show and hide advanced options with checkbox dbAdvanced.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { boolean selected = ((JCheckBox) e.getSource()).isSelected(); driver.setVisible(selected); ((JLabel) driver.getClientProperty("labeledBy")).setVisible(selected); dialect.setVisible(selected); ((JLabel) dialect.getClientProperty("labeledBy")).setVisible(selected); } }); importButton.addActionListener(new ActionListener() { protected void showImportError(String error) { JOptionPane.showMessageDialog(frame, error, "Configuration Error", JOptionPane.ERROR_MESSAGE); } protected void showInputErrorDatabase(String error) { if (dbType.getSelectedItem() == null) showImportError("No dbType specified, " + StringUtils.uncapitalize(error)); else showImportError(error); } public void actionPerformed(ActionEvent e) { boolean validationPassed = false; if (controller.getDumpContainers().isEmpty()) showImportError("Please add dump folders/archives"); else if (StringUtils.isBlank(jdbcString.getText())) showInputErrorDatabase("Must specify JDBC String"); else if (StringUtils.isBlank(driver.getText())) showInputErrorDatabase("Must specify driver"); else if (StringUtils.isBlank(dialect.getText())) showInputErrorDatabase("Must specify hibernate dialect"); else validationPassed = true; if (!validationPassed) return; //Disable all GUI components so they can't change anything during processing setGuiEnabled(false); //Run in new thread controller.getGeneralThreadPool().execute(new Runnable() { public void run() { try { start(); } catch (final Exception e) { //Show an error message box SwingUtilities.invokeLater(new Runnable() { public void run() { LoggerFactory.getLogger(getClass()).error("Cannot import", e); showErrorDialog(e, "Cannot import", null); } }); } //Renable GUI SwingUtilities.invokeLater(new Runnable() { public void run() { setGuiEnabled(true); } }); } }); } }); //Done, init logger logAppender.init(); log.info("Finished creating GUI"); //Display frame.setContentPane(primaryBuilder.getPanel()); frame.pack(); frame.setMinimumSize(frame.getSize()); frame.setVisible(true); }
From source file:org.webcat.plugintester.ui.MainFrameBuilder.java
/** * Initializes a new instances of the MainFrameBuilder class. * * @param wcConfig the object that represents the Web-CAT application * configuration/*w w w .ja v a 2s .c o m*/ * @param settings the Properties object that contains the settings that * are specified in the user interface */ public MainFrameBuilder(WebCATConfiguration wcConfig, Properties settings) { webcatConfig = wcConfig; currentSettings = settings; frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setTitle("Web-CAT Plug-in Tester"); constructFrame(frame); initializeFields(); frame.setLocationRelativeTo(null); }
From source file:pingdesktop.LoginForm.java
public static Autentivication LoginView() { final JFrame parent = new JFrame("Ping Desktop - Login"); final AtomicReference<LoginForm.Autentivication> result = new AtomicReference<LoginForm.Autentivication>(); // Create Browser instance. final Browser browser = new Browser(); // Load HTML with dialog's HTML+CSS+JavaScript UI. String FileURl = ConfigData.HTMLurl() + "login.html"; browser.loadURL(FileURl);// w ww .j av a 2 s . c om browser.registerFunction("AuthLogin", new BrowserFunction() { @Override public JSValue invoke(JSValue... args) { // Read text field values received from JavaScript. String username = args[0].getString(); String password = args[1].getString(); //bikin functoin baru dan panggil disini Autentivication respon = new LoginForm.Autentivication(username, password); System.out.println(respon); return JSValue.create(respon.toString()); } }); parent.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // Embed Browser Swing component into the dialog. parent.add(new BrowserView(browser), BorderLayout.CENTER); parent.setSize(450, 640); parent.setResizable(false); parent.setVisible(true); return result.get(); }
From source file:Provider.GoogleMapsStatic.TestUI.MySample.java
/** * @author Nazmul/*from w w w.j ava2s .c o m*/ */ private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY // //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license ttfSizeW = new JTextField("512"); ttfLat = new JTextField("45.5"); btnGetMap = new JButton("Get Map"); btnQuit = new JButton("Quit"); ttfSizeH = new JTextField("512"); ttfLon = new JTextField("-73.55"); ttfZoom = new JTextField("14"); ttaStatus = new JTextArea(); checkboxRecvStatus = new JCheckBox(); checkboxSendStatus = new JCheckBox(); ttfProgressMsg = new JTextField(); progressBar = new JProgressBar(); imgLbl = new JLabel(); /*** * @author Dhgiang, jpmolinamatute * Created a slider, zoom in/out buttons, conbo box (drop down listbox) for city selection, * a panel to group the zoom buttons and the slider bar */ slider = new JSlider(0, 19, 14); controlPanel = new JPanel(new GridBagLayout()); // controlPanel was created by jpmolinamatute cities = new JComboBox<Object>(new String[] { "Montreal", "Toronto", // the place setting where the combo box is now used to be a text field "Vancouver", "New York City", "Caracas", "Hong Kong" }); // for license key, but it was removed to accommodate space for combo box // @author Dhgiang JPanel panel1 = new JPanel(); JPanel contentPanel = new JPanel(); JPanel btnPanel = new JPanel(); JPanel dialogPane = new JPanel(); JLabel label1 = new JLabel("Select City"); // this used to be the label for license key, it was changed to label as 'select city' JLabel label2 = new JLabel("Size Width"); JLabel label3 = new JLabel("Size Height"); JLabel label4 = new JLabel("Latitude"); JLabel label5 = new JLabel("Longitude"); JLabel label6 = new JLabel("Zoom"); JButton btnZoomIn = new JButton("-"); JButton btnZoomOut = new JButton("+"); /*** * @author jpmolinamatute * Created 8 cardinal points: N,NE,NW; S,SE,SW; E, W; */ JButton btnSE = new JButton("SE"); JButton btnS = new JButton("S"); JButton btnSW = new JButton("SW"); JButton btnE = new JButton("E"); JButton btnW = new JButton("W"); JButton btnNE = new JButton("NE"); JButton btnN = new JButton("N"); JButton btnNW = new JButton("NW"); /*** * @author JPMolinaMatute * Creaetd a spaceControl GridBagConstraints object to manage * the cardinal points, and add KeyListener so users can use the * 8 cardinal keys on the num pad; initialize dimensions * */ GridBagConstraints spaceControl = new GridBagConstraints(); spaceControl.insets = new Insets(5, 5, 5, 5); controlPanel.addKeyListener(this); controlPanel.setSize(new Dimension(512, 512)); // ---- My Combo Boxes for different city coordinates ----// // ======== this ======== setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Google Static Maps"); setIconImage(null); Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setOpaque(false); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { contentPanel.setOpaque(false); contentPanel.setLayout(new TableLayout( new double[][] { { TableLayoutConstants.FILL }, { TableLayoutConstants.PREFERRED, TableLayoutConstants.FILL, TableLayoutConstants.PREFERRED } })); ((TableLayout) contentPanel.getLayout()).setHGap(5); ((TableLayout) contentPanel.getLayout()).setVGap(5); // ======== panel1 ======== { panel1.setOpaque(false); panel1.setBorder(new CompoundBorder( new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER)); panel1.setLayout(new TableLayout( new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayoutConstants.FILL }, { TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED, TableLayoutConstants.PREFERRED } })); ((TableLayout) panel1.getLayout()).setHGap(5); ((TableLayout) panel1.getLayout()).setVGap(5); label1.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label2 ---- label2.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfSizeW ---- panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label4 ---- label4.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfLat ---- panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- btnGetMap ---- btnGetMap.setHorizontalAlignment(SwingConstants.LEFT); btnGetMap.setMnemonic('G'); btnGetMap.setActionCommand("getMap"); btnGetMap.addActionListener(this); panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label3 ---- label3.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfSizeH ---- panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- label5 ---- label5.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfLon ---- panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- btnQuit ---- btnQuit.setMnemonic('Q'); btnQuit.setHorizontalAlignment(SwingConstants.LEFT); btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT); btnQuit.setActionCommand("quit"); btnQuit.addActionListener(this); panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); /*** * @author Dhgiang * Added an anonymous inner class for ItemLister and event handling for the combo box * Used the switch case condition handling to set coordinates based on the city selected * Juan helped modified this method by adding the startTaskAction() at the end so * users don't have to click on Get Map button. */ cities.setSelectedIndex(0); // initialize the city selection item to 0 (or the first item) cities.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { Integer z = cities.getSelectedIndex(); switch (z) { case 0: ttfLat.setText("45.5"); ttfLon.setText("-73.55"); break; case 1: ttfLat.setText("43.65"); ttfLon.setText("-79.38"); break; case 2: ttfLat.setText("49.2505"); ttfLon.setText("-123.1119"); break; case 3: ttfLat.setText("40.7142"); ttfLon.setText("-74.0064"); break; case 4: ttfLat.setText("10.4901"); ttfLon.setText("-66.9151"); break; case 5: ttfLat.setText("22.257"); ttfLon.setText("114.2"); break; default: break; } startTaskAction(); } }); /*** * @author Dhgiang * Added the combo box to the panel */ panel1.add(cities, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); // ---- label6 ---- label6.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); // ---- ttfZoom ---- panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); } { btnPanel.setOpaque(false); btnPanel.setLayout(new GridLayout(0, 3)); /**** * @author Dhgiang * Initializing the zoom IN / OUT buttons with proper parameters and * adding them to the btnPanel of Panel1 (panel within a panel) */ // ---- btnZoomIn ---- btnZoomIn.setHorizontalAlignment(SwingConstants.LEFT); btnZoomIn.setHorizontalTextPosition(SwingConstants.RIGHT); btnZoomIn.setActionCommand("Zoomin"); btnZoomIn.addActionListener(this); btnPanel.add(btnZoomIn, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); // ---- btnZoomOut ---- btnZoomOut.setHorizontalAlignment(SwingConstants.RIGHT); btnZoomOut.setHorizontalTextPosition(SwingConstants.RIGHT); btnZoomOut.setActionCommand("Zoomout"); btnZoomOut.addActionListener(this); btnPanel.add(btnZoomOut, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); /*** * @author Dhgiang * Having created a new JSlider slider object, maximum & minimum values * are initialized along with incremental values * */ // ---- slider ----- slider.setMaximum(19); slider.setMinimum(0); slider.setPaintTicks(true); slider.setMajorTickSpacing(19); slider.setMinorTickSpacing(1); slider.setPaintTrack(false); slider.createStandardLabels(4, 0); /*** * @author Dhgiang * Added a ChangeListener to the slider so that * 1) the slider moves left if (-) button is clicked, slider moves right if (+) is clicked * 2) and zoom values will increase or decrease if slider bar is shifted left or right accordingly * 3) after the user releases the click button, the map will display automatically with the values * set by the slider bar, without having the user to click on get map button */ slider.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { Integer a = slider.getValue(); if (a >= 0 && a <= 19) { ttfZoom.setText(a.toString()); startTaskAction(); } } }); slider.setBorder(null); /*** * @author Dhgiang * Added the slider bar to the button panel */ btnPanel.add(slider, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } /*** * @author Dhgiang * Adding the button panel to panel1 */ panel1.add(btnPanel, new TableLayoutConstraints(5, 2, 5, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); /*** * @author jpmolinamatute * Initializing coordinates for the cardinal points * Adding the cardinal points button to the control panel */ // ---- Cardinals points ----- btnNW.setActionCommand("Northwest"); btnNW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 0; controlPanel.add(btnNW, spaceControl); btnN.setActionCommand("North"); btnN.addActionListener(this); spaceControl.gridx = 3; spaceControl.gridy = 0; controlPanel.add(btnN, spaceControl); btnNE.setActionCommand("Northeast"); btnNE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 0; controlPanel.add(btnNE, spaceControl); btnW.setActionCommand("West"); btnW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 3; controlPanel.add(btnW, spaceControl); spaceControl.gridx = 3; spaceControl.gridy = 3; controlPanel.add(imgLbl, spaceControl); btnE.setActionCommand("East"); btnE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 3; controlPanel.add(btnE, spaceControl); btnSW.setActionCommand("Southwest"); btnSW.addActionListener(this); spaceControl.gridx = 0; spaceControl.gridy = 6; controlPanel.add(btnSW, spaceControl); btnS.setActionCommand("South"); btnS.addActionListener(this); spaceControl.gridx = 3; spaceControl.gridy = 6; controlPanel.add(btnS, spaceControl); btnSE.setActionCommand("Southeast"); btnSE.addActionListener(this); spaceControl.gridx = 6; spaceControl.gridy = 6; controlPanel.add(btnSE, spaceControl); contentPanel.add(controlPanel, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstants.FULL, TableLayoutConstants.FULL)); } dialogPane.add(contentPanel, BorderLayout.CENTER); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(700, 800); setLocationRelativeTo(null); }
From source file:Provider.GoogleMapsStatic.TestUI.SampleApp.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner non-commercial license dialogPane = new JPanel(); contentPanel = new JPanel(); panel1 = new JPanel(); label2 = new JLabel(); ttfSizeW = new JTextField(); label4 = new JLabel(); ttfLat = new JTextField(); btnGetMap = new JButton(); label3 = new JLabel(); ttfSizeH = new JTextField(); label5 = new JLabel(); ttfLon = new JTextField(); btnQuit = new JButton(); label1 = new JLabel(); ttfLicense = new JTextField(); label6 = new JLabel(); ttfZoom = new JTextField(); scrollPane1 = new JScrollPane(); ttaStatus = new JTextArea(); panel2 = new JPanel(); panel3 = new JPanel(); checkboxRecvStatus = new JCheckBox(); checkboxSendStatus = new JCheckBox(); ttfProgressMsg = new JTextField(); progressBar = new JProgressBar(); lblProgressStatus = new JLabel(); //======== this ======== setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle("Google Static Maps"); setIconImage(null);//from www . j ava2 s . c o m Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); //======== dialogPane ======== { dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); dialogPane.setOpaque(false); dialogPane.setLayout(new BorderLayout()); //======== contentPanel ======== { contentPanel.setOpaque(false); contentPanel.setLayout(new TableLayout(new double[][] { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED } })); ((TableLayout) contentPanel.getLayout()).setHGap(5); ((TableLayout) contentPanel.getLayout()).setVGap(5); //======== panel1 ======== { panel1.setOpaque(false); panel1.setBorder(new CompoundBorder( new TitledBorder("Configure the inputs to Google Static Maps"), Borders.DLU2_BORDER)); panel1.setLayout( new TableLayout(new double[][] { { 0.17, 0.17, 0.17, 0.17, 0.05, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel1.getLayout()).setHGap(5); ((TableLayout) panel1.getLayout()).setVGap(5); //---- label2 ---- label2.setText("Size Width"); label2.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label2, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeW ---- ttfSizeW.setText("512"); panel1.add(ttfSizeW, new TableLayoutConstraints(1, 0, 1, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label4 ---- label4.setText("Latitude"); label4.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label4, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLat ---- ttfLat.setText("38.931099"); panel1.add(ttfLat, new TableLayoutConstraints(3, 0, 3, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnGetMap ---- btnGetMap.setText("Get Map"); btnGetMap.setHorizontalAlignment(SwingConstants.LEFT); btnGetMap.setMnemonic('G'); btnGetMap.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startTaskAction(); } }); panel1.add(btnGetMap, new TableLayoutConstraints(5, 0, 5, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label3 ---- label3.setText("Size Height"); label3.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label3, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfSizeH ---- ttfSizeH.setText("512"); panel1.add(ttfSizeH, new TableLayoutConstraints(1, 1, 1, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label5 ---- label5.setText("Longitude"); label5.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label5, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLon ---- ttfLon.setText("-77.3489"); panel1.add(ttfLon, new TableLayoutConstraints(3, 1, 3, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- btnQuit ---- btnQuit.setText("Quit"); btnQuit.setMnemonic('Q'); btnQuit.setHorizontalAlignment(SwingConstants.LEFT); btnQuit.setHorizontalTextPosition(SwingConstants.RIGHT); btnQuit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { quitProgram(); } }); panel1.add(btnQuit, new TableLayoutConstraints(5, 1, 5, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label1 ---- label1.setText("License Key"); label1.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label1, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfLicense ---- ttfLicense.setToolTipText("Enter your own URI for a file to download in the background"); panel1.add(ttfLicense, new TableLayoutConstraints(1, 2, 1, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- label6 ---- label6.setText("Zoom"); label6.setHorizontalAlignment(SwingConstants.RIGHT); panel1.add(label6, new TableLayoutConstraints(2, 2, 2, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfZoom ---- ttfZoom.setText("14"); panel1.add(ttfZoom, new TableLayoutConstraints(3, 2, 3, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel1, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== scrollPane1 ======== { scrollPane1.setBorder( new TitledBorder("System.out - displays all status and progress messages, etc.")); scrollPane1.setOpaque(false); //---- ttaStatus ---- ttaStatus.setBorder(Borders.createEmptyBorder("1dlu, 1dlu, 1dlu, 1dlu")); ttaStatus.setToolTipText( "<html>Task progress updates (messages) are displayed here,<br>along with any other output generated by the Task.<html>"); scrollPane1.setViewportView(ttaStatus); } contentPanel.add(scrollPane1, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //======== panel2 ======== { panel2.setOpaque(false); panel2.setBorder(new CompoundBorder(new TitledBorder("Status - control progress reporting"), Borders.DLU2_BORDER)); panel2.setLayout(new TableLayout(new double[][] { { 0.45, TableLayout.FILL, 0.45 }, { TableLayout.PREFERRED, TableLayout.PREFERRED } })); ((TableLayout) panel2.getLayout()).setHGap(5); ((TableLayout) panel2.getLayout()).setVGap(5); //======== panel3 ======== { panel3.setOpaque(false); panel3.setLayout(new GridLayout(1, 2)); //---- checkboxRecvStatus ---- checkboxRecvStatus.setText("Enable \"Recieve\""); checkboxRecvStatus.setOpaque(false); checkboxRecvStatus.setToolTipText("Task will fire \"send\" status updates"); checkboxRecvStatus.setSelected(true); panel3.add(checkboxRecvStatus); //---- checkboxSendStatus ---- checkboxSendStatus.setText("Enable \"Send\""); checkboxSendStatus.setOpaque(false); checkboxSendStatus.setToolTipText("Task will fire \"recieve\" status updates"); panel3.add(checkboxSendStatus); } panel2.add(panel3, new TableLayoutConstraints(0, 0, 0, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- ttfProgressMsg ---- ttfProgressMsg.setText("Loading map from Google Static Maps"); ttfProgressMsg.setToolTipText("Set the task progress message here"); panel2.add(ttfProgressMsg, new TableLayoutConstraints(2, 0, 2, 0, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- progressBar ---- progressBar.setStringPainted(true); progressBar.setString("progress %"); progressBar.setToolTipText("% progress is displayed here"); panel2.add(progressBar, new TableLayoutConstraints(0, 1, 0, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); //---- lblProgressStatus ---- lblProgressStatus.setText("task status listener"); lblProgressStatus.setHorizontalTextPosition(SwingConstants.LEFT); lblProgressStatus.setHorizontalAlignment(SwingConstants.LEFT); lblProgressStatus.setToolTipText("Task status messages are displayed here when the task runs"); panel2.add(lblProgressStatus, new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } contentPanel.add(panel2, new TableLayoutConstraints(0, 2, 0, 2, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL)); } dialogPane.add(contentPanel, BorderLayout.CENTER); } contentPane.add(dialogPane, BorderLayout.CENTER); setSize(675, 485); setLocationRelativeTo(null); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:savant.view.swing.Savant.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.// w w w .j a va 2s . co m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { view_buttongroup = new javax.swing.ButtonGroup(); toolbar_bottom = new javax.swing.JToolBar(); label_mouseposition_title = new javax.swing.JLabel(); mousePositionLabel = new javax.swing.JLabel(); timeCaption = new javax.swing.JLabel(); label_status = new javax.swing.JLabel(); s_e_sep = new javax.swing.JToolBar.Separator(); label_memory = new javax.swing.JLabel(); panel_browser = new javax.swing.JPanel(); panel_top = new javax.swing.JPanel(); panelExtendedMiddle = new javax.swing.JPanel(); panel_main = new javax.swing.JPanel(); pluginToolbar = new javax.swing.JPanel(); menuBar_top = new javax.swing.JMenuBar(); fileMenu = new javax.swing.JMenu(); loadGenomeItem = new javax.swing.JMenuItem(); loadFromFileItem = new javax.swing.JMenuItem(); loadFromURLItem = new javax.swing.JMenuItem(); loadFromDataSourcePluginItem = new javax.swing.JMenuItem(); recentTrackMenu = new javax.swing.JMenu(); javax.swing.JPopupMenu.Separator jSeparator1 = new javax.swing.JPopupMenu.Separator(); openProjectItem = new javax.swing.JMenuItem(); recentProjectMenu = new javax.swing.JMenu(); saveProjectItem = new javax.swing.JMenuItem(); saveProjectAsItem = new javax.swing.JMenuItem(); javax.swing.JPopupMenu.Separator jSeparator2 = new javax.swing.JPopupMenu.Separator(); formatItem = new javax.swing.JMenuItem(); javax.swing.JPopupMenu.Separator jSeparator3 = new javax.swing.JPopupMenu.Separator(); exportItem = new javax.swing.JMenuItem(); jSeparator4 = new javax.swing.JPopupMenu.Separator(); exitItem = new javax.swing.JMenuItem(); editMenu = new javax.swing.JMenu(); undoItem = new javax.swing.JMenuItem(); redoItem = new javax.swing.JMenuItem(); javax.swing.JPopupMenu.Separator jSeparator6 = new javax.swing.JPopupMenu.Separator(); bookmarkItem = new javax.swing.JMenuItem(); deselectAllItem = new javax.swing.JMenuItem(); jSeparator7 = new javax.swing.JPopupMenu.Separator(); preferencesItem = new javax.swing.JMenuItem(); viewMenu = new javax.swing.JMenu(); panLeftItem = new javax.swing.JMenuItem(); panRightItem = new javax.swing.JMenuItem(); zoomInItem = new javax.swing.JMenuItem(); zoomOutItem = new javax.swing.JMenuItem(); toStartItem = new javax.swing.JMenuItem(); toEndItem = new javax.swing.JMenuItem(); javax.swing.JSeparator jSeparator8 = new javax.swing.JSeparator(); crosshairItem = new javax.swing.JCheckBoxMenuItem(); plumblineItem = new javax.swing.JCheckBoxMenuItem(); spotlightItem = new javax.swing.JCheckBoxMenuItem(); windowMenu = new javax.swing.JMenu(); navigationItem = new javax.swing.JCheckBoxMenuItem(); genomeItem = new javax.swing.JCheckBoxMenuItem(); rulerItem = new javax.swing.JCheckBoxMenuItem(); pluginToolbarItem = new javax.swing.JCheckBoxMenuItem(); statusBarItem = new javax.swing.JCheckBoxMenuItem(); speedAndEfficiencyItem = new javax.swing.JCheckBoxMenuItem(); javax.swing.JSeparator jSeparator9 = new javax.swing.JSeparator(); bookmarksItem = new javax.swing.JCheckBoxMenuItem(); pluginsMenu = new javax.swing.JMenu(); menuitem_pluginmanager = new javax.swing.JMenuItem(); jSeparator10 = new javax.swing.JPopupMenu.Separator(); helpMenu = new javax.swing.JMenu(); userManualItem = new javax.swing.JMenuItem(); tutorialsItem = new javax.swing.JMenuItem(); javax.swing.JMenuItem checkForUpdatesItem = new javax.swing.JMenuItem(); javax.swing.JMenuItem bugReportItem = new javax.swing.JMenuItem(); javax.swing.JMenuItem featureRequestItem = new javax.swing.JMenuItem(); javax.swing.JSeparator jSeparator11 = new javax.swing.JSeparator(); websiteItem = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setBackground(new java.awt.Color(204, 204, 204)); toolbar_bottom.setFloatable(false); toolbar_bottom.setAlignmentX(1.0F); label_mouseposition_title.setText(" Position: "); toolbar_bottom.add(label_mouseposition_title); toolbar_bottom.add(mousePositionLabel); timeCaption.setText("Time: "); toolbar_bottom.add(timeCaption); label_status.setMaximumSize(new java.awt.Dimension(300, 14)); label_status.setMinimumSize(new java.awt.Dimension(100, 14)); label_status.setPreferredSize(new java.awt.Dimension(100, 14)); toolbar_bottom.add(label_status); toolbar_bottom.add(s_e_sep); label_memory.setText(" Memory: "); toolbar_bottom.add(label_memory); panel_top.setMaximumSize(new java.awt.Dimension(1000, 30)); panel_top.setMinimumSize(new java.awt.Dimension(0, 0)); panel_top.setPreferredSize(new java.awt.Dimension(0, 30)); panel_top.setLayout(new java.awt.BorderLayout()); panelExtendedMiddle.setMinimumSize(new java.awt.Dimension(990, 30)); panelExtendedMiddle.setPreferredSize(new java.awt.Dimension(990, 30)); javax.swing.GroupLayout panelExtendedMiddleLayout = new javax.swing.GroupLayout(panelExtendedMiddle); panelExtendedMiddle.setLayout(panelExtendedMiddleLayout); panelExtendedMiddleLayout.setHorizontalGroup(panelExtendedMiddleLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 1045, Short.MAX_VALUE)); panelExtendedMiddleLayout.setVerticalGroup(panelExtendedMiddleLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 30, Short.MAX_VALUE)); panel_top.add(panelExtendedMiddle, java.awt.BorderLayout.CENTER); panel_main.setBackground(new java.awt.Color(153, 153, 153)); panel_main.setMaximumSize(new java.awt.Dimension(99999, 99999)); panel_main.setMinimumSize(new java.awt.Dimension(1, 1)); panel_main.setPreferredSize(new java.awt.Dimension(99999, 99999)); javax.swing.GroupLayout panel_mainLayout = new javax.swing.GroupLayout(panel_main); panel_main.setLayout(panel_mainLayout); panel_mainLayout.setHorizontalGroup(panel_mainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); panel_mainLayout.setVerticalGroup(panel_mainLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 532, Short.MAX_VALUE)); pluginToolbar.setVisible(false); pluginToolbar.setPreferredSize(new java.awt.Dimension(856, 24)); pluginToolbar.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEADING)); javax.swing.GroupLayout panel_browserLayout = new javax.swing.GroupLayout(panel_browser); panel_browser.setLayout(panel_browserLayout); panel_browserLayout.setHorizontalGroup( panel_browserLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panel_top, javax.swing.GroupLayout.DEFAULT_SIZE, 1045, Short.MAX_VALUE) .addComponent(pluginToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, 1045, Short.MAX_VALUE)); panel_browserLayout.setVerticalGroup(panel_browserLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(panel_browserLayout.createSequentialGroup().addContainerGap() .addComponent(panel_top, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(pluginToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, 0) .addComponent(panel_main, javax.swing.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE))); fileMenu.setText("File"); loadGenomeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_MASK)); loadGenomeItem.setText("Load Genome..."); loadGenomeItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadGenomeItemActionPerformed(evt); } }); fileMenu.add(loadGenomeItem); loadFromFileItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.CTRL_MASK)); loadFromFileItem.setText("Load Track from File..."); loadFromFileItem.setEnabled(false); loadFromFileItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadFromFileItemActionPerformed(evt); } }); fileMenu.add(loadFromFileItem); loadFromURLItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK)); loadFromURLItem.setText("Load Track from URL..."); loadFromURLItem.setEnabled(false); loadFromURLItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadFromURLItemActionPerformed(evt); } }); fileMenu.add(loadFromURLItem); loadFromDataSourcePluginItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.CTRL_MASK)); loadFromDataSourcePluginItem.setText("Load Track from Repository..."); loadFromDataSourcePluginItem.setEnabled(false); loadFromDataSourcePluginItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { loadFromDataSourcePluginItemActionPerformed(evt); } }); fileMenu.add(loadFromDataSourcePluginItem); recentTrackMenu.setText("Load Recent Track"); fileMenu.add(recentTrackMenu); fileMenu.add(jSeparator1); openProjectItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); openProjectItem.setText("Open Project..."); openProjectItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { openProjectItemActionPerformed(evt); } }); fileMenu.add(openProjectItem); recentProjectMenu.setText("Open Recent Project"); fileMenu.add(recentProjectMenu); saveProjectItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK)); saveProjectItem.setText("Save Project"); saveProjectItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveProjectItemActionPerformed(evt); } }); fileMenu.add(saveProjectItem); saveProjectAsItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); saveProjectAsItem.setText("Save Project As..."); saveProjectAsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { saveProjectAsItemActionPerformed(evt); } }); fileMenu.add(saveProjectAsItem); fileMenu.add(jSeparator2); formatItem.setText("Format File..."); formatItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { formatItemActionPerformed(evt); } }); fileMenu.add(formatItem); fileMenu.add(jSeparator3); exportItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK)); exportItem.setText("Export Track Images..."); exportItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuitem_exportActionPerformed(evt); } }); fileMenu.add(exportItem); fileMenu.add(jSeparator4); exitItem.setText("Exit"); exitItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitItemActionPerformed(evt); } }); fileMenu.add(exitItem); menuBar_top.add(fileMenu); editMenu.setText("Edit"); undoItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Z, java.awt.event.InputEvent.CTRL_MASK)); undoItem.setText("Undo Range Change"); undoItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { undoItemActionPerformed(evt); } }); editMenu.add(undoItem); redoItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Y, java.awt.event.InputEvent.CTRL_MASK)); redoItem.setText("Redo Range Change"); redoItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { redoItemActionPerformed(evt); } }); editMenu.add(redoItem); editMenu.add(jSeparator6); bookmarkItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK)); bookmarkItem.setText("Bookmark"); bookmarkItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bookmarkItemActionPerformed(evt); } }); editMenu.add(bookmarkItem); deselectAllItem.setText("Deselect All"); deselectAllItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuitem_deselectActionPerformed(evt); } }); editMenu.add(deselectAllItem); editMenu.add(jSeparator7); preferencesItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK)); preferencesItem.setText("Preferences"); preferencesItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { preferencesItemActionPerformed(evt); } }); editMenu.add(preferencesItem); menuBar_top.add(editMenu); viewMenu.setText("View"); panLeftItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_LEFT, java.awt.event.InputEvent.SHIFT_MASK)); panLeftItem.setText("Pan Left"); panLeftItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { panLeftItemActionPerformed(evt); } }); viewMenu.add(panLeftItem); panRightItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_RIGHT, java.awt.event.InputEvent.SHIFT_MASK)); panRightItem.setText("Pan Right"); panRightItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { panRightItemActionPerformed(evt); } }); viewMenu.add(panRightItem); zoomInItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_UP, java.awt.event.InputEvent.SHIFT_MASK)); zoomInItem.setText("Zoom In"); zoomInItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { zoomInItemActionPerformed(evt); } }); viewMenu.add(zoomInItem); zoomOutItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_DOWN, java.awt.event.InputEvent.SHIFT_MASK)); zoomOutItem.setText("Zoom Out"); zoomOutItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { zoomOutItemActionPerformed(evt); } }); viewMenu.add(zoomOutItem); toStartItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_HOME, 0)); toStartItem.setText("Shift to Start"); toStartItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { toStartItemActionPerformed(evt); } }); viewMenu.add(toStartItem); toEndItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_END, 0)); toEndItem.setText("Shift to End"); toEndItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { toEndItemActionPerformed(evt); } }); viewMenu.add(toEndItem); viewMenu.add(jSeparator8); crosshairItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_J, java.awt.event.InputEvent.CTRL_MASK)); crosshairItem.setText("Crosshair"); crosshairItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { crosshairItemActionPerformed(evt); } }); viewMenu.add(crosshairItem); plumblineItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_K, java.awt.event.InputEvent.CTRL_MASK)); plumblineItem.setText("Plumbline"); plumblineItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { plumblineItemActionPerformed(evt); } }); viewMenu.add(plumblineItem); spotlightItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.CTRL_MASK)); spotlightItem.setText("Spotlight"); spotlightItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { spotlightItemActionPerformed(evt); } }); viewMenu.add(spotlightItem); menuBar_top.add(viewMenu); windowMenu.setText("Window"); windowMenu.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { windowMenuStateChanged(evt); } }); navigationItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); navigationItem.setText("Navigation"); navigationItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { navigationItemMousePressed(evt); } }); windowMenu.add(navigationItem); genomeItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); genomeItem.setText("Genome"); genomeItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { genomeItemActionPerformed(evt); } }); windowMenu.add(genomeItem); rulerItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_L, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); rulerItem.setText("Ruler"); rulerItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rulerItemActionPerformed(evt); } }); windowMenu.add(rulerItem); pluginToolbarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); pluginToolbarItem.setSelected(true); pluginToolbarItem.setText("Plugin Toolbar"); pluginToolbarItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pluginToolbarItemActionPerformed(evt); } }); windowMenu.add(pluginToolbarItem); statusBarItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); statusBarItem.setSelected(true); statusBarItem.setText("Status Bar"); statusBarItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { statusBarItemActionPerformed(evt); } }); windowMenu.add(statusBarItem); speedAndEfficiencyItem.setText("Resources"); speedAndEfficiencyItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { speedAndEfficiencyItemActionPerformed(evt); } }); windowMenu.add(speedAndEfficiencyItem); windowMenu.add(jSeparator9); bookmarksItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK)); bookmarksItem.setText("Bookmarks"); bookmarksItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bookmarksItemActionPerformed(evt); } }); windowMenu.add(bookmarksItem); menuBar_top.add(windowMenu); pluginsMenu.setText("Plugins"); menuitem_pluginmanager.setText("Plugin Manager"); menuitem_pluginmanager.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { menuitem_pluginmanagerActionPerformed(evt); } }); pluginsMenu.add(menuitem_pluginmanager); pluginsMenu.add(jSeparator10); menuBar_top.add(pluginsMenu); helpMenu.setText("Help"); userManualItem.setText("Manuals"); userManualItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { userManualItemActionPerformed(evt); } }); helpMenu.add(userManualItem); tutorialsItem.setText("Video Tutorials"); tutorialsItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tutorialsItemActionPerformed(evt); } }); helpMenu.add(tutorialsItem); checkForUpdatesItem.setText("Check for updates"); checkForUpdatesItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { checkForUpdatesItemActionPerformed(evt); } }); helpMenu.add(checkForUpdatesItem); bugReportItem.setText("Report an issue"); bugReportItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { bugReportItemActionPerformed(evt); } }); helpMenu.add(bugReportItem); featureRequestItem.setText("Request a feature"); featureRequestItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { featureRequestItemActionPerformed(evt); } }); helpMenu.add(featureRequestItem); helpMenu.add(jSeparator11); websiteItem.setText("Website"); websiteItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { websiteItemActionPerformed(evt); } }); helpMenu.add(websiteItem); menuBar_top.add(helpMenu); setJMenuBar(menuBar_top); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(panel_browser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(toolbar_bottom, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(panel_browser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(toolbar_bottom, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))); pack(); }