I forgot to check in the fixes to BasicInternalFrameUI, that really belong to the previous patch.
2006-06-23 Roman Kennke <[EMAIL PROTECTED]>
* javax/swing/plaf/basic/BasicInternalFrameUI.java
(InternalFramePropertyChangeListener.propertyChange):
Don't call getPropertyName() repeatedly. Added null checks
to avoid NPEs. Call closeFrame() if the closed property
changes.
/Roman
--
“Improvement makes straight roads, but the crooked roads, without
Improvement, are roads of Genius.” - William Blake
Index: javax/swing/plaf/basic/BasicInternalFrameUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java,v
retrieving revision 1.38
diff -u -2 -0 -r1.38 BasicInternalFrameUI.java
--- javax/swing/plaf/basic/BasicInternalFrameUI.java 13 Jun 2006 09:28:57 -0000 1.38
+++ javax/swing/plaf/basic/BasicInternalFrameUI.java 23 Jun 2006 12:27:48 -0000
@@ -928,75 +928,88 @@
}
}
}
/**
* This helper class listens for PropertyChangeEvents from the
* JInternalFrame.
*/
public class InternalFramePropertyChangeListener
implements PropertyChangeListener
{
/**
* This method is called when one of the JInternalFrame's properties change.
*
* @param evt
* The PropertyChangeEvent.
*/
public void propertyChange(PropertyChangeEvent evt)
{
- if (evt.getPropertyName().equals(JInternalFrame.IS_MAXIMUM_PROPERTY))
+ String property = evt.getPropertyName();
+ if (property.equals(JInternalFrame.IS_MAXIMUM_PROPERTY))
{
if (frame.isMaximum())
maximizeFrame(frame);
else
minimizeFrame(frame);
}
- else if (evt.getPropertyName().equals(JInternalFrame.IS_ICON_PROPERTY))
+ else if (property.equals(JInternalFrame.IS_ICON_PROPERTY))
{
if (frame.isIcon())
iconifyFrame(frame);
else
deiconifyFrame(frame);
}
- else if (evt.getPropertyName().equals(JInternalFrame.IS_SELECTED_PROPERTY))
+ else if (property.equals(JInternalFrame.IS_SELECTED_PROPERTY))
{
if (frame.isSelected())
activateFrame(frame);
else
deactivateFrame(frame);
}
- else if (evt.getPropertyName().equals(JInternalFrame.ROOT_PANE_PROPERTY)
- || evt.getPropertyName().equals(
- JInternalFrame.GLASS_PANE_PROPERTY))
+ else if (property.equals(JInternalFrame.ROOT_PANE_PROPERTY)
+ || property.equals(JInternalFrame.GLASS_PANE_PROPERTY))
{
Component old = (Component) evt.getOldValue();
- old.removeMouseListener(glassPaneDispatcher);
- old.removeMouseMotionListener(glassPaneDispatcher);
+ if (old != null)
+ {
+ old.removeMouseListener(glassPaneDispatcher);
+ old.removeMouseMotionListener(glassPaneDispatcher);
+ }
Component newPane = (Component) evt.getNewValue();
- newPane.addMouseListener(glassPaneDispatcher);
- newPane.addMouseMotionListener(glassPaneDispatcher);
+ if (newPane != null)
+ {
+ newPane.addMouseListener(glassPaneDispatcher);
+ newPane.addMouseMotionListener(glassPaneDispatcher);
+ }
frame.revalidate();
}
+ else if (property.equals(JInternalFrame.IS_CLOSED_PROPERTY))
+ {
+ if (evt.getNewValue() == Boolean.TRUE)
+ {
+ closeFrame(frame);
+ }
+ }
/*
* FIXME: need to add ancestor properties to JComponents. else if
* (evt.getPropertyName().equals(JComponent.ANCESTOR_PROPERTY)) { if
* (desktopPane != null)
* desktopPane.removeComponentListener(componentListener); desktopPane =
* frame.getDesktopPane(); if (desktopPane != null)
* desktopPane.addComponentListener(componentListener); }
*/
}
}
/**
* This helper class is the border for the JInternalFrame.
*/
class InternalFrameBorder extends AbstractBorder implements
UIResource
{
/**
* The width of the border.
*/
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
