List of usage examples for javax.swing JComponent getLayout
public LayoutManager getLayout()
From source file:Main.java
public static void uninstallLayout(JComponent c, LayoutManager layout) { if (layout != null && layout == c.getLayout()) { c.setLayout(null);/*from w ww . j a va 2 s .co m*/ } }
From source file:Main.java
public static void showAsOnlyVisibleChild(JComponent container, Component childToBeMadeVisible) { for (Component child : container.getComponents()) { boolean visible = child.equals(childToBeMadeVisible); child.setVisible(visible);/*from w w w . ja v a 2 s .c o m*/ if (visible) { container.getLayout().addLayoutComponent(BorderLayout.CENTER, child); } else { container.getLayout().removeLayoutComponent(child); } child.repaint(); } container.revalidate(); container.repaint(); }
From source file:com.googlecode.vfsjfilechooser2.plaf.metal.MetalVFSFileChooserUI.java
/** * Returns the preferred size of the specified * <code>VFSJFileChooser</code>. * The preferred size is at least as large, * in both height and width,/* ww w. j a v a2 s . c o m*/ * as the preferred size recommended * by the file chooser's layout manager. * * @param c a <code>VFSJFileChooser</code> * @return a <code>Dimension</code> specifying the preferred * width and height of the file chooser */ @Override public Dimension getPreferredSize(JComponent c) { int prefWidth = PREF_SIZE.width; Dimension d = c.getLayout().preferredLayoutSize(c); if (d != null) { return new Dimension((d.width < prefWidth) ? prefWidth : d.width, (d.height < PREF_SIZE.height) ? PREF_SIZE.height : d.height); } else { return new Dimension(prefWidth, PREF_SIZE.height); } }