List of usage examples for javax.swing JTabbedPane JTabbedPane
public JTabbedPane()
TabbedPane
with a default tab placement of JTabbedPane.TOP
. From source file:org.gtdfree.GTDFree.java
/** * This method initializes aboutDialog * // ww w . ja va2s .co m * @return javax.swing.JDialog */ private JDialog getAboutDialog() { if (aboutDialog == null) { aboutDialog = new JDialog(getJFrame(), true); aboutDialog.setTitle(Messages.getString("GTDFree.About.Free")); //$NON-NLS-1$ Image i = ApplicationHelper.loadImage(ApplicationHelper.icon_name_large_logo); //$NON-NLS-1$ ImageIcon ii = new ImageIcon(i); JTabbedPane jtp = new JTabbedPane(); JPanel jp = new JPanel(); jp.setLayout(new GridBagLayout()); JLabel jl = new JLabel("GTD-Free", ii, SwingConstants.CENTER); //$NON-NLS-1$ jl.setIconTextGap(22); jl.setFont(jl.getFont().deriveFont((float) 24)); jp.add(jl, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); String s = "Version " + ApplicationHelper.getVersion(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(4, 11, 4, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBType") //$NON-NLS-1$ + getEngine().getGTDModel().getDataRepository().getDatabaseType(); jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 2, 11), 0, 0)); s = Messages.getString("GTDFree.About.DBloc") + getEngine().getDataFolder(); //$NON-NLS-1$ jp.add(new JLabel(s, SwingConstants.CENTER), new GridBagConstraints(0, 3, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 11, 4, 11), 0, 0)); jp.add(new JLabel("Copyright 2008,2009 ikesan@users.sourceforge.net", SwingConstants.CENTER), //$NON-NLS-1$ new GridBagConstraints(0, 4, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("About", jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); TableModel tm = new AbstractTableModel() { private static final long serialVersionUID = -8449423008172417278L; private String[] props; private String[] getProperties() { if (props == null) { props = System.getProperties().keySet().toArray(new String[System.getProperties().size()]); Arrays.sort(props); } return props; } @Override public String getColumnName(int column) { switch (column) { case 0: return Messages.getString("GTDFree.About.Prop"); //$NON-NLS-1$ case 1: return Messages.getString("GTDFree.About.Val"); //$NON-NLS-1$ default: return null; } } public int getColumnCount() { return 2; } public int getRowCount() { return getProperties().length; } public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return getProperties()[rowIndex]; case 1: return System.getProperty(getProperties()[rowIndex]); default: return null; } } }; JTable jt = new JTable(tm); jp.add(new JScrollPane(jt), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab(Messages.getString("GTDFree.About.SysP"), jp); //$NON-NLS-1$ jp = new JPanel(); jp.setLayout(new GridBagLayout()); JTextArea ta = new JTextArea(); ta.setEditable(false); ta.setText(ApplicationHelper.loadLicense()); ta.setCaretPosition(0); jp.add(new JScrollPane(ta), new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(11, 11, 11, 11), 0, 0)); jtp.addTab("License", jp); //$NON-NLS-1$ aboutDialog.setContentPane(jtp); aboutDialog.setSize(550, 300); //aboutDialog.pack(); aboutDialog.setLocationRelativeTo(getJFrame()); } return aboutDialog; }
From source file:org.jab.docsearch.DocSearch.java
/** * Constructor//from ww w .j a va 2 s. c o m */ public DocSearch() { super(I18n.getString("ds.windowtitle")); // get logger logger = Logger.getLogger(getClass().getName()); // File testCDFi = new File(cdRomDefaultHome); Properties sys = new Properties(System.getProperties()); if (testCDFi.exists()) { sys.setProperty("disableLuceneLocks", "true"); logger.info("DocSearch() Disabling Lucene Locks for CDROM indexes"); } else { sys.setProperty("disableLuceneLocks", "false"); } // checkCDROMDir(); defaultHndlr = getBrowserFile(); loadSettings(); // pPanel = new ProgressPanel("", 100L); pPanel.init(); phrase = new JRadioButton(I18n.getString("label.phrase")); searchField = new JComboBox(); searchIn = new JComboBox(searchOptsLabels); JLabel searchTypeLabel = new JLabel(I18n.getString("label.search_type")); JLabel searchInLabel = new JLabel(I18n.getString("label.search_in")); keywords = new JRadioButton(I18n.getString("label.keyword")); // searchLabel = new JLabel(I18n.getString("label.search_for")); searchButton = new JButton(I18n.getString("button.search")); searchButton.setActionCommand("ac_search"); searchButton.setMnemonic(KeyEvent.VK_A); // TODO alt text to resource htmlTag = "<img src=\"" + fEnv.getIconURL(FileType.HTML.getIcon()) + "\" border=\"0\" alt=\"Web Page Document\">"; wordTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_WORD.getIcon()) + "\" border=\"0\" alt=\"MS Word Document\">"; excelTag = "<img src=\"" + fEnv.getIconURL(FileType.MS_EXCEL.getIcon()) + "\" border=\"0\" alt=\"MS Excel Document\">"; pdfTag = "<img src=\"" + fEnv.getIconURL(FileType.PDF.getIcon()) + "\" border=\"0\" alt=\"PDF Document\">"; textTag = "<img src=\"" + fEnv.getIconURL(FileType.TEXT.getIcon()) + "\" border=\"0\" alt=\"Text Document\">"; rtfTag = "<img src=\"" + fEnv.getIconURL(FileType.RTF.getIcon()) + "\" border=\"0\" alt=\"RTF Document\">"; ooImpressTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_IMPRESS.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Impress Document\">"; ooWriterTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_WRITER.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Writer Document\">"; ooCalcTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_CALC.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Calc Document\">"; ooDrawTag = "<img src=\"" + fEnv.getIconURL(FileType.OO_DRAW.getIcon()) + "\" border=\"0\" alt=\"OpenOffice Draw Document\">"; openDocumentTextTag = "<img src=\"" + fEnv.getIconURL(FileType.OPENDOCUMENT_TEXT.getIcon()) + "\" border=\"0\" alt=\"OpenDocument Text Document\">"; // idx = new Index(this); colors = new String[2]; colors[0] = "ffeffa"; colors[1] = "fdffda"; if (env.isWebStart()) { startPageString = getClass().getResource("/" + FileEnvironment.FILENAME_START_PAGE_WS).toString(); helpPageString = getClass().getResource("/" + FileEnvironment.FILENAME_HELP_PAGE_WS).toString(); if (startPageString != null) { logger.debug("DocSearch() Start Page is: " + startPageString); hasStartPage = true; } else { logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString); } } else { startPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_START_PAGE); helpPageString = FileUtils.addFolder(fEnv.getStartDirectory(), FileEnvironment.FILENAME_HELP_PAGE); File startPageFile = new File(startPageString); if (startPageFile.exists()) { logger.debug("DocSearch() Start Page is: " + startPageString); hasStartPage = true; } else { logger.error("DocSearch() Start Page NOT FOUND where expected: " + startPageString); } } defaultSaveFolder = FileUtils.addFolder(fEnv.getWorkingDirectory(), "saved_searches"); searchField.setEditable(true); searchField.addItem(""); bg = new ButtonGroup(); bg.add(phrase); bg.add(keywords); keywords.setSelected(true); keywords.setToolTipText(I18n.getString("tooltip.keyword")); phrase.setToolTipText(I18n.getString("tooltip.phrase")); int iconInt = 2; searchField.setPreferredSize(new Dimension(370, 22)); // application icon Image iconImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/icons/ds.gif")); this.setIconImage(iconImage); // menu bar JMenuBar menuBar = createMenuBar(); // add menu to frame setJMenuBar(menuBar); // tool bar JToolBar toolbar = createToolBar(); editorPane = new JEditorPane("text/html", lastSearch); editorPane.setEditable(false); editorPane.addHyperlinkListener(new Hyperactive()); if (hasStartPage) { try { editorPane.setContentType("text/html"); if (setPage("home")) { logger.info("DocSearch() loaded start page: " + startPageString); } } catch (Exception e) { editorPane.setText(lastSearch); } } else { logger.warn("DocSearch() no start page loaded"); } scrollPane = new JScrollPane(editorPane); scrollPane.setPreferredSize(new Dimension(1024, 720)); scrollPane.setMinimumSize(new Dimension(900, 670)); scrollPane.setMaximumSize(new Dimension(1980, 1980)); // create panels // add printing stuff vista = new JComponentVista(editorPane, new PageFormat()); JPanel topPanel = new JPanel(); topPanel.add(searchLabel); topPanel.add(searchField); topPanel.add(searchButton); JPanel bottomPanel = new JPanel(); bottomPanel.add(searchTypeLabel); bottomPanel.add(keywords); bottomPanel.add(phrase); bottomPanel.add(searchInLabel); bottomPanel.add(searchIn); // GUI items for advanced searching useDate = new JCheckBox(I18n.getString("label.use_date_property")); fromField = new JTextField(11); JLabel fromLabel = new JLabel(I18n.getString("label.from")); JLabel toLabel = new JLabel(I18n.getString("label.to")); toField = new JTextField(11); cbl = new CheckBoxListener(); authorPanel = new JPanel(); useAuthor = new JCheckBox(I18n.getString("label.use_auth_property")); authorField = new JTextField(31); JLabel authorLabel = new JLabel(I18n.getString("label.author")); authorPanel.add(useAuthor); authorPanel.add(authorLabel); authorPanel.add(authorField); // combine stuff JPanel datePanel = new JPanel(); datePanel.add(useDate); datePanel.add(fromLabel); datePanel.add(fromField); datePanel.add(toLabel); datePanel.add(toField); JPanel metaPanel = new JPanel(); metaPanel.setLayout(new BorderLayout()); metaPanel.setBorder(new TitledBorder(I18n.getString("label.date_and_author"))); metaPanel.add(datePanel, BorderLayout.NORTH); metaPanel.add(authorPanel, BorderLayout.SOUTH); useDate.addActionListener(cbl); useAuthor.addActionListener(cbl); fromField.setText(DateTimeUtils.getLastYear()); toField.setText(DateTimeUtils.getToday()); authorField.setText(System.getProperty("user.name")); JPanel[] panels = new JPanel[numPanels]; for (int i = 0; i < numPanels; i++) { panels[i] = new JPanel(); } // add giu to panels panels[0].setLayout(new BorderLayout()); panels[0].add(topPanel, BorderLayout.NORTH); panels[0].add(bottomPanel, BorderLayout.SOUTH); panels[0].setBorder(new TitledBorder(I18n.getString("label.search_critera"))); searchButton.addActionListener(this); JPanel fileTypePanel = new JPanel(); useType = new JCheckBox(I18n.getString("label.use_filetype_property")); useType.addActionListener(cbl); fileType = new JComboBox(fileTypesToFindLabel); JLabel fileTypeLabel = new JLabel(I18n.getString("label.find_only_these_filetypes")); fileTypePanel.add(useType); fileTypePanel.add(fileTypeLabel); fileTypePanel.add(fileType); JPanel sizePanel = new JPanel(); useSize = new JCheckBox(I18n.getString("label.use_filesize_property")); useSize.addActionListener(cbl); // TODO l18n kbytes JLabel sizeFromLabel = new JLabel(I18n.getString("label.from") + " KByte"); JLabel sizeToLabel = new JLabel(I18n.getString("label.to") + " KByte"); sizeFromField = new JTextField(10); sizeFromField.setText("0"); sizeToField = new JTextField(10); sizeToField.setText("100"); sizePanel.add(useSize); sizePanel.add(sizeFromLabel); sizePanel.add(sizeFromField); sizePanel.add(sizeToLabel); sizePanel.add(sizeToField); JPanel sizeAndTypePanel = new JPanel(); sizeAndTypePanel.setLayout(new BorderLayout()); sizeAndTypePanel.setBorder(new TitledBorder(I18n.getString("label.filetype_and_size"))); sizeAndTypePanel.add(fileTypePanel, BorderLayout.NORTH); sizeAndTypePanel.add(sizePanel, BorderLayout.SOUTH); // set up the tabbed pane JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(I18n.getString("label.general"), null, panels[0], I18n.getString("tooltip.general_search_criteria")); tabbedPane.addTab(I18n.getString("label.date_and_author"), null, metaPanel, I18n.getString("tooltip.date_auth_options")); tabbedPane.addTab(I18n.getString("label.filetype_and_size"), null, sizeAndTypePanel, I18n.getString("tooltip.filetype_and_size_options")); // gridbag getContentPane().setLayout(new GridLayout(1, numPanels + iconInt + 1)); GridBagLayout gridbaglayout = new GridBagLayout(); GridBagConstraints gridbagconstraints = new GridBagConstraints(); getContentPane().setLayout(gridbaglayout); gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = 0; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(toolbar, gridbagconstraints); getContentPane().add(toolbar); int start = 1; for (int i = 0; i < numPanels; i++) { if (i == 0) { gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = i + start; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(tabbedPane, gridbagconstraints); getContentPane().add(tabbedPane); } else { gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = i + start; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(panels[i], gridbagconstraints); getContentPane().add(panels[i]); } } // now add the results area gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = iconInt; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 1.0D; gridbaglayout.setConstraints(scrollPane, gridbagconstraints); getContentPane().add(scrollPane); JPanel statusP = new JPanel(); statusP.setLayout(new BorderLayout()); statusP.add(dirLabel, BorderLayout.WEST); statusP.add(pPanel, BorderLayout.EAST); // now add the status label gridbagconstraints.fill = GridBagConstraints.HORIZONTAL; gridbagconstraints.insets = new Insets(1, 1, 1, 1); gridbagconstraints.gridx = 0; gridbagconstraints.gridy = numPanels + iconInt; gridbagconstraints.gridwidth = 1; gridbagconstraints.gridheight = 1; gridbagconstraints.weightx = 1.0D; gridbagconstraints.weighty = 0.0D; gridbaglayout.setConstraints(statusP, gridbagconstraints); getContentPane().add(statusP); // File testArchDir = new File(fEnv.getArchiveDirectory()); if (!testArchDir.exists()) { boolean madeDir = testArchDir.mkdir(); if (!madeDir) { logger.warn("DocSearch() Error creating directory: " + fEnv.getArchiveDirectory()); } else { logger.info("DocSearch() Directory created: " + fEnv.getArchiveDirectory()); } } loadIndexes(); // DocTypeHandler String handlersFiName; if (!isCDSearchTool) { handlersFiName = FileUtils.addFolder(fEnv.getWorkingDirectory(), DocTypeHandlerUtils.HANDLER_FILE); } else { handlersFiName = FileUtils.addFolder(cdRomDefaultHome, DocTypeHandlerUtils.HANDLER_FILE); } DocTypeHandlerUtils dthUtils = new DocTypeHandlerUtils(); if (!FileUtils.fileExists(handlersFiName)) { logger.warn("DocSearch() Handlers file not found at: " + handlersFiName); handlerList = dthUtils.getInitialHandler(env); } else { handlerList = dthUtils.loadHandler(handlersFiName); } }
From source file:org.jajuk.ui.views.SuggestionView.java
@Override public void initUI() { tabs = new JTabbedPane(); // Now use the new TabbedPaneUI tabs.setUI(new MyTabbedPaneUI()); // Fill tabs with empty tabs tabs.addTab(Messages.getString("SuggestionView.1"), UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3")))); tabs.addTab(Messages.getString("SuggestionView.2"), UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3")))); tabs.addTab(Messages.getString("SuggestionView.5"), UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3")))); tabs.addTab(Messages.getString("SuggestionView.3"), new JLabel(Messages.getString("SuggestionView.7"))); tabs.addTab(Messages.getString("SuggestionView.4"), new JLabel(Messages.getString("SuggestionView.7"))); addTabChangeListener();//from w w w . jav a2s . c o m selectTabFromConf(); refreshLocalCollectionTabs(); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); add(tabs); ObservationManager.register(this); }
From source file:org.jcurl.demo.tactics.TacticsApp.java
public TacticsApp() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { TacticsApp.this.cmdExit(); }/*from w ww .j a va 2 s. co m*/ }); master = new RockEditDisplay(); master.setPos(mod_locations); master.setSpeed(mod_speeds); final PositionDisplay pnl2 = new PositionDisplay(); pnl2.setPos(mod_locations); pnl2.setZoom(Zoomer.HOG2HACK); final Container con = getContentPane(); { final JPanel p = new JPanel(new BorderLayout()); p.add(new SumWaitDisplay(mod_locations), "West"); p.add(master, "Center"); p.add(new SumShotDisplay(mod_locations), "East"); con.add(p, "Center"); } // con.add(new SumWaitDisplay(mod_locations), "West"); con.add(new SumOutDisplay(mod_locations), "West"); { final Box b1 = Box.createHorizontalBox(); b1.add(Box.createRigidArea(new Dimension(0, 75))); b1.add(pnl2); con.add(b1, "South"); } final JTabbedPane t = new JTabbedPane(); con.add(t, "East"); { final Box b0 = Box.createHorizontalBox(); t.add("Rock", b0); { final JPanel b1 = new JPanel(new BorderLayout()); final Box b2 = Box.createVerticalBox(); b2.add(new JComboBox(new String[] { "Dark", "Light" })); b2.add(new JLabel("Broom", SwingConstants.LEFT)); b1.add(b2, "North"); JSlider s = new JSlider(-2000, 2000, 0); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final Box b3 = Box.createHorizontalBox(); b3.add(new JFormattedTextField()); b3.add(new JLabel("mm", SwingConstants.LEFT)); b1.add(b3, "South"); b0.add(b1); } { final JPanel b1 = new JPanel(new BorderLayout()); final Box b2 = Box.createVerticalBox(); b2.add(new JComboBox(new String[] { "1", "2", "3", "4", "5", "6", "7", "8" })); b2.add(new JLabel("Splittime", SwingConstants.LEFT)); b1.add(b2, "North"); JSlider s = new JSlider(500, 2500, 1500); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final Box b3 = Box.createHorizontalBox(); b3.add(new JSpinner()); b3.add(new JLabel("ms", SwingConstants.LEFT)); b1.add(b3, "South"); b0.add(b1); } } { final Box b0 = Box.createHorizontalBox(); t.add("Ice", b0); { final JPanel b1 = new JPanel(new BorderLayout()); b1.add(new JLabel("Curl"), "North"); JSlider s = new JSlider(0, 5000, 0); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(1000); s.setMinorTickSpacing(100); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final JSpinner s1 = new JSpinner(); b1.add(s1, "South"); b0.add(b1); } { final JPanel b1 = new JPanel(new BorderLayout()); b1.add(new JLabel("DrawToTee"), "North"); JSlider s = new JSlider(15000, 30000, 25000); s.setOrientation(SwingConstants.VERTICAL); s.setMajorTickSpacing(5000); s.setMinorTickSpacing(1000); s.setPaintLabels(true); s.setPaintTicks(true); b1.add(s, "Center"); final JSpinner s1 = new JSpinner(); b1.add(s1, "South"); b0.add(b1); } } setJMenuBar(createMenu()); refreshTitle(); this.setSize(900, 400); new SpeedController(mod_locations, mod_speeds, master); new LocationController(mod_locations, pnl2); lastSaved = mod_locations.getLastChanged(); }
From source file:org.jets3t.apps.cockpit.gui.StartupDialog.java
/** * Initialises all GUI elements.// ww w .j a va 2s . com */ private void initGui() { this.setResizable(false); this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); cancelButton = new JButton("Don't log in"); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); storeCredentialsButton = new JButton("Store Credentials"); storeCredentialsButton.setActionCommand("StoreCredentials"); storeCredentialsButton.addActionListener(this); okButton = new JButton("Log in"); okButton.setActionCommand("LogIn"); okButton.addActionListener(this); // Set default ENTER and ESCAPE buttons. this.getRootPane().setDefaultButton(okButton); this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE"); this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() { private static final long serialVersionUID = -1742280851624947873L; public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } }); JPanel buttonsPanel = new JPanel(new GridBagLayout()); buttonsPanel.add(cancelButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); buttonsPanel.add(storeCredentialsButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); buttonsPanel.add(okButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); loginPassphrasePanel = new LoginPassphrasePanel(hyperlinkListener); loginLocalFolderPanel = new LoginLocalFolderPanel(ownerFrame, hyperlinkListener); loginCredentialsPanel = new LoginCredentialsPanel(false, hyperlinkListener); // Target storage service selection targetS3 = new JRadioButton("Amazon S3"); targetS3.setSelected(true); targetGS = new JRadioButton("Google Storage"); ButtonGroup targetButtonGroup = new ButtonGroup(); targetButtonGroup.add(targetS3); targetButtonGroup.add(targetGS); JPanel targetServicePanel = new JPanel(new GridBagLayout()); targetServicePanel.add(targetS3, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0)); targetServicePanel.add(targetGS, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0)); // Tabbed Pane. tabbedPane = new JTabbedPane(); tabbedPane.addChangeListener(this); tabbedPane.add(loginPassphrasePanel, "Online"); tabbedPane.add(loginLocalFolderPanel, "Local Folder"); tabbedPane.add(loginCredentialsPanel, "Direct Login"); int row = 0; this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(targetServicePanel, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); this.getContentPane().add(tabbedPane, new GridBagConstraints(0, row++, 2, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0)); this.getContentPane().add(buttonsPanel, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); this.pack(); this.setSize(500, 430); this.setLocationRelativeTo(this.getOwner()); }
From source file:org.jivesoftware.sparkimpl.plugin.viewer.PluginViewer.java
public PluginViewer() { _prefs = SettingsManager.getLocalPreferences(); _deactivatedPlugins = _prefs.getDeactivatedPlugins(); EventQueue.invokeLater(new Runnable() { public void run() { tabbedPane = new JTabbedPane(); installedPanel = new JPanel(); availablePanel = new JPanel(); deactivatedPanel = new JPanel(); setLayout(new GridBagLayout()); installedPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false)); installedPanel.setBackground(Color.white); availablePanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false)); availablePanel.setBackground(Color.white); // Add TabbedPane add(tabbedPane, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); // Add Tabs tabbedPane.addTab(Res.getString("tab.installed.plugins"), new JScrollPane(installedPanel)); if (!Default.getBoolean(Default.INSTALL_PLUGINS_DISABLED)) { tabbedPane.addTab(Res.getString("tab.available.plugins"), new JScrollPane(availablePanel)); }/*from w w w .j ava 2 s . co m*/ loadInstalledPlugins(); loadDeactivatedPlugins(); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { if (tabbedPane.getSelectedComponent() .equals(((JViewport) availablePanel.getParent()).getParent())) { loadAvailablePlugins(); loaded = true; } } }); } }); }
From source file:org.kuali.test.creator.TestCreator.java
private void loadSplitPanes() { if (hsplitPane != null) { desktopPane.remove(hsplitPane);//www .j av a2 s. c o m } hsplitPane = new JSplitPane(); vsplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); JPanel p = new JPanel(new BorderLayout()); p.add(new JScrollPane(testRepositoryTree = new RepositoryTree(this)), BorderLayout.CENTER); hsplitPane.setDividerLocation(150); hsplitPane.setOneTouchExpandable(true); vsplitPane.setDividerLocation(250); vsplitPane.setTopComponent(p); vsplitPane.setBottomComponent(platformTestsPanel = new PlatformTestsPanel(this)); testRepositoryTree.addTreeSelectionListener(platformTestsPanel); JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.addTab(Constants.REPOSITORY, vsplitPane); tabbedPane.addTab(Constants.DATABASES, new JScrollPane(databaseTree = new DatabaseTree(this, getConfiguration()))); tabbedPane.addTab(Constants.WEBSERVICES, new JScrollPane(webServiceTree = new WebServiceTree(this, getConfiguration()))); tabbedPane.addTab(Constants.JMX, new JScrollPane(jmxTree = new JmxTree(this, getConfiguration()))); hsplitPane.setLeftComponent(tabbedPane); hsplitPane.setRightComponent(createTestPanel = new CreateTestPanel(this)); Preferences proot = Preferences.userRoot(); Preferences node = proot.node(Constants.PREFS_ROOT_NODE); hsplitPane.setDividerLocation(node.getInt(Constants.PREFS_HORIZONTAL_DIVIDER_LOCATION, Constants.DEFAULT_HORIZONTAL_DIVIDER_LOCATION)); vsplitPane.setDividerLocation(node.getInt(Constants.PREFS_VERTICAL_DIVIDER_LOCATION, Constants.DEFAULT_VERTICAL_DIVIDER_LOCATION)); desktopPane.add(hsplitPane, BorderLayout.CENTER); }
From source file:org.kuali.test.handlers.htmltag.DefaultHtmlTagHandler.java
/** * * @return */ protected JTabbedPane getNewTabbedPane() { return new JTabbedPane(); }
From source file:org.kuali.test.ui.components.dialogs.JmxDlg.java
private void initComponents() { String[] labels = { "Name", "JMX URL", "User Name", "Password" }; name = new JTextField(jmx.getName(), 20); name.setEditable(!isEditmode());/*from w ww . j a v a 2s . c o m*/ jmxUrl = new JTextField(jmx.getJmxUrl(), 30); username = new JTextField(jmx.getUsername(), 20); String pass = ""; if (StringUtils.isNotBlank(jmx.getPassword())) { try { pass = Utils.decrypt(getMainframe().getEncryptionPassword(), jmx.getPassword()); } catch (UnsupportedEncodingException ex) { UIUtils.showError(this, "Decrypt Exception", "Password decryption failed"); } } password = new JPasswordField(pass, 20); JComponent[] components = { name, jmxUrl, username, password }; getContentPane().add(UIUtils.buildEntryPanel(labels, components), BorderLayout.NORTH); JPanel p = new JPanel(new BorderLayout()); if (!isEditmode()) { JButton b = new JButton("Refresh JMX Attributes"); JPanel p2 = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 6)); p2.add(b); p.add(p2, BorderLayout.NORTH); b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadJMXData(); } }); } tabbedPane = new JTabbedPane(); for (int i = 0; i < tabInfo.length; ++i) { tabbedPane.addTab(tabInfo[i].getTabName(), new TablePanel(getMBeanTable(tabInfo[i].getJmxBeanName()))); } p.add(tabbedPane, BorderLayout.CENTER); getContentPane().add(p, BorderLayout.CENTER); if (isEditmode()) { loadJMXData(); } addStandardButtons(); setDefaultBehavior(); }
From source file:org.kuali.test.ui.components.panels.HtmlCheckpointPanel.java
private void initComponents(HtmlDomProcessor.DomInformation dominfo) { if (dominfo != null) { setName(Constants.DEFAULT_HTML_PROPERTY_GROUP); checkPointMap = loadCheckpointMap(dominfo.getCheckpointProperties()); if (LOG.isDebugEnabled()) { LOG.debug("labelNodes.size(): " + dominfo.getLabelMap().size()); LOG.debug("CheckpointProperty list size: " + dominfo.getCheckpointProperties().size()); LOG.debug("CheckpointProperty map.size: " + checkPointMap.size()); }//from w w w. j a v a2 s . c o m // if we have more than 1 group then we will use tabs if (checkPointMap.size() > 1) { if (isUseTabContainers()) { JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT)); p.add(containers = new JComboBox(getContainerNames())); add(p, BorderLayout.NORTH); containers.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { loadTabs(); } }); } add(tabbedPane = new JTabbedPane(), BorderLayout.CENTER); loadTabs(); } else if (checkPointMap.size() == 1) { CheckpointTable t; String key = checkPointMap.keySet().iterator().next(); if (singleSelectMode) { t = buildParameterTableForSingleSelect(key, checkPointMap.get(key)); } else { t = buildParameterTable(key, checkPointMap.get(key)); } TablePanel p = new TablePanel(t); t.getSelectionModel().addListSelectionListener(this); add(p, BorderLayout.CENTER); } else { add(new JLabel("No checkpoint properties found", JLabel.CENTER), BorderLayout.CENTER); empty = true; } } else { UIUtils.showError(parentDialog, "HTML Parse Error", "Unable to parse web browser HTML"); } parentDialog.validate(); }