List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:nz.co.fortytwo.freeboard.installer.InstalManager.java
private void addWidgets() { JTabbedPane tabPane = new JTabbedPane(); this.add(tabPane, BorderLayout.CENTER); // upload to arduinos JPanel uploadPanel = new JPanel(); uploadPanel.setLayout(new BorderLayout()); uploadPanel.add(uploadingPanel, BorderLayout.CENTER); final JPanel westUploadPanel = new JPanel(new MigLayout()); String info = "\nUse this panel to upload compiled code to the arduino devices.\n\n" + "NOTE: directories with spaces will probably not work!\n\n" + "First select the base directory of your Arduino IDE installation, eg C:/devtools/arduino-1.5.2\n\n" + "Then select target files to upload, these are ended in '.hex'\n" + "\nand can be downloaded from github (https://github.com/rob42),\n" + " see the 'Release*' sub-directories\n\n" + "Output of the process will display in the right-side window\n\n"; JTextArea jTextInfo = new JTextArea(info); jTextInfo.setEditable(false);//from w w w .j av a2s . c o m westUploadPanel.add(jTextInfo, "span,wrap"); westUploadPanel.add(new JLabel("Select Arduino IDE directory:"), "wrap"); arduinoDirTextField.setEditable(false); westUploadPanel.add(arduinoDirTextField, "span 2"); arduinoIdeChooser.setApproveButtonText("Select"); arduinoIdeChooser.setAcceptAllFileFilterUsed(false); arduinoIdeChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); arduinoIdeChooser.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (JFileChooser.APPROVE_SELECTION.equals(evt.getActionCommand())) { toolsDir = new File(arduinoIdeChooser.getSelectedFile(), File.separator + "hardware" + File.separator + "tools" + File.separator); if (!toolsDir.exists()) { toolsDir = null; JOptionPane.showMessageDialog(westUploadPanel, "Not a valid Arduino IDE directory"); return; } arduinoDirTextField.setText(arduinoIdeChooser.getSelectedFile().getAbsolutePath()); } } }); JButton arduinoDirButton = new JButton("Select"); arduinoDirButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { arduinoIdeChooser.showDialog(westUploadPanel, "Select"); } }); westUploadPanel.add(arduinoDirButton, "wrap"); westUploadPanel.add(new JLabel("Select comm port:")); westUploadPanel.add(portComboBox, "wrap"); westUploadPanel.add(new JLabel("Select device:"), "gap unrelated"); westUploadPanel.add(deviceComboBox, "wrap"); hexFileChooser.setApproveButtonText("Upload"); hexFileChooser.setAcceptAllFileFilterUsed(false); hexFileChooser.addChoosableFileFilter(new FileFilter() { @Override public String getDescription() { return "*.hex - Hex file"; } @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } if (f.getName().toUpperCase().endsWith(".HEX")) { return true; } return false; } }); westUploadPanel.add(hexFileChooser, "span, wrap"); uploadPanel.add(westUploadPanel, BorderLayout.WEST); tabPane.addTab("Upload", uploadPanel); // charts JPanel chartPanel = new JPanel(); chartPanel.setLayout(new BorderLayout()); FileNameExtensionFilter filter = new FileNameExtensionFilter("Charts", "tiff", "kap", "KAP", "TIFF", "tif", "TIF"); chartFileChooser.setFileFilter(filter); chartFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chartFileChooser.setMultiSelectionEnabled(true); final JPanel chartWestPanel = new JPanel(new MigLayout()); String info2 = "\nUse this panel to convert charts into the correct format for FreeBoard.\n" + "\nYou need to select the charts or directories containing charts, then click 'Process'.\n " + "\nThe results will be in a directory with the same name as the chart, and the chart " + "\ndirectory will also be compressed into a zip file ready to transfer to your FreeBoard " + "\nserver\n" + "\nOutput of the process will display in the right-side window\n\n"; JTextArea jTextInfo2 = new JTextArea(info2); jTextInfo2.setEditable(false); chartWestPanel.add(jTextInfo2, "wrap"); chartFileChooser.setApproveButtonText("Process"); chartWestPanel.add(chartFileChooser, "span,wrap"); final JPanel loggingPanel = new JPanel(new MigLayout()); loggingGroup.add(infoButton); loggingGroup.add(debugButton); debugButton.setSelected(logger.isDebugEnabled()); infoButton.setSelected(!logger.isDebugEnabled()); infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (infoButton.isSelected()) { LogManager.getRootLogger().setLevel(Level.INFO); } } }); debugButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (debugButton.isSelected()) { LogManager.getRootLogger().setLevel(Level.DEBUG); } } }); loggingPanel.add(new JLabel("Logging Level")); loggingPanel.add(infoButton); loggingPanel.add(debugButton); chartWestPanel.add(loggingPanel, "span,wrap"); final JPanel transparentPanel = new JPanel(new MigLayout()); charsetGroup.add(utf8Button); charsetGroup.add(iso8859Button); iso8859Button.setSelected(logger.isDebugEnabled()); utf8Button.setSelected(!logger.isDebugEnabled()); utf8Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (utf8Button.isSelected()) { charset = "UTF-8"; } } }); iso8859Button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (iso8859Button.isSelected()) { charset = "ISO-8859-1"; } } }); transparentPanel.add(new JLabel("KAP Character set:")); transparentPanel.add(utf8Button); transparentPanel.add(iso8859Button); chartWestPanel.add(transparentPanel); chartPanel.add(chartWestPanel, BorderLayout.WEST); chartPanel.add(processingPanel, BorderLayout.CENTER); tabPane.addTab("Charts", chartPanel); // IMU calibration JPanel calPanel = new JPanel(); calPanel.setLayout(new BorderLayout()); JPanel westCalPanel = new JPanel(new MigLayout()); String info3 = "\nUse this panel to calibrate your ArduIMU.\n" + "\nYou should do this as near to the final location as possible,\n" + "and like all compasses, as far from wires and magnetic materials \n" + "as possible.\n" + "\nSelect your comm port, then click 'Start'.\n " + "\nSmoothly and steadily rotate the ArduIMU around all 3 axes (x,y,z)\n" + "several times. Then press stop and the calibration will be performed and\n" + "uploaded to the ArduIMU\n\n" + "Output of the process will display in the right-side window\n\n"; JTextArea jTextInfo3 = new JTextArea(info3); jTextInfo3.setEditable(false); westCalPanel.add(jTextInfo3, "span, wrap"); westCalPanel.add(new JLabel("Select comm port:")); westCalPanel.add(portComboBox1, "wrap"); JButton startCal = new JButton("Start"); startCal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calibrationPanel.process((String) portComboBox.getSelectedItem()); } }); westCalPanel.add(startCal); JButton stopCal = new JButton("Stop"); stopCal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { calibrationPanel.stopProcess(); } }); westCalPanel.add(stopCal); calPanel.add(westCalPanel, BorderLayout.WEST); calPanel.add(calibrationPanel, BorderLayout.CENTER); tabPane.addTab("Calibration", calPanel); }
From source file:ome.formats.importer.gui.GuiImporter.java
/** * Main entry class for the application//w w w . j a v a2 s. co m * * @param config - ImportConfig file */ public GuiImporter(ImportConfig config) { //super(TITLE); //javax.swing.ToolTipManager.sharedInstance().setDismissDelay(0); this.setConfig(config); this.bounds = config.getUIBounds(); Level level = org.apache.log4j.Level.toLevel(config.getDebugLevel()); LogAppender.setLoggingLevel(level); historyHandler = new HistoryHandler(this); setHistoryTable(historyHandler.table); // Add a shutdown hook for when app closes Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { log.debug("Running shutdown hook."); shutdown(); } }); // Set app defaults setTitle(config.getAppTitle()); setIconImage(GuiCommonElements.getImageIcon(GuiImporter.ICON).getImage()); setPreferredSize(new Dimension(bounds.width, bounds.height)); setSize(bounds.width, bounds.height); setLocation(bounds.x, bounds.y); setLayout(new BorderLayout()); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); pack(); addWindowListener(this); // capture move info addComponentListener(new ComponentAdapter() { public void componentMoved(ComponentEvent evt) { bounds = getBounds(); } }); // capture resize info addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent evt) { bounds = getBounds(); } }); // menu bar menubar = new JMenuBar(); fileMenu = new JMenu("File"); menubar.add(fileMenu); login = new JMenuItem("Login to the server...", GuiCommonElements.getImageIcon(LOGIN_ICON)); login.setActionCommand("login"); login.addActionListener(this); fileMenu.add(login); options = new JMenuItem("Options...", GuiCommonElements.getImageIcon(CONFIG_ICON)); options.setActionCommand("options"); options.addActionListener(this); fileMenu.add(options); fileQuit = new JMenuItem("Quit", GuiCommonElements.getImageIcon(QUIT_ICON)); fileQuit.setActionCommand("quit"); fileQuit.addActionListener(this); fileMenu.add(fileQuit); helpMenu = new JMenu("Help"); menubar.add(helpMenu); helpComment = new JMenuItem("Send a Comment...", GuiCommonElements.getImageIcon(COMMENT_ICON)); helpComment.setActionCommand("comment"); helpComment.addActionListener(this); helpHome = new JMenuItem("Visit Importer Homepage...", GuiCommonElements.getImageIcon(HOME_ICON)); helpHome.setActionCommand("home"); helpHome.addActionListener(this); helpForums = new JMenuItem("Visit the OMERO Forums...", GuiCommonElements.getImageIcon(FORUM_ICON)); helpForums.setActionCommand("forums"); helpForums.addActionListener(this); helpAbout = new JMenuItem("About the Importer...", GuiCommonElements.getImageIcon(ABOUT_ICON)); helpAbout.setActionCommand("about"); helpAbout.addActionListener(this); helpMenu.add(helpComment); helpMenu.add(helpHome); helpMenu.add(helpForums); // Help --> Show log file location... JMenuItem helpShowLog = new JMenuItem("Show log file location...", GuiCommonElements.getImageIcon(LOGFILE_ICON)); helpShowLog.setActionCommand(show_log_file); helpShowLog.addActionListener(this); helpMenu.add(helpShowLog); helpMenu.add(helpAbout); // Help --> About setJMenuBar(menubar); // tabbed panes tPane = new JTabbedPane(); tPane.setOpaque(false); // content panes must be opaque // file chooser pane JPanel filePanel = new JPanel(new BorderLayout()); setStatusBar(new StatusBar()); getStatusBar().setStatusIcon("gfx/server_disconn16.png", "Server disconnected."); getStatusBar().setProgress(false, 0, ""); this.getContentPane().add(getStatusBar(), BorderLayout.SOUTH); // The file chooser sub-pane setFileQueueHandler(new FileQueueHandler(scanEx, importEx, this, config)); //splitPane.setResizeWeight(0.5); filePanel.add(getFileQueueHandler(), BorderLayout.CENTER); tPane.addTab("File Chooser", GuiCommonElements.getImageIcon(CHOOSER_ICON), filePanel, "Add and delete images here to the import queue."); tPane.setMnemonicAt(0, KeyEvent.VK_1); // history pane historyPanel = new JPanel(); historyPanel.setOpaque(false); historyPanel.setLayout(new BorderLayout()); tPane.addTab("Import History", GuiCommonElements.getImageIcon(HISTORY_ICON), historyPanel, "Import history is displayed here."); tPane.setMnemonicAt(0, KeyEvent.VK_4); // output text pane JPanel outputPanel = new JPanel(); outputPanel.setLayout(new BorderLayout()); outputTextPane = new JTextPane(); outputTextPane.setEditable(false); JScrollPane outputScrollPane = new JScrollPane(); outputScrollPane.getViewport().add(outputTextPane); outputScrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { try { outputTextPane.setCaretPosition(outputTextPane.getDocument().getLength()); } catch (IllegalArgumentException e1) { log.error("Error setting cursor:" + e1); } } }); outputPanel.add(outputScrollPane, BorderLayout.CENTER); tPane.addTab("Output Text", GuiCommonElements.getImageIcon(OUTPUT_ICON), outputPanel, "Standard output text goes here."); tPane.setMnemonicAt(0, KeyEvent.VK_2); // debug pane JPanel debugPanel = new JPanel(); debugPanel.setLayout(new BorderLayout()); debugTextPane = new JTextPane(); debugTextPane.setEditable(false); JScrollPane debugScrollPane = new JScrollPane(); debugScrollPane.getViewport().add(debugTextPane); debugScrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { try { debugTextPane.setCaretPosition(debugTextPane.getDocument().getLength()); } catch (IllegalArgumentException e1) { log.error("Error setting cursor:" + e1); } } }); debugPanel.add(debugScrollPane, BorderLayout.CENTER); tPane.addTab("Debug Text", GuiCommonElements.getImageIcon(BUG_ICON), debugPanel, "Debug messages are displayed here."); tPane.setMnemonicAt(0, KeyEvent.VK_3); // Error Pane errorPanel = new JPanel(); errorPanel.setOpaque(false); errorPanel.setLayout(new BorderLayout()); tPane.addTab("Import Errors", GuiCommonElements.getImageIcon(ERROR_ICON), errorPanel, "Import errors are displayed here."); tPane.setMnemonicAt(0, KeyEvent.VK_5); tPane.setSelectedIndex(0); if (getHistoryTable().db.historyEnabled == false) tPane.setEnabledAt(historyTabIndex, false); // Add the tabbed pane to this panel. add(tPane); this.setVisible(false); historyPanel.add(historyHandler, BorderLayout.CENTER); tPane.setEnabledAt(historyTabIndex, false); setLoginHandler(new LoginHandler(this, getHistoryTable())); LogAppender.getInstance().setTextArea(debugTextPane); appendToOutputLn("> Starting the importer (revision " + getPrintableKeyword(Version.revision) + ")."); appendToOutputLn("> Build date: " + getPrintableKeyword(Version.revisionDate)); appendToOutputLn("> Release date: " + Version.releaseDate); // TODO : should this be a third executor? setErrorHandler(new ErrorHandler(importEx, config)); getErrorHandler().addObserver(this); errorPanel.add(getErrorHandler(), BorderLayout.CENTER); macMenuFix(); //displayLoginDialog(this, true); }
From source file:ome.formats.importer.gui.ImportDialog.java
/** * Display a dialog so the user can choose project/dataset for importing * //from ww w .j a v a2 s. c om * @param config - ImportConfig * @param owner - parent frame * @param title - dialog title * @param modal - modal yes/no * @param store - Initialized OMEROMetadataStore */ ImportDialog(ImportConfig config, JFrame owner, String title, boolean modal, OMEROMetadataStoreClient store) { this.store = store; if (store != null) { projectItems = ProjectItem.createProjectItems(store.getProjects()); } setLocation(200, 200); setTitle(title); setModal(modal); setResizable(false); setSize(new Dimension(dialogWidth, dialogHeight)); setLocationRelativeTo(owner); tabbedPane = new JTabbedPane(); tabbedPane.setOpaque(false); // content panes must be opaque this.config = config; /////////////////////// START IMPORT PANEL //////////////////////// // Set up the import panel for tPane, quit, and send buttons double mainTable[][] = { { TableLayout.FILL, 120, 5, 160, TableLayout.FILL }, // columns { TableLayout.PREFERRED, 10, TableLayout.PREFERRED, TableLayout.FILL, 40, 30 } }; // rows importPanel = GuiCommonElements.addMainPanel(tabbedPane, mainTable, 0, 10, 0, 10, debug); String message = "Import these images into which dataset?"; GuiCommonElements.addTextPane(importPanel, message, "0, 0, 4, 0", debug); // Set up the project/dataset table double pdTable[][] = { { TableLayout.FILL, 5, 40 }, // columns { 35, 35 } }; // rows // Panel containing the project / dataset layout pdPanel = GuiCommonElements.addMainPanel(importPanel, pdTable, 0, 0, 0, 0, debug); pbox = GuiCommonElements.addComboBox(pdPanel, "Project: ", projectItems, 'P', "Select dataset to use for this import.", 60, "0,0,F,C", debug); pbox.addActionListener(this); // Fixing broken mac buttons. String offsetButtons = ",C"; //if (GuiCommonElements.offsetButtons == true) offsetButtons = ",t"; addProjectBtn = GuiCommonElements.addIconButton(pdPanel, "", addIcon, 20, 60, null, null, "2,0,f" + offsetButtons, debug); addProjectBtn.addActionListener(this); dbox = GuiCommonElements.addComboBox(pdPanel, "Dataset: ", datasetItems, 'D', "Select dataset to use for this import.", 60, "0,1,F,C", debug); dbox.setEnabled(false); addDatasetBtn = GuiCommonElements.addIconButton(pdPanel, "", addIcon, 20, 60, null, null, "2,1,f" + offsetButtons, debug); addDatasetBtn.addActionListener(this); //addDatasetBtn.setEnabled(false); importPanel.add(pdPanel, "0, 2, 4, 2"); // File naming section double namedTable[][] = { { 30, TableLayout.FILL }, // columns { 24, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL } }; // rows namedPanel = GuiCommonElements.addBorderedPanel(importPanel, namedTable, "File Naming", debug); String fullPathTooltip = "The full file+path name for the file. For example: \"c:/myfolder/mysubfolder/myfile.dv\""; String partPathTooltip = "A partial path and file name for the file. For example: \"mysubfolder/myfile.dv\""; fullPathButton = GuiCommonElements.addRadioButton(namedPanel, "the full path+file name of your file", 'u', fullPathTooltip, "1,1", debug); fullPathButton.addActionListener(this); partPathButton = GuiCommonElements.addRadioButton(namedPanel, "a partial path+file name with...", 'u', partPathTooltip, "1,2", debug); partPathButton.addActionListener(this); numOfDirectoriesField = GuiCommonElements.addWholeNumberField(namedPanel, "", "0", "of the directories immediately before it.", 0, "Add this number of directories to the file names", 3, 40, "1,3,L,C", debug); numOfDirectoriesField.addActionListener(this); numOfDirectoriesField.setText(Integer.toString(config.getNumOfDirectories())); // focus on the partial path button if you enter the numofdirfield numOfDirectoriesField.addFocusListener(new FocusListener() { public void focusGained(FocusEvent e) { partPathButton.setSelected(true); } public void focusLost(FocusEvent e) { } }); ButtonGroup group = new ButtonGroup(); group.add(fullPathButton); group.add(partPathButton); //if (config.useFullPath.get() == true ) if (config.getUserFullPath() == true) group.setSelected(fullPathButton.getModel(), true); else group.setSelected(partPathButton.getModel(), true); useCustomNamingChkBox = GuiCommonElements.addCheckBox(namedPanel, "Override default file naming. Instead use:", "0,0,1,0", debug); useCustomNamingChkBox.addActionListener(this); //if (config.useCustomImageNaming.get() == true) if (config.getCustomImageNaming() == true) { useCustomNamingChkBox.setSelected(true); enabledPathButtons(true); } else { useCustomNamingChkBox.setSelected(false); enabledPathButtons(false); } importPanel.add(namedPanel, "0, 3, 4, 2"); archiveImage = GuiCommonElements.addCheckBox(importPanel, "Archive the original imported file(s) to the server.", "0,4,4,4", debug); archiveImage.addActionListener(this); archiveImage.setSelected(config.archiveImage.get()); // Override config.archiveImage.get() if // import.config is set for forceFileArchiveOn if (config.getForceFileArchiveOn() == true) archiveImage.setSelected(true); if (ARCHIVE_ENABLED) { archiveImage.setVisible(true); } else { archiveImage.setVisible(false); } // Buttons at the bottom of the form cancelBtn = GuiCommonElements.addButton(importPanel, "Cancel", 'L', "Cancel", "1, 5, f, c", debug); cancelBtn.addActionListener(this); importBtn = GuiCommonElements.addButton(importPanel, "Add to Queue", 'Q', "Import", "3, 5, f, c", debug); importBtn.addActionListener(this); importBtn.setEnabled(false); this.getRootPane().setDefaultButton(importBtn); this.getRootPane().setDefaultButton(importBtn); GuiCommonElements.enterPressesWhenFocused(importBtn); /////////////////////// START METADATA PANEL //////////////////////// double metadataTable[][] = { { TableLayout.FILL }, // columns { TableLayout.FILL, 10, TableLayout.FILL } }; // rows metadataPanel = GuiCommonElements.addMainPanel(tabbedPane, metadataTable, 0, 10, 0, 10, debug); double pixelTable[][] = { { 10, TableLayout.FILL, 10, TableLayout.FILL, 10, TableLayout.FILL, 10 }, // columns { 68, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL } }; // rows pixelPanel = GuiCommonElements.addBorderedPanel(metadataPanel, pixelTable, "Pixel Size Defaults", debug); message = "These X, Y & Z pixel size values (typically measured in microns) " + "will be used if no values are included in the image file metadata:"; GuiCommonElements.addTextPane(pixelPanel, message, "1, 0, 6, 0", debug); xPixelSize = GuiCommonElements.addDecimalNumberField(pixelPanel, "X: ", null, "", 0, "", 8, 80, "1,1,L,C", debug); yPixelSize = GuiCommonElements.addDecimalNumberField(pixelPanel, "Y: ", null, "", 0, "", 8, 80, "3,1,L,C", debug); zPixelSize = GuiCommonElements.addDecimalNumberField(pixelPanel, "Z: ", null, "", 0, "", 8, 80, "5,1,L,C", debug); metadataPanel.add(pixelPanel, "0, 0"); double channelTable[][] = { { 10, TableLayout.FILL, 10, TableLayout.FILL, 10, TableLayout.FILL, 10 }, // columns { 68, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL } }; // rows channelPanel = GuiCommonElements.addBorderedPanel(metadataPanel, channelTable, "Channel Defaults", debug); rChannel = GuiCommonElements.addWholeNumberField(channelPanel, "R: ", "0", "", 0, "", 8, 80, "1,1,L,C", debug); gChannel = GuiCommonElements.addWholeNumberField(channelPanel, "G: ", "1", "", 0, "", 8, 80, "3,1,L,C", debug); bChannel = GuiCommonElements.addWholeNumberField(channelPanel, "B: ", "2", "", 0, "", 8, 80, "5,1,L,C", debug); message = "These RGB channel wavelengths (typically measured in nanometers)" + " will be used if no channel values are included in the image file metadata:"; GuiCommonElements.addTextPane(channelPanel, message, "1, 0, 6, 0", debug); //metadataPanel.add(channelPanel, "0, 2"); /////////////////////// START TABBED PANE //////////////////////// this.add(tabbedPane); tabbedPane.addTab("Import Settings", null, importPanel, "Import Settings"); tabbedPane.addTab("Metadata Defaults", null, metadataPanel, "Metadata Defaults"); getProjectDatasets(projectItems[0].getProject()); buildProjectsAndDatasets(); setVisible(true); }
From source file:ome.formats.importer.gui.OptionsDialog.java
/** * Initialize and show the options dialog * /*from w w w . j ava2s . c o m*/ * @param config - ImportConfig to store/save settings too * @param owner - parent * @param title - dialog title * @param modal - modal yes/no */ OptionsDialog(ImportConfig config, JFrame owner, String title, boolean modal) { super(owner); this.owner = owner; setLocation(200, 200); setTitle(title); setModal(modal); setResizable(false); setSize(new Dimension(dialogWidth, dialogHeight)); setLocationRelativeTo(owner); tabbedPane = new JTabbedPane(); tabbedPane.setOpaque(false); // content panes must be opaque this.config = config; oldQuaquaLevel = config.getUseQuaqua(); oldUserDisableHistory = config.getUserDisableHistory(); /////////////////////// START MAIN PANEL //////////////////////// // Set up the main pane double mainPanelTable[][] = { { TableLayout.FILL, 120, 5, 120, TableLayout.FILL }, // columns { TableLayout.FILL, 5, 30 } }; // rows mainPanel = GuiCommonElements.addMainPanel(this, mainPanelTable, 10, 10, 10, 10, debug); // Buttons at the bottom of the form cancelBtn = GuiCommonElements.addButton(mainPanel, "Cancel", 'L', "Cancel", "1, 2, f, c", debug); cancelBtn.addActionListener(this); okBtn = GuiCommonElements.addButton(mainPanel, "OK", 'Q', "Import", "3, 2, f, c", debug); okBtn.addActionListener(this); this.getRootPane().setDefaultButton(okBtn); GuiCommonElements.enterPressesWhenFocused(okBtn); mainPanel.add(tabbedPane, "0,0,4,0"); /////////////////////// START DEBUG OPTIONS PANEL //////////////////////// double debugOptionTable[][] = { { TableLayout.FILL }, // columns { 10, TableLayout.PREFERRED, 20, 30, 15, TableLayout.FILL } }; // rows debugOptionsPanel = GuiCommonElements.addMainPanel(tabbedPane, debugOptionTable, 0, 10, 10, 10, debug); String message = "Choose the level of detail for your log file's data."; GuiCommonElements.addTextPane(debugOptionsPanel, message, "0, 1, 0, 0", debug); dBox = GuiCommonElements.addComboBox(debugOptionsPanel, "Debug Level: ", debugItems, 'D', "Choose the level of detail for your log file's data.", 95, "0,3,F,C", debug); int debugLevel = config.getDebugLevel(); for (int i = 0; i < dBox.getItemCount(); i++) { if (((DebugItem) dBox.getItemAt(i)).getLevel() == debugLevel) dBox.setSelectedIndex(i); } dBox.addActionListener(this); String description = ((DebugItem) dBox.getSelectedItem()).getDescription(); descriptionText = GuiCommonElements.addTextPane(debugOptionsPanel, description, "0, 5", debug); final Font textFieldFont = (Font) UIManager.get("TextField.font"); final Font font = new Font(textFieldFont.getFamily(), Font.ITALIC, textFieldFont.getSize()); descriptionText.setFont(font); /////////////////////// START OTHER OPTIONS PANEL //////////////////////// double otherOptionTable[][] = { { TableLayout.FILL }, // columns { 10, TableLayout.PREFERRED, 20, 30, 15, TableLayout.FILL } }; // rows otherOptionsPanel = GuiCommonElements.addMainPanel(tabbedPane, otherOptionTable, 0, 10, 10, 10, debug); companionFileCheckbox = GuiCommonElements.addCheckBox(otherOptionsPanel, "<html>Attached a text file to each imported" + " file containing all collected metadata.</html>", "0,1", debug); companionFileCheckbox.setSelected(config.companionFile.get()); disableHistoryCheckbox = GuiCommonElements.addCheckBox(otherOptionsPanel, "<html>Disable Import History. (Improves " + " import speed. Restart required if changed).</html>", "0,3", debug); disableHistoryCheckbox.setSelected(config.getUserDisableHistory()); // If disabled by admin in import.config, disable this option if (config.getStaticDisableHistory()) { disableHistoryCheckbox.setEnabled(false); } /////////////////////// START FILECHOOSER PANEL //////////////////////// // Set up the import panel for tPane, quit, and send buttons double fileChooserTable[][] = { { TableLayout.FILL, 120, 5, 120, TableLayout.FILL }, // columns { TableLayout.PREFERRED, 15, TableLayout.FILL, 10 } }; // rows fileChooserPanel = GuiCommonElements.addMainPanel(tabbedPane, fileChooserTable, 0, 10, 0, 10, debug); message = "Switch between single pane view and triple pane view. " + "You will need to reboot the importer before your changes will take effect."; GuiCommonElements.addTextPane(fileChooserPanel, message, "0, 0, 4, 0", debug); // Set up single pane table double singlePaneTable[][] = { { 24, 5, TableLayout.FILL }, // columns { TableLayout.FILL } }; // rows // Panel containing the single pane layout singlePanePanel = GuiCommonElements.addMainPanel(fileChooserPanel, singlePaneTable, 0, 0, 0, 0, debug); singlePaneBtn = GuiCommonElements.addRadioButton(singlePanePanel, null, 'u', null, "0,0", debug); GuiCommonElements.addImagePanel(singlePanePanel, SINGLE_PANE_IMAGE, "2,0", debug); fileChooserPanel.add(singlePanePanel, "0, 2, 1, 2"); // Set up triple pane table double triplePaneTable[][] = { { 24, 5, TableLayout.FILL }, // columns { TableLayout.FILL } }; // rows // Panel containing the triple pane layout triplePanePanel = GuiCommonElements.addMainPanel(fileChooserPanel, triplePaneTable, 0, 0, 0, 0, debug); triplePaneBtn = GuiCommonElements.addRadioButton(triplePanePanel, null, 'u', null, "0,0", debug); GuiCommonElements.addImagePanel(triplePanePanel, TRIPLE_PANE_IMAGE, "2,0", debug); fileChooserPanel.add(triplePanePanel, "3, 2, 4, 2"); ButtonGroup group = new ButtonGroup(); group.add(singlePaneBtn); group.add(triplePaneBtn); if (config.getUseQuaqua() == true) { triplePaneBtn.setSelected(true); singlePaneBtn.setSelected(false); } else { triplePaneBtn.setSelected(false); singlePaneBtn.setSelected(true); } /////////////////////// START TABBED PANE //////////////////////// //if (GuiCommonElements.getIsMac()) tabbedPane.addTab("FileChooser", null, fileChooserPanel, "FileChooser Settings"); tabbedPane.addTab("Debug", null, debugOptionsPanel, "Debug Settings"); tabbedPane.addTab("Other", null, otherOptionsPanel, "Other Settings"); this.add(mainPanel); setVisible(true); }
From source file:ome.formats.importer.gui.SPWDialog.java
/** * Create and display a Screen/Plate/Well dialog for import selection * /*from w ww. j a v a 2 s .c om*/ * @param config - ImportConfig for saving/retrieving defaults * @param owner - parent dialog * @param title - dialog tible * @param modal - modal yes/no * @param store - OMEROMetadataStore to retrieve SPW data from */ SPWDialog(ImportConfig config, JFrame owner, String title, boolean modal, OMEROMetadataStoreClient store) { super(owner); this.store = store; if (store != null) { screenItems = ScreenItem.createScreenItem(store.getScreens()); } setLocation(200, 200); setTitle(title); setModal(modal); setResizable(false); setSize(new Dimension(dialogWidth, dialogHeight)); setLocationRelativeTo(owner); tabbedPane = new JTabbedPane(); tabbedPane.setOpaque(false); // content panes must be opaque this.config = config; /////////////////////// START IMPORT PANEL //////////////////////// // Set up the import panel for tPane, quit, and send buttons double mainTable[][] = { { TableLayout.FILL, 120, 5, 160, TableLayout.FILL }, // columns { TableLayout.PREFERRED, 5, TableLayout.PREFERRED, TableLayout.FILL, 40, 30 } }; // rows importPanel = GuiCommonElements.addMainPanel(tabbedPane, mainTable, 5, 10, 0, 10, debug); String message = "Import this plate into which screen?"; GuiCommonElements.addTextPane(importPanel, message, "0, 0, 4, 0", debug); // Set up the project/dataset table double pdTable[][] = { { TableLayout.FILL, 5, 40 }, // columns { 35 } }; // rows // Panel containing the project / dataset layout sPanel = GuiCommonElements.addMainPanel(importPanel, pdTable, 0, 0, 0, 0, debug); sbox = GuiCommonElements.addComboBox(sPanel, "Screen: ", screenItems, 'P', "Select dataset to use for this import.", 50, "0,0,F,C", debug); // Fixing broken mac buttons. String offsetButtons = ",C"; //if (GuiCommonElements.offsetButtons == true) offsetButtons = ",t"; int addBtnSize = 60; if (GuiCommonElements.getIsMac() == true) addBtnSize = 20; addScreenBtn = GuiCommonElements.addIconButton(sPanel, "", addIcon, 20, addBtnSize, null, null, "2,0,f" + offsetButtons, debug); addScreenBtn.addActionListener(this); importPanel.add(sPanel, "0, 2, 4, 2"); // Buttons at the bottom of the form cancelBtn = GuiCommonElements.addButton(importPanel, "Cancel", 'L', "Cancel", "1, 5, f, c", debug); cancelBtn.addActionListener(this); importBtn = GuiCommonElements.addButton(importPanel, "Add to Queue", 'Q', "Import", "3, 5, f, c", debug); importBtn.addActionListener(this); this.getRootPane().setDefaultButton(importBtn); GuiCommonElements.enterPressesWhenFocused(importBtn); archiveImage = GuiCommonElements.addCheckBox(importPanel, "Archive the original imported file(s) to the server.", "0,4,4,4", debug); archiveImage.setSelected(false); if (ARCHIVE_ENABLED) { archiveImage.setVisible(true); } else { archiveImage.setVisible(false); } /////////////////////// START TABBED PANE //////////////////////// this.add(tabbedPane); tabbedPane.addTab("Import Settings", null, importPanel, "Import Settings"); //this.add(mainPanel); importBtn.setEnabled(false); this.getRootPane().setDefaultButton(importBtn); cancelBtn.addActionListener(this); importBtn.addActionListener(this); sbox.addActionListener(this); buildScreens(); setVisible(true); }
From source file:op.users.PnlUser.java
/** * This method is called from within the constructor to * initialize the form.//from www.j a va2 s . c o m * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the PrinterForm Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { tabMain = new JTabbedPane(); jspUsers = new JScrollPane(); cpsUsers = new CollapsiblePanes(); jspGroups = new JScrollPane(); cpsGroups = new CollapsiblePanes(); //======== this ======== setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); //======== tabMain ======== { tabMain.setFont(new Font("Arial", Font.PLAIN, 18)); //======== jspUsers ======== { //======== cpsUsers ======== { cpsUsers.setLayout(new BoxLayout(cpsUsers, BoxLayout.X_AXIS)); } jspUsers.setViewportView(cpsUsers); } tabMain.addTab("text", jspUsers); //======== jspGroups ======== { //======== cpsGroups ======== { cpsGroups.setLayout(new FormLayout("default, $lcgap, default", "2*(default, $lgap), default")); } jspGroups.setViewportView(cpsGroups); } tabMain.addTab("text", jspGroups); } add(tabMain); }
From source file:org.apache.jmeter.protocol.http.config.gui.HttpDefaultsGui.java
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) setLayout(new BorderLayout(0, 5)); setBorder(makeBorder());/*from w w w.ja va 2s . com*/ // URL CONFIG urlConfigGui = new UrlConfigGui(false, true, false); // AdvancedPanel (embedded resources, source address and optional tasks) JPanel advancedPanel = new VerticalPanel(); advancedPanel.add(createEmbeddedRsrcPanel()); advancedPanel.add(createSourceAddrPanel()); advancedPanel.add(createOptionalTasksPanel()); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add(JMeterUtils.getResString("web_testing_basic"), urlConfigGui); tabbedPane.add(JMeterUtils.getResString("web_testing_advanced"), advancedPanel); JPanel emptyPanel = new JPanel(); emptyPanel.setMaximumSize(new Dimension()); add(makeTitlePanel(), BorderLayout.NORTH); add(tabbedPane, BorderLayout.CENTER); add(emptyPanel, BorderLayout.SOUTH); }
From source file:org.apache.jmeter.visualizers.ViewResultsFullVisualizer.java
/** * Initialize this visualizer//from w ww.ja v a2 s . co m */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) log.debug("init() - pass"); setLayout(new BorderLayout(0, 5)); setBorder(makeBorder()); add(makeTitlePanel(), BorderLayout.NORTH); leftSide = createLeftPanel(); // Prepare the common tab rightSide = new JTabbedPane(); // Create the split pane mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSide, rightSide); mainSplit.setOneTouchExpandable(true); JSplitPane searchAndMainSP = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new SearchTreePanel(root), mainSplit); searchAndMainSP.setOneTouchExpandable(true); add(searchAndMainSP, BorderLayout.CENTER); // init right side with first render resultsRender.setRightSide(rightSide); resultsRender.init(); }
From source file:org.apache.jmeter.visualizers.ViewResultsFullVisualizer.java
/** {@inheritDoc} */ @Override/*from w w w. j a v a2s. c o m*/ public void actionPerformed(ActionEvent event) { String command = event.getActionCommand(); if (COMBO_CHANGE_COMMAND.equals(command)) { JComboBox<?> jcb = (JComboBox<?>) event.getSource(); if (jcb != null) { resultsRender = (ResultRenderer) jcb.getSelectedItem(); if (rightSide != null) { // to restore last selected tab (better user-friendly) selectedTab = rightSide.getSelectedIndex(); // Remove old right side mainSplit.remove(rightSide); // create and add a new right side rightSide = new JTabbedPane(); mainSplit.add(rightSide); resultsRender.setRightSide(rightSide); resultsRender.setLastSelectedTab(selectedTab); log.debug("selectedTab=" + selectedTab); resultsRender.init(); // To display current sampler result before change this.valueChanged(lastSelectionEvent); } } } }
From source file:org.apache.oodt.cas.workflow.gui.perspective.view.impl.GlobalConfigView.java
@Override public void refreshView(ViewState state) { Rectangle visibleRect = null; if (this.tree != null) { visibleRect = this.tree.getVisibleRect(); }/*from w w w . j ava2s.c o m*/ DefaultMutableTreeNode root = new DefaultMutableTreeNode("GlobalConfig"); if (state != null && state.getGlobalConfigGroups() != null) { if (globalConfig != null && globalConfig.keySet().equals(state.getGlobalConfigGroups().keySet()) && globalConfig.values().equals(state.getGlobalConfigGroups().values())) { return; } this.removeAll(); for (ConfigGroup group : (globalConfig = state.getGlobalConfigGroups()).values()) { HashSet<String> keys = new HashSet<String>(); DefaultMutableTreeNode groupNode = new DefaultMutableTreeNode(new Group(group.getName())); root.add(groupNode); for (String key : group.getMetadata().getAllKeys()) { keys.add(key); DefaultMutableTreeNode keyNode = new DefaultMutableTreeNode(new Key(key)); groupNode.add(keyNode); DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode( new Value(StringUtils.join(group.getMetadata().getAllMetadata(key), ","))); keyNode.add(valueNode); } if (group.getExtends() != null) { List<String> extendsGroups = new Vector<String>(group.getExtends()); Collections.reverse(extendsGroups); for (String extendsGroup : extendsGroups) { List<String> groupKeys = state.getGlobalConfigGroups().get(extendsGroup).getMetadata() .getAllKeys(); groupKeys.removeAll(keys); if (groupKeys.size() > 0) { for (String key : groupKeys) { if (!keys.contains(key)) { keys.add(key); DefaultMutableTreeNode keyNode = new DefaultMutableTreeNode( new ExtendsKey(extendsGroup, key)); groupNode.add(keyNode); DefaultMutableTreeNode valueNode = new DefaultMutableTreeNode( new ExtendsValue(StringUtils.join(state.getGlobalConfigGroups() .get(extendsGroup).getMetadata().getAllMetadata(key), ","))); keyNode.add(valueNode); } } } } } } tree = new JTree(root); tree.setShowsRootHandles(true); tree.setRootVisible(false); tree.setCellRenderer(new TreeCellRenderer() { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; if (node.getUserObject() instanceof Key) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JLabel label = new JLabel(node.getUserObject().toString()); label.setForeground(Color.darkGray); panel.add(label, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else if (node.getUserObject() instanceof ExtendsKey) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); ExtendsKey key = (ExtendsKey) node.getUserObject(); JLabel groupLabel = new JLabel("(" + key.getGroup() + ") "); groupLabel.setForeground(Color.black); JLabel keyLabel = new JLabel(key.getValue()); keyLabel.setForeground(Color.gray); panel.add(groupLabel, BorderLayout.WEST); panel.add(keyLabel, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else if (node.getUserObject() instanceof Group) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JLabel label = new JLabel(node.getUserObject().toString()); label.setForeground(Color.black); label.setBackground(Color.white); panel.add(label, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else if (node.getUserObject() instanceof Value) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(new EtchedBorder(1)); JLabel label = new JLabel(node.getUserObject().toString()); label.setForeground(Color.black); panel.add(label, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else if (node.getUserObject() instanceof ExtendsValue) { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.setBorder(new EtchedBorder(1)); JLabel label = new JLabel(node.getUserObject().toString()); label.setForeground(Color.gray); panel.add(label, BorderLayout.CENTER); panel.setBackground(selected ? Color.lightGray : Color.white); return panel; } else { return new JLabel(); } } }); } this.setBorder(new EtchedBorder()); JLabel panelName = new JLabel("Global-Config Groups"); panelName.setBorder(new EtchedBorder()); this.add(panelName, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(tree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); tabbedPane = new JTabbedPane(); tabbedPane.addTab("Tree", scrollPane); tabbedPane.addTab("Table", new JPanel()); this.add(tabbedPane, BorderLayout.CENTER); if (visibleRect != null) { this.tree.scrollRectToVisible(visibleRect); } this.revalidate(); }