@Override public Dimension maximumLayoutSize(Container target) { Dimension rd, mbd; Insets i = pane.getInsets(); mbd = new Dimension(0, 0); Container contentPane = pane.getContentPane(); if (contentPane != null) { rd = contentPane.getMaximumSize(); } else { // This is silly, but should stop an overflow error rd = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE - i.top - i.bottom - mbd.height - 1); } return new Dimension(Math.min(rd.width, mbd.width) + i.left + i.right, rd.height + mbd.height + i.top + i.bottom); }
@Override public Dimension maximumLayoutSize(final Container target) { if (target.isMaximumSizeSet()) { return target.getMaximumSize(); } return validateSize((i, j) -> Math.max(i, j), c -> c.getMaximumSize(), target, new Dimension()); }
JScrollPane scroll=new JScrollPane(tree); splitPan=new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,scroll,new JLabel("aaaaa")); splitPan.setSize(this.getMaximumSize()); add(splitPan);
Dimension max = frame.getMaximumSize(); if (size.getWidth() > max.getWidth())
setSize(getMaximumSize().width,getMaximumSize().height); setLocation(getLocation().x,getLocation().y); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/** * Returns the maximum amount of space the layout can use. * * @param target the Container for which this layout manager * is being used * @return a Dimension object containing the layout's maximum size */ public Dimension maximumLayoutSize(Container target) { Dimension rd, mbd; Insets i = rootPane.getInsets(); Container contentPane = rootPane.getContentPane(); JMenuBar menuBar = rootPane.getJMenuBar(); if (menuBar != null && menuBar.isVisible()) { mbd = menuBar.getMaximumSize(); } else { mbd = new Dimension(0, 0); } if (contentPane != null && contentPane.isVisible()) { rd = contentPane.getMaximumSize(); } else { // This is silly, but should stop an overflow error rd = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE - i.top - i.bottom - mbd.height - 1); } return new Dimension(Math.min(rd.width, mbd.width) + i.left + i.right, rd.height + mbd.height + i.top + i.bottom); }
cpd = root.getContentPane().getMaximumSize(); if (cpd != null) { cpWidth = cpd.width;
Dimension cpd = root.getContentPane().getMaximumSize(); if (cpd != null) { cpWidth = cpd.width;
cpd = root.getContentPane().getMaximumSize(); if(cpd != null) { cpWidth = cpd.width;
cpd = root.getContentPane().getMaximumSize(); if (cpd != null) { cpWidth = cpd.width;
cpd = root.getContentPane().getMaximumSize(); if (cpd != null)
cpd = root.getContentPane().getMaximumSize(); if (cpd != null) { cpWidth = cpd.width;
cpd = root.getContentPane().getMaximumSize(); if (cpd != null) { cpWidth = cpd.width;
setSize(getMaximumSize()); this.addKeyListener(this); setLayout(null);