Java Code Examples for javax.swing.Box#createRigidArea()

The following examples show how to use javax.swing.Box#createRigidArea() . 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: PanMode.java    From Forsythia with GNU General Public License v3.0 5 votes vote down vote up
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 2
Source File: ColorSelector.java    From gpx-animator with Apache License 2.0 5 votes vote down vote up
/**
 * Create the panel.
 */
public ColorSelector() {
    final ResourceBundle resourceBundle = Preferences.getResourceBundle();

    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));

    colorTextField = new JTextField();
    colorTextField.setEditable(false);
    colorTextField.setMaximumSize(new Dimension(2147483647, 21));
    colorTextField.setPreferredSize(new Dimension(55, 21));
    add(colorTextField);
    colorTextField.setColumns(10);

    final Component rigidArea = Box.createRigidArea(new Dimension(5, 0));
    add(rigidArea);

    selectButton = new JButton(resourceBundle.getString("ui.dialog.color.button.select"));
    selectButton.addActionListener(e -> {
        final JColorChooser chooserPane = new JColorChooser();
        chooserPane.setColor(colorTextField.getBackground());
        final ActionListener okListener = e1 -> setColor(chooserPane.getColor());
        final JDialog colorChooser = JColorChooser.createDialog(
                ColorSelector.this, resourceBundle.getString("ui.dialog.color.title"), true, chooserPane, okListener, null);
        colorChooser.setVisible(true);
    });

    add(selectButton);
}
 
Example 3
Source File: DataDisplay.java    From netbeans with Apache License 2.0 4 votes vote down vote up
static Component createRigidArea() {
return Box.createRigidArea(new Dimension(0,5));
   }
 
Example 4
Source File: JFixedToolBar.java    From jeveassets with GNU General Public License v2.0 4 votes vote down vote up
public void addSpace(final int width) {
	super.add(Box.createRigidArea(new Dimension(width,0)));
}
 
Example 5
Source File: ScatterPlotWindow.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
public ScatterPlotWindow(PeakList peakList) {

    super("Scatter plot of " + peakList);

    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    topPanel = new ScatterPlotTopPanel();
    add(topPanel, BorderLayout.NORTH);

    chart = new ScatterPlotChart(this, topPanel, peakList);
    Border border = BorderFactory.createEtchedBorder(EtchedBorder.RAISED);
    chart.setBorder(border);
    chart.setBackground(Color.white);
    add(chart, BorderLayout.CENTER);

    toolbar = new ScatterPlotToolBar(chart);
    add(toolbar, BorderLayout.EAST);

    JComponent leftMargin = (JComponent) Box.createRigidArea(new Dimension(10, 10));
    leftMargin.setOpaque(false);
    add(leftMargin, BorderLayout.WEST);

    bottomPanel = new ScatterPlotBottomPanel(this, chart, peakList);
    add(bottomPanel, BorderLayout.SOUTH);

    // Add the Windows menu
    JMenuBar menuBar = new JMenuBar();
    menuBar.add(new WindowsMenu());
    setJMenuBar(menuBar);

    pack();

    // get the window settings parameter
    ParameterSet paramSet =
        MZmineCore.getConfiguration().getModuleParameters(ScatterPlotVisualizerModule.class);
    WindowSettingsParameter settings = paramSet.getParameter(ScatterPlotParameters.windowSettings);

    // update the window and listen for changes
    settings.applySettingsToWindow(this);
    this.addComponentListener(settings);

  }
 
Example 6
Source File: GridUtils.java    From netbeans with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a padding component.
 *
 * @param horizontalPadding determines whether we are interested in horizontal padding.
 * @param verticalPadding determines whether we are interested in vertical padding.
 * @param paddingSize determines padding component size in pixels.
 * @return new padding component.
 */
private static Component createPaddingComponent(boolean horizontalPadding, boolean verticalPadding, int paddingSize) {
    Dimension dim = new Dimension(horizontalPadding ? paddingSize : 0, verticalPadding ? paddingSize : 0);
    JComponent padding = (JComponent)Box.createRigidArea(dim);
    padding.putClientProperty(PADDING_COMPONENT, Boolean.TRUE);
    return padding;
}