Java Code Examples for java.awt.LayoutManager2

The following are top voted examples for showing how to use java.awt.LayoutManager2. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: swingx   File: JXRootPane.java   Source Code and License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void setLayout(LayoutManager layout) {
    if (layout instanceof XRootLayout) {
        // happens if decoration is uninstalled by ui
        if ((layout != null) && (layout == getLayout())) {
            ((XRootLayout) layout).setLayoutManager(null);
        }
        super.setLayout(layout);
    } else {
        if (layout instanceof LayoutManager2) {
            ((XRootLayout) getLayout()).setLayoutManager((LayoutManager2) layout);
            if (!isValid()) {
                invalidate();
            }
        }
    }
}
 
Example 2
Project: aibench-project   File: JXRootPane.java   Source Code and License 6 votes vote down vote up
@Override
public void setLayout(LayoutManager layout) {
    if (layout instanceof XRootLayout) {
        // happens if decoration is uninstalled by ui
        if ((layout != null) && (layout == getLayout())) {
            ((XRootLayout) layout).setLayoutManager(null);
        }
        super.setLayout(layout);
    } else {
        if (layout instanceof LayoutManager2) {
            ((XRootLayout) getLayout()).setLayoutManager((LayoutManager2) layout);
            if (!isValid()) {
                invalidate();
            }
        }
    }
}
 
Example 3
Project: cn1   File: JComponent.java   Source Code and License 6 votes vote down vote up
@Override
public Dimension getMaximumSize() {
    if (isMaximumSizeSet()) {
        return super.getMaximumSize();
    }
    if (ui != null) {
        Dimension size = ui.getMaximumSize(this);
        if (size != null) {
            return new Dimension(size);
        }
    }
    LayoutManager layout = getLayout();
    if (layout != null && layout instanceof LayoutManager2) {
        return ((LayoutManager2) layout).maximumLayoutSize(this);
    }
    return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
}
 
Example 4
Project: freeVM   File: JComponent.java   Source Code and License 6 votes vote down vote up
@Override
public Dimension getMaximumSize() {
    if (isMaximumSizeSet()) {
        return super.getMaximumSize();
    }
    if (ui != null) {
        Dimension size = ui.getMaximumSize(this);
        if (size != null) {
            return new Dimension(size);
        }
    }
    LayoutManager layout = getLayout();
    if (layout != null && layout instanceof LayoutManager2) {
        return ((LayoutManager2) layout).maximumLayoutSize(this);
    }
    return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
}
 
Example 5
Project: freeVM   File: JComponent.java   Source Code and License 6 votes vote down vote up
@Override
public Dimension getMaximumSize() {
    if (isMaximumSizeSet()) {
        return super.getMaximumSize();
    }
    if (ui != null) {
        Dimension size = ui.getMaximumSize(this);
        if (size != null) {
            return new Dimension(size);
        }
    }
    LayoutManager layout = getLayout();
    if (layout != null && layout instanceof LayoutManager2) {
        return ((LayoutManager2) layout).maximumLayoutSize(this);
    }
    return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
}
 
Example 6
Project: taxonaut   File: Panel.java   Source Code and License 5 votes vote down vote up
public Panel(LayoutManager2 layout, Locale locale, int subtype)
   {
super(layout);
if(layout instanceof BorderLayout) {
    ((BorderLayout)getLayout()).setHgap(6);
}

createComponents(locale, subtype);
layoutComponents();
setComponentsSize();
   }
 
Example 7
Project: javify   File: BasicInternalFrameUI.java   Source Code and License 5 votes vote down vote up
/**
 * This method returns the maximum size of the given JComponent.
 *
 * @param x The JComponent to find a maximum size for.
 *
 * @return The maximum size.
 */
public Dimension getMaximumSize(JComponent x)
{
  Dimension max = null;
  LayoutManager layout = frame.getLayout();
  if (frame == x && layout != null && layout instanceof LayoutManager2)
    max = ((LayoutManager2) layout).maximumLayoutSize(frame);
  else
    max = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  return max;
}
 
Example 8
Project: jvm-stm   File: BasicInternalFrameUI.java   Source Code and License 5 votes vote down vote up
/**
 * This method returns the maximum size of the given JComponent.
 *
 * @param x The JComponent to find a maximum size for.
 *
 * @return The maximum size.
 */
public Dimension getMaximumSize(JComponent x)
{
  Dimension max = null;
  LayoutManager layout = frame.getLayout();
  if (frame == x && layout != null && layout instanceof LayoutManager2)
    max = ((LayoutManager2) layout).maximumLayoutSize(frame);
  else
    max = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  return max;
}
 
