Example usage for javax.swing Box createHorizontalGlue

List of usage examples for javax.swing Box createHorizontalGlue

Introduction

In this page you can find the example usage for javax.swing Box createHorizontalGlue.

Prototype

public static Component createHorizontalGlue() 

Source Link

Document

Creates a horizontal glue component.

Usage

From source file:org.biojava.bio.view.MotifAnalyzer.java

private Box getControlBox(SequencePanel seqPanel, String seqName) {
    JSlider scale;//from  www.  ja  v  a2s. c  o m
    Box controlBox = null;
    if (controlBox == null) {
        controlBox = Box.createHorizontalBox();
        scale = new JSlider(SwingConstants.HORIZONTAL, 1, 100, INITIAL_SCALE);

        controlBox.add(new JLabel(seqName));
        controlBox.add(Box.createHorizontalGlue());
        controlBox.add(Box.createHorizontalStrut(10));
        controlBox.add(Box.createHorizontalGlue());
        controlBox.add(new JLabel("Scale"));
        controlBox.add(Box.createHorizontalStrut(5));
        controlBox.add(scale);
        controlBox.add(Box.createHorizontalGlue());

        scale.addChangeListener(new SliderListener(seqPanel));
    }
    return controlBox;
}

From source file:org.sikuli.ide.SikuliIDE.java

private JToolBar initToolbar() {
    if (ENABLE_UNIFIED_TOOLBAR) {
        MacUtils.makeWindowLeopardStyle(this.getRootPane());
    }/*from  www.j  ava2s  .  c o  m*/

    JToolBar toolbar = new JToolBar();
    JButton btnInsertImage = new ButtonInsertImage();
    _btnCapture = new ButtonCapture();
    JButton btnSubregion = new ButtonSubregion();
    toolbar.add(_btnCapture);
    toolbar.add(btnInsertImage);
    toolbar.add(btnSubregion);
    toolbar.add(Box.createHorizontalGlue());
    _btnRun = new ButtonRun();
    toolbar.add(_btnRun);
    _btnRunViz = new ButtonRunViz();
    toolbar.add(_btnRunViz);
    toolbar.add(Box.createHorizontalGlue());

    //TODO get it working for OSX 10.10
    if (!Settings.isMac10()) {
        toolbar.add(createSearchField());
    }

    toolbar.add(Box.createRigidArea(new Dimension(7, 0)));
    toolbar.setFloatable(false);
    //toolbar.setMargin(new Insets(0, 0, 0, 5));
    return toolbar;
}