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

The following examples show how to use javax.swing.Box#createHorizontalStrut() . 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: SettingsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static int defaultHeight() {
    if (DEFAULT_HEIGHT == -1) {
        JPanel ref = new JPanel(null);
        ref.setLayout(new BoxLayout(ref, BoxLayout.LINE_AXIS));
        ref.setOpaque(false);
        
        ref.add(new JLabel("XXX")); // NOI18N
        
        ref.add(new JButton("XXX")); // NOI18N
        ref.add(new PopupButton("XXX")); // NOI18N
        
        ref.add(new JCheckBox("XXX")); // NOI18N
        ref.add(new JRadioButton("XXX")); // NOI18N
        
        ref.add(new JTextField("XXX")); // NOI18N
        
        ref.add(new JExtendedSpinner(new SpinnerNumberModel(1, 1, 655535, 1)));
        
        Component separator = Box.createHorizontalStrut(1);
        Dimension d = separator.getMaximumSize(); d.height = 20;
        separator.setMaximumSize(d);
        ref.add(separator);
        
        DEFAULT_HEIGHT = ref.getPreferredSize().height;
    }
    return DEFAULT_HEIGHT;
}
 
Example 2
Source File: CommitPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Component makeHorizontalStrut(JComponent compA,
                                      JComponent compB,
                                      LayoutStyle.ComponentPlacement relatedUnrelated) {
    int width = LayoutStyle.getInstance().getPreferredGap(
                        compA,
                        compB,
                        relatedUnrelated,
                        WEST,
                        this);
    return Box.createHorizontalStrut(width);
}
 
Example 3
Source File: VCSCommitPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
static Component makeHorizontalStrut(JComponent compA,
                                          JComponent compB,
                                          ComponentPlacement relatedUnrelated,
                                          JPanel parent) {
        int width = LayoutStyle.getInstance().getPreferredGap(
                            compA,
                            compB,
                            relatedUnrelated,
                            WEST,
                            parent);
        return Box.createHorizontalStrut(width);
}
 
Example 4
Source File: CommitPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Component makeHorizontalStrut(JComponent compA,
                                      JComponent compB,
                                      LayoutStyle.ComponentPlacement relatedUnrelated) {
    int width = LayoutStyle.getInstance().getPreferredGap(
                        compA,
                        compB,
                        relatedUnrelated,
                        WEST,
                        this);
    return Box.createHorizontalStrut(width);
}
 
Example 5
Source File: HelpFinder.java    From tracker with GNU General Public License v3.0 5 votes vote down vote up
protected static Component[] getNavComponentsFor(Launcher launcher) {
	helpLauncher = launcher;
	searchLabel.setText(TrackerRes.getString("HelpFinder.Label.SearchFor.Text")+":"); //$NON-NLS-1$ //$NON-NLS-2$
	searchLabel.setToolTipText(TrackerRes.getString("HelpFinder.Label.SearchFor.Tooltip")); //$NON-NLS-1$
	searchField.setToolTipText(TrackerRes.getString("HelpFinder.Label.SearchFor.Tooltip")); //$NON-NLS-1$
	clearSearchButton.setText(TrackerRes.getString("HelpFinder.Button.ClearResults.Text")); //$NON-NLS-1$
	clearSearchButton.setToolTipText(TrackerRes.getString("HelpFinder.Button.ClearResults.Tooltip")); //$NON-NLS-1$
	return new Component[] {searchLabel, searchField, Box.createHorizontalStrut(4), clearSearchButton, TToolBar.getSeparator()};
}
 
Example 6
Source File: PanExportImageSize.java    From Forsythia with GNU General Public License v3.0 5 votes vote down vote up
public PanExportImageSize(){
  
  setBackground(UI.BUTTON_ORANGE);
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  
  Component horizontalStrut = Box.createHorizontalStrut(8);
  add(horizontalStrut);
  
  JLabel lbljigtag = new JLabel("Export Image Size =");
  add(lbljigtag);
  lbljigtag.setFont(new Font("Dialog", Font.BOLD, 14));
  
  Component horizontalStrut_3 = Box.createHorizontalStrut(8);
  add(horizontalStrut_3);
  
  txtsize = new JTextField("1234",6);
  txtsize.setBackground(UI.BUTTON_YELLOW);
  add(txtsize);
  txtsize.setFont(new Font("DejaVu Sans Mono", Font.PLAIN, 18));
  txtsize.setBorder(null);
  
  Component horizontalStrut_1 = Box.createHorizontalStrut(8);
  add(horizontalStrut_1);
  txtsize.addKeyListener(new KeyAdapter(){
    public void keyReleased(KeyEvent e){
      GE.ge.editor_generator.setExportSize(txtsize.getText());}});
  
}
 
