List of usage examples for javax.swing Box createVerticalStrut
public static Component createVerticalStrut(int height)
From source file:org.isatools.isacreatorconfigurator.ontologyconfigurationtool.OntologyConfigUI.java
public void createGUI() { HUDTitleBar titlePanel = new HUDTitleBar(null, null, true); add(titlePanel, BorderLayout.NORTH); titlePanel.installListeners();//from w ww. java 2 s . c om titlePanel.addPropertyChangeListener("windowClosed", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { firePropertyChange("ontologyClosed", "", "closed"); } }); // create left panel with list of selected ontology terms and Expandable panel createOntologySelectionPanel(); // create right panel containing tree showing the entirety of the ontology selected from the left pane. JPanel ontologySelectionPanel = new JPanel(new BorderLayout()); ontologyViewContainer = new JPanel(new BorderLayout()); ontologyViewContainer.setPreferredSize(new Dimension(500, 300)); // add placeholder panel by default with some image describing what to do setOntologySelectionPanelPlaceholder(infoImage); ontologyViewContainer.setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7), "browse ontology", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); ontologySelectionPanel.add(ontologyViewContainer, BorderLayout.CENTER); ontologySelectionPanel.add(Box.createVerticalStrut(20), BorderLayout.SOUTH); add(ontologySelectionPanel, BorderLayout.CENTER); JPanel functionWrapper = new JPanel(new BorderLayout()); searchAndTermDefinitionViewer = new SearchAndDefinitionUI(); searchAndTermDefinitionViewer.setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7), "functions", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); functionWrapper.add(searchAndTermDefinitionViewer); functionWrapper.add(createButtonPanel(), BorderLayout.SOUTH); add(functionWrapper, BorderLayout.EAST); this.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent componentEvent) { if (currentlyActiveBrowser != null && currentlyActiveBrowser.isShowing()) { ontologyViewContainer.setPreferredSize(getMaxBrowserSize()); currentlyActiveBrowser.setBrowserSize(getMaxBrowserSize()); ontologyViewContainer.repaint(); currentlyActiveBrowser.repaint(); } } }); FooterPanel footer = new FooterPanel(this); add(footer, BorderLayout.SOUTH); pack(); setVisible(true); }
From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java
private void instantiateFields(String initFieldName) { // OVERALL CONTAINER JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setBackground(UIHelper.BG_COLOR); JLabel fieldDefinitionLab = new JLabel(fieldDefinitionHeader, JLabel.CENTER); container.add(fieldDefinitionLab);//ww w .j a va 2 s. c o m container.add(Box.createVerticalStrut(5)); // FIELD LABEL & INPUT BOX CONTAINER JPanel fieldCont = new JPanel(new GridLayout(1, 2)); fieldCont.setBackground(UIHelper.BG_COLOR); fieldName = new RoundedJTextField(15); fieldName.setText(initFieldName); fieldName.setEditable(false); UIHelper.renderComponent(fieldName, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel fieldNameLab = UIHelper.createLabel("Field Name: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); fieldCont.add(fieldNameLab); fieldCont.add(fieldName); container.add(fieldCont); JPanel descCont = new JPanel(new GridLayout(1, 2)); descCont.setBackground(UIHelper.BG_COLOR); description = new RoundedJTextArea(); description.setLineWrap(true); description.setWrapStyleWord(true); UIHelper.renderComponent(description, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane descScroll = new JScrollPane(description, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descScroll.setBackground(UIHelper.BG_COLOR); descScroll.setPreferredSize(new Dimension(150, 65)); descScroll.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(descScroll); JLabel descLab = UIHelper.createLabel("Description: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); descLab.setVerticalAlignment(JLabel.TOP); descCont.add(descLab); descCont.add(descScroll); container.add(descCont); // add datatype information JPanel datatypeCont = new JPanel(new GridLayout(1, 2)); datatypeCont.setBackground(UIHelper.BG_COLOR); DataTypes[] allowedDataTypes = initFieldName.equals(UNIT_STR) ? new DataTypes[] { DataTypes.ONTOLOGY_TERM } : DataTypes.values(); datatype = new JComboBox(allowedDataTypes); datatype.addActionListener(this); UIHelper.renderComponent(datatype, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel dataTypeLab = UIHelper.createLabel("Datatype:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); datatypeCont.add(dataTypeLab); datatypeCont.add(datatype); container.add(datatypeCont); defaultValContStd = new JPanel(new GridLayout(1, 2)); defaultValContStd.setBackground(UIHelper.BG_COLOR); defaultValCont = Box.createHorizontalBox(); defaultValCont.setPreferredSize(new Dimension(150, 25)); defaultValStd = new RoundedFormattedTextField(null, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.DARK_GREEN_COLOR); defaultValCont.setPreferredSize(new Dimension(120, 25)); defaultValStd.setFormatterFactory(new DefaultFormatterFactory( new RegExFormatter(".*", defaultValStd, false, UIHelper.DARK_GREEN_COLOR, UIHelper.RED_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR))); defaultValStd.setForeground(UIHelper.DARK_GREEN_COLOR); defaultValStd.setFont(UIHelper.VER_11_PLAIN); defaultValCont.add(defaultValStd); defaultValLabStd = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContStd.add(defaultValLabStd); defaultValContStd.add(defaultValCont); container.add(defaultValContStd); defaultValContBool = new JPanel(new GridLayout(1, 2)); defaultValContBool.setBackground(UIHelper.BG_COLOR); defaultValContBool.setVisible(false); listDataSourceCont = new JPanel(new GridLayout(2, 1)); listDataSourceCont.setBackground(UIHelper.BG_COLOR); listDataSourceCont.setVisible(false); JLabel listValLab = UIHelper.createLabel("Please enter comma separated list of values:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); listDataSourceCont.add(listValLab); listValues = new RoundedJTextArea("SampleVal1, SampleVal2, SampleVal3", 3, 5); listValues.setLineWrap(true); listValues.setWrapStyleWord(true); UIHelper.renderComponent(listValues, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane listScroll = new JScrollPane(listValues, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); listScroll.setBackground(UIHelper.BG_COLOR); listScroll.getViewport().setBackground(UIHelper.BG_COLOR); listDataSourceCont.add(listScroll); container.add(listDataSourceCont); IAppWidgetFactory.makeIAppScrollPane(listScroll); sourceEntryPanel = new JPanel(new BorderLayout()); sourceEntryPanel.setSize(new Dimension(125, 190)); sourceEntryPanel.setOpaque(false); sourceEntryPanel.setVisible(false); preferredOntologySource = new JPanel(); preferredOntologySource.setLayout(new BoxLayout(preferredOntologySource, BoxLayout.PAGE_AXIS)); preferredOntologySource.setVisible(false); recommendOntologySource = new JCheckBox("Use recommended ontology source?", false); UIHelper.renderComponent(recommendOntologySource, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); recommendOntologySource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (recommendOntologySource.isSelected()) { sourceEntryPanel.setVisible(true); } else { sourceEntryPanel.setVisible(false); } } }); JPanel useOntologySourceCont = new JPanel(new GridLayout(1, 1)); useOntologySourceCont.add(recommendOntologySource); preferredOntologySource.add(useOntologySourceCont); JPanel infoCont = new JPanel(new GridLayout(1, 1)); JLabel infoLab = UIHelper.createLabel( "<html>click on the <strong>configure ontologies</strong> button to open the ontology configurator to edit the list of ontologies and search areas within an ontology</html>", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); infoLab.setPreferredSize(new Dimension(100, 40)); infoCont.add(infoLab); sourceEntryPanel.add(infoCont, BorderLayout.NORTH); JLabel preferredOntologiesLab = new JLabel(preferredOntologiesSidePanelIcon); preferredOntologiesLab.setVerticalAlignment(SwingConstants.TOP); sourceEntryPanel.add(preferredOntologiesLab, BorderLayout.WEST); ontologiesToUseModel = new DefaultTableModel(new String[0][2], ontologyColumnHeaders) { @Override public boolean isCellEditable(int i, int i1) { return false; } }; ontologiesToUse = new JTable(ontologiesToUseModel); ontologiesToUse.getTableHeader().setBackground(UIHelper.BG_COLOR); try { ontologiesToUse.setDefaultRenderer(Class.forName("java.lang.Object"), new CustomSpreadsheetCellRenderer()); } catch (ClassNotFoundException e) { // empty } renderTableHeader(); JScrollPane ontologiesToUseScroller = new JScrollPane(ontologiesToUse, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); ontologiesToUseScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); ontologiesToUseScroller.setPreferredSize(new Dimension(100, 80)); ontologiesToUseScroller.setBackground(UIHelper.BG_COLOR); ontologiesToUseScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(ontologiesToUseScroller); sourceEntryPanel.add(ontologiesToUseScroller); JPanel buttonCont = new JPanel(new BorderLayout()); final JLabel openConfigButton = new JLabel(ontologyConfigIcon); openConfigButton.setVerticalAlignment(SwingConstants.TOP); openConfigButton.setHorizontalAlignment(SwingConstants.RIGHT); MouseAdapter showOntologyConfigurator = new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIconOver); } public void mouseExited(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIcon); } public void mousePressed(MouseEvent mouseEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (openConfigButton.isEnabled()) { openConfigButton.setIcon(ontologyConfigIcon); ontologyConfig = new OntologyConfigUI(ontologiesToQuery, selectedOntologies); ontologyConfig.addPropertyChangeListener("ontologySelected", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { selectedOntologies = (ListOrderedMap<String, RecommendedOntology>) propertyChangeEvent .getNewValue(); updateTable(); } }); showPopupInCenter(ontologyConfig); } } }); } }; openConfigButton.addMouseListener(showOntologyConfigurator); buttonCont.add(openConfigButton, BorderLayout.EAST); sourceEntryPanel.add(buttonCont, BorderLayout.SOUTH); preferredOntologySource.add(sourceEntryPanel); container.add(preferredOntologySource); String[] contents = new String[] { "true", "false" }; defaultValBool = new JComboBox(contents); UIHelper.renderComponent(defaultValBool, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel defaultValLabBool = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContBool.add(defaultValLabBool); defaultValContBool.add(defaultValBool); container.add(defaultValContBool); // RegExp data entry isInputFormatted = new JCheckBox("Is the input formatted?", false); isInputFormatted.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); isInputFormatted.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(isInputFormatted, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); isInputFormatted.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(isInputFormatted)); inputFormatCont = new JPanel(); inputFormatCont.setLayout(new BoxLayout(inputFormatCont, BoxLayout.LINE_AXIS)); inputFormatCont.setVisible(false); inputFormatCont.setBackground(UIHelper.BG_COLOR); inputFormat = new RoundedJTextField(10); inputFormat.setText(".*"); inputFormat.setSize(new Dimension(150, 19)); inputFormat.setPreferredSize(new Dimension(160, 25)); inputFormat.setToolTipText("Field expects a regular expression describing the input format."); UIHelper.renderComponent(inputFormat, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel inputFormatLab = UIHelper.createLabel("Input format:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); inputFormatLab.setVerticalAlignment(SwingConstants.TOP); inputFormatCont.add(inputFormatLab); inputFormatCont.add(inputFormat); JLabel checkRegExp = new JLabel(checkRegExIcon, JLabel.RIGHT); checkRegExp.setOpaque(false); checkRegExp.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { String regexToCheck = inputFormat.getText(); final CheckRegExGUI regexChecker = new CheckRegExGUI(regexToCheck); SwingUtilities.invokeLater(new Runnable() { public void run() { regexChecker.createGUI(); } }); regexChecker.addPropertyChangeListener("close", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { main.getApplicationContainer().hideSheet(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { main.getApplicationContainer().showJDialogAsSheet(regexChecker); } }); } } ); inputFormatCont.add(checkRegExp); container.add(inputFormatCont); usesTemplateForWizard = new JCheckBox("Requires template for wizard?", false); usesTemplateForWizard.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); usesTemplateForWizard.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(usesTemplateForWizard, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); usesTemplateForWizard.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(usesTemplateForWizard)); wizardTemplatePanel = new JPanel(new GridLayout(1, 2)); wizardTemplatePanel.setVisible(false); wizardTemplatePanel.setBackground(UIHelper.BG_COLOR); wizardTemplate = new RoundedJTextArea(); wizardTemplate.setToolTipText("A template for the wizard to auto-create the data..."); wizardTemplate.setLineWrap(true); wizardTemplate.setWrapStyleWord(true); UIHelper.renderComponent(wizardTemplate, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane wizScroll = new JScrollPane(wizardTemplate, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); wizScroll.getViewport().setBackground(UIHelper.BG_COLOR); wizScroll.setPreferredSize(new Dimension(70, 60)); IAppWidgetFactory.makeIAppScrollPane(wizScroll); JLabel wizardTemplateLab = UIHelper.createLabel("Template definition:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); wizardTemplateLab.setVerticalAlignment(JLabel.TOP); wizardTemplatePanel.add(wizardTemplateLab); wizardTemplatePanel.add(wizScroll); container.add(wizardTemplatePanel); JPanel checkCont = new JPanel(new GridLayout(3, 2)); checkCont.setBackground(UIHelper.BG_COLOR); checkCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 4), "Behavioural Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); required = new JCheckBox("Required ", true); UIHelper.renderComponent(required, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(required); acceptsMultipleValues = new JCheckBox("Allow multiple instances", false); UIHelper.renderComponent(acceptsMultipleValues, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsMultipleValues); acceptsFileLocations = new JCheckBox("Accepts file locations", false); acceptsFileLocations.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { acceptsMultipleValues.setSelected(false); acceptsMultipleValues.setEnabled(!acceptsFileLocations.isSelected()); } }); UIHelper.renderComponent(acceptsFileLocations, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsFileLocations); hidden = new JCheckBox("hidden?", false); UIHelper.renderComponent(hidden, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(hidden); forceOntologySelection = new JCheckBox("Force ontology selection", false); UIHelper.renderComponent(forceOntologySelection, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(forceOntologySelection); container.add(checkCont); JScrollPane contScroll = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); contScroll.setBorder(null); contScroll.setAutoscrolls(true); IAppWidgetFactory.makeIAppScrollPane(contScroll); add(contScroll, BorderLayout.NORTH); }
From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java
/** * Creates the UI panel containing all of the fields necessary to upload * the current session data to the web service *///from w ww . j a v a 2 s . c o m private void createSetupPane() { this.setupPanel = new JPanel(); this.setupPanel.setLayout(new BorderLayout()); this.setupPanel.setBackground(Color.white); try { String data = IOUtils.toString(LoginDialog.class.getResourceAsStream("/export2.html")); data = data.replace("{LIST}", formatWitnessList()); JLabel txt = new JLabel(data); this.setupPanel.add(txt, BorderLayout.NORTH); } catch (IOException e) { // dunno. not much that can be done! } // ugly layout code to follow. avert your eyes JPanel data = new JPanel(); data.setLayout(new BorderLayout()); data.setBackground(Color.white); JPanel names = new JPanel(); names.setLayout(new BoxLayout(names, BoxLayout.Y_AXIS)); names.setBackground(Color.white); JLabel l = new JLabel("Name:", SwingConstants.RIGHT); l.setPreferredSize(new Dimension(100, 20)); l.setMaximumSize(new Dimension(100, 20)); l.setAlignmentX(RIGHT_ALIGNMENT); names.add(l); names.add(Box.createVerticalStrut(5)); JLabel l2 = new JLabel("Description:", SwingConstants.RIGHT); l2.setPreferredSize(new Dimension(100, 20)); l2.setMaximumSize(new Dimension(100, 20)); l2.setAlignmentX(RIGHT_ALIGNMENT); names.add(l2); data.add(names, BorderLayout.WEST); JPanel edits = new JPanel(); edits.setBackground(Color.white); edits.setLayout(new BoxLayout(edits, BoxLayout.Y_AXIS)); this.nameEdit = new JTextField(); this.nameEdit.setPreferredSize(new Dimension(200, 22)); this.nameEdit.setMaximumSize(new Dimension(200, 22)); File saveFile = this.juxtaFrame.getSession().getSaveFile(); if (saveFile == null) { this.nameEdit.setText("new_session"); } else { String name = saveFile.getName(); this.nameEdit.setText(name.substring(0, name.lastIndexOf('.'))); } edits.add(this.nameEdit); this.descriptionEdit = new JTextArea(3, 0); this.descriptionEdit.setLineWrap(true); this.descriptionEdit.setWrapStyleWord(true); JScrollPane sp = new JScrollPane(this.descriptionEdit); sp.setPreferredSize(new Dimension(194, 60)); sp.setMaximumSize(new Dimension(194, 300)); edits.add(Box.createVerticalStrut(4)); edits.add(sp); data.add(edits, BorderLayout.CENTER); this.setupPanel.add(data, BorderLayout.SOUTH); }
From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java
/** * This method initializes jPanel/*from ww w .java 2 s .c om*/ * * @return javax.swing.JPanel */ private JPanel getJPanel() { if (jPanel == null) { jPanel = new JPanel(); jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS)); jPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); jPanel.add(getSelectionChartPanel()); jPanel.add(Box.createVerticalStrut(10)); jPanel.add(getCardPanel()); jPanel.add(new JSeparator(JSeparator.HORIZONTAL)); } return jPanel; }
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//from w ww .j a v 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:de.mpg.mpi_inf.bioinf.netanalyzer.ui.SaveChartDialog.java
/** * Creates and lays out the controls inside this dialog's content pane. * <p>//from w w w . jav a 2 s. c o m * This method is called upon initialization only. * </p> */ private void initControls() { JPanel sizePanel = new JPanel(new GridLayout(2, 3, 4, 4)); sizePanel.setBorder(BorderFactory.createTitledBorder(Messages.DI_IMAGESIZE)); // Add a spinner for choosing width sizePanel.add(new JLabel(Messages.DI_WIDTH, SwingConstants.RIGHT)); int width = ChartPanel.DEFAULT_WIDTH; int minWidth = ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH; int maxWidth = ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH; SpinnerModel widthSettings = new SpinnerNumberModel(width, minWidth, maxWidth, 1); sizePanel.add(widthSpinner = new JSpinner(widthSettings)); sizePanel.add(new JLabel(Messages.DI_PIXELS)); // Add a spinner for choosing height sizePanel.add(new JLabel(Messages.DI_HEIGHT, SwingConstants.RIGHT)); int height = ChartPanel.DEFAULT_HEIGHT; int minHeight = ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT; int maxHeight = ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT; SpinnerModel heightSettings = new SpinnerNumberModel(height, minHeight, maxHeight, 1); sizePanel.add(heightSpinner = new JSpinner(heightSettings)); sizePanel.add(new JLabel(Messages.DI_PIXELS)); // Add Save and Cancel buttons JPanel buttons = new JPanel(new GridLayout(1, 2, 4, 0)); buttons.add(btnSave = Utils.createButton(Messages.DI_SAVE, null, this)); buttons.add(btnCancel = Utils.createButton(Messages.DI_CANCEL, null, this)); Box buttonsBox = Box.createHorizontalBox(); buttonsBox.add(Box.createHorizontalGlue()); buttonsBox.add(buttons); buttonsBox.add(Box.createHorizontalGlue()); Container contentPane = getContentPane(); contentPane.add(sizePanel, BorderLayout.NORTH); contentPane.add(Box.createVerticalStrut(Utils.BORDER_SIZE / 2)); contentPane.add(buttonsBox, BorderLayout.PAGE_END); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Utils.setStandardBorder(getRootPane()); }
From source file:org.dishevelled.brainstorm.BrainStorm.java
/** * Calculate the placeholder size based on the current window size. */// w w w .j a v a2 s.c o m private void calculatePlaceholderSize() { int height = (int) (getHeight() / 3); placeholder = Box.createVerticalStrut(height); }
From source file:org.datacleaner.panels.WelcomePanel.java
private JComponent createContentPanel() { JComponent result = null;//from w ww. j a va 2s. c om final String welcomePanelClassName = SystemProperties.getString(SystemProperties.UI_DESKTOP_WELCOME_PANEL, null); if (!Strings.isNullOrEmpty(welcomePanelClassName)) { final Injector injector = _dcModule.createInjectorBuilder().with(WelcomePanel.class, this) .createInjector(); try { @SuppressWarnings("unchecked") final Class<? extends JComponent> componentClass = (Class<? extends JComponent>) Class .forName(welcomePanelClassName); result = injector.getInstance(componentClass); } catch (Exception e) { logger.error("Failed to instantiate welcome panel class: {}", welcomePanelClassName, e); } } if (result == null) { result = new DCPanel(); if (Version.isCommunityEdition()) { final JXEditorPane editorPane = new JXEditorPane("text/html", "You're now using the <b>Community Edition</b> of DataCleaner.<br/><br/>" + "We hope that you enjoy this free product. We encourage you to also check out the " + "commercial DataCleaner editions which feature added functionality, " + "helpful getting started wizards and commercial support. " + "You can find more information about them online."); editorPane.setEditable(false); editorPane.setOpaque(false); editorPane.setFont(WidgetUtils.FONT_HEADER2); editorPane.setPreferredSize(new Dimension(DCSplashPanel.WIDTH_CONTENT, 120)); final JButton tryProfessionalButton = WidgetFactory.createDefaultButton("Try professional edition", IconUtils.APPLICATION_ICON); tryProfessionalButton .addActionListener(new OpenBrowserAction("http://datacleaner.org/get_datacleaner")); final JButton readMoreButton = WidgetFactory.createDefaultButton("Compare the editions", IconUtils.WEBSITE); readMoreButton.addActionListener(new OpenBrowserAction("http://datacleaner.org/editions")); final JButton discussionForumButton = WidgetFactory .createDefaultButton("Visit the discussion forum", "images/menu/forum.png"); discussionForumButton.setToolTipText( "Visit the online discussion forum for questions and answers in the community"); final OpenBrowserAction forumActionListener = new OpenBrowserAction("http://datacleaner.org/forum"); discussionForumButton.addActionListener(forumActionListener); final JButton twitterButton = WidgetFactory.createDefaultButton(null, "images/menu/twitter.png"); twitterButton.setToolTipText("Spread the message about #DataCleaner on Twitter"); twitterButton.addActionListener(new OpenBrowserAction("https://twitter.com/intent/tweet?text=" + UrlEscapers.urlFormParameterEscaper().escape("I'm using @DataCleaner (v. " + Version.getVersion() + ") for some really fancy #dataquality stuff!"))); final JButton linkedInButton = WidgetFactory.createDefaultButton(null, "images/menu/linkedin.png"); linkedInButton.setToolTipText("Join our LinkedIn group of users and professionals"); linkedInButton .addActionListener(new OpenBrowserAction("http://www.linkedin.com/groups?gid=3352784")); final JLabel loveFeedbackAnimation = new JLabel( ImageManager.get().getImageIcon("images/window/we_love_community_and_feedback.gif"), JLabel.LEFT); loveFeedbackAnimation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); loveFeedbackAnimation.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { forumActionListener.actionPerformed(null); } }); final DCPanel innerPanel = new DCPanel(); innerPanel.setLayout(new VerticalLayout()); innerPanel.setBorder( new CompoundBorder(WidgetUtils.BORDER_LIST_ITEM_LEFT_ONLY, new EmptyBorder(0, 20, 0, 0))); innerPanel.add(editorPane); innerPanel.add(DCPanel.flow(tryProfessionalButton, readMoreButton)); innerPanel.add(Box.createVerticalStrut(80)); innerPanel.add(loveFeedbackAnimation); innerPanel.add(Box.createVerticalStrut(20)); innerPanel.add(DCPanel.flow(discussionForumButton, twitterButton, linkedInButton)); innerPanel.add(Box.createVerticalStrut(5)); result.setLayout(new VerticalLayout()); result.add(Box.createVerticalStrut(100)); result.add(innerPanel); } } return wrapContent(result); }
From source file:eu.delving.sip.frames.AllFrames.java
public JComponent getSidePanel() { JPanel arrangements = new JPanel(); arrangements.setLayout(new BoxLayout(arrangements, BoxLayout.Y_AXIS)); for (Arrangement a : this.arrangements) { JButton b = new JButton(a); b.setHorizontalTextPosition(JButton.CENTER); b.setVerticalTextPosition(JButton.BOTTOM); b.setFont(new Font("Sans", Font.PLAIN, 10)); arrangements.add(b);/* w w w. j av a2s. c o m*/ arrangements.add(Box.createVerticalStrut(5)); } arrangements.add(Box.createVerticalGlue()); JPanel p = new JPanel(new BorderLayout()); p.add(arrangements, BorderLayout.CENTER); return scrollV(p); }
From source file:greenfoot.gui.export.ExportPublishPane.java
/** * Build the component.//from w w w . j a v a2 s .co m */ private void makePane() { font = (new JLabel()).getFont().deriveFont(Font.ITALIC, 11.0f); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(12, 12, 0, 12)); setBackground(backgroundColor); add(getHelpBox()); add(Box.createVerticalStrut(12)); infoPanel = new JPanel(new BorderLayout(22, 18)); { infoPanel.setAlignmentX(LEFT_ALIGNMENT); infoPanel.setBackground(background); Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(12, 22, 12, 22)); infoPanel.setBorder(border); JLabel text = new JLabel(Config.getString("export.publish.info") + " " + serverName, SwingConstants.CENTER); text.setForeground(headingColor); infoPanel.add(text, BorderLayout.NORTH); createScenarioDisplay(); infoPanel.add(leftPanel, BorderLayout.CENTER); infoPanel.add(getTagDisplay(), BorderLayout.EAST); } add(infoPanel); add(Box.createVerticalStrut(16)); add(getLoginPanel()); add(Box.createVerticalStrut(10)); }