List of usage examples for javax.swing BorderFactory createTitledBorder
public static TitledBorder createTitledBorder(Border border, String title)
From source file:com._17od.upm.gui.OptionsDialog.java
public OptionsDialog(JFrame frame) { super(frame, Translator.translate("options"), true); Container container = getContentPane(); // Create a pane with an empty border for spacing Border emptyBorder = BorderFactory.createEmptyBorder(2, 5, 5, 5); JPanel emptyBorderPanel = new JPanel(); emptyBorderPanel.setLayout(new BoxLayout(emptyBorderPanel, BoxLayout.Y_AXIS)); emptyBorderPanel.setBorder(emptyBorder); container.add(emptyBorderPanel);/*w w w.j av a 2s . c om*/ // ****************** // *** The DB TO Load On Startup Section // ****************** // Create a pane with an title etched border Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED); Border etchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, ' ' + Translator.translate("general") + ' '); JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.setBorder(etchedTitleBorder); emptyBorderPanel.add(mainPanel); GridBagConstraints c = new GridBagConstraints(); // The "Database to Load on Startup" row JLabel urlLabel = new JLabel(Translator.translate("dbToLoadOnStartup")); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; mainPanel.add(urlLabel, c); // The "Database to Load on Startup" input field row dbToLoadOnStartup = new JTextField(Preferences.get(Preferences.ApplicationOptions.DB_TO_LOAD_ON_STARTUP), 25); dbToLoadOnStartup.setHorizontalAlignment(JTextField.LEFT); c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(dbToLoadOnStartup, c); JButton dbToLoadOnStartupButton = new JButton("..."); dbToLoadOnStartupButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getDBToLoadOnStartup(); } }); c.gridx = 1; c.gridy = 1; c.anchor = GridBagConstraints.LINE_END; c.insets = new Insets(0, 0, 5, 5); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(dbToLoadOnStartupButton, c); // The "Language" label row JLabel localeLabel = new JLabel(Translator.translate("language")); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; mainPanel.add(localeLabel, c); // The "Locale" field row localeComboBox = new JComboBox(getSupportedLocaleNames()); for (int i = 0; i < localeComboBox.getItemCount(); i++) { // If the locale language is blank then set it to the English language // I'm not sure why this happens. Maybe it's because the default locale // is English??? String currentLanguage = Translator.getCurrentLocale().getLanguage(); if (currentLanguage.equals("")) { currentLanguage = "en"; } if (currentLanguage.equals(Translator.SUPPORTED_LOCALES[i].getLanguage())) { localeComboBox.setSelectedIndex(i); break; } } c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 8, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(localeComboBox, c); // The "Hide account password" row Boolean hideAccountPassword = new Boolean( Preferences.get(Preferences.ApplicationOptions.ACCOUNT_HIDE_PASSWORD, "true")); hideAccountPasswordCheckbox = new JCheckBox(Translator.translate("hideAccountPassword"), hideAccountPassword.booleanValue()); c.gridx = 0; c.gridy = 4; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(hideAccountPasswordCheckbox, c); // The "Database auto lock" row Boolean databaseAutoLock = new Boolean( Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK, "false")); databaseAutoLockCheckbox = new JCheckBox(Translator.translate("databaseAutoLock"), databaseAutoLock.booleanValue()); c.gridx = 0; c.gridy = 5; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(databaseAutoLockCheckbox, c); databaseAutoLockCheckbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { databaseAutoLockTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED); } }); // The "Database auto lock" field row databaseAutoLockTime = new JTextField( Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK_TIME), 5); c.gridx = 1; c.gridy = 5; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(databaseAutoLockTime, c); databaseAutoLockTime.setEnabled(databaseAutoLockCheckbox.isSelected()); // The "Generated password length" row accountPasswordLengthLabel = new JLabel(Translator.translate("generatedPasswodLength")); c.gridx = 0; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; mainPanel.add(accountPasswordLengthLabel, c); accountPasswordLength = new JTextField( Preferences.get(Preferences.ApplicationOptions.ACCOUNT_PASSWORD_LENGTH, "8"), 5); c.gridx = 1; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; mainPanel.add(accountPasswordLength, c); // Some spacing emptyBorderPanel.add(Box.createVerticalGlue()); // ****************** // *** The HTTPS Section // ****************** // Create a pane with an title etched border Border httpsEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, " HTTPS "); final JPanel httpsPanel = new JPanel(new GridBagLayout()); httpsPanel.setBorder(httpsEtchedTitleBorder); emptyBorderPanel.add(httpsPanel); // The "Accept Self Sigend Certificates" checkbox row Boolean acceptSelfSignedCerts = new Boolean( Preferences.get(Preferences.ApplicationOptions.HTTPS_ACCEPT_SELFSIGNED_CERTS, "false")); acceptSelfSignedCertsCheckbox = new JCheckBox(Translator.translate("acceptSelfSignedCerts"), acceptSelfSignedCerts.booleanValue()); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; httpsPanel.add(acceptSelfSignedCertsCheckbox, c); // ****************** // *** The Proxy Section // ****************** // Create a pane with an title etched border Border proxyEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, ' ' + Translator.translate("httpProxy") + ' '); final JPanel proxyPanel = new JPanel(new GridBagLayout()); proxyPanel.setBorder(proxyEtchedTitleBorder); emptyBorderPanel.add(proxyPanel); // The "Enable Proxy" row Boolean proxyEnabled = new Boolean(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_ENABLED)); enableProxyCheckbox = new JCheckBox(Translator.translate("enableProxy"), proxyEnabled.booleanValue()); enableProxyCheckbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { enableProxyComponents(true); } else { enableProxyComponents(false); } } }); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 2, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; proxyPanel.add(enableProxyCheckbox, c); // The "HTTP Proxy" label row proxyLabel = new JLabel(Translator.translate("httpProxy")); c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyLabel, c); // The "HTTP Proxy Port" label proxyPortLabel = new JLabel(Translator.translate("port")); c.gridx = 1; c.gridy = 1; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyPortLabel, c); // The "HTTP Proxy" field row httpProxyHost = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_HOST), 20); c.gridx = 0; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyHost, c); httpProxyPort = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PORT), 6); c.gridx = 1; c.gridy = 2; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyPort, c); // The "HTTP Proxy Username" label row proxyUsernameLabel = new JLabel(Translator.translate("httpProxyUsername")); c.gridx = 0; c.gridy = 3; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyUsernameLabel, c); // The "HTTP Proxy Username" field row httpProxyUsername = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_USERNAME), 20); c.gridx = 0; c.gridy = 4; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyUsername, c); // The "HTTP Proxy Password" label row proxyPasswordLabel = new JLabel(Translator.translate("httpProxyPassword")); c.gridx = 0; c.gridy = 5; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 3, 0); c.weightx = 1; c.weighty = 0; c.gridwidth = 2; c.fill = GridBagConstraints.NONE; proxyPanel.add(proxyPasswordLabel, c); // The "HTTP Proxy Password" field row String encodedPassword = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PASSWORD); String decodedPassword = null; if (encodedPassword != null) { decodedPassword = new String(Base64.decodeBase64(encodedPassword.getBytes())); } httpProxyPassword = new JPasswordField(decodedPassword, 20); c.gridx = 0; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 5); c.weightx = 1; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; proxyPanel.add(httpProxyPassword, c); hidePasswordCheckbox = new JCheckBox(Translator.translate("hide"), true); defaultEchoChar = httpProxyPassword.getEchoChar(); hidePasswordCheckbox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { httpProxyPassword.setEchoChar(defaultEchoChar); } else { httpProxyPassword.setEchoChar((char) 0); } } }); c.gridx = 1; c.gridy = 6; c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(0, 5, 5, 0); c.weightx = 0; c.weighty = 0; c.gridwidth = 1; c.fill = GridBagConstraints.NONE; proxyPanel.add(hidePasswordCheckbox, c); // Some spacing emptyBorderPanel.add(Box.createVerticalGlue()); // The buttons row JPanel buttonPanel = new JPanel(new FlowLayout()); emptyBorderPanel.add(buttonPanel); JButton okButton = new JButton(Translator.translate("ok")); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okButtonAction(); } }); buttonPanel.add(okButton); JButton cancelButton = new JButton(Translator.translate("cancel")); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); dispose(); } }); buttonPanel.add(cancelButton); enableProxyComponents(proxyEnabled.booleanValue()); }
From source file:hermes.browser.dialog.DestinationPropertyConfigPanel.java
public DestinationPropertyConfigPanel(String hermesId, Destination bean, DestinationConfig config) { try {//from w w w .j a va 2 s . c o m this.bean = bean; this.config = config; final Border border = BorderFactory.createBevelBorder(BevelBorder.RAISED); setLayout(new BorderLayout()); add(tabbedPane); generalPanel.setLayout(new BorderLayout()); if (bean != null) { beanPropertyPanel = new BeanPropertyPanel(bean, true, false); beanPropertyPanel.init(); beanPropertyPanel.setBorder(BorderFactory.createTitledBorder(border, "Provider Properties")); } generalPanel.setBorder(BorderFactory.createTitledBorder(border, "Hermes Properties")); tabbedPane.add("Hermes", generalPanel); if (bean != null) { tabbedPane.add("Provider", beanPropertyPanel); } tabbedPane.setTabPlacement(JTabbedPane.BOTTOM); init(); } catch (IllegalAccessException e) { throw new HermesRuntimeException(e); } catch (InvocationTargetException e) { throw new HermesRuntimeException(e); } catch (NoSuchMethodException e) { throw new HermesRuntimeException(e); } }
From source file:ui.results.ResultChartPanel.java
/** * Construct new Result panel/*w w w.j a v a 2 s. c o m*/ */ public ResultChartPanel() { // The charting objects dataset = new DefaultStatisticalCategoryDataset(); upper = new DefaultCategoryDataset(); lower = new DefaultCategoryDataset(); // The Renderers lineRenderer0 = new LineAndShapeRenderer(); lineRenderer1 = new LineAndShapeRenderer(); lineRenderer2 = new LineAndShapeRenderer(); lineRenderer0.setSeriesPaint(0, lowerColor); lineRenderer1.setSeriesPaint(0, mspColor); lineRenderer2.setSeriesPaint(0, upperColor); lineRenderer0.setSeriesShapesVisible(0, false); lineRenderer1.setSeriesShapesVisible(0, false); lineRenderer2.setSeriesShapesVisible(0, false); barRenderer = new StatisticalBarRenderer(); barRenderer.setSeriesPaint(0, mspColor); // The Plot: begin as a line plot CategoryPlot plot = new CategoryPlot(); plot.setDomainAxis(new CategoryAxis("Datasets")); plot.setRangeAxis(new NumberAxis("MSP")); plot.setRenderer(0, lineRenderer0); plot.setRenderer(1, lineRenderer1); plot.setRenderer(2, lineRenderer2); plot.setDataset(0, lower); plot.setDataset(1, dataset); plot.setDataset(2, upper); // Adding the new plot chart = new JFreeChart(plot); panel = new ChartPanel(chart); // Listening to changes //dataset.addChangeListener(chart.getPlot()); chart.getPlot().addChangeListener(chart); chart.addChangeListener(panel); ((CategoryPlot) chart.getPlot()).getRangeAxis().setAutoRange(true); // Choice panel: choicing between line and bar chart JPanel choicePanel = createChoicePanel(); // Doing the interface setLayout(new BorderLayout()); add(choicePanel, BorderLayout.NORTH); add(panel, BorderLayout.CENTER); setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Chart")); // size stuff //setPreferredSize(new Dimension(500, 400)); }
From source file:net.sf.xmm.moviemanager.gui.DialogIMDB.java
JPanel createMoviehitsList() { /* Movies List panel...*/ JPanel panelMoviesList = new JPanel(); panelMoviesList.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); listMovies = new JList() { public String getToolTipText(MouseEvent e) { if (getCellBounds(0, 0) == null) return null; String retVal = null; int row = (int) e.getPoint().getY() / (int) getCellBounds(0, 0).getHeight(); if (row >= 0 && row < getModel().getSize() && getMoviesList().getModel().getElementAt(row) instanceof ModelIMDbSearchHit) { retVal = ((ModelIMDbSearchHit) getMoviesList().getModel().getElementAt(row)).getAka(); if (retVal != null && retVal.trim().equals("")) //$NON-NLS-1$ retVal = null;//from w w w . j a v a 2 s . com } return retVal; } public JToolTip createToolTip() { JMultiLineToolTip tooltip = new JMultiLineToolTip(); tooltip.setComponent(this); return tooltip; } }; // Unfortunately setting tooltip timeout affects ALL tooltips ToolTipManager ttm = ToolTipManager.sharedInstance(); ttm.registerComponent(listMovies); ttm.setInitialDelay(0); ttm.setReshowDelay(0); listMovies.setFixedCellHeight(18); listMovies.setFont(new Font(listMovies.getFont().getName(), Font.PLAIN, listMovies.getFont().getSize())); listMovies.setLayoutOrientation(JList.VERTICAL); listMovies.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); listMovies.setCellRenderer(new MovieHitListCellRenderer()); listMovies.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent event) { // Open we page if (SwingUtilities.isRightMouseButton(event)) { int index = listMovies.locationToIndex(event.getPoint()); if (index >= 0) { ModelIMDbSearchHit hit = (ModelIMDbSearchHit) listMovies.getModel().getElementAt(index); if (hit.getUrlID() != null && !hit.getUrlID().equals("")) { BrowserOpener opener = new BrowserOpener(hit.getCompleteUrl()); opener.executeOpenBrowser(MovieManager.getConfig().getSystemWebBrowser(), MovieManager.getConfig().getBrowserPath()); } } } else if (SwingUtilities.isLeftMouseButton(event) && event.getClickCount() >= 2) { buttonSelect.doClick(); } } }); KeyStroke enterKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true); ActionListener listKeyBoardActionListener = new ActionListener() { public void actionPerformed(ActionEvent ae) { log.debug("ActionPerformed: " + "Movielist - ENTER pressed."); //$NON-NLS-1$ buttonSelect.doClick(); } }; listMovies.registerKeyboardAction(listKeyBoardActionListener, enterKeyStroke, JComponent.WHEN_FOCUSED); JScrollPane scrollPaneMovies = new JScrollPane(listMovies); scrollPaneMovies.setAutoscrolls(true); //scrollPaneMovies.registerKeyboardAction(listKeyBoardActionListener,enterKeyStroke, JComponent.WHEN_FOCUSED); panelMoviesList.setLayout(new BorderLayout()); panelMoviesList.add(scrollPaneMovies, BorderLayout.CENTER); return panelMoviesList; }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultTitleEditor.java
/** * Standard constructor: builds a panel for displaying/editing the * properties of the specified title./*from w w w . j av a2s . c om*/ * * @param title * the title, which should be changed. */ public DefaultTitleEditor(Title title) { if (title == null) { this.showTitle = false; this.titleFont = SimulationDiagramTheme.DEFAULT_TITLE_FONT; this.titleField = new JTextField(); this.titlePaint = new PaintSample(Color.BLACK); } else { TextTitle t = (TextTitle) title; this.showTitle = title.isVisible(); this.titleFont = t.getFont(); this.titleField = new JTextField(t.getText()); this.titlePaint = new PaintSample(t.getPaint()); } System.out.println(this.titleFont.getName()); setLayout(new BorderLayout()); JPanel general = new JPanel(new BorderLayout()); general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("General"))); JPanel interior = new JPanel(new LCBLayout(4)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); interior.add(new JLabel(localizationResources.getString("Show_Title"))); this.showTitleCheckBox = new JCheckBox(); this.showTitleCheckBox.setSelected(this.showTitle); this.showTitleCheckBox.setActionCommand("ShowTitle"); this.showTitleCheckBox.addActionListener(this); interior.add(new JPanel()); interior.add(this.showTitleCheckBox); JLabel titleLabel = new JLabel(localizationResources.getString("Text")); interior.add(titleLabel); interior.add(this.titleField); interior.add(new JPanel()); JLabel fontLabel = new JLabel(localizationResources.getString("Font")); this.fontfield = new FontDisplayField(this.titleFont); this.selectFontButton = new JButton(localizationResources.getString("Select...")); this.selectFontButton.setActionCommand("SelectFont"); this.selectFontButton.addActionListener(this); interior.add(fontLabel); interior.add(this.fontfield); interior.add(this.selectFontButton); JLabel colorLabel = new JLabel(localizationResources.getString("Color")); this.selectPaintButton = new JButton(localizationResources.getString("Select...")); this.selectPaintButton.setActionCommand("SelectPaint"); this.selectPaintButton.addActionListener(this); interior.add(colorLabel); interior.add(this.titlePaint); interior.add(this.selectPaintButton); this.enableOrDisableControls(); general.add(interior); add(general, BorderLayout.NORTH); }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java
private final JPanel getMainPanel() { final JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); final ServerList linkedServerList = new ServerList(linkedServerListModel); linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList); linkedServerScrollPane/* ww w. j av a 2s . c o m*/ .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers")); // Doesn't matter what this is set to, as long as it's the same as the // one for unlinkedServerScrollPane linkedServerScrollPane.setPreferredSize(new Dimension(10, 10)); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.weightx = 0.5; c.weighty = 1.0; mainPanel.add(linkedServerScrollPane, c); final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel); unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList); unlinkedServerScrollPane .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers")); // Doesn't matter what this is set to, as long as it's the same as the // one for unlinkedServerScrollPane unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10)); final JPanel middlePanel = new JPanel(); middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS)); middlePanel.add(Box.createVerticalGlue()); final JButton linkSelectionButton = new JButton("<"); final JButton unlinkSelectionButton = new JButton(">"); linkSelectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { // Move selection from unlinked to linked list final int selection = unlinkedServerList.getSelectedIndex(); if (selection < 0) { return; } final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection); unlinkedServerListModel.removeServer(server); linkedServerListModel.addServer(server); } }); unlinkSelectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { // Move selection from linked to unlinked list final int selection = linkedServerList.getSelectedIndex(); if (selection < 0) { return; } final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this, "You are about to unlink a server. " + "Unlinking a server will permanently remove \nall data associated with " + "this server, but the server will keep running. " + "\n\nAre you sure you wish to continue?", "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); if (answer != JOptionPane.YES_OPTION) { return; } final Server server = linkedServerListModel.getVisibleServerAtIndex(selection); linkedServerListModel.removeServer(server); unlinkedServerListModel.addServer(server); } }); middlePanel.add(unlinkSelectionButton); middlePanel.add(Box.createVerticalStrut(10)); middlePanel.add(linkSelectionButton); middlePanel.add(Box.createVerticalGlue()); c.gridx = 1; c.gridy = 0; c.weightx = 0.0; c.weighty = 0.0; mainPanel.add(middlePanel, c); c.gridx = 2; c.gridy = 0; c.weightx = 0.5; c.weighty = 1.0; mainPanel.add(unlinkedServerScrollPane, c); return mainPanel; }
From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPDefaultsGui.java
private void init() { setLayout(new BorderLayout(0, 5)); setBorder(makeBorder());/*from w w w .j a v a 2 s .com*/ add(makeTitlePanel(), BorderLayout.NORTH); urlConfig = new UPMPUrlConfigGui(false, true, false); add(urlConfig, BorderLayout.CENTER); // OPTIONAL TASKS final JPanel optionalTasksPanel = new VerticalPanel(); optionalTasksPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), JMeterUtils.getResString("optional_tasks"))); // $NON-NLS-1$ final JPanel checkBoxPanel = new HorizontalPanel(); imageParser = new JCheckBox(JMeterUtils.getResString("web_testing_retrieve_images")); // $NON-NLS-1$ checkBoxPanel.add(imageParser); imageParser.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { enableConcurrentDwn(true); } else { enableConcurrentDwn(false); } } }); // Concurrent resources download concurrentDwn = new JCheckBox(JMeterUtils.getResString("web_testing_concurrent_download")); // $NON-NLS-1$ concurrentDwn.addItemListener(new ItemListener() { @Override public void itemStateChanged(final ItemEvent e) { if (imageParser.isSelected() && e.getStateChange() == ItemEvent.SELECTED) { concurrentPool.setEnabled(true); } else { concurrentPool.setEnabled(false); } } }); concurrentPool = new JTextField(2); // 2 columns size concurrentPool.setMaximumSize(new Dimension(30, 20)); checkBoxPanel.add(concurrentDwn); checkBoxPanel.add(concurrentPool); optionalTasksPanel.add(checkBoxPanel); // Embedded URL match regex embeddedRE = new JLabeledTextField(JMeterUtils.getResString("web_testing_embedded_url_pattern"), 30); // $NON-NLS-1$ optionalTasksPanel.add(embeddedRE); add(optionalTasksPanel, BorderLayout.SOUTH); }
From source file:ch.zhaw.simulation.diagram.charteditor.DefaultAxisEditor.java
/** * Standard constructor: builds a panel for displaying/editing the * properties of the specified axis./* ww w. j av a 2 s . c om*/ * * @param axis * the axis whose properties are to be displayed/edited in the * panel. */ public DefaultAxisEditor(Axis axis) { this.labelFont = axis.getLabelFont(); this.labelPaintSample = new PaintSample(axis.getLabelPaint()); this.tickLabelFont = axis.getTickLabelFont(); this.tickLabelPaintSample = new PaintSample(axis.getTickLabelPaint()); // Insets values this.tickLabelInsets = axis.getTickLabelInsets(); this.labelInsets = axis.getLabelInsets(); setLayout(new BorderLayout()); JPanel general = new JPanel(new BorderLayout()); general.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("General"))); JPanel interior = new JPanel(new LCBLayout(5)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); interior.add(new JLabel(localizationResources.getString("Label"))); this.label = new JTextField(axis.getLabel()); interior.add(this.label); interior.add(new JPanel()); interior.add(new JLabel(localizationResources.getString("Font"))); this.labelFontField = new FontDisplayField(this.labelFont); interior.add(this.labelFontField); JButton b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectLabelFont"); b.addActionListener(this); interior.add(b); interior.add(new JLabel(localizationResources.getString("Paint"))); interior.add(this.labelPaintSample); b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectLabelPaint"); b.addActionListener(this); interior.add(b); general.add(interior); add(general, BorderLayout.NORTH); this.slot1 = new JPanel(new BorderLayout()); JPanel other = new JPanel(new BorderLayout()); other.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), localizationResources.getString("Other"))); this.otherTabs = new JTabbedPane(); this.otherTabs.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); JPanel ticks = new JPanel(new LCBLayout(3)); ticks.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); this.showTickLabelsCheckBox = new JCheckBox(localizationResources.getString("Show_tick_labels"), axis.isTickLabelsVisible()); ticks.add(this.showTickLabelsCheckBox); ticks.add(new JPanel()); ticks.add(new JPanel()); ticks.add(new JLabel(localizationResources.getString("Tick_label_font"))); this.tickLabelFontField = new FontDisplayField(this.tickLabelFont); ticks.add(this.tickLabelFontField); b = new JButton(localizationResources.getString("Select...")); b.setActionCommand("SelectTickLabelFont"); b.addActionListener(this); ticks.add(b); this.showTickMarksCheckBox = new JCheckBox(localizationResources.getString("Show_tick_marks"), axis.isTickMarksVisible()); ticks.add(this.showTickMarksCheckBox); ticks.add(new JPanel()); ticks.add(new JPanel()); this.otherTabs.add(localizationResources.getString("Ticks"), ticks); other.add(this.otherTabs); this.slot1.add(other); this.slot2 = new JPanel(new BorderLayout()); this.slot2.add(this.slot1, BorderLayout.NORTH); add(this.slot2); }
From source file:org.gumtree.vis.awt.time.TimePlotChartEditor.java
private JPanel createCurvesPanel() { JPanel wrap = new JPanel(new BorderLayout()); JPanel curves = new JPanel(new BorderLayout()); curves.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); // JPanel general = new JPanel(new BorderLayout()); // general.setBorder(BorderFactory.createTitledBorder( // BorderFactory.createEtchedBorder(), "General")); ////from w w w . j ava2 s.c om // JPanel inner = new JPanel(new LCBLayout(6)); // inner.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); // // inner.add(new JLabel("Show Marker")); // showMarker = new JCheckBox(); // showMarker.setActionCommand(SHOW_MARKER_COMMAND); // showMarker.addActionListener(this); // inner.add(showMarker); // inner.add(new JLabel()); // inner.add(new JLabel("Show Error")); // showError = new JCheckBox(); // showError.setActionCommand(SHOW_ERROR_COMMAND); // showError.addActionListener(this); // inner.add(showError); // inner.add(new JLabel()); // // general.add(inner, BorderLayout.NORTH); // curves.add(general, BorderLayout.NORTH); JPanel individual = new JPanel(new BorderLayout()); individual.setBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Individual Curve")); JPanel interior = new JPanel(new LCBLayout(7)); interior.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); int numberOfDataset = chart.getXYPlot().getDatasetCount(); currentDataset = null; currentSeriesIndex = -1; List<String> seriesNames = new ArrayList<String>(); for (int i = 0; i < numberOfDataset; i++) { XYDataset dataset = chart.getXYPlot().getDataset(i); if (dataset != null && dataset instanceof ITimeSeriesSet) { int numberOfSeries = dataset.getSeriesCount(); for (int j = 0; j < numberOfSeries; j++) { String seriesName = (String) dataset.getSeriesKey(j); seriesNames.add(seriesName); if (seriesName.equals(currentSeriesKey)) { currentDataset = (IDataset) dataset; currentSeriesIndex = j; } } } } if ((currentDataset == null || currentSeriesIndex < 0) && seriesNames.size() > 0) { for (int i = 0; i < numberOfDataset; i++) { XYDataset dataset = chart.getXYPlot().getDataset(i); if (dataset != null && dataset instanceof ITimeSeriesSet && dataset.getSeriesCount() > 0) { currentDataset = (IDataset) dataset; currentSeriesIndex = 0; currentSeriesKey = (String) dataset.getSeriesKey(currentSeriesIndex); break; } } } //Select curve combo this.seriesCombo = new JComboBox(seriesNames.toArray()); seriesCombo.setActionCommand(CHANGE_CURVE_COMMAND); seriesCombo.addActionListener(this); interior.add(new JLabel("Select Curve")); interior.add(seriesCombo); interior.add(new JLabel("")); interior.add(new JLabel("Curve Stroke")); curveStrokeSample = new StrokeSample(new BasicStroke()); curveStrokeSample.setEnabled(false); interior.add(curveStrokeSample); // JButton button = new JButton(localizationResources.getString("Edit...")); Float[] strokes = new Float[] { 0f, 0.2f, 0.5f, 1f, 1.5f, 2f, 3f }; strokeCombo = new JComboBox(strokes); strokeCombo.setActionCommand(CURVE_STROCK_COMMAND); strokeCombo.addActionListener(this); interior.add(strokeCombo); interior.add(new JLabel("Curve Colour")); curveColorPaint = new PaintSample(chart.getBackgroundPaint()); interior.add(curveColorPaint); JButton button = new JButton(localizationResources.getString("Edit...")); button.setActionCommand(CURVE_COLOR_COMMAND); button.addActionListener(this); interior.add(button); interior.add(new JLabel("Marker Visible")); showMarker = new JCheckBox(); showMarker.setActionCommand(SHOW_MARKER_COMMAND); showMarker.addActionListener(this); interior.add(showMarker); interior.add(new JLabel()); interior.add(new JLabel("Marker Shape")); shapeLabel = new JLabel(); interior.add(shapeLabel); Integer[] shapeIndex = new Integer[MarkerShape.size]; for (int i = 0; i < shapeIndex.length; i++) { shapeIndex[i] = i; } shapeCombo = new JComboBox(shapeIndex); comboRender = new ImageComboRender(); comboRender.setShapes(StaticValues.LOCAL_SHAPE_SERIES); shapeCombo.setRenderer(comboRender); shapeCombo.setMaximumRowCount(7); shapeCombo.setActionCommand(MARKER_SHAPE_COMMAND); shapeCombo.addActionListener(this); interior.add(shapeCombo); interior.add(new JLabel("Marker Filled")); markerFilled = new JCheckBox(); markerFilled.setActionCommand(MARKER_FILLED_COMMAND); markerFilled.addActionListener(this); interior.add(markerFilled); interior.add(new JLabel()); interior.add(new JLabel("Curve Visable")); curveVisable = new JCheckBox(); curveVisable.setActionCommand(CURVE_VISIBLE_COMMAND); curveVisable.addActionListener(this); interior.add(curveVisable); interior.add(new JLabel()); individual.add(interior, BorderLayout.NORTH); curves.add(individual, BorderLayout.NORTH); curves.setName("Curves"); wrap.setName("Curves"); wrap.add(curves, BorderLayout.NORTH); return wrap; }
From source file:net.sf.xmm.moviemanager.gui.DialogIMDbMultiAdd.java
JButton createChooseBetweenImdbAndLocalDatabaseButton() { /*This button choses between IMDB and local movie database*/ final JButton chooseBetweenImdbAndLocalDatabase = new JButton( Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase/*from w w w . j a v a 2 s. com*/ .setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.tooltip")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.setActionCommand("GetIMDBInfo - chooseBetweenImdbAndLocalDatabase"); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$ if (addInfoToExistingMovie) { getPanelMoviesList().setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); chooseBetweenImdbAndLocalDatabase .setText(Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase.setToolTipText( Localizer.get("DialogIMDbMultiAdd.button.add-to-existing-movie.tooltip")); //$NON-NLS-1$ addInfoToExistingMovie = false; executeSearchMultipleMovies(); } else { executeEditExistingMovie(""); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase .setText(Localizer.get("DialogIMDbMultiAdd.button.search-on-IMDb.text")); //$NON-NLS-1$ chooseBetweenImdbAndLocalDatabase .setToolTipText(Localizer.get("DialogIMDbMultiAdd.button.search-on-IMDb.tooltip")); //$NON-NLS-1$ addInfoToExistingMovie = true; getPanelMoviesList().setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localizer.get("DialogIMDB.panel-your-movie-list.title")), //$NON-NLS-1$ BorderFactory.createEmptyBorder(5, 5, 5, 5))); } } }); return chooseBetweenImdbAndLocalDatabase; }