Example 9
Project: RipplePower   File: Panels.java   Source Code and License 5 votes vote down vote up
public static JPanel newPanel(LayoutManager2 layout) {
	JPanel panel = new JPanel(layout);
	panel.setBackground(UIConfig.dialogbackground);
	panel.setOpaque(false);
	panel.applyComponentOrientation(LangConfig.currentComponentOrientation());
	return panel;
}
 
Example 10
Project: cn1   File: MetalRootPaneUI$MetalRootLayoutTest.java   Source Code and License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    JFrame.setDefaultLookAndFeelDecorated(true);
    frame = new JFrame();
    rootPane = frame.getRootPane();
    ((JComponent) rootPane).setBorder(BorderFactory.createEmptyBorder(5, 10, 15, 20));
    ui = new MetalRootPaneUI();
    rootPane.setUI(ui);
    layout = (LayoutManager2) rootPane.getLayout();
    titlePane = (JComponent) rootPane.getLayeredPane().getComponent(1);
}
 
Example 11
Project: JamVM-PH   File: BasicInternalFrameUI.java   Source Code and License 5 votes vote down vote up
/**
 * This method returns the maximum size of the given JComponent.
 *
 * @param x The JComponent to find a maximum size for.
 *
 * @return The maximum size.
 */
public Dimension getMaximumSize(JComponent x)
{
  Dimension max = null;
  LayoutManager layout = frame.getLayout();
  if (frame == x && layout != null && layout instanceof LayoutManager2)
    max = ((LayoutManager2) layout).maximumLayoutSize(frame);
  else
    max = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  return max;
}
 
Example 12
Project: magarena   File: FilterDialog.java   Source Code and License 5 votes vote down vote up
/**
 * Default layout. Variable sized main panel containing filter
 * values above fixed sized action bar.
 */
protected LayoutManager2 getLayoutManager() {
   return new MigLayout("flowy, gap 0, insets 0",
            "[fill, grow]",         // column layout
            "[fill, grow]3[fill]"   // row layout
    );
}
 
Example 13
Project: classpath   File: BasicInternalFrameUI.java   Source Code and License 5 votes vote down vote up
/**
 * This method returns the maximum size of the given JComponent.
 *
 * @param x The JComponent to find a maximum size for.
 *
 * @return The maximum size.
 */
public Dimension getMaximumSize(JComponent x)
{
  Dimension max = null;
  LayoutManager layout = frame.getLayout();
  if (frame == x && layout != null && layout instanceof LayoutManager2)
    max = ((LayoutManager2) layout).maximumLayoutSize(frame);
  else
    max = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
  return max;
}
 
Example 14
Project: freeVM   File: MetalRootPaneUI$MetalRootLayoutTest.java   Source Code and License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    JFrame.setDefaultLookAndFeelDecorated(true);
    frame = new JFrame();
    rootPane = frame.getRootPane();
    ((JComponent) rootPane).setBorder(BorderFactory.createEmptyBorder(5, 10, 15, 20));
    ui = new MetalRootPaneUI();
    rootPane.setUI(ui);
    layout = (LayoutManager2) rootPane.getLayout();
    titlePane = (JComponent) rootPane.getLayeredPane().getComponent(1);
}
 
Example 15
Project: freeVM   File: MetalRootPaneUI$MetalRootLayoutTest.java   Source Code and License 5 votes vote down vote up
@Override
protected void setUp() throws Exception {
    super.setUp();
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    JFrame.setDefaultLookAndFeelDecorated(true);
    frame = new JFrame();
    rootPane = frame.getRootPane();
    ((JComponent) rootPane).setBorder(BorderFactory.createEmptyBorder(5, 10, 15, 20));
    ui = new MetalRootPaneUI();
    rootPane.setUI(ui);
    layout = (LayoutManager2) rootPane.getLayout();
    titlePane = (JComponent) rootPane.getLayeredPane().getComponent(1);
}
 
Example 16
Project: conciliacao   File: Window.java   Source Code and License 4 votes vote down vote up
/**
 * Default constructor
 */
public Window(LayoutManager2 layout) {
	this.setLayout(layout);
}
 
Example 17
Project: xdm   File: TitlePanel.java   Source Code and License 4 votes vote down vote up
public TitlePanel(LayoutManager2 lm, Window w) {
   super(lm);
   this.parentWindow = w;
   this.registerMouseListener();
}
 
