Java Code Examples for javax.swing.Box#createHorizontalBox()
The following examples show how to use
javax.swing.Box#createHorizontalBox() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test4903007.java From jdk8u_jdk with GNU General Public License v2.0 | 7 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 2
Source File: SearchPanel.java From HubPlayer with GNU General Public License v3.0 | 7 votes |
private void createLayout() { Box Box1 = Box.createHorizontalBox(); Box1.add(Box.createHorizontalStrut(10)); Box1.add(userButton); Box1.add(Box.createHorizontalStrut(20)); Box1.add(textField); Box1.add(Box.createHorizontalStrut(5)); Box1.add(searchButton); Box1.add(Box.createHorizontalStrut(10)); Box Box2 = Box.createVerticalBox(); Box2.add(Box.createVerticalStrut(7)); Box2.add(Box1); Box2.add(Box.createVerticalStrut(5)); add(Box2, BorderLayout.NORTH); add(hubToolBar, BorderLayout.CENTER); }
Example 3
Source File: Test4903007.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 4
Source File: InstallerGUI.java From EasyMPermission with MIT License | 6 votes |
void addLocation(final IdeLocation location) { if (locations.contains(location)) return; Box box = Box.createHorizontalBox(); box.setBackground(Color.WHITE); final JCheckBox checkbox = new JCheckBox(location.getName()); checkbox.setBackground(Color.WHITE); box.add(new JLabel(new ImageIcon(location.getIdeIcon()))); box.add(checkbox); checkbox.setSelected(true); checkbox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { location.selected = checkbox.isSelected(); fireSelectionChange(); } }); if (location.hasLombok()) { box.add(new JLabel(new ImageIcon(Installer.class.getResource("lombokIcon.png")))); } box.add(Box.createHorizontalGlue()); locations.add(location); add(box); getParent().doLayout(); fireSelectionChange(); }
Example 5
Source File: Test4903007.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected JPanel getObject() { Box vBox = Box.createVerticalBox(); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); vBox.add(Box.createVerticalGlue()); vBox.add(new JButton("button")); vBox.add(Box.createVerticalStrut(10)); vBox.add(new JLabel("label")); Box hBox = Box.createHorizontalBox(); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); hBox.add(Box.createHorizontalGlue()); hBox.add(new JButton("button")); hBox.add(Box.createHorizontalStrut(10)); hBox.add(new JLabel("label")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(vBox); panel.add(Box.createGlue()); panel.add(hBox); return panel; }
Example 6
Source File: SourceSelectionDialog.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private void initComponents() { Container pane = getContentPane(); pane.setLayout(new BorderLayout()); tabs.add(LanguageBundle.getString("in_basic"), basicPanel); //$NON-NLS-1$ tabs.add(LanguageBundle.getString("in_advanced"), advancedPanel); //$NON-NLS-1$ tabs.addChangeListener(this); pane.add(tabs, BorderLayout.CENTER); loadButton.setDefaultCapable(true); getRootPane().setDefaultButton(loadButton); loadButton.setActionCommand(LOAD_COMMAND); cancelButton.setActionCommand(CANCEL_COMMAND); deleteButton.setActionCommand(DELETE_COMMAND); saveButton.setActionCommand(SAVE_COMMAND); installDataButton.setActionCommand(INSTALLDATA_COMMAND); loadButton.addActionListener(this); cancelButton.addActionListener(this); saveButton.addActionListener(this); deleteButton.addActionListener(this); installDataButton.addActionListener(this); Box buttons = Box.createHorizontalBox(); buttons.add(buttonPanel); buttons.add(Box.createHorizontalGlue()); buttons.add(installDataButton); buttons.add(Box.createHorizontalGlue()); buttons.add(loadButton); buttons.add(Box.createHorizontalStrut(5)); buttons.add(cancelButton); buttons.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); pane.add(buttons, BorderLayout.SOUTH); Utility.installEscapeCloseOperation(this); }
Example 7
Source File: CheckBoxListDecorator.java From importer-exporter with Apache License 2.0 | 5 votes |
public CheckBoxListCellRenderer() { renderer = list.getCellRenderer(); checkBox = new JCheckBox(); setLayout(new BorderLayout()); setOpaque(false); checkBox.setOpaque(false); Box box = Box.createHorizontalBox(); box.add(checkBox); box.add(Box.createHorizontalStrut(5)); add(box, BorderLayout.WEST); }
Example 8
Source File: ProgramEditor.java From FancyBing with GNU General Public License v3.0 | 5 votes |
private JComponent createEntryLabel(String text) { Box box = Box.createHorizontalBox(); box.add(Box.createHorizontalGlue()); JLabel label = new JLabel(i18n(text)); label.setAlignmentY(Component.CENTER_ALIGNMENT); box.add(label); return box; }
Example 9
Source File: GameInfoDialog.java From FancyBing with GNU General Public License v3.0 | 5 votes |
private void createTime(TimeSettings timeSettings, JComponent labels, JComponent values) { Box boxLabel = Box.createHorizontalBox(); boxLabel.add(Box.createHorizontalGlue()); JLabel label = new JLabel(i18n("LB_GAMEINFO_TIME")); label.setAlignmentY(Component.CENTER_ALIGNMENT); boxLabel.add(label); labels.add(boxLabel); Box boxValue = Box.createVerticalBox(); JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); boxValue.add(Box.createVerticalGlue()); boxValue.add(panel); boxValue.add(Box.createVerticalGlue()); m_preByoyomi = new TimeField(3, "TT_GAMEINFO_TIME_MAIN"); if (timeSettings != null) m_preByoyomi.setTime(timeSettings.getPreByoyomi()); panel.add(m_preByoyomi); panel.add(new JLabel(" + ")); m_byoyomi = new TimeField(2, "TT_GAMEINFO_TIME_BYOYOMI"); if (timeSettings != null && timeSettings.getUseByoyomi()) m_byoyomi.setTime(timeSettings.getByoyomi()); panel.add(m_byoyomi); panel.add(new JLabel(" / ")); m_byoyomiMoves = new JTextField(2); m_byoyomiMoves.setToolTipText(i18n("TT_GAMEINFO_TIME_BYOYOMI_MOVES")); m_byoyomiMoves.setHorizontalAlignment(JTextField.RIGHT); if (timeSettings != null && timeSettings.getUseByoyomi()) { int byoyomiMoves = timeSettings.getByoyomiMoves(); m_byoyomiMoves.setText(Integer.toString(byoyomiMoves)); } panel.add(m_byoyomiMoves); panel.add(new JLabel(" " + i18n("LB_GAMEINFO_TIME_MOVES"))); values.add(boxValue); }
Example 10
Source File: ExportDialog.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
private void initLayout() { Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); Box topPanel = Box.createHorizontalBox(); topPanel.add(new JLabel("Select Character:")); topPanel.add(Box.createHorizontalStrut(5)); topPanel.add(characterBox); topPanel.add(Box.createHorizontalStrut(5)); topPanel.add(partyBox); topPanel.add(Box.createHorizontalGlue()); topPanel.add(Box.createHorizontalStrut(50)); topPanel.add(new JLabel("Export to:")); topPanel.add(Box.createHorizontalStrut(5)); topPanel.add(exportBox); contentPane.add(topPanel, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(fileList); scrollPane.setBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Templates"), scrollPane.getBorder())); contentPane.add(scrollPane, BorderLayout.CENTER); Box bottomPanel = Box.createHorizontalBox(); bottomPanel.add(progressBar); bottomPanel.add(Box.createHorizontalGlue()); bottomPanel.add(Box.createHorizontalStrut(5)); bottomPanel.add(exportButton); bottomPanel.add(Box.createHorizontalStrut(5)); bottomPanel.add(closeButton); contentPane.add(bottomPanel, BorderLayout.SOUTH); topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); bottomPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); pack(); }
Example 11
Source File: SimpleBoxFormBuilder.java From jdal with Apache License 2.0 | 5 votes |
/** * Reset the form builder to reuse for creating a new panel */ public void reset() { columns = new ArrayList<Box>(); columnsWidth = new ArrayList<Integer>(); rowsHeight = new ArrayList<Integer>(); container = Box.createHorizontalBox(); index = 0; rows = 0; focusTransversal = new FormFocusTransversalPolicy(); }
Example 12
Source File: Boxer.java From tmc-intellij with MIT License | 5 votes |
public static Box hbox(Component... components) { logger.info("Processing hbox. @Boxer"); Box box = Box.createHorizontalBox(); addComponentsToBox(box, components); return box; }
Example 13
Source File: PanMode.java From Forsythia with GNU General Public License v3.0 | 5 votes |
public PanMode(){ setBackground(new Color(204, 153, 255)); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); Box verticalBox = Box.createVerticalBox(); add(verticalBox); Box horizontalboxtop = Box.createHorizontalBox(); verticalBox.add(horizontalboxtop); Component rigidArea = Box.createRigidArea(new Dimension(44, 4)); horizontalboxtop.add(rigidArea); Box horizontalboxmid = Box.createHorizontalBox(); verticalBox.add(horizontalboxmid); Component horizontalStrut = Box.createHorizontalStrut(4); horizontalboxmid.add(horizontalStrut); btnmode = new JButton("MODE FOO"); btnmode.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e){ GE.ge.editor_jig.toggleMode();}}); btnmode.setFont(new Font("Dialog", Font.BOLD, 12)); horizontalboxmid.add(btnmode); Component horizontalStrut_3 = Box.createHorizontalStrut(4); horizontalboxmid.add(horizontalStrut_3); Box horizontalboxbottom = Box.createHorizontalBox(); verticalBox.add(horizontalboxbottom); Component rigidArea_1 = Box.createRigidArea(new Dimension(44, 4)); horizontalboxbottom.add(rigidArea_1);}
Example 14
Source File: OperationMouseAdapter.java From cstc with GNU General Public License v3.0 | 5 votes |
private Container createPreview(String title) { Box previewBox = Box.createHorizontalBox(); previewBox.setOpaque(true); previewBox.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); previewBox.setBackground(new Color(127, 237, 247, 255)); JLabel previewLbl = new JLabel(title); previewLbl.setForeground(new Color(58, 135, 173)); previewBox.add(previewLbl); return previewBox; }
Example 15
Source File: LoginPanel.java From swift-explorer with Apache License 2.0 | 4 votes |
public LoginPanel(LoginCallback callback, CredentialsStore credentialsStore, HasLocalizedStrings stringsBundle) { super(new BorderLayout(0, 0)); this.callback = callback; this.credentialsStore = credentialsStore; this.stringsBundle = stringsBundle ; initMenuActions () ; setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); Box outer = Box.createVerticalBox(); Box box = Box.createVerticalBox(); Box btn = Box.createHorizontalBox(); box.setBorder(BorderFactory.createTitledBorder(getLocalizedString("Credentials"))); JPanel buttons = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JPanel warn = new JPanel(new BorderLayout()); warn.setBorder(BorderFactory.createEmptyBorder(8, 0, 4, 0)); warn.add(warningLabel, BorderLayout.CENTER); buttons.setBorder(BorderFactory.createEtchedBorder()); buttons.add(okButton); buttons.add(cancelButton); // saveButton.setToolTipText(getLocalizedString("Save_Credentials")); deleteButton.setToolTipText(getLocalizedString("Delete_Credentials")); btn.add(saveButton); btn.add(deleteButton); // box.add(new LabelComponentPanel("", savedCredentials, btn)); box.add(new LabelComponentPanel("AuthURL", authUrl)); box.add(new LabelComponentPanel("Tenant", tenant)); box.add(new LabelComponentPanel("Username", username)); box.add(new LabelComponentPanel("Password", password)); // outer.add(box); outer.add(warn); this.add(outer, BorderLayout.NORTH); this.add(buttons, BorderLayout.SOUTH); // bindSelectionListener(); refreshCredentials(); enableDisable(); bindDocumentListeners(); }
Example 16
Source File: javax_swing_Box.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
protected Box getAnotherObject() { return Box.createHorizontalBox(); }
Example 17
Source File: javax_swing_Box.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
protected Box getAnotherObject() { return Box.createHorizontalBox(); }
Example 18
Source File: DateIntervalListEditor.java From ganttproject with GNU General Public License v3.0 | 4 votes |
public DateIntervalListEditor(final DateIntervalModel intervalsModel) { super(new BorderLayout()); myIntervalsModel = intervalsModel; myStart = new DefaultDateOption("generic.startDate") { @Override public void setValue(Date value) { super.setValue(value); if (intervalsModel.getMaxIntervalLength() == 1) { DateIntervalListEditor.this.myFinish.setValue(value); } DateIntervalListEditor.this.updateActions(); } }; myFinish = new DefaultDateOption("generic.endDate") { @Override public void setValue(Date value) { super.setValue(value); DateIntervalListEditor.this.updateActions(); } }; myAddAction = new GPAction("add") { @Override public void actionPerformed(ActionEvent e) { myIntervalsModel.add(DateInterval.createFromVisibleDates(myStart.getValue(), myFinish.getValue())); myListModel.update(); } }; myDeleteAction = new GPAction("delete") { @Override public void actionPerformed(ActionEvent e) { int selected = myListSelectionModel.getMinSelectionIndex(); myIntervalsModel.remove(myIntervalsModel.getIntervals()[selected]); myListModel.update(); myListSelectionModel.removeIndexInterval(selected, selected); updateActions(); } }; JPanel topPanel = new JPanel(new BorderLayout()); OptionsPageBuilder builder = new OptionsPageBuilder(); builder.setOptionKeyPrefix(""); GPOptionGroup group = myIntervalsModel.getMaxIntervalLength() == 1 ? new GPOptionGroup("", new GPOption[] { myStart }) : new GPOptionGroup("", new GPOption[] { myStart, myFinish }); group.setTitled(false); JComponent datesBox = builder.buildPlanePage(new GPOptionGroup[] { group }); topPanel.add(datesBox, BorderLayout.CENTER); Box buttonBox = Box.createHorizontalBox(); buttonBox.setBorder(BorderFactory.createEmptyBorder(3, 0, 3, 0)); buttonBox.add(new JButton(myAddAction)); buttonBox.add(Box.createHorizontalStrut(5)); buttonBox.add(new JButton(myDeleteAction)); topPanel.add(buttonBox, BorderLayout.SOUTH); topPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5)); add(topPanel, BorderLayout.NORTH); JList list = new JList(myListModel); list.setName("list"); list.setBorder(BorderFactory.createLoweredBevelBorder()); myListSelectionModel = list.getSelectionModel(); myListSelectionModel.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { updateActions(); } }); JScrollPane scrollPane = new JScrollPane(list); scrollPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); scrollPane.setPreferredSize(new Dimension(120, 200)); add(scrollPane, BorderLayout.CENTER); updateActions(); }
Example 19
Source File: javax_swing_Box.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected Box getAnotherObject() { return Box.createHorizontalBox(); }
Example 20
Source File: InputOutputAnnotationSetsDialog.java From gate-core with GNU Lesser General Public License v3.0 | 4 votes |
AnnotationSetsList(Collection<String> hintSetNames, Collection<String> initialSetNames) { GridBagLayout layout = new GridBagLayout(); setLayout(layout); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.ipady = 2; c.weightx = 1.0; String[] hintSetNamesArray = hintSetNames.toArray(new String[hintSetNames .size()]); Arrays.sort(hintSetNamesArray, NATURAL_COMPARATOR); combo = new JComboBox<String>(hintSetNamesArray); combo.setEditable(true); // custom editor to handle the default annotation set. combo.setEditor(new AnnotationSetNameComboEditor(combo.getEditor())); // set up renderer combo.setRenderer(new AnnotationSetNameCellRenderer()); c.fill = GridBagConstraints.HORIZONTAL; add(combo, c); // add and remove buttons Action addAction = new AddAction(); Action removeAction = new RemoveAction(); Box buttonsBox = Box.createHorizontalBox(); buttonsBox.add(Box.createHorizontalGlue()); addButton = new JButton(addAction); buttonsBox.add(addButton); buttonsBox.add(Box.createHorizontalStrut(5)); removeButton = new JButton(removeAction); buttonsBox.add(removeButton); buttonsBox.add(Box.createHorizontalGlue()); add(buttonsBox, c); listModel = new DefaultListModel<String>(); String[] initialSetNamesArray = initialSetNames .toArray(new String[initialSetNames.size()]); Arrays.sort(initialSetNamesArray, NATURAL_COMPARATOR); for(String name : initialSetNamesArray) { listModel.addElement(name); } annotationSetsList = new JList<String>(listModel); // set up list cell renderer annotationSetsList.setCellRenderer(new AnnotationSetNameCellRenderer()); c.fill = GridBagConstraints.BOTH; c.weighty = 1.0; add(new JScrollPane(annotationSetsList), c); }