Example 7
Source File: PanInterval.java    From Forsythia with GNU General Public License v3.0 5 votes vote down vote up
public PanInterval(){
  
  setBackground(UI.BUTTON_PURPLE);
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  
  Component horizontalStrut = Box.createHorizontalStrut(8);
  add(horizontalStrut);
  
  JLabel lbljigtag = new JLabel("Interval = ");
  add(lbljigtag);
  lbljigtag.setFont(new Font("Dialog", Font.BOLD, 14));
  
  Component horizontalStrut_3 = Box.createHorizontalStrut(8);
  add(horizontalStrut_3);
  
  txtinterval = new JTextField("1234",6);
  txtinterval.setBackground(UI.BUTTON_YELLOW);
  add(txtinterval);
  txtinterval.setFont(new Font("DejaVu Sans Mono", Font.PLAIN, 18));
  txtinterval.setBorder(null);
  
  Component horizontalStrut_1 = Box.createHorizontalStrut(8);
  add(horizontalStrut_1);
  txtinterval.addKeyListener(new KeyAdapter(){
    public void keyReleased(KeyEvent e){
      GE.ge.editor_generator.setInterval(txtinterval.getText());}});
  
}
 
Example 8
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 9
Source File: PanJigTags.java    From Forsythia with GNU General Public License v3.0 5 votes vote down vote up
public PanJigTags(){
  
  setBackground(UI.BUTTON_PURPLE);
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  
  Component horizontalStrut = Box.createHorizontalStrut(4);
  add(horizontalStrut);
  
  JLabel lbljigtag = new JLabel("Jig Tags =");
  add(lbljigtag);
  lbljigtag.setFont(new Font("Dialog", Font.BOLD, 14));
  
  Component horizontalStrut_3 = Box.createHorizontalStrut(4);
  add(horizontalStrut_3);
  
  txtjigtag = new JTextField("foo",20);
  txtjigtag.setBackground(UI.BUTTON_YELLOW);
  add(txtjigtag);
  txtjigtag.setFont(new Font("DejaVu Sans Mono", Font.PLAIN, 18));
  txtjigtag.setBorder(null);
  txtjigtag.addKeyListener(new KeyAdapter(){
    public void keyReleased(KeyEvent e){
      GE.ge.editor_jig.setJigTags(txtjigtag.getText());}});
  
  Component horizontalStrut_1 = Box.createHorizontalStrut(4);
  add(horizontalStrut_1);
  
}
 
Example 10
Source File: PanSectionTags.java    From Forsythia with GNU General Public License v3.0 5 votes vote down vote up
public PanSectionTags(){
  
  setBackground(UI.BUTTON_GREEN);
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  
  Component horizontalStrut = Box.createHorizontalStrut(4);
  add(horizontalStrut);
  
  JLabel lbljigtag = new JLabel("SectionTags=");
  add(lbljigtag);
  lbljigtag.setFont(new Font("Dialog", Font.BOLD, 14));
  
  Component horizontalStrut_3 = Box.createHorizontalStrut(4);
  add(horizontalStrut_3);
  
  txttag = new JTextField("foo",20);
  txttag.setBackground(UI.BUTTON_YELLOW);
  add(txttag);
  txttag.setFont(new Font("DejaVu Sans Mono", Font.PLAIN, 18));
  txttag.setBorder(null);
  txttag.addKeyListener(new KeyAdapter(){
    public void keyReleased(KeyEvent e){
      GE.ge.editor_jig.setSectionTags(txttag.getText());}});
  
  Component horizontalStrut_1 = Box.createHorizontalStrut(4);
  add(horizontalStrut_1);
  
}
 
Example 11
Source File: PanMetagonTags.java    From Forsythia with GNU General Public License v3.0 5 votes vote down vote up
public PanMetagonTags(){
  
  setBackground(UI.BUTTON_RED);
  setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
  
  Component horizontalStrut = Box.createHorizontalStrut(4);
  add(horizontalStrut);
  
  JLabel lbljigtag = new JLabel("MetagonTags=");
  add(lbljigtag);
  lbljigtag.setFont(new Font("Dialog", Font.BOLD, 14));
  
  Component horizontalStrut_3 = Box.createHorizontalStrut(4);
  add(horizontalStrut_3);
  
  txtmetagontags = new JTextField("foo",20);
  txtmetagontags.setBackground(UI.BUTTON_YELLOW);
  add(txtmetagontags);
  txtmetagontags.setFont(new Font("DejaVu Sans Mono", Font.PLAIN, 18));
  txtmetagontags.setBorder(null);
  txtmetagontags.addKeyListener(new KeyAdapter(){
    public void keyReleased(KeyEvent e){
      GE.ge.editor_metagon.setMetagonTags(txtmetagontags.getText());}});
  
  Component horizontalStrut_1 = Box.createHorizontalStrut(4);
  add(horizontalStrut_1);
  
}
 