Example 18
Project: xdm   File: AboutDialog.java   Source Code and License 4 votes vote down vote up
void init() {
   this.setUndecorated(true);
   this.setSize(350, 280);
   this.getContentPane().setLayout((LayoutManager)null);
   this.bgColor = new Color(73, 73, 73);
   this.getContentPane().setBackground(this.bgColor);
   TitlePanel titlePanel = new TitlePanel((LayoutManager2)null, this);
   titlePanel.setOpaque(false);
   titlePanel.setBounds(0, 0, 350, 50);
   JLabel titleLbl = new JLabel("XDM 2016", 0);
   titleLbl.setFont(new Font("Dialog", 1, 20));
   titleLbl.setForeground(StaticResource.selectedColor);
   titleLbl.setBounds(0, 0, 320, 74);
   titlePanel.add(titleLbl);
   this.add(titlePanel);
   JLabel lineLbl = new JLabel();
   lineLbl.setBackground(StaticResource.selectedColor);
   lineLbl.setBounds(0, 75, 350, 1);
   lineLbl.setOpaque(true);
   this.add(lineLbl);
   JLabel iconLbl = new JLabel(XDMMainWindow.getIcon("icon.png"));
   iconLbl.setBounds(32, 95, 70, 70);
   this.add(iconLbl);
   JTextArea txtInfo = new JTextArea("6.0.00\nBuilt on Sunday 6 March 2016\nCopyright (C) 2015\nSubhra Das Gupta\nCopyright (C) 2016\nSeedo Eldho Paul");
   txtInfo.setBounds(114, 100, 201, 90);
   txtInfo.setEditable(false);
   txtInfo.setBackground(this.bgColor);
   txtInfo.setForeground(Color.WHITE);
   this.add(txtInfo);
   ImageIcon icon = XDMIconMap.getIcon("APP_ICON");
   this.setTitle(StringResource.getString("ABT_TTL"));
   this.setIconImage(icon.getImage());
   JPanel p = new JPanel((LayoutManager)null);
   p.setBackground(Color.GRAY);
   p.setBounds(0, 210, 350, 70);
   this.add(p);
   JButton okBtn = new JButton("OK");
   okBtn.setForeground(Color.WHITE);
   okBtn.setFont(StaticResource.plainFontBig2);
   okBtn.setBackground(this.bgColor);
   okBtn.setBounds(0, 1, 350, 70);
   p.add(okBtn);
   okBtn.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
         AboutDialog.this.setVisible(false);
      }
   });
}
 
Example 19
Project: aibench-project   File: JXRootPane.java   Source Code and License 4 votes vote down vote up
public void setLayoutManager(LayoutManager2 delegate) {
    this.delegate = delegate;
}
 
Example 20
Project: RipplePower   File: RoundedPanel.java   Source Code and License 4 votes vote down vote up
public RoundedPanel(LayoutManager2 layout) {
	super(layout);
	setOpaque(false);
	this.cornerRadius = LSystem.COMPONENT_CORNER_RADIUS;
}
 
Example 21
Project: RipplePower   File: Panels.java   Source Code and License 3 votes vote down vote up
public static JPanel newRoundedPanel(LayoutManager2 layout) {

		JPanel panel = new RoundedPanel(layout);

		return panel;

	}
 
Example 22
Project: swingx   File: JXRootPane.java   Source Code and License 2 votes vote down vote up
/**
 * The layout manager backing this manager. The delegate is used to
 * calculate the size when the UI handles the window decorations.
 * 
 * @param delegate
 *            the backing manager
 */
public void setLayoutManager(LayoutManager2 delegate) {
    this.delegate = delegate;
}
 
Example 23
Project: stendhal   File: AnimatedLayout.java   Source Code and License 2 votes vote down vote up
/**
 * Create a new AnimatedLayout.
 * 
 * @param proxy layout manager to be used for determining the desired layout
 */
public AnimatedLayout(LayoutManager2 proxy) {
	this.proxy = proxy;
	animations = new WeakHashMap<Container, Animator>(5);
}
 
Example 24
Project: toolkit   File: Wrapper.java   Source Code and License 2 votes vote down vote up
/**
 * Creates a new {@link Wrapper}.
 *
 * @param layout The layout to use.
 */
public Wrapper(LayoutManager2 layout) {
	super(layout);
	setOpaque(false);
}
 
Example 25
Project: cohorte-utilities   File: CPanelUpdater.java   Source Code and License 2 votes vote down vote up
/**
 * @param panel
 * @param parent
 * @param installData
 * @param layout
 * @param resources
 */
public CPanelUpdater(Panel panel, InstallerFrame parent, GUIInstallData installData,
		LayoutManager2 layout, Resources resources) {
	super(panel, parent, installData, layout, resources);
}