List of usage examples for javax.swing BoxLayout X_AXIS
int X_AXIS
To view the source code for javax.swing BoxLayout X_AXIS.
Click Source Link
From source file:mergedoc.ui.ButtonBar.java
/** * ?? */ public ButtonBar() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); }
From source file:com.apatar.ui.JHelpDialog.java
private void createDialog() { setLayout(new BorderLayout(5, 5)); setSize(500, 500);// w ww .j av a 2s . c o m JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(sendButton); getContentPane().add(text, BorderLayout.CENTER); getContentPane().add(buttonPanel, BorderLayout.SOUTH); }
From source file:UndoableToggleApp4.java
public UndoableToggleApp4() { SimpleListener sl = new SimpleListener(); tog.addActionListener(sl);/*from ww w. j av a2 s . com*/ cb.addActionListener(sl); radio.addActionListener(sl); Box buttonBox = new Box(BoxLayout.Y_AXIS); buttonBox.add(tog); buttonBox.add(cb); buttonBox.add(radio); startButton.setEnabled(true); endButton.setEnabled(false); undoButton.setEnabled(false); redoButton.setEnabled(false); startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { edit = new StateEdit(UndoableToggleApp4.this); startButton.setEnabled(false); endButton.setEnabled(true); // undoButton.setEnabled(edit.canUndo()); // // NOTE: We really don't want to be able to undo until end() is pressed, // but StateEdit does not enforce this for us! undoButton.setEnabled(false); redoButton.setEnabled(edit.canRedo()); } }); endButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { edit.end(); startButton.setEnabled(true); endButton.setEnabled(false); undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } }); // Add a listener to the undo button. It attempts to call undo() on the // current edit, then enables/disables the undo/redo buttons as appropriate. undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.undo(); } catch (CannotUndoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); redoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.redo(); } catch (CannotRedoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); // Lay out the state/end and undo/redo buttons. Box undoRedoBox = new Box(BoxLayout.X_AXIS); undoRedoBox.add(Box.createGlue()); undoRedoBox.add(startButton); undoRedoBox.add(Box.createHorizontalStrut(2)); undoRedoBox.add(endButton); undoRedoBox.add(Box.createHorizontalStrut(2)); undoRedoBox.add(undoButton); undoRedoBox.add(Box.createHorizontalStrut(2)); undoRedoBox.add(redoButton); undoRedoBox.add(Box.createGlue()); // Lay out the main frame. Container content = getContentPane(); content.setLayout(new BorderLayout()); content.add(buttonBox, BorderLayout.CENTER); content.add(undoRedoBox, BorderLayout.SOUTH); setSize(400, 150); }
From source file:UndoableToggleApp2.java
public UndoableToggleApp2() { // Create some toggle buttons (and subclasses) JToggleButton tog = new JToggleButton("ToggleButton"); JCheckBox cb = new JCheckBox("CompoundEdit ExampleCheckBox"); JRadioButton radio = new JRadioButton("RadioButton"); // Add our listener to each toggle button SimpleListener sl = new SimpleListener(); tog.addActionListener(sl);/* w w w. ja va 2 s . co m*/ cb.addActionListener(sl); radio.addActionListener(sl); // Lay out the buttons Box buttonBox = new Box(BoxLayout.Y_AXIS); buttonBox.add(tog); buttonBox.add(cb); buttonBox.add(radio); // Create undo and redo buttons (initially disabled) undoButton = new JButton("Undo"); redoButton = new JButton("Redo"); endButton = new JButton("End"); undoButton.setEnabled(false); redoButton.setEnabled(false); endButton.setEnabled(false); // Add a listener to the undo button. It attempts to call undo() on the // current edit, then enables/disables the undo/redo buttons as // appropriate. undoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.undo(); } catch (CannotUndoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); // Add a redo listener: just like the undo listener, but for redo this // time. redoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { edit.redo(); } catch (CannotRedoException ex) { ex.printStackTrace(); } finally { undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } } }); // Add an end listener. This listener will call end() on the // CompoundEdit // and update the undo/redo buttons. endButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { edit.end(); endButton.setEnabled(false); undoButton.setEnabled(edit.canUndo()); redoButton.setEnabled(edit.canRedo()); } }); // Layout the undo/redo/end buttons Box undoRedoEndBox = new Box(BoxLayout.X_AXIS); undoRedoEndBox.add(Box.createGlue()); undoRedoEndBox.add(undoButton); undoRedoEndBox.add(Box.createHorizontalStrut(2)); undoRedoEndBox.add(redoButton); undoRedoEndBox.add(Box.createHorizontalStrut(2)); undoRedoEndBox.add(endButton); undoRedoEndBox.add(Box.createGlue()); // Layout the main frame Container content = getContentPane(); content.setLayout(new BorderLayout()); content.add(buttonBox, BorderLayout.CENTER); content.add(undoRedoEndBox, BorderLayout.SOUTH); setSize(400, 150); }
From source file:medsavant.enrichment.app.RegionListAggregatePanel.java
public RegionListAggregatePanel(String page) { super(page);/*w ww . ja v a 2 s . c o m*/ setLayout(new BorderLayout()); variantCounts = new TreeMap<GenomicRegion, Integer>(); patientCounts = new TreeMap<GenomicRegion, Integer>(); regionSetCombo = new JComboBox(); mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); progress = new JProgressBar(); progress.setStringPainted(true); JPanel banner = new JPanel(); banner.setLayout(new BoxLayout(banner, BoxLayout.X_AXIS)); banner.setBackground(new Color(245, 245, 245)); banner.setBorder(BorderFactory.createTitledBorder("Region List")); banner.add(regionSetCombo); banner.add(ViewUtil.getMediumSeparator()); banner.add(Box.createHorizontalGlue()); banner.add(progress); add(banner, BorderLayout.NORTH); add(mainPanel, BorderLayout.CENTER); createSearchableTable(); regionSetCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { fetchRegions((RegionSet) regionSetCombo.getSelectedItem()); } }); new MedSavantWorker<List<RegionSet>>(pageName) { @Override protected List<RegionSet> doInBackground() throws Exception { return RegionController.getInstance().getRegionSets(); } @Override protected void showProgress(double fraction) { } @Override protected void showSuccess(List<RegionSet> result) { if (!result.isEmpty()) { updateRegionSetCombo(result); } } }.execute(); }
From source file:SimpleSoundCapture.java
public SimpleSoundCapture() { setLayout(new BorderLayout()); EmptyBorder eb = new EmptyBorder(5, 5, 5, 5); SoftBevelBorder sbb = new SoftBevelBorder(SoftBevelBorder.LOWERED); setBorder(new EmptyBorder(5, 5, 5, 5)); JPanel p1 = new JPanel(); p1.setLayout(new BoxLayout(p1, BoxLayout.X_AXIS)); JPanel p2 = new JPanel(); p2.setBorder(sbb);//from ww w.j av a 2s . c om p2.setLayout(new BoxLayout(p2, BoxLayout.Y_AXIS)); JPanel buttonsPanel = new JPanel(); buttonsPanel.setBorder(new EmptyBorder(10, 0, 5, 0)); playB = addButton("Play", buttonsPanel, false); captB = addButton("Record", buttonsPanel, true); p2.add(buttonsPanel); p1.add(p2); add(p1); }
From source file:biomine.bmvis2.pipeline.KMedoidsHighlight.java
@Override public JComponent getSettingsComponent(final SettingsChangeCallback v, VisualGraph graph) { Box ret = new Box(BoxLayout.X_AXIS); ret.add(new JLabel("k:")); final JSpinner spin = new JSpinner(new SpinnerNumberModel(3, 1, 1000, 1)); spin.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { setK(((Number) spin.getValue()).intValue()); v.settingsChanged(false);/*ww w. j a va2s .c o m*/ } }); ret.add(spin); final JCheckBox showClustersBox = new JCheckBox("Color clusters"); ret.add(showClustersBox); showClustersBox.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { showClusters = showClustersBox.isSelected(); v.settingsChanged(false); } }); return ret; }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java
private JPanel getBottomPanel() { final JPanel bottomPanel = new JPanel(); bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS)); bottomPanel.add(Box.createHorizontalGlue()); final JButton cancelButton = ButtonFactory.createCancelButton(); cancelButton.addActionListener(new ActionListener() { @Override/* ww w .j a v a 2s . c o m*/ public void actionPerformed(final ActionEvent e) { LinkUnlinkWindow.this.dispose(); } }); bottomPanel.add(cancelButton); bottomPanel.add(Box.createHorizontalStrut(10)); final JButton okButton = ButtonFactory.createOkButton(); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { actuallyLinkUnlink(); LinkUnlinkWindow.this.dispose(); } }); bottomPanel.add(okButton); bottomPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 20, 20)); return bottomPanel; }
From source file:BoxAlignmentDemo.java
protected JPanel createButtonRow(boolean changeAlignment) { JButton button1 = new JButton("A JButton", createImageIcon("images/middle.gif")); button1.setVerticalTextPosition(AbstractButton.BOTTOM); button1.setHorizontalTextPosition(AbstractButton.CENTER); JButton button2 = new JButton("Another JButton", createImageIcon("images/geek-cght.gif")); button2.setVerticalTextPosition(AbstractButton.BOTTOM); button2.setHorizontalTextPosition(AbstractButton.CENTER); String title;// www .jav a2 s . c o m if (changeAlignment) { title = "Desired"; button1.setAlignmentY(BOTTOM_ALIGNMENT); button2.setAlignmentY(BOTTOM_ALIGNMENT); } else { title = "Default"; } JPanel pane = new JPanel(); pane.setBorder(BorderFactory.createTitledBorder(title)); pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS)); pane.add(button1); pane.add(button2); return pane; }
From source file:gdt.jgui.tool.JEntityEditor.java
/** * The default consturctor./* w w w. java2s .c o m*/ */ public JEntityEditor() { setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); tabbedPane = new JTabbedPane(JTabbedPane.TOP); add(tabbedPane); }