summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS5
-rw-r--r--ChangeLog168
-rw-r--r--NEWS23
-rw-r--r--configure.ac114
-rw-r--r--examples/gnu/classpath/examples/swing/Demo.java34
-rw-r--r--java/awt/Component.java9
-rw-r--r--java/awt/Container.java25
-rw-r--r--java/awt/Dialog.java1
-rw-r--r--java/io/ObjectInputStream.java1
-rw-r--r--java/lang/String.java40
-rw-r--r--javax/swing/BoxLayout.java14
-rw-r--r--javax/swing/JComponent.java179
-rw-r--r--javax/swing/JTable.java446
-rw-r--r--javax/swing/JToolBar.java1
-rw-r--r--javax/swing/filechooser/FileSystemView.java152
-rw-r--r--javax/swing/filechooser/UnixFileSystemView.java47
-rw-r--r--javax/swing/plaf/basic/BasicLookAndFeel.java8
-rw-r--r--javax/swing/plaf/basic/BasicScrollPaneUI.java23
-rw-r--r--javax/swing/plaf/basic/BasicToolBarUI.java1
-rw-r--r--javax/swing/plaf/metal/MetalScrollPaneUI.java9
-rw-r--r--javax/swing/text/WrappedPlainView.java3
21 files changed, 1102 insertions, 201 deletions
diff --git a/AUTHORS b/AUTHORS
index 2f021ea04..d7965c941 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,7 +4,8 @@ caught bugs or submitted minor patches. If your name does not appear
on either list, but should, let us know. Please keep this list in
alphabetic order.
-Stuart Ballard (stuart.ballard@mcmail.com)
+Lillian Angel (langel@redhat.com)
+Stuart Ballard (stuart.a.ballard@gmail.com)
Mark Benvenuto (mcb54@columbia.edu)
Geoff Berry (gcb@gnu.org)
James E. Blair (corvus@gnu.org)
@@ -12,6 +13,7 @@ Eric Blake (ebb9@email.byu.edu)
Sascha Brawer (brawer@acm.org)
Nic Ferrier (nferrier@tapsellferrier.co.uk)
Paul Fisher (rao@gnu.org)
+David Gilbert (david.gilbert@object-refinery.com)
Anthony Green (green@redhat.com)
Jochen Hoenicke (Jochen.Hoenicke@Informatik.Uni-Oldenburg.de)
Brian Jones (cbj@gnu.org)
@@ -25,6 +27,7 @@ Bryce McKinlay (bryce@waitaki.otago.ac.nz)
Audrius Meskauskas (audriusa@Bioinformatics.org)
Aaron M. Renn (arenn@urbanophile.com)
Andrew Selkirk (aselkirk@sympatico.ca)
+Christian Thalinger (twisti@complang.tuwien.ac.at)
Tom Tromey (tromey@cygnus.com)
Ronald Veldema (rveldema@cs.vu.nl)
Mark Wielaard (mark@klomp.org)
diff --git a/ChangeLog b/ChangeLog
index 1304da673..fe7f3c5c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,174 @@
(getTracks): Updated.
(getTickLength): Updated.
+2005-11-02 Andreas Tobler <a.tobler@schweiz.ch>
+
+ * NEWS: Mention Qt4 configury for OS-X.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * NEWS: Added some news items regarding my Swing work.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (findOverlapFreeParent): Don't search beyond the components
+ containing window (important when in a Dialog).
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * AUTHORS: Added myself to the cool gang.
+
+2005-11-02 Anthony Balkissoon <abalkiss@redhat.com>
+
+ * javax/swing/text/WrappedPlainView.java:
+ (calculateBreakPosition): If the component is not valid use it's
+ preferredSize instead of getBounds().
+
+2005-11-02 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Dialog.java
+ (show): pack should always be called before show, so Dialog is
+ set to the correct size and validated.
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * configure.ac: Check for cairo, pangoft2 and freetype2 only
+ when gtk peers are enabled.
+
+2005-11-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * AUTHORS (Stuart Ballard): Address update.
+
+2005-11-02 Audrius Meskauskas <AudriusA@Bioinformatics.org>
+
+ * AUTHORS: Added Lillian Angel.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JToolBar.java
+ (addImpl): Don't call updateUI here. This is really not necessary.
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (installDefaults): Call setRolloverBorders() here in order to
+ initialize the button borders.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicScrollPaneUI.java
+ (PropertyChangeHandler.propertyChange): Re-setup listeners on
+ the scrollbars if the scrollbars change.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Container.java
+ (addImpl): Notify registered ContainerListeners even when the
+ Container is not showing. Notify the listeners directly, not
+ via the event queue.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Fixed the defaults for EditorPane.border,
+ TextArea.font and TextPane.border.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getForeground): Return null as default color, instead of some
+ system color.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/BoxLayout.java
+ (BoxLayout): Throw AWTError when the axis is invalid.
+ (minimumLayoutSize): Respect the insets of the container.
+ (maximumLayoutSize): Likewise.
+ (invalidateLayout): Throw AWTError if the managed container is
+ not the same as the parent parameter.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Component.java
+ (getMaximumSize): Return (Short.MAX_VALUE, Short.MAX_VALUE) instead
+ of (Integer.MAX_VALUE, Integer.MAX_VALUE) as shown by the
+ Mauve test.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JTable.java
+ (AccessibleJTable.AccessibleJTableCell): New inner class.
+
+2005-11-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * javax/swing/filechooser/FileSystemView.java: Added API docs all over,
+ * javax/swing/filechooser/UnixFileSystemView.java: Likewise.
+
+2005-11-02 Christian Thalinger <twisti@complang.tuwien.ac.at>
+
+ * java/lang/String.java (String): Added
+ StringIndexOutOfBoundsException check (overflow) and a message
+ to the exceptions.
+
+2005-11-02 David Gilbert <david.gilbert@object-refinery.com>
+
+ * NEWS: added entries for javax.swing.plaf.metal.* package and updates
+ to the gnu.classpath.examples.swing.Demo application,
+ * AUTHORS: Added my name to bring honour and glory to myself and all
+ my descendants.
+
+2005-11-02 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/JComponent.java
+ (AccessibleJComponent.changeSupport): New field.
+ (AccessibleJComponent.AccessibleJComponent): Initialize changeSupport.
+ (AccessibleJComponent.addPropertyChangeListener): Implemented this
+ method.
+ (AccessibleJComponent.removePropertyChangeListener): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleChildrenCount): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleChild): Implemented this
+ method.
+ (AccessibleJComponent.getAccessibleName): Added API comment and
+ TODO tag.
+ (AccessibleJComponent.getAccessibleDescription): Added API comment
+ and TODO tag.
+ (AccessibleJComponent.getAccessibleRole): Implemented this method.
+ (AccessibleJComponent.getBorderTitle): Implemented this method.
+ (AccessibleJComponent.getToolTipText): Implemented this method.
+ (AccessibleJComponent.getTitledBorderText): Implemented this method.
+ (AccessibleJComponent.getAccessibleKeyBinding): Added API comment
+ and TODO tag.
+
+2005-11-01 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (init): Use
+ JOptionPane to select the laf if not explicitly set.
+
+2005-11-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/io/ObjectInputStream.java:
+ (parseContent(byte)): Remove weird exception
+ throwing.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * java/awt/Window.java
+ (show): Don't set size of the window here.
+
+2005-11-01 Roman Kennke <kennke@aicas.com>
+
+ * javax/swing/plaf/metal/MetalScrollPaneUI.java
+ (instance): Removed unnecessary field.
+ (createUI): Always return a new instance instead of returning a
+ shared instance.
+
+2005-11-01 Lillian Angel <langel@redhat.com>
+
+ * java/awt/Window.java
+ (show): If pack is not called before show, the size of the
+ window is often set to 0. This is now fixed.
+
2005-11-01 Roman Kennke <kennke@aicas.com>
* javax/swing/JPopupMenu.java
diff --git a/NEWS b/NEWS
index 2eac895a4..336ecb8e3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,14 @@
New for the subsequent release:
+* The Swing RepaintManager has been reworked for more efficient painting,
+ especially for large GUIs.
+
+* The Swing layout manager OverlayLayout has been implemented, the BoxLayout
+ has been rewritten to make use of the SizeRequirements utility class and
+ caching for more efficient layout.
+
+* Improved accessibility support for Swing.
+
* The java.net.HttpURLConnection implementation no longer buffers the
entire response body in memory. This means that response bodies
larger than available memory can now be handled.
@@ -14,7 +23,19 @@ New for the subsequent release:
IIOP protocol. The current implementation is capable for remote invocations,
transferring various Serializables and Externalizables via RMI-IIOP protocol.
It can flatten graphs and, at least for the simple cases, is interoperable
- with Sun's jdk 1.5.
+ with Sun's jdk 1.5.
+
+* Qt4 configury switches for OS-X. Additional to the --enable-qt-peer, OS-X
+ users with a Qt4 installation can build the qt-peers with the argument
+ --with-qt4dir=<Qt4-installation-dir>.
+
+* Significant progress has been made in the implementation of the
+ javax.swing.plaf.metal.* package, with most UI delegates in a working state
+ now. Please test this with your own applications and provide feedback that
+ will help us to improve this package.
+
+* The GUI demo (gnu.classpath.examples.swing.Demo) has been extended to
+ highlight various features in our free-swing implementation.
Runtime interface changes:
diff --git a/configure.ac b/configure.ac
index a44c9dcbb..a790b692b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -338,17 +338,31 @@ if test "x${COMPILE_JNI}" = xyes; then
dnl Check for AWT related gthread/gtk
if test "x${COMPILE_GTK_PEER}" = xyes; then
- AC_PATH_XTRA
- if test "$no_x" = yes; then
- AC_MSG_ERROR([GTK+ peers requested but no X library available])
- fi
- dnl We explicitly want the XTest Extension for Robot support.
- AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
- [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
- [${X_LIBS}])
- PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
- AC_SUBST(GTK_CFLAGS)
- AC_SUBST(GTK_LIBS)
+ AC_PATH_XTRA
+ if test "$no_x" = yes; then
+ AC_MSG_ERROR([GTK+ peers requested but no X library available])
+ fi
+ dnl We explicitly want the XTest Extension for Robot support.
+ AC_CHECK_LIB([Xtst], [XTestQueryExtension], [true],
+ [AC_MSG_ERROR([libXtst NOT found, required for GdkRobot])],
+ [${X_LIBS}])
+ PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.4 gthread-2.0 >= 2.2 gdk-pixbuf-2.0)
+
+ if test "x${enable_gtk_cairo}" = xyes; then
+ PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
+ fi
+
+ PKG_CHECK_MODULES(PANGOFT2, pangoft2)
+ PKG_CHECK_MODULES(FREETYPE2, freetype2)
+
+ AC_SUBST(GTK_CFLAGS)
+ AC_SUBST(GTK_LIBS)
+ AC_SUBST(CAIRO_LIBS)
+ AC_SUBST(CAIRO_CFLAGS)
+ AC_SUBST(PANGOFT2_LIBS)
+ AC_SUBST(PANGOFT2_CFLAGS)
+ AC_SUBST(FREETYPE2_LIBS)
+ AC_SUBST(FREETYPE2_CFLAGS)
fi
dnl Check for AWT related Qt4
@@ -366,53 +380,39 @@ if test "x${COMPILE_JNI}" = xyes; then
AC_MSG_WARN([QWidget not found])))
AC_CHECK_PROG(MOC, [moc], [moc])
fi
- if test "x$HAVE_QT4" = "xno"; then
- AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
- case "$host_os" in
- darwin*)
- AC_ARG_WITH([qt4dir],
- [AS_HELP_STRING([--with-qt4dir=DIR],
- [Qt4 installation directory used for OS-X.
- For other systems use pkg-config.])],
- [QT4DIR=$withval]
- )
- if test x"$QT4DIR" = x ; then
- AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
- fi
- AC_MSG_RESULT([QT4DIR... $QT4DIR])
- AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
- if test x"$MOC" = x; then
- AC_MSG_ERROR([*** This is not the right Qt installation])
- fi
- QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
- QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
- QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
- QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
- ;;
- *)
- AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
- of your installed Qt4 installation.])
- ;;
- esac
- fi
- AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
- AC_SUBST(QT_CFLAGS)
- AC_SUBST(QT_LIBS)
-fi
-
- if test "x${enable_gtk_cairo}" = xyes; then
- PKG_CHECK_MODULES(CAIRO, cairo >= 0.5.0)
+ if test "x$HAVE_QT4" = "xno"; then
+ AC_MSG_NOTICE([Looking for QT_CFLAGS and QT_LIBS without pkg-config])
+ case "$host_os" in
+ darwin*)
+ AC_ARG_WITH([qt4dir],
+ [AS_HELP_STRING([--with-qt4dir=DIR],
+ [Qt4 installation directory used for OS-X.
+ For other systems use pkg-config.])],
+ [QT4DIR=$withval]
+ )
+ if test x"$QT4DIR" = x ; then
+ AC_MSG_ERROR([*** No path for Qt4 --with-qt4dir option given])
+ fi
+ AC_MSG_RESULT([QT4DIR... $QT4DIR])
+ AC_CHECK_PROG(MOC, [moc], [$QT4DIR/bin/moc], [], $QT4DIR/bin)
+ if test x"$MOC" = x; then
+ AC_MSG_ERROR([*** This is not the right Qt installation])
+ fi
+ QT_CFLAGS="-F$QT4DIR/lib -I$QT4DIR/lib/QtCore.framework/Headers"
+ QT_CFLAGS="$QT_CFLAGS -I$QT4DIR/lib/QtGui.framework/Headers"
+ QT_LIBS="-Xlinker -F$QT4DIR/lib -Xlinker -framework -Xlinker QtCore"
+ QT_LIBS="$QT_LIBS -Xlinker -framework -Xlinker QtGui"
+ ;;
+ *)
+ AC_MSG_ERROR([*** Please check PKG_CONFIG_PATH or the version
+ of your installed Qt4 installation.])
+ ;;
+ esac
+ fi
+ AC_MSG_NOTICE([Set QT_CFLAGS... $QT_CFLAGS])
+ AC_SUBST(QT_CFLAGS)
+ AC_SUBST(QT_LIBS)
fi
-
- PKG_CHECK_MODULES(PANGOFT2, pangoft2)
- PKG_CHECK_MODULES(FREETYPE2, freetype2)
-
- AC_SUBST(CAIRO_LIBS)
- AC_SUBST(CAIRO_CFLAGS)
- AC_SUBST(PANGOFT2_LIBS)
- AC_SUBST(PANGOFT2_CFLAGS)
- AC_SUBST(FREETYPE2_LIBS)
- AC_SUBST(FREETYPE2_CFLAGS)
fi
CLASSPATH_WITH_JAVAH
diff --git a/examples/gnu/classpath/examples/swing/Demo.java b/examples/gnu/classpath/examples/swing/Demo.java
index 6eec946a6..6e71af3c8 100644
--- a/examples/gnu/classpath/examples/swing/Demo.java
+++ b/examples/gnu/classpath/examples/swing/Demo.java
@@ -29,6 +29,9 @@ import javax.swing.*;
import javax.swing.tree.*;
import javax.swing.border.*;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.metal.OceanTheme;
+
import java.net.URL;
public class Demo
@@ -42,8 +45,6 @@ public class Demo
{
if (System.getProperty("swing.defaultlaf") == null)
{
- UIManager.setLookAndFeel(new GNULookAndFeel());
-
StringBuffer text = new StringBuffer();
text.append("You may change the Look and Feel of this\n");
text.append("Demo by setting the system property\n");
@@ -58,15 +59,26 @@ public class Demo
text.append(" the GNU Look and Feel\n");
text.append(" (derived from javax.swing.plaf.basic.BasicLookAndFeel)\n");
text.append("\n");
- text.append("the default is gnu.classpath.examples.swing.GNULookAndFeel\n");
- JEditorPane textPane = new JEditorPane();
- // temporary hack, preferred size should be computed by the
- // component
- textPane.setPreferredSize(new Dimension(400, 300));
- textPane.setText(text.toString());
- JOptionPane.showMessageDialog(null, textPane,
- "Look and Feel notice",
- JOptionPane.INFORMATION_MESSAGE);
+ text.append("MetalLookAndFeel supports different Themes.\n");
+ text.append("DefaultMetalTheme (the default) and OceanTheme (in development)\n");
+
+ final String DEFAULT = "MetalLookAndFeel (default)";
+ final String OCEAN = "MetalLookAndFeel (Ocean)";
+ final String GNU = "GNULookAndFeel";
+ final String[] lafs = new String[] { DEFAULT, OCEAN, GNU };
+
+ int laf = JOptionPane.showOptionDialog(null, text /* textPane */,
+ "Look and Feel choice",
+ JOptionPane.OK_OPTION,
+ JOptionPane.QUESTION_MESSAGE,
+ null, lafs, DEFAULT);
+ if (laf == 1)
+ {
+ MetalLookAndFeel.setCurrentTheme(new OceanTheme());
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ }
+ else if (laf == 2)
+ UIManager.setLookAndFeel(new GNULookAndFeel());
}
}
catch (UnsupportedLookAndFeelException e)
diff --git a/java/awt/Component.java b/java/awt/Component.java
index c3f36af30..91b47f71b 100644
--- a/java/awt/Component.java
+++ b/java/awt/Component.java
@@ -587,6 +587,7 @@ public abstract class Component
*/
protected Component()
{
+ // Nothing to do here.
}
/**
@@ -977,7 +978,7 @@ public abstract class Component
{
if (foreground != null)
return foreground;
- return parent == null ? SystemColor.windowText : parent.getForeground();
+ return parent == null ? null : parent.getForeground();
}
/**
@@ -1645,7 +1646,7 @@ public abstract class Component
*/
public Dimension getMaximumSize()
{
- return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+ return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
}
/**
@@ -5572,6 +5573,7 @@ p * <li>the set of backward traversal keys
*/
protected AccessibleAWTComponentHandler()
{
+ // Nothing to do here.
}
/**
@@ -5603,6 +5605,7 @@ p * <li>the set of backward traversal keys
*/
public void componentMoved(ComponentEvent e)
{
+ // Nothing to do here.
}
/**
@@ -5612,6 +5615,7 @@ p * <li>the set of backward traversal keys
*/
public void componentResized(ComponentEvent e)
{
+ // Nothing to do here.
}
} // class AccessibleAWTComponentHandler
@@ -5629,6 +5633,7 @@ p * <li>the set of backward traversal keys
*/
protected AccessibleAWTFocusHandler()
{
+ // Nothing to do here.
}
/**
diff --git a/java/awt/Container.java b/java/awt/Container.java
index 536e5e0d5..0f571e291 100644
--- a/java/awt/Container.java
+++ b/java/awt/Container.java
@@ -397,17 +397,20 @@ public class Container extends Component
layoutMgr.addLayoutComponent(null, comp);
}
- if (isShowing ())
- {
- // Post event to notify of adding the component.
- ContainerEvent ce = new ContainerEvent(this,
- ContainerEvent.COMPONENT_ADDED,
- comp);
- getToolkit().getSystemEventQueue().postEvent(ce);
-
- // Repaint this container.
- repaint();
- }
+ // We previously only sent an event when this container is showing.
+ // Also, the event was posted to the event queue. A Mauve test shows
+ // that this event is not delivered using the event queue and it is
+ // also sent when the container is not showing.
+ ContainerEvent ce = new ContainerEvent(this,
+ ContainerEvent.COMPONENT_ADDED,
+ comp);
+ ContainerListener[] listeners = getContainerListeners();
+ for (int i = 0; i < listeners.length; i++)
+ listeners[i].componentAdded(ce);
+
+ // Repaint this container.
+ repaint(comp.getX(), comp.getY(), comp.getWidth(),
+ comp.getHeight());
}
}
diff --git a/java/awt/Dialog.java b/java/awt/Dialog.java
index 7213e29b2..982048ea8 100644
--- a/java/awt/Dialog.java
+++ b/java/awt/Dialog.java
@@ -406,6 +406,7 @@ addNotify()
public synchronized void
show()
{
+ pack();
super.show();
if (isModal())
diff --git a/java/io/ObjectInputStream.java b/java/io/ObjectInputStream.java
index 80e74f482..b0982dcf7 100644
--- a/java/io/ObjectInputStream.java
+++ b/java/io/ObjectInputStream.java
@@ -190,7 +190,6 @@ public class ObjectInputStream extends InputStream
else
{ if(dump) dumpElementln("BLOCKDATA"); }
readNextBlock(marker);
- throw new StreamCorruptedException("Unexpected blockData");
}
case TC_NULL:
diff --git a/java/lang/String.java b/java/lang/String.java
index 4f96bb5b0..69464b78a 100644
--- a/java/lang/String.java
+++ b/java/lang/String.java
@@ -237,6 +237,7 @@ public final class String
* @param count the number of characters from data to copy
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
*/
@@ -260,6 +261,7 @@ public final class String
* @param count the number of characters from ascii to copy
* @throws NullPointerException if ascii is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; ascii.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(byte[])
@@ -271,8 +273,13 @@ public final class String
*/
public String(byte[] ascii, int hibyte, int offset, int count)
{
- if (offset < 0 || count < 0 || offset + count > ascii.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > ascii.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
value = new char[count];
this.offset = 0;
this.count = count;
@@ -331,8 +338,13 @@ public final class String
public String(byte[] data, int offset, int count, String encoding)
throws UnsupportedEncodingException
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
try
{
CharsetDecoder csd = Charset.forName(encoding).newDecoder();
@@ -406,8 +418,13 @@ public final class String
*/
public String(byte[] data, int offset, int count)
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
int o, c;
char[] v;
String encoding;
@@ -516,8 +533,13 @@ public final class String
*/
String(char[] data, int offset, int count, boolean dont_copy)
{
- if (offset < 0 || count < 0 || offset + count > data.length)
- throw new StringIndexOutOfBoundsException();
+ if (offset < 0)
+ throw new StringIndexOutOfBoundsException("offset: " + offset);
+ if (count < 0)
+ throw new StringIndexOutOfBoundsException("count: " + count);
+ if (offset + count < 0 || offset + count > data.length)
+ throw new StringIndexOutOfBoundsException("offset + count: "
+ + (offset + count));
if (dont_copy)
{
value = data;
@@ -1613,6 +1635,8 @@ public final class String
* @return String containing the chars from data[offset..offset+count]
* @throws NullPointerException if data is null
* @throws IndexOutOfBoundsException if (offset &lt; 0 || count &lt; 0
+ * || offset + count &lt; 0 (overflow)
+ * || offset + count &lt; 0 (overflow)
* || offset + count &gt; data.length)
* (while unspecified, this is a StringIndexOutOfBoundsException)
* @see #String(char[], int, int)
diff --git a/javax/swing/BoxLayout.java b/javax/swing/BoxLayout.java
index fb540e478..ebc0b4c21 100644
--- a/javax/swing/BoxLayout.java
+++ b/javax/swing/BoxLayout.java
@@ -141,6 +141,9 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public BoxLayout(Container container, int way)
{
+ if (way != X_AXIS && way != Y_AXIS && way != LINE_AXIS && way != PAGE_AXIS)
+ throw new AWTError("Invalid axis");
+
int width = 0;
int height = 0;
this.container = container;
@@ -216,7 +219,9 @@ public class BoxLayout implements LayoutManager2, Serializable
throw new AWTError("BoxLayout can't be shared");
checkTotalRequirements();
- return new Dimension(xTotal.minimum, yTotal.minimum);
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.minimum + i.left + i.right,
+ yTotal.minimum + i.top + i.bottom);
}
}
@@ -297,6 +302,9 @@ public class BoxLayout implements LayoutManager2, Serializable
*/
public void invalidateLayout(Container parent)
{
+ if (container != parent)
+ throw new AWTError("BoxLayout can't be shared");
+
synchronized (container.getTreeLock())
{
xChildren = null;
@@ -326,7 +334,9 @@ public class BoxLayout implements LayoutManager2, Serializable
throw new AWTError("BoxLayout can't be shared");
checkTotalRequirements();
- return new Dimension(xTotal.maximum, yTotal.maximum);
+ Insets i = container.getInsets();
+ return new Dimension(xTotal.maximum + i.left + i.right,
+ yTotal.maximum + i.top + i.bottom);
}
}
diff --git a/javax/swing/JComponent.java b/javax/swing/JComponent.java
index 80cfc5b32..a800501d7 100644
--- a/javax/swing/JComponent.java
+++ b/javax/swing/JComponent.java
@@ -84,6 +84,8 @@ import javax.accessibility.AccessibleKeyBinding;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.TitledBorder;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
import javax.swing.event.EventListenerList;
@@ -161,9 +163,14 @@ public abstract class JComponent extends Container implements Serializable
protected ContainerListener accessibleContainerHandler;
protected FocusListener accessibleFocusHandler;
+ /**
+ * Manages the property change listeners;
+ */
+ private SwingPropertyChangeSupport changeSupport;
+
protected AccessibleJComponent()
{
- // TODO: Implement this properly.
+ changeSupport = new SwingPropertyChangeSupport(this);
}
/**
@@ -173,16 +180,58 @@ public abstract class JComponent extends Container implements Serializable
*/
public void addPropertyChangeListener(PropertyChangeListener listener)
{
- // TODO: Why is this overridden?
- super.addPropertyChangeListener(listener);
+ changeSupport.addPropertyChangeListener(listener);
}
+ /**
+ * Removes a propery change listener from the list of registered listeners.
+ *
+ * @param listener the listener to remove
+ */
public void removePropertyChangeListener(PropertyChangeListener listener)
{
- // TODO: Implement this properly.
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Returns the number of accessible children of this object.
+ *
+ * @return the number of accessible children of this object
+ */
+ public int getAccessibleChildrenCount()
+ {
+ int count = 0;
+ Component[] children = getComponents();
+ for (int i = 0; i < children.length; ++i)
+ {
+ if (children[i] instanceof Accessible)
+ count++;
+ }
+ return count;
+ }
+
+ /**
+ * Returns the accessible child component at index <code>i</code>.
+ *
+ * @param i the index of the accessible child to return
+ *
+ * @return the accessible child component at index <code>i</code>
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ int index = 0;
+ Component[] children = getComponents();
+ Accessible found = null;
+ for (int j = 0; index != i; j++)
+ {
+ if (children[j] instanceof Accessible)
+ index++;
+ if (index == i)
+ found = (Accessible) children[index];
+ }
+ // TODO: Figure out what to do when i is not a valid index.
+ return found;
}
- public int getAccessibleChildrenCount() { return 0; }
- public Accessible getAccessibleChild(int value0) { return null; }
/**
* Returns the accessible state set of this component.
@@ -196,13 +245,115 @@ public abstract class JComponent extends Container implements Serializable
return super.getAccessibleStateSet();
}
- public String getAccessibleName() { return null; }
- public String getAccessibleDescription() { return null; }
- public AccessibleRole getAccessibleRole() { return null; }
- protected String getBorderTitle(Border value0) { return null; }
- public String getToolTipText() { return null; }
- public String getTitledBorderText() { return null; }
- public AccessibleKeyBinding getAccessibleKeyBinding() { return null; }
+ /**
+ * Returns the localized name for this object. Generally this should
+ * almost never return {@link Component#getName()} since that is not
+ * a localized name. If the object is some kind of text component (like
+ * a menu item), then the value of the object may be returned. Also, if
+ * the object has a tooltip, the value of the tooltip may also be
+ * appropriate.
+ *
+ * @return the localized name for this object or <code>null</code> if this
+ * object has no name
+ */
+ public String getAccessibleName()
+ {
+ // TODO: Figure out what exactly to return here. It's possible that this
+ // method simply should return null.
+ return null;
+ }
+
+ /**
+ * Returns the localized description of this object.
+ *
+ * @return the localized description of this object or <code>null</code>
+ * if this object has no description
+ */
+ public String getAccessibleDescription()
+ {
+ // TODO: Figure out what exactly to return here. It's possible that this
+ // method simply should return null.
+ return null;
+ }
+
+ /**
+ * Returns the accessible role of this component.
+ *
+ * @return the accessible role of this component
+ *
+ * @see AccessibleRole
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ // TODO: Check if this is correct.
+ return AccessibleRole.SWING_COMPONENT;
+ }
+
+ /**
+ * Recursivly searches a border hierarchy (starting at <code>border) for
+ * a titled border and returns the title if one is found, <code>null</code>
+ * otherwise.
+ *
+ * @param border the border to start search from
+ *
+ * @return the border title of a possibly found titled border
+ */
+ protected String getBorderTitle(Border border)
+ {
+ String title = null;
+ if (border instanceof CompoundBorder)
+ {
+ CompoundBorder compound = (CompoundBorder) border;
+ Border inner = compound.getInsideBorder();
+ title = getBorderTitle(inner);
+ if (title == null)
+ {
+ Border outer = compound.getOutsideBorder();
+ title = getBorderTitle(outer);
+ }
+ }
+ else if (border instanceof TitledBorder)
+ {
+ TitledBorder titled = (TitledBorder) border;
+ title = titled.getTitle();
+ }
+ return title;
+ }
+
+ /**
+ * Returns the tooltip text for this accessible component.
+ *
+ * @return the tooltip text for this accessible component
+ */
+ public String getToolTipText()
+ {
+ return JComponent.this.getToolTipText();
+ }
+
+ /**
+ * Returns the title of the border of this accessible component if
+ * this component has a titled border, otherwise returns <code>null</code>.
+ *
+ * @return the title of the border of this accessible component if
+ * this component has a titled border, otherwise returns
+ * <code>null</code>
+ */
+ public String getTitledBorderText()
+ {
+ return getBorderTitle(getBorder());
+ }
+
+ /**
+ * Returns the keybindings associated with this accessible component or
+ * <code>null</code> if the component does not support key bindings.
+ *
+ * @return the keybindings associated with this accessible component
+ */
+ public AccessibleKeyBinding getAccessibleKeyBinding()
+ {
+ // TODO: Implement this properly.
+ return null;
+ }
}
/**
@@ -3031,7 +3182,7 @@ public abstract class JComponent extends Container implements Serializable
Rectangle currentClip = clip;
Component found = this;
Container parent = this;
- while (parent != null)
+ while (parent != null && !(parent instanceof Window))
{
Container newParent = parent.getParent();
if (newParent == null)
diff --git a/javax/swing/JTable.java b/javax/swing/JTable.java
index 39673b19c..a386559b0 100644
--- a/javax/swing/JTable.java
+++ b/javax/swing/JTable.java
@@ -40,11 +40,15 @@ package javax.swing;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.FocusListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.text.DateFormat;
@@ -52,12 +56,16 @@ import java.text.NumberFormat;
import java.util.Date;
import java.util.EventObject;
import java.util.Hashtable;
+import java.util.Locale;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleExtendedTable;
+import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
import javax.accessibility.AccessibleTable;
import javax.accessibility.AccessibleTableModelChange;
import javax.swing.event.CellEditorListener;
@@ -97,6 +105,444 @@ public class JTable
AccessibleExtendedTable
{
+ /**
+ * Provides accessibility support for table cells.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+ protected class AccessibleJTableCell
+ extends AccessibleContext
+ implements Accessible, AccessibleComponent
+ {
+
+ /**
+ * The table of this cell.
+ */
+ private JTable table;
+
+ /**
+ * The row index of this cell.
+ */
+ private int row;
+
+ /**
+ * The column index of this cell.
+ */
+ private int column;
+
+ /**
+ * The index of this cell inside the AccessibleJTable parent.
+ */
+ private int index;
+
+ /**
+ * Creates a new <code>AccessibleJTableCell</code>.
+ *
+ * @param t the table
+ * @param r the row
+ * @param c the column
+ * @param i the index of this cell inside the accessible table parent
+ */
+ public AccessibleJTableCell(JTable t, int r, int c, int i)
+ {
+ table = t;
+ row = r;
+ column = c;
+ index = i;
+ }
+
+ /**
+ * Returns the accessible row for the table cell.
+ *
+ * @return the accessible row for the table cell
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ // TODO: What is the role of the table cell?
+ return AccessibleRole.UNKNOWN;
+ }
+
+ /**
+ * Returns the accessible state set of this accessible table cell.
+ *
+ * @return the accessible state set of this accessible table cell
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ // TODO: What state shoiuld be returned here?
+ return new AccessibleStateSet();
+ }
+
+ /**
+ * Returns the index of this cell in the parent object.
+ *
+ * @return the index of this cell in the parent object
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return index;
+ }
+
+ /**
+ * Returns the number of children of this object. Table cells cannot have
+ * children, so we return <code>0</code> here.
+ *
+ * @return <code>0</code>
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Returns the accessible child at index <code>i</code>. Table cells
+ * don't have children, so we return <code>null</code> here.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleChild(int i)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the locale setting for this accessible table cell.
+ *
+ * @return the locale setting for this accessible table cell
+ */
+ public Locale getLocale()
+ {
+ // TODO: For now, we return english here. This must be fixed as soon
+ // as we have a localized Swing.
+ return Locale.ENGLISH;
+ }
+
+ /**
+ * Returns the accessible context of this table cell. Since accessible
+ * table cells are their own accessible context, we return
+ * <code>this</code>.
+ *
+ * @return the accessible context of this table cell
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the background color of this cell.
+ *
+ * @return the background color of this cell
+ */
+ public Color getBackground()
+ {
+ return table.getBackground();
+ }
+
+ /**
+ * Sets the background of the cell. Since table cells cannot have
+ * individual background colors, this method does nothing. Set the
+ * background directly on the table instead.
+ *
+ * @param color not used
+ */
+ public void setBackground(Color color)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the foreground color of the table cell.
+ *
+ * @return the foreground color of the table cell
+ */
+ public Color getForeground()
+ {
+ return table.getForeground();
+ }
+
+ /**
+ * Sets the foreground of the cell. Since table cells cannot have
+ * individual foreground colors, this method does nothing. Set the
+ * foreground directly on the table instead.
+ *
+ * @param color not used
+ */
+ public void setForeground(Color color)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the cursor for this table cell.
+ *
+ * @return the cursor for this table cell
+ */
+ public Cursor getCursor()
+ {
+ return table.getCursor();
+ }
+
+ /**
+ * Sets the cursor of the cell. Since table cells cannot have
+ * individual cursors, this method does nothing. Set the
+ * cursor directly on the table instead.
+ *
+ * @param cursor not used
+ */
+ public void setCursor(Cursor cursor)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the font of the table cell.
+ *
+ * @return the font of the table cell
+ */
+ public Font getFont()
+ {
+ return table.getFont();
+ }
+
+ /**
+ * Sets the font of the cell. Since table cells cannot have
+ * individual fonts, this method does nothing. Set the
+ * font directly on the table instead.
+ *
+ * @param font not used
+ */
+ public void setFont(Font font)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the font metrics for a specified font.
+ *
+ * @param font the font for which we return the metrics
+ *
+ * @return the font metrics for a specified font
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return table.getFontMetrics(font);
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is enabled,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this table cell is enabled,
+ * <code>false</code> otherwise
+ */
+ public boolean isEnabled()
+ {
+ return table.isEnabled();
+ }
+
+ /**
+ * Table cells cannot be disabled or enabled individually, so this method
+ * does nothing. Set the enabled flag on the table itself.
+ *
+ * @param b not used here
+ */
+ public void setEnabled(boolean b)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns <code>true</code> if this cell is visible, <code>false</code>
+ * otherwise.
+ *
+ * @return <code>true</code> if this cell is visible, <code>false</code>
+ * otherwise
+ */
+ public boolean isVisible()
+ {
+ return table.isVisible();
+ }
+
+ /**
+ * The visibility cannot be set on individual table cells, so this method
+ * does nothing. Set the visibility on the table itself.
+ *
+ * @param b not used
+ */
+ public void setVisible(boolean b)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is currently showing on
+ * screen.
+ *
+ * @return <code>true</code> if this table cell is currently showing on
+ * screen
+ */
+ public boolean isShowing()
+ {
+ return table.isShowing();
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell contains the location
+ * at <code>point</code>, <code>false</code> otherwise.
+ * <code>point</code> is interpreted as relative to the coordinate system
+ * of the table cell.
+ *
+ * @return <code>true</code> if this table cell contains the location
+ * at <code>point</code>, <code>false</code> otherwise
+ */
+ public boolean contains(Point point)
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ cellRect.x = 0;
+ cellRect.y = 0;
+ return cellRect.contains(point);
+ }
+
+ /**
+ * Returns the screen location of the table cell.
+ *
+ * @return the screen location of the table cell
+ */
+ public Point getLocationOnScreen()
+ {
+ Point tableLoc = table.getLocationOnScreen();
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ tableLoc.x += cellRect.x;
+ tableLoc.y += cellRect.y;
+ return tableLoc;
+ }
+
+ /**
+ * Returns the location of this cell relative to the table's bounds.
+ *
+ * @return the location of this cell relative to the table's bounds
+ */
+ public Point getLocation()
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ return new Point(cellRect.x, cellRect.y);
+ }
+
+ /**
+ * The location of the table cells cannot be manipulated directly, so
+ * this method does nothing.
+ *
+ * @param point not used
+ */
+ public void setLocation(Point point)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the bounds of the cell relative to its table.
+ *
+ * @return the bounds of the cell relative to its table
+ */
+ public Rectangle getBounds()
+ {
+ return table.getCellRect(row, column, true);
+ }
+
+ /**
+ * The bounds of the table cells cannot be manipulated directly, so
+ * this method does nothing.
+ *
+ * @param rectangle not used
+ */
+ public void setBounds(Rectangle rectangle)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Returns the size of the table cell.
+ *
+ * @return the size of the table cell
+ */
+ public Dimension getSize()
+ {
+ Rectangle cellRect = table.getCellRect(row, column, true);
+ return new Dimension(cellRect.width, cellRect.height);
+ }
+
+ /**
+ * The size cannot be set on table cells directly, so this method does
+ * nothing.
+ *
+ * @param dimension not used
+ */
+ public void setSize(Dimension dimension)
+ {
+ // This method does nothing. See API comments.
+ }
+
+ /**
+ * Table cells have no children, so we return <code>null</code> here.
+ *
+ * @return <code>null</code>
+ */
+ public Accessible getAccessibleAt(Point point)
+ {
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if this table cell is focus traversable,
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this table cell is focus traversable,
+ * <code>false</code> otherwise
+ */
+ public boolean isFocusTraversable()
+ {
+ return table.isFocusable();
+ }
+
+ /**
+ * Requests that this table cell gets the keyboard focus.
+ */
+ public void requestFocus()
+ {
+ // We first set the selection models' lead selection to this cell.
+ table.getColumnModel().getSelectionModel()
+ .setLeadSelectionIndex(column);
+ table.getSelectionModel().setLeadSelectionIndex(row);
+ // Now we request that the table receives focus.
+ table.requestFocus();
+ }
+
+ /**
+ * Adds a focus listener to this cell. The focus listener is really
+ * added to the table, so there is no way to find out when an individual
+ * cell changes the focus.
+ *
+ * @param listener the focus listener to add
+ */
+ public void addFocusListener(FocusListener listener)
+ {
+ table.addFocusListener(listener);
+ }
+
+ /**
+ * Removes a focus listener from the cell. The focus listener is really
+ * removed from the table.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeFocusListener(FocusListener listener)
+ {
+ table.removeFocusListener(listener);
+ }
+
+ }
+
protected class AccessibleJTableModelChange
implements AccessibleTableModelChange
{
diff --git a/javax/swing/JToolBar.java b/javax/swing/JToolBar.java
index dc85e294d..a508ee6d8 100644
--- a/javax/swing/JToolBar.java
+++ b/javax/swing/JToolBar.java
@@ -752,7 +752,6 @@ public class JToolBar extends JComponent implements SwingConstants, Accessible
{
AbstractButton b = (AbstractButton) component;
b.setRolloverEnabled(rollover);
- b.updateUI();
}
} // addImpl()
diff --git a/javax/swing/filechooser/FileSystemView.java b/javax/swing/filechooser/FileSystemView.java
index 5867cdbe3..f51b745c8 100644
--- a/javax/swing/filechooser/FileSystemView.java
+++ b/javax/swing/filechooser/FileSystemView.java
@@ -40,11 +40,14 @@ package javax.swing.filechooser;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+
import javax.swing.Icon;
+import javax.swing.JFileChooser;
/**
- * DOCUMENT ME!
+ * The base class providing a view of the file system for use by the
+ * {@link JFileChooser} component.
*/
public abstract class FileSystemView
{
@@ -52,12 +55,12 @@ public abstract class FileSystemView
private static FileSystemView defaultFileSystemView;
/**
- * DOCUMENT ME!
+ * Creates a new file object with the given name in the specified directory.
*
- * @param dir DOCUMENT ME!
- * @param filename DOCUMENT ME!
+ * @param dir the directory (<code>null</code> permitted).
+ * @param filename the file name.
*
- * @return DOCUMENT ME!
+ * @return A new file object.
*/
public File createFileObject(File dir, String filename)
{
@@ -65,11 +68,11 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Creates a new file object from the specified path.
*
- * @param path DOCUMENT ME!
+ * @param path the path.
*
- * @return DOCUMENT ME!
+ * @return A new file object.
*/
public File createFileObject(String path)
{
@@ -92,13 +95,16 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Creates a new folder with a unique name in the specified directory and
+ * returns a {@link File} object representing the new directory.
*
- * @param containingDir DOCUMENT ME!
+ * @param containingDir the directory to contain the new folder
+ * (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return A {@link File} object representing the new directory.
*
- * @throws IOException DOCUMENT ME!
+ * @throws IOException if an exception occurs while creating the new
+ * directory.
*/
public abstract File createNewFolder(File containingDir)
throws IOException;
@@ -118,9 +124,9 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the default directory.
*
- * @return DOCUMENT ME!
+ * @return The default directory.
*/
public File getDefaultDirectory()
{
@@ -128,12 +134,16 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns an array containing the files in the given directory. The
+ * <code>useFileHiding</code> controls whether or not hidden files are
+ * included in the result.
*
- * @param dir DOCUMENT ME!
- * @param useFileHiding DOCUMENT ME!
+ * @param dir the directory (if <code>null</code>
+ * @param useFileHiding a flag that controls whether or not hidden files are
+ * included in the result (pass in <code>true</code> to
+ * exclude hidden files).
*
- * @return DOCUMENT ME!
+ * @return The files in the given directory (possibly <code>null</code>).
*/
public File[] getFiles(File dir, boolean useFileHiding)
{
@@ -161,6 +171,7 @@ public abstract class FileSystemView
{
if (File.separator.equals("/"))
defaultFileSystemView = new UnixFileSystemView();
+ // FIXME: need to implement additional views
// else if (File.Separator.equals("\"))
// return new Win32FileSystemView();
// else
@@ -170,9 +181,9 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the home directory for the current user.
*
- * @return DOCUMENT ME!
+ * @return The home directory for the current user.
*/
public File getHomeDirectory()
{
@@ -180,11 +191,12 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the parent directory for the given file/directory.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return The parent directory (or <code>null</code> if there is no parent
+ * directory).
*/
public File getParentDirectory(File f)
{
@@ -194,9 +206,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * Returns an array containing the file system roots. On Unix-like platforms,
+ * this array will contain just a single item ("/"), while other platforms
+ * may return multiple roots.
+ * <p>
+ * This method is implemented to return <code>null</code>, subclasses must
+ * override this method.
+ *
+ * @return An array containing the file system roots.
*/
public File[] getRoots()
{
@@ -205,11 +222,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the name of a file as it would be displayed by the underlying
+ * system. This implementation returns <code>null</code>, subclasses must
+ * override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemDisplayName(File f)
{
@@ -217,11 +236,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the icon that would be displayed for the given file by the
+ * underlying system. This implementation returns <code>null</code>,
+ * subclasses must override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public Icon getSystemIcon(File f)
{
@@ -229,11 +250,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the type description of a file that would be displayed by the
+ * underlying system. This implementation returns <code>null</code>,
+ * subclasses must override.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemTypeDescription(File f)
{
@@ -253,11 +276,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory represents a disk
+ * drive, and <code>false</code> otherwise. This default implementation
+ * always returns <code>false</code>.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>false</code>.
*/
public boolean isDrive(File dir)
{
@@ -265,11 +290,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if <code>f</code> is a file or directory, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file/directory.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if <code>f</code> is a file or directory, and
+ * <code>false</code> otherwise.
*/
public boolean isFileSystem(File f)
{
@@ -277,11 +304,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory is a file system root,
+ * and <code>false</code> otherwise.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the given directory is a file system root,
+ * and <code>false</code> otherwise.
*/
public boolean isFileSystemRoot(File dir)
{
@@ -296,11 +325,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given directory represents a floppy
+ * drive, and <code>false</code> otherwise. This default implementation
+ * always returns <code>false</code>.
*
- * @param dir DOCUMENT ME!
+ * @param dir the directory.
*
- * @return DOCUMENT ME!
+ * @return <code>false</code>.
*/
public boolean isFloppyDrive(File dir)
{
@@ -308,11 +339,13 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the given file is hidden, and
+ * <code>false</code> otherwise.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the given file is hidden, and
+ * <code>false</code> otherwise.
*/
public boolean isHiddenFile(File f)
{
@@ -320,12 +353,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if <code>folder</code> is the parent of
+ * <code>file</code>, and <code>false</code> otherwise.
*
- * @param folder DOCUMENT ME!
- * @param file DOCUMENT ME!
+ * @param folder the folder (<code>null</code> not permitted).
+ * @param file the file (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if <code>folder</code> is the parent of
+ * <code>file</code>, and <code>false</code> otherwise.
*/
public boolean isParent(File folder, File file)
{
@@ -349,11 +384,14 @@ public abstract class FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise. Here, all directories are considered
+ * traversable, and files are considered non-traversable.
*
- * @param f DOCUMENT ME!
+ * @param f the file or directory (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return <code>true</code> if the file is traversable, and
+ * <code>false</code> otherwise.
*/
public Boolean isTraversable(File f)
{
diff --git a/javax/swing/filechooser/UnixFileSystemView.java b/javax/swing/filechooser/UnixFileSystemView.java
index f2360ec52..c2f65965e 100644
--- a/javax/swing/filechooser/UnixFileSystemView.java
+++ b/javax/swing/filechooser/UnixFileSystemView.java
@@ -43,21 +43,31 @@ import javax.swing.Icon;
/**
- * DOCUMENT ME!
+ * A concrete implementation of {@link FileSystemView} that is appropriate for
+ * Unix-like systems.
+ *
+ * @see FileSystemView#getFileSystemView()
*/
class UnixFileSystemView extends FileSystemView
{
- /** DOCUMENT ME! */
+ /** The default name for new folders. */
private static final String NEW_FOLDER_NAME = "NewFolder";
/**
- * DOCUMENT ME!
+ * Creates a new folder with a unique name in the specified directory and
+ * returns a {@link File} object representing the new directory. The name
+ * of the new folder is <code>NewFolder</code> or, if a directory or file
+ * with that name already exists, <code>NewFolder.n</code> where
+ * <code>n</code> is the lowest integer greater than zero that results in
+ * a unique directory name.
*
- * @param containingDir DOCUMENT ME!
+ * @param containingDir the directory to contain the new folder
+ * (<code>null</code> not permitted).
*
- * @return DOCUMENT ME!
+ * @return A {@link File} object representing the new directory.
*
- * @throws IOException DOCUMENT ME!
+ * @throws IOException if an exception occurs while creating the new
+ * directory.
*/
public File createNewFolder(File containingDir) throws IOException
{
@@ -82,9 +92,9 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns an array containing the file system root.
*
- * @return DOCUMENT ME!
+ * @return An array containing the file system root.
*/
public File[] getRoots()
{
@@ -92,11 +102,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the name of a file as it would be displayed by the underlying
+ * system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemDisplayName(File f)
{
@@ -105,11 +116,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the icon that would be displayed for the given file by the
+ * underlying system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public Icon getSystemIcon(File f)
{
@@ -118,11 +130,12 @@ class UnixFileSystemView extends FileSystemView
}
/**
- * DOCUMENT ME!
+ * Returns the description of a file that would be displayed by the
+ * underlying system. This method is NOT YET IMPLEMENTED.
*
- * @param f DOCUMENT ME!
+ * @param f the file.
*
- * @return DOCUMENT ME!
+ * @return <code>null</code>.
*/
public String getSystemTypeDescription(File f)
{
diff --git a/javax/swing/plaf/basic/BasicLookAndFeel.java b/javax/swing/plaf/basic/BasicLookAndFeel.java
index 64a9b2d08..ab779945b 100644
--- a/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -397,8 +397,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"DesktopIcon.border", new BorderUIResource.CompoundBorderUIResource(null,
null),
"EditorPane.background", new ColorUIResource(Color.white),
- "EditorPane.border",
- new BorderUIResource(BasicBorders.getMarginBorder()),
+ "EditorPane.border", BasicBorders.getMarginBorder(),
"EditorPane.caretBlinkRate", new Integer(500),
"EditorPane.caretForeground", new ColorUIResource(Color.black),
"EditorPane.font", new FontUIResource("Serif", Font.PLAIN, 12),
@@ -985,7 +984,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
new BorderUIResource(BasicBorders.getMarginBorder()),
"TextArea.caretBlinkRate", new Integer(500),
"TextArea.caretForeground", new ColorUIResource(Color.black),
- "TextArea.font", new FontUIResource("Monospaced", Font.PLAIN, 12),
+ "TextArea.font", new FontUIResource("MonoSpaced", Font.PLAIN, 12),
"TextArea.foreground", new ColorUIResource(Color.black),
"TextArea.inactiveForeground", new ColorUIResource(Color.gray),
"TextArea.keyBindings", new JTextComponent.KeyBinding[] {
@@ -1032,8 +1031,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TextField.selectionBackground", new ColorUIResource(Color.black),
"TextField.selectionForeground", new ColorUIResource(Color.white),
"TextPane.background", new ColorUIResource(Color.white),
- "TextPane.border",
- new BorderUIResource(BasicBorders.getMarginBorder()),
+ "TextPane.border", BasicBorders.getMarginBorder(),
"TextPane.caretBlinkRate", new Integer(500),
"TextPane.caretForeground", new ColorUIResource(Color.black),
"TextPane.font", new FontUIResource("Serif", Font.PLAIN, 12),
diff --git a/javax/swing/plaf/basic/BasicScrollPaneUI.java b/javax/swing/plaf/basic/BasicScrollPaneUI.java
index 277b25a00..808ed2763 100644
--- a/javax/swing/plaf/basic/BasicScrollPaneUI.java
+++ b/javax/swing/plaf/basic/BasicScrollPaneUI.java
@@ -185,15 +185,30 @@ public class BasicScrollPaneUI extends ScrollPaneUI
*/
public void propertyChange(PropertyChangeEvent e)
{
- if (e.getPropertyName().equals("viewport"))
+ String propName = e.getPropertyName();
+ if (propName.equals("viewport"))
updateViewport(e);
- else if (e.getPropertyName().equals("rowHeader"))
+ else if (propName.equals("rowHeader"))
updateRowHeader(e);
- else if (e.getPropertyName().equals("columnHeader"))
+ else if (propName.equals("columnHeader"))
updateColumnHeader(e);
- else if (e.getPropertyName().equals("horizontalScrollBarPolicy")
+ else if (propName.equals("horizontalScrollBarPolicy")
|| e.getPropertyName().equals("verticalScrollBarPolicy"))
updateScrollBarDisplayPolicy(e);
+ else if (propName.equals("verticalScrollBar"))
+ {
+ JScrollBar oldSb = (JScrollBar) e.getOldValue();
+ oldSb.getModel().removeChangeListener(vsbChangeListener);
+ JScrollBar newSb = (JScrollBar) e.getNewValue();
+ newSb.getModel().addChangeListener(vsbChangeListener);
+ }
+ else if (propName.equals("horizontalScrollBar"))
+ {
+ JScrollBar oldSb = (JScrollBar) e.getOldValue();
+ oldSb.getModel().removeChangeListener(hsbChangeListener);
+ JScrollBar newSb = (JScrollBar) e.getNewValue();
+ newSb.getModel().addChangeListener(hsbChangeListener);
+ }
}
}
diff --git a/javax/swing/plaf/basic/BasicToolBarUI.java b/javax/swing/plaf/basic/BasicToolBarUI.java
index d02922f74..ef4ed835f 100644
--- a/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -596,6 +596,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
floatingBorderColor = UIManager.getColor("ToolBar.floatingForeground");
floatingColor = UIManager.getColor("ToolBar.floatingBackground");
+ setRolloverBorders(toolBar.isRollover());
}
/**
diff --git a/javax/swing/plaf/metal/MetalScrollPaneUI.java b/javax/swing/plaf/metal/MetalScrollPaneUI.java
index 31fd19d26..d5bf175f9 100644
--- a/javax/swing/plaf/metal/MetalScrollPaneUI.java
+++ b/javax/swing/plaf/metal/MetalScrollPaneUI.java
@@ -49,11 +49,6 @@ import javax.swing.plaf.basic.BasicScrollPaneUI;
public class MetalScrollPaneUI
extends BasicScrollPaneUI
{
-
- // FIXME: maybe replace by a Map of instances when this becomes stateful
- /** The shared UI instance for JScrollPanes. */
- private static MetalScrollPaneUI instance = null;
-
/**
* Constructs a new instance of <code>MetalScrollPaneUI</code>.
*/
@@ -71,8 +66,6 @@ public class MetalScrollPaneUI
*/
public static ComponentUI createUI(JComponent component)
{
- if (instance == null)
- instance = new MetalScrollPaneUI();
- return instance;
+ return new MetalScrollPaneUI();
}
}
diff --git a/javax/swing/text/WrappedPlainView.java b/javax/swing/text/WrappedPlainView.java
index 02200d254..5b70c9df2 100644
--- a/javax/swing/text/WrappedPlainView.java
+++ b/javax/swing/text/WrappedPlainView.java
@@ -226,7 +226,8 @@ public class WrappedPlainView extends BoxView implements TabExpander
protected int calculateBreakPosition(int p0, int p1)
{
Container c = getContainer();
- Rectangle alloc = c.getBounds();
+ Rectangle alloc = c.isValid() ? c.getBounds()
+ : new Rectangle(c.getPreferredSize());
updateMetrics();
try
{