Example 12
Source File: GameToolbar.java    From SproutLife with MIT License 4 votes vote down vote up
/**
 * Create the panel.
 */
public void buildPanel() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));

    horizontalStrut = Box.createHorizontalStrut(20);
    add(horizontalStrut);

    JLabel lblZoom = new JLabel("Zoom");
    add(lblZoom);
    //lblZoom.setMinimumSize(new Dimension(100, 14));

    zoomSlider = new JSlider();
    zoomSlider.setPreferredSize(new Dimension(100, 29));
    add(zoomSlider);
    zoomSlider.setMinorTickSpacing(1);
    zoomSlider.setMinimum(-5);
    zoomSlider.setValue(-2);
    zoomSlider.setMaximum(5);

    JLabel speedLabel = new JLabel("Speed");
    add(speedLabel);

    speedSlider = new JSlider();
    speedSlider.setPreferredSize(new Dimension(100, 29));
    speedSlider.setSnapToTicks(true);
    add(speedSlider);
    speedSlider.setMinimum(-5);
    speedSlider.setMaximum(4);
    speedSlider.setValue(-2);

    gifStopRecordingButton = new JButton("GIF - Stop Rec.");
    gifStopRecordingButton.setVisible(false);
    add(gifStopRecordingButton);

    startPauseButton = new JButton("Start");
    add(startPauseButton);
    startPauseButton.setMaximumSize(new Dimension(200, 23));
    startPauseButton.setPreferredSize(new Dimension(80, 29));

    stepButton = new JButton("Step");
    stepButton.setPreferredSize(new Dimension(80, 29));
    add(stepButton);

    resetButton = new JButton("Reset");
    resetButton.setPreferredSize(new Dimension(80, 29));
    add(resetButton);

    horizontalStrut_1 = Box.createHorizontalStrut(20);
    add(horizontalStrut_1);

}
 
Example 13
Source File: ObjectsFeatureModes.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Component createStrut(JComponent c, int width, boolean before) {
    Border b = c.getBorder();
    Insets i = b != null ? b.getBorderInsets(c) : null;
    int w = i == null ? width : Math.max(width - (before ? i.left : i.right), 0);
    return Box.createHorizontalStrut(w);
}
 
Example 14
Source File: FilterSelector.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private static Component createStrut(JComponent c, int width, boolean before) {
    Border b = c.getBorder();
    Insets i = b != null ? b.getBorderInsets(c) : null;
    int w = i == null ? width : Math.max(width - (before ? i.left : i.right), 0);
    return Box.createHorizontalStrut(w);
}
 
Example 15
Source File: MethodsFeatureModes.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private static Component createStrut(JComponent c, int width, boolean before) {
    Border b = c.getBorder();
    Insets i = b != null ? b.getBorderInsets(c) : null;
    int w = i == null ? width : Math.max(width - (before ? i.left : i.right), 0);
    return Box.createHorizontalStrut(w);
}
 
Example 16
Source File: ObjectsFeatureModes.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private static Component createStrut(JComponent c, int width, boolean before) {
    Border b = c.getBorder();
    Insets i = b != null ? b.getBorderInsets(c) : null;
    int w = i == null ? width : Math.max(width - (before ? i.left : i.right), 0);
    return Box.createHorizontalStrut(w);
}
 
Example 17
Source File: RepositorySelectorBuilder.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private Component createHorizontalStrut(JComponent parent, JComponent compA, JComponent compB, LayoutStyle.ComponentPlacement related) {
    return Box.createHorizontalStrut(getSpace(parent, compA, compB, related, HORIZONTAL));
}
 
Example 18
Source File: FilterSelector.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Component createStrut(JComponent c, int width, boolean before) {
    Border b = c.getBorder();
    Insets i = b != null ? b.getBorderInsets(c) : null;
    int w = i == null ? width : Math.max(width - (before ? i.left : i.right), 0);
    return Box.createHorizontalStrut(w);
}
 
Example 19
Source File: MethodsFeatureModes.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static Component createStrut(JComponent c, int width, boolean before) {
    Border b = c.getBorder();
    Insets i = b != null ? b.getBorderInsets(c) : null;
    int w = i == null ? width : Math.max(width - (before ? i.left : i.right), 0);
    return Box.createHorizontalStrut(w);
}
 
Example 20
Source File: StratPanel.java    From shakey with Apache License 2.0 votes vote down vote up
private static Component sp(int n) { return Box.createHorizontalStrut(n); }