Package java.awt

Examples of java.awt.LayoutManager.preferredLayoutSize()


    JRootPane rp = new JRootPane();
    LayoutManager l = rp.getLayout();
    JPanel p = new JPanel();
    p.setPreferredSize(new Dimension(100, 100));
    rp.setContentPane(p);
    h.check(l.preferredLayoutSize(rp), new Dimension(100, 100));
    p.setPreferredSize(new Dimension(200, 200));
    h.check(l.preferredLayoutSize(rp), new Dimension(200, 200));
  }
}
View Full Code Here


    JPanel p = new JPanel();
    p.setPreferredSize(new Dimension(100, 100));
    rp.setContentPane(p);
    h.check(l.preferredLayoutSize(rp), new Dimension(100, 100));
    p.setPreferredSize(new Dimension(200, 200));
    h.check(l.preferredLayoutSize(rp), new Dimension(200, 200));
  }
}
View Full Code Here

    /* This has to deal with the fact that the title may be wider than
       the widest child component.
       */
    public Dimension getPreferredSize(JComponent c) {
        LayoutManager layout = c.getLayout();
        Dimension d = layout.preferredLayoutSize(c);
        String title = ((JPopupMenu)c).getLabel();
        if (titleFont == null) {
            UIDefaults table = UIManager.getLookAndFeelDefaults();
            titleFont = table.getFont("PopupMenu.font");
        }
View Full Code Here

    /* This has to deal with the fact that the title may be wider than
       the widest child component.
       */
    public Dimension getPreferredSize(JComponent c) {
  LayoutManager layout = c.getLayout();
  Dimension d = layout.preferredLayoutSize(c);
  String title = ((JPopupMenu)c).getLabel();
  if (titleFont == null) {
      UIDefaults table = UIManager.getLookAndFeelDefaults();
      titleFont = table.getFont("PopupMenu.font");
  }
View Full Code Here

        assertEquals("iconButton", iconButtonBounds, pane.iconButton.getBounds());
        assertEquals("maximizeButton", maximizeButtonBounds, pane.maxButton.getBounds());
        assertEquals("closeButton", closeButtonBounds, pane.closeButton.getBounds());
        // minimumLayoutSize(), preferredLayoutSize() implementations
        assertTrue("", layout.minimumLayoutSize(pane) != null);
        assertTrue("", layout.preferredLayoutSize(pane) != null);
    }

    @SuppressWarnings("deprecation")
    public void testSystemMenuBar() {
        JMenuBar menuBar = pane.new SystemMenuBar();
View Full Code Here

    if ((JOptionPane)c == optionPane) {
      Dimension            ourMin = getMinimumOptionPaneSize();
      LayoutManager        lm = c.getLayout();

      if (lm != null) {
        Dimension         lmSize = lm.preferredLayoutSize(c);

        if (ourMin != null)
          return new Dimension
          (Math.max(lmSize.width, ourMin.width),
              Math.max(lmSize.height, ourMin.height));
View Full Code Here

    if ((JOptionPane)c == optionPane) {
      Dimension            ourMin = getMinimumOptionPaneSize();
      LayoutManager        lm = c.getLayout();

      if (lm != null) {
        Dimension         lmSize = lm.preferredLayoutSize(c);

        if (ourMin != null)
          return new Dimension
          (Math.max(lmSize.width, ourMin.width),
              Math.max(lmSize.height, ourMin.height));
View Full Code Here

    if ((JOptionPane)c == optionPane) {
      Dimension            ourMin = getMinimumOptionPaneSize();
      LayoutManager        lm = c.getLayout();

      if (lm != null) {
        Dimension         lmSize = lm.preferredLayoutSize(c);

        if (ourMin != null)
          return new Dimension
          (Math.max(lmSize.width, ourMin.width),
              Math.max(lmSize.height, ourMin.height));
View Full Code Here

            assertEquals("palette: closeButton", new Rectangle(189, 11, 8, 8), pane
                    .getComponent(0).getBounds());
        }
        // minimumLayoutSize(), preferredLayoutSize() implementations
        assertTrue("", layout.minimumLayoutSize(pane) != null);
        assertTrue("", layout.preferredLayoutSize(pane) != null);
    }
}
View Full Code Here

    /* This has to deal with the fact that the title may be wider than
       the widest child component.
       */
    public Dimension getPreferredSize(JComponent c) {
        LayoutManager layout = c.getLayout();
        Dimension d = layout.preferredLayoutSize(c);
        String title = ((JPopupMenu)c).getLabel();
        if (titleFont == null) {
            UIDefaults table = UIManager.getLookAndFeelDefaults();
            titleFont = table.getFont("PopupMenu.font");
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.