Java Code Examples for javax.swing.Box#Filler

The following examples show how to use javax.swing.Box#Filler . 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: VerticalLayout.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
public Dimension minimumLayoutSize(final Container parent) {
    final Insets insets = parent.getInsets();
    final Dimension d = new Dimension(insets.left + insets.right,
                                      insets.top + insets.bottom);
    int maxWidth = 0;
    int visibleCount = 0;

    for (Component comp : parent.getComponents()) {
        if (comp.isVisible() && !(comp instanceof Box.Filler)) {
            final Dimension size = comp.getPreferredSize();
            maxWidth = Math.max(maxWidth, size.width);
            d.height += size.height;
            visibleCount++;
        }
    }

    d.height += (visibleCount - 1) * vGap;
    d.width += maxWidth;

    return d;
}
 
Example 2
Source File: HorizontalLayout.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
public Dimension minimumLayoutSize(final Container parent) {
    final Insets insets = parent.getInsets();
    final Dimension d = new Dimension(insets.left + insets.right,
                                      insets.top + insets.bottom);
    int maxHeight = 0;
    int visibleCount = 0;

    for (Component comp : parent.getComponents()) {
        if (comp.isVisible() && !(comp instanceof Box.Filler)) {
            final Dimension size = comp.getPreferredSize();
            maxHeight = Math.max(maxHeight, size.height);
            d.width += size.width;
            visibleCount++;
        }
    }

    d.width += (visibleCount - 1) * hGap;
    d.height += maxHeight;

    return d;
}
 
Example 3
Source File: VerticalLayout.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
public Dimension minimumLayoutSize(final Container parent) {
    final Insets insets = parent.getInsets();
    final Dimension d = new Dimension(insets.left + insets.right,
                                      insets.top + insets.bottom);
    int maxWidth = 0;
    int visibleCount = 0;

    for (Component comp : parent.getComponents()) {
        if (comp.isVisible() && !(comp instanceof Box.Filler)) {
            final Dimension size = comp.getPreferredSize();
            maxWidth = Math.max(maxWidth, size.width);
            d.height += size.height;
            visibleCount++;
        }
    }

    d.height += (visibleCount - 1) * vGap;
    d.width += maxWidth;

    return d;
}
 
Example 4
Source File: VerticalLayout.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public Dimension minimumLayoutSize(final Container parent) {
    final Insets insets = parent.getInsets();
    final Dimension d = new Dimension(insets.left + insets.right,
                                      insets.top + insets.bottom);
    int maxWidth = 0;
    int visibleCount = 0;

    for (Component comp : parent.getComponents()) {
        if (comp.isVisible() && !(comp instanceof Box.Filler)) {
            final Dimension size = comp.getPreferredSize();
            maxWidth = Math.max(maxWidth, size.width);
            d.height += size.height;
            visibleCount++;
        }
    }

    d.height += (visibleCount - 1) * vGap;
    d.width += maxWidth;

    return d;
}
 
Example 5
Source File: ValidateLayerMenuTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
protected boolean correctInstance (Object obj) {
    if (obj instanceof javax.swing.Action) {
        return true;
    }
    if (obj instanceof org.openide.util.actions.Presenter.Menu) {
        return true;
    }
    if (obj instanceof javax.swing.JSeparator) {
        return true;
    }
    if (obj instanceof javax.swing.JMenuItem) {
        return true;
    }
    if (obj instanceof Box.Filler) {
        return true;
    }
    
    return false;
}
 
Example 6
Source File: GenericToolbar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
protected boolean isFocusableComponent(Component component) {
        if (!component.isVisible()) return false;
//            if (!component.isEnabled()) return false;
        if (component instanceof JLabel) return false;
        if (component instanceof JPanel) return false;
        if (component instanceof JSeparator) return false;
        if (component instanceof JToolBar) return false;
        if (component instanceof Box.Filler) return false;
        return true;
    }
 
Example 7
Source File: SynthToolBarUI.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private boolean isGlue(Component c) {
    if (c.isVisible() && c instanceof Box.Filler) {
        Box.Filler f = (Box.Filler)c;
        Dimension min = f.getMinimumSize();
        Dimension pref = f.getPreferredSize();
        return min.width == 0 &&  min.height == 0 &&
                pref.width == 0 && pref.height == 0;
    }
    return false;
}
 
Example 8
Source File: SeaGlassToolBarUI.java    From seaglass with Apache License 2.0 5 votes vote down vote up
private boolean isGlue(Component c) {
    if (c.isVisible() && c instanceof Box.Filler) {
        Box.Filler f = (Box.Filler) c;
        Dimension min = f.getMinimumSize();
        Dimension pref = f.getPreferredSize();
        return min.width == 0 && min.height == 0 && pref.width == 0 && pref.height == 0;
    }
    return false;
}
 
Example 9
Source File: SynthToolBarUI.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private boolean isGlue(Component c) {
    if (c.isVisible() && c instanceof Box.Filler) {
        Box.Filler f = (Box.Filler)c;
        Dimension min = f.getMinimumSize();
        Dimension pref = f.getPreferredSize();
        return min.width == 0 &&  min.height == 0 &&
                pref.width == 0 && pref.height == 0;
    }
    return false;
}
 
Example 10
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public void addFiller() {
    Dimension minDim = new Dimension(0, 0);
    Dimension maxDim = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
    Box.Filler filler = new Box.Filler(minDim, minDim, maxDim) {
        protected void paintComponent(Graphics g) {}
    };
    addItem(filler);
}
 
Example 11
Source File: SynthToolBarUI.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private boolean isGlue(Component c) {
    if (c.isVisible() && c instanceof Box.Filler) {
        Box.Filler f = (Box.Filler)c;
        Dimension min = f.getMinimumSize();
        Dimension pref = f.getPreferredSize();
        return min.width == 0 &&  min.height == 0 &&
                pref.width == 0 && pref.height == 0;
    }
    return false;
}
 
Example 12
Source File: SynthToolBarUI.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isGlue(Component c) {
    if (c.isVisible() && c instanceof Box.Filler) {
        Box.Filler f = (Box.Filler)c;
        Dimension min = f.getMinimumSize();
        Dimension pref = f.getPreferredSize();
        return min.width == 0 &&  min.height == 0 &&
                pref.width == 0 && pref.height == 0;
    }
    return false;
}
 
Example 13
Source File: SynthToolBarUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isGlue(Component c) {
    if (c.isVisible() && c instanceof Box.Filler) {
        Box.Filler f = (Box.Filler)c;
        Dimension min = f.getMinimumSize();
        Dimension pref = f.getPreferredSize();
        return min.width == 0 &&  min.height == 0 &&
                pref.width == 0 && pref.height == 0;
    }
    return false;
}
 
Example 14
Source File: CommitPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private Component makeFlexibleHorizontalStrut(int minWidth,
                                              int prefWidth,
                                              int maxWidth) {
    return new Box.Filler(new Dimension(minWidth,  0),
                          new Dimension(prefWidth, 0),
                          new Dimension(maxWidth,  0));
}
 
Example 15
Source File: SwingTasks.java    From LoboBrowser with MIT License 4 votes vote down vote up
public static Component createHorizontalFill() {
  final Dimension min = new Dimension(0, 0);
  final Dimension pref = new Dimension(Short.MAX_VALUE, 0);
  final Dimension max = pref;
  return new Box.Filler(min, pref, max);
}
 
Example 16
Source File: MessageDialogs.java    From FancyBing with GNU General Public License v3.0 4 votes vote down vote up
private static void addFiller(JComponent component)
{
    Box.Filler filler = GuiUtil.createFiller();
    filler.setAlignmentX(Component.LEFT_ALIGNMENT);
    component.add(filler);
}
 
Example 17
Source File: JComponentBuilders.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
protected Box.Filler createInstanceImpl() {
    return new Box.Filler(null, null, null);
}
 
Example 18
Source File: ProfilerPopup.java    From visualvm with GNU General Public License v2.0 4 votes vote down vote up
private static boolean focusable(Component c) {
    if (c instanceof JLabel || c instanceof Box.Filler) return false;
    return c.isVisible() && c.isEnabled() && c.isFocusable();
}
 
Example 19
Source File: SwingTasks.java    From LoboBrowser with MIT License 4 votes vote down vote up
public static Component createVerticalFill() {
  final Dimension min = new Dimension(0, 0);
  final Dimension pref = new Dimension(0, Short.MAX_VALUE);
  final Dimension max = pref;
  return new Box.Filler(min, pref, max);
}
 
Example 20
Source File: UI.java    From arcgis-runtime-demo-java with Apache License 2.0 4 votes vote down vote up
public static void addBigSeparator(JToolBar toolbar) {
  Box.Filler separator = new Box.Filler(UI.VFD_BIG, UI.VFD_BIG, UI.VFD_BIG);
  separator.setBackground(Color.WHITE);
  toolbar.add(separator);
}