2005-04-19 Roman Kennke <roman@kennke.org>

* javax/swing/plaf/basic/BasicMenuUI.java
	(getMaximumSize): Now returns preferredSize because JMenu should
	never be bigger than that.
	* javax/swing/JRootPane
	(RootLayout.layoutContainer): Make JMenuBars take the whole width.

2005-04-19  Roman Kennke  <roman@kennke.org>

	* javax/swing/JRootPane.java:
	Fixed various tabs to be spaces.
	(RootLayout.layoutContainer): Made menubar left aligned.

From-SVN: r98386
This commit is contained in:
Roman Kennke 2005-04-19 06:23:00 +00:00 committed by Michael Koch
parent 48918616ef
commit 6f5d653386
3 changed files with 77 additions and 63 deletions

View File

@ -1,3 +1,17 @@
2005-04-19 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicMenuUI.java
(getMaximumSize): Now returns preferredSize because JMenu should
never be bigger than that.
* javax/swing/JRootPane
(RootLayout.layoutContainer): Make JMenuBars take the whole width.
2005-04-19 Roman Kennke <roman@kennke.org>
* javax/swing/JRootPane.java:
Fixed various tabs to be spaces.
(RootLayout.layoutContainer): Made menubar left aligned.
2005-04-19 Roman Kennke <roman@ontographics.com> 2005-04-19 Roman Kennke <roman@ontographics.com>
* javax/swing/JList.java * javax/swing/JList.java

View File

@ -189,52 +189,52 @@ public class JRootPane extends JComponent
*/ */
if (containerSize.width == 0 && containerSize.height == 0) if (containerSize.width == 0 && containerSize.height == 0)
{ {
if (menuBar != null) if (menuBar != null)
{ {
int maxWidth; int maxWidth;
menuBarSize = menuBar.getPreferredSize(); menuBarSize = menuBar.getPreferredSize();
maxWidth = Math.max(menuBarSize.width, contentPaneSize.width); maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
menuBar.setBounds(0, 0, maxWidth, menuBarSize.height); menuBar.setBounds(0, 0, maxWidth, menuBarSize.height);
glassPane.setBounds(0, menuBarSize.height, maxWidth, glassPane.setBounds(0, menuBarSize.height, maxWidth,
contentPaneSize.height); contentPaneSize.height);
contentPane.setBounds(0, menuBarSize.height, maxWidth, contentPane.setBounds(0, menuBarSize.height, maxWidth,
contentPaneSize.height); contentPaneSize.height);
layeredPane.setSize(maxWidth, layeredPane.setSize(maxWidth,
menuBarSize.height + contentPaneSize.height); menuBarSize.height + contentPaneSize.height);
} }
else else
{ {
glassPane.setBounds(0, 0, contentPaneSize.width, glassPane.setBounds(0, 0, contentPaneSize.width,
contentPaneSize.height); contentPaneSize.height);
contentPane.setBounds(0, 0, contentPaneSize.width, contentPane.setBounds(0, 0, contentPaneSize.width,
contentPaneSize.height); contentPaneSize.height);
layeredPane.setSize(contentPaneSize.width, contentPaneSize.height); layeredPane.setSize(contentPaneSize.width, contentPaneSize.height);
} }
} }
else else
{ {
if (menuBar != null) if (menuBar != null)
{ {
menuBarSize = menuBar.getPreferredSize(); menuBarSize = menuBar.getPreferredSize();
if (menuBarSize.height > containerSize.height) if (menuBarSize.height > containerSize.height)
menuBarSize.height = containerSize.height; menuBarSize.height = containerSize.height;
menuBar.setBounds(0, 0, containerSize.width, menuBarSize.height); menuBar.setBounds(0, 0, containerSize.width, menuBarSize.height);
int remainingHeight = containerSize.height - menuBarSize.height; int remainingHeight = containerSize.height - menuBarSize.height;
glassPane.setBounds(0, menuBarSize.height, containerSize.width, glassPane.setBounds(0, menuBarSize.height, containerSize.width,
containerSize.height - menuBarSize.height); containerSize.height - menuBarSize.height);
contentPane.setBounds(0, menuBarSize.height, contentPane.setBounds(0, menuBarSize.height,
containerSize.width, containerSize.width,
(containerSize.height - menuBarSize.height)); (containerSize.height - menuBarSize.height));
} }
else else
{ {
glassPane.setBounds(0, 0, containerSize.width, glassPane.setBounds(0, 0, containerSize.width,
containerSize.height); containerSize.height);
contentPane.setBounds(0, 0, containerSize.width, contentPane.setBounds(0, 0, containerSize.width,
containerSize.height); containerSize.height);
} }
layeredPane.setSize(containerSize.width, containerSize.height); layeredPane.setSize(containerSize.width, containerSize.height);
} }
} }
@ -279,20 +279,20 @@ public class JRootPane extends JComponent
if (containerSize.width == 0 && containerSize.height == 0) if (containerSize.width == 0 && containerSize.height == 0)
{ {
if (menuBar != null) if (menuBar != null)
{ {
int maxWidth; int maxWidth;
menuBarSize = menuBar.getPreferredSize(); menuBarSize = menuBar.getPreferredSize();
maxWidth = Math.max(menuBarSize.width, contentPaneSize.width); maxWidth = Math.max(menuBarSize.width, contentPaneSize.width);
prefSize = new Dimension(maxWidth, prefSize = new Dimension(maxWidth,
contentPaneSize.height contentPaneSize.height
+ menuBarSize.height); + menuBarSize.height);
} }
else else
prefSize = contentPaneSize; prefSize = contentPaneSize;
} }
else else
prefSize = c.getSize(); prefSize = c.getSize();
return prefSize; return prefSize;
} }
@ -319,7 +319,7 @@ public class JRootPane extends JComponent
public static final int FILE_CHOOSER_DIALOG = 6; public static final int FILE_CHOOSER_DIALOG = 6;
public static final int QUESTION_DIALOG = 7; public static final int QUESTION_DIALOG = 7;
public static final int WARNING_DIALOG = 8; public static final int WARNING_DIALOG = 8;
/** DOCUMENT ME! */ /** DOCUMENT ME! */
protected Component glassPane; protected Component glassPane;
@ -609,13 +609,13 @@ public class JRootPane extends JComponent
public void setWindowDecorationStyle(int style) public void setWindowDecorationStyle(int style)
{ {
if (style != NONE if (style != NONE
&& style != FRAME && style != FRAME
&& style != INFORMATION_DIALOG && style != INFORMATION_DIALOG
&& style != ERROR_DIALOG && style != ERROR_DIALOG
&& style != COLOR_CHOOSER_DIALOG && style != COLOR_CHOOSER_DIALOG
&& style != FILE_CHOOSER_DIALOG && style != FILE_CHOOSER_DIALOG
&& style != QUESTION_DIALOG && style != QUESTION_DIALOG
&& style != WARNING_DIALOG) && style != WARNING_DIALOG)
throw new IllegalArgumentException("invalid style"); throw new IllegalArgumentException("invalid style");
int oldStyle = windowDecorationStyle; int oldStyle = windowDecorationStyle;

View File

@ -179,7 +179,7 @@ public class BasicMenuUI extends BasicMenuItemUI
*/ */
public Dimension getMaximumSize(JComponent c) public Dimension getMaximumSize(JComponent c)
{ {
return null; return c.getPreferredSize();
} }
protected String getPropertyPrefix() protected String getPropertyPrefix()