Package java.awt

Examples of java.awt.LayoutManager


   * <code>getMinimumOptionPaneSize</code>.
   */
  public Dimension getPreferredSize(JComponent c) {
    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


   * <code>getMinimumOptionPaneSize</code>.
   */
  public Dimension getPreferredSize(JComponent c) {
    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

   * <code>getMinimumOptionPaneSize</code>.
   */
  public Dimension getPreferredSize(JComponent c) {
    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

    /*
     * Class under test for LayoutManager createLayout()
     */
    public void testCreateLayout() {
        LayoutManager layout = pane.createLayout();
        assertTrue("!= null", layout != null);
        assertTrue("instanceof TitlePaneLayout",
                layout instanceof BasicInternalFrameTitlePane.TitlePaneLayout);
    }
View Full Code Here

     * Test MetalInternalFrameTitlePane.MetalTitlePaneLayout class
     */
    public void testMetalTitlePaneLayout() {
        TestMetalInternalFrameTitlePane pane = new TestMetalInternalFrameTitlePane(frame);
        pane.setSize(200, 31);
        LayoutManager layout = pane.getLayout();
        final Rectangle iconButtonBounds = new Rectangle(134, 7, 16, 16);
        final Rectangle maximizeButtonBounds = new Rectangle(156, 7, 16, 16);
        final Rectangle closeButtonBounds = new Rectangle(178, 7, 16, 16);
        // test layoutContainer(): non-iconifiable, non-maximizable, non-closable
        layout.layoutContainer(null);
        //        assertEquals("iconButton", zeroBounds,
        //                     pane.getComponent(0).getBounds());
        //        assertTrue("maximizeButton", pane.getComponent(1).getBounds().
        //                equals(zeroBounds));
        //        assertTrue("closeButton", pane.getComponent(2).getBounds().
        //                equals(zeroBounds));
        // test layoutContainer(): iconifiable, maximizable, closable
        frame.setIconifiable(true);
        frame.setMaximizable(true);
        frame.setClosable(true);
        layout.layoutContainer(pane);
        if (isHarmony()) {
            assertEquals("iconButton", iconButtonBounds, pane.getComponent(0).getBounds());
            assertEquals("maximizeButton", maximizeButtonBounds, pane.getComponent(1)
                    .getBounds());
            assertEquals("closeButton", closeButtonBounds, pane.getComponent(2).getBounds());
        }
        // test layoutContainer(): isPalette == true
        pane.setPalette(true);
        layout.layoutContainer(null);
        // these bounds can be changed in the future
        if (isHarmony()) {
            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

     * Test method for 'javax.swing.plaf.basic.BasicMenuBarUI.installUI(JComponent)'
     */
    public void testInstallUninstallUI() {
        JMenuBar menu = new JMenuBar();
        menu.setUI(menuBarUI);
        LayoutManager oldManager = menu.getLayout();
        menuBarUI.uninstallUI(menu);
        menuBarUI.installUI(menu);
        assertNotNull(menu.getLayout());
        assertNotSame(oldManager, menu.getLayout());
        menuBarUI.uninstallUI(menu);
View Full Code Here

    /*
     * Class under test for void JPanel(LayoutManager, boolean)
     */
    public void testJPanelLayoutManagerboolean() {
        final LayoutManager layout1 = new GridLayout(2, 2);
        panel = new JPanel(layout1, true);
        assertTrue(panel.isOpaque());
        assertSame(layout1, panel.getLayout());
        assertTrue(panel.isDoubleBuffered());
        final LayoutManager layout2 = new FlowLayout();
        panel = new JPanel(layout2, false);
        assertTrue(panel.isOpaque());
        assertSame(layout2, panel.getLayout());
        assertFalse(panel.isDoubleBuffered());
    }
View Full Code Here

    /*
     * Class under test for void JPanel(LayoutManager)
     */
    public void testJPanelLayoutManager() {
        final LayoutManager layout1 = new GridLayout(2, 2);
        panel = new JPanel(layout1);
        assertTrue(panel.isOpaque());
        assertSame(layout1, panel.getLayout());
        assertTrue(panel.isDoubleBuffered());
        final LayoutManager layout2 = new FlowLayout();
        panel = new JPanel(layout2);
        assertTrue(panel.isOpaque());
        assertSame(layout2, panel.getLayout());
        assertTrue(panel.isDoubleBuffered());
    }
View Full Code Here

        assertNull(paneUI.getPreferredSize(null));
        Dimension preferredSize = paneUI.getPreferredSize(pane);
        assertNotNull(preferredSize);
        assertTrue(preferredSize.width > 0);
        assertTrue(preferredSize.height > 0);
        LayoutManager layout = new MyLayoutManager(new Dimension(200, 500));
        pane.setLayout(layout);
        assertEquals(new Dimension(200, 500), paneUI.getPreferredSize(pane));
        layout = new MyLayoutManager(new Dimension(200, 300));
        pane.setLayout(layout);
        assertEquals(new Dimension(200, 456), paneUI.getPreferredSize(pane));
View Full Code Here

        assertNotNull(paneUI.optionPane);
        assertNull(paneUI.inputComponent);
    }

    public void testCreateLayoutManager() {
        LayoutManager layout1 = paneUI.createLayoutManager();
        LayoutManager layout2 = paneUI.createLayoutManager();
        assertTrue("LayoutManager is not null", layout1 != null);
        assertEquals("LayoutManager's class ", "javax.swing.BoxLayout", layout1.getClass()
                .getName());
        assertFalse("layout2 is not shared", layout1 == layout2);
    }
View Full Code Here

TOP

Related Classes of java.awt.LayoutManager

Copyright © 2018 www.massapicom. 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.