diff --git a/src/share/classes/com/sun/beans/finder/BeanInfoFinder.java b/src/share/classes/com/sun/beans/finder/BeanInfoFinder.java index 3e1c37c2d57c17793e949aa0151a6361b61ec6a3..faab85cafa99eb84bd8e1f56ae5bd365775f8755 100644 --- a/src/share/classes/com/sun/beans/finder/BeanInfoFinder.java +++ b/src/share/classes/com/sun/beans/finder/BeanInfoFinder.java @@ -48,7 +48,7 @@ public final class BeanInfoFinder } private static boolean isValid(Class> type, Method method) { - return (method != null) && type.equals(method.getDeclaringClass()); + return (method != null) && method.getDeclaringClass().isAssignableFrom(type); } @Override diff --git a/src/share/classes/java/lang/Character.java b/src/share/classes/java/lang/Character.java index f20f8e3d3b99386682fb6b24887c369ed60b8cec..56e763ee6a67b668965c0ac23f9b9cae5f76a2cd 100644 --- a/src/share/classes/java/lang/Character.java +++ b/src/share/classes/java/lang/Character.java @@ -38,7 +38,7 @@ import java.util.Locale; * a character's category (lowercase letter, digit, etc.) and for converting * characters from uppercase to lowercase and vice versa. *
- * Character information is based on the Unicode Standard, version 4.0. + * Character information is based on the Unicode Standard, version 5.1.0. *
* The methods and data of class Character
are defined by
* the information in the UnicodeData file that is part of the
diff --git a/src/share/classes/javax/swing/JLayer.java b/src/share/classes/javax/swing/JLayer.java
new file mode 100644
index 0000000000000000000000000000000000000000..b8cc69e9bcd1086dccd072b7ad82838310ac60ef
--- /dev/null
+++ b/src/share/classes/javax/swing/JLayer.java
@@ -0,0 +1,788 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ */
+
+package javax.swing;
+
+import javax.swing.plaf.LayerUI;
+import java.awt.*;
+import java.awt.event.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * {@code JLayer} is a universal decorator for Swing components
+ * which enables you to implement various advanced painting effects as well as
+ * receive notifications of all {@code AWTEvent}s generated within its borders.
+ *
+ * // create a component to be decorated with the layer + * JPanel panel = new JPanel(); + * panel.add(new JButton("JButton")); + * // This custom layerUI will fill the layer with translucent green + * // and print out all mouseMotion events generated within its borders + * LayerUI<JPanel> layerUI = new LayerUI<JPanel>() { + * public void paint(Graphics g, JCompo nent c) { + * // paint the layer as is + * super.paint(g, c); + * // fill it with the translucent green + * g.setColor(new Color(0, 128, 0, 128)); + * g.fillRect(0, 0, c.getWidth(), c.getHeight()); + * } + * // overridden method which catches MouseMotion events + * public void eventDispatched(AWTEvent e, JLayer<JPanel> l) { + * System.out.println("AWTEvent detected: " + e); + * } + * }; + * // create the layer for the panel using our custom layerUI + * JLayer<JPanel> layer = new JLayer<JPanel>(panel, layerUI); + * // work with the layer as with any other Swing component + * frame.add(layer); + *+ * + * Note: {@code JLayer} doesn't support the following methods: + *
+ * public void installUI(JComponent c) { + * super.installUI(c); + * JLayer l = (JLayer) c; + * // this LayerUI will receive only key and focus events + * l.setLayerEventMask(AWTEvent.KEY_EVENT_MASK | AWTEvent.FOCUS_EVENT_MASK); + * } + * + * public void uninstallUI(JComponent c) { + * super.uninstallUI(c); + * JLayer l = (JLayer) c; + * // JLayer must be returned to its initial state + * l.setLayerEventMask(0); + * } + *+ * + * By default {@code JLayer} receives no events. + * + * @param layerEventMask the bitmask of event types to receive + * + * @throws IllegalArgumentException if the {@code layerEventMask} parameter + * contains unsupported event types + * @see #getLayerEventMask() + */ + public void setLayerEventMask(long layerEventMask) { + if (layerEventMask != (layerEventMask & ACCEPTED_EVENTS)) { + throw new IllegalArgumentException( + "The event bitmask contains unsupported event types"); + } + long oldEventMask = getLayerEventMask(); + this.eventMask = layerEventMask; + firePropertyChange("layerEventMask", oldEventMask, layerEventMask); + if (layerEventMask != oldEventMask) { + disableEvents(oldEventMask); + enableEvents(eventMask); + eventController.updateAWTEventListener(this); + } + } + + /** + * Returns the bitmap of event mask to receive by this {@code JLayer} + * and its {@code LayerUI}. + * + * It means that {@link javax.swing.plaf.LayerUI#eventDispatched(AWTEvent, JLayer)} method + * will only receive events that match the event mask. + * + * By default {@code JLayer} receives no events. + * + * @return the bitmask of event types to receive for this {@code JLayer} + */ + public long getLayerEventMask() { + return eventMask; + } + + /** + * Delegates its functionality to the {@link javax.swing.plaf.LayerUI#updateUI(JLayer)} method, + * if {@code LayerUI} is set. + */ + public void updateUI() { + if (getUI() != null) { + getUI().updateUI(this); + } + } + + /** + * Returns the preferred size of the viewport for a view component. + * + * If the ui delegate of this layer is not {@code null}, this method delegates its + * implementation to the {@code LayerUI.getPreferredScrollableViewportSize(JLayer)} + * + * @return the preferred size of the viewport for a view component + * + * @see Scrollable + * @see LayerUI#getPreferredScrollableViewportSize(JLayer) + */ + public Dimension getPreferredScrollableViewportSize() { + if (getUI() != null) { + return getUI().getPreferredScrollableViewportSize(this); + } + return getPreferredSize(); + } + + /** + * Returns a scroll increment, which is required for components + * that display logical rows or columns in order to completely expose + * one block of rows or columns, depending on the value of orientation. + * + * If the ui delegate of this layer is not {@code null}, this method delegates its + * implementation to the {@code LayerUI.getScrollableBlockIncrement(JLayer,Rectangle,int,int)} + * + * @return the "block" increment for scrolling in the specified direction + * + * @see Scrollable + * @see LayerUI#getScrollableBlockIncrement(JLayer, Rectangle, int, int) + */ + public int getScrollableBlockIncrement(Rectangle visibleRect, + int orientation, int direction) { + if (getUI() != null) { + return getUI().getScrollableBlockIncrement(this, visibleRect, + orientation, direction); + } + return (orientation == SwingConstants.VERTICAL) ? visibleRect.height : + visibleRect.width; + } + + /** + * Returns {@code false} to indicate that the height of the viewport does not + * determine the height of the layer, unless the preferred height + * of the layer is smaller than the height of the viewport. + * + * If the ui delegate of this layer is not null, this method delegates its + * implementation to the {@code LayerUI.getScrollableTracksViewportHeight(JLayer)} + * + * @return whether the layer should track the height of the viewport + * + * @see Scrollable + * @see LayerUI#getScrollableTracksViewportHeight(JLayer) + */ + public boolean getScrollableTracksViewportHeight() { + if (getUI() != null) { + return getUI().getScrollableTracksViewportHeight(this); + } + if (getParent() instanceof JViewport) { + return ((getParent()).getHeight() > getPreferredSize().height); + } + return false; + } + + /** + * Returns {@code false} to indicate that the width of the viewport does not + * determine the width of the layer, unless the preferred width + * of the layer is smaller than the width of the viewport. + * + * If the ui delegate of this layer is not null, this method delegates its + * implementation to the {@code LayerUI.getScrollableTracksViewportWidth(JLayer)} + * + * @return whether the layer should track the width of the viewport + * + * @see Scrollable + * @see LayerUI#getScrollableTracksViewportWidth(JLayer) + */ + public boolean getScrollableTracksViewportWidth() { + if (getUI() != null) { + return getUI().getScrollableTracksViewportWidth(this); + } + if (getParent() instanceof JViewport) { + return ((getParent()).getWidth() > getPreferredSize().width); + } + return false; + } + + /** + * Returns a scroll increment, which is required for components + * that display logical rows or columns in order to completely expose + * one new row or column, depending on the value of orientation. + * Ideally, components should handle a partially exposed row or column + * by returning the distance required to completely expose the item. + * + * Scrolling containers, like {@code JScrollPane}, will use this method + * each time the user requests a unit scroll. + * + * If the ui delegate of this layer is not {@code null}, this method delegates its + * implementation to the {@code LayerUI.getScrollableUnitIncrement(JLayer,Rectangle,int,int)} + * + * @return The "unit" increment for scrolling in the specified direction. + * This value should always be positive. + * + * @see Scrollable + * @see LayerUI#getScrollableUnitIncrement(JLayer, Rectangle, int, int) + */ + public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, + int direction) { + if (getUI() != null) { + return getUI().getScrollableUnitIncrement( + this, visibleRect, orientation, direction); + } + return 1; + } + + private void readObject(ObjectInputStream s) + throws IOException, ClassNotFoundException { + s.defaultReadObject(); + if (getUI() != null) { + setUI(getUI()); + } + if (getLayerEventMask() != 0) { + eventController.updateAWTEventListener(this); + } + } + + /** + * static AWTEventListener to be shared with all AbstractLayerUIs + */ + private static class LayerEventController implements AWTEventListener { + private ArrayList
+ * To enable the {@code AWTEvent} of the particular type, + * you call {@link javax.swing.JLayer#setLayerEventMask} + * in {@link #installUI(javax.swing.JComponent)} + * and set the layer event mask to {@code 0} + * in {@link #uninstallUI(javax.swing.JComponent)} after that + * + * @param e the event to be dispatched + * @param l the layer this LayerUI is set to + * + * @see JLayer#setLayerEventMask(long) + * @see javax.swing.JLayer#getLayerEventMask() + */ + public void eventDispatched(AWTEvent e, JLayer extends V> l){ + } + + /** + * Invoked when {@link javax.swing.JLayer#updateUI()} is called + * by the {@code JLayer} this {@code LayerUI} is set to. + * + * @param l the {@code JLayer} which UI is updated + */ + public void updateUI(JLayer extends V> l){ + } + + /** + * Configures the {@code JLayer} this {@code LayerUI} is set to. + * The default implementation registers the {@code LayerUI} + * as a property change listener for the passed {@code JLayer} component. + * + * @param c the {@code JLayer} component where this UI delegate is being installed + */ + public void installUI(JComponent c) { + addPropertyChangeListener((JLayer) c); + } + + /** + * Reverses the configuration which was previously set + * in the {@link #installUI(JComponent)} method. + * The default implementation unregisters the property change listener + * for the passed JLayer component. + * + * @param c the component from which this UI delegate is being removed. + */ + public void uninstallUI(JComponent c) { + removePropertyChangeListener((JLayer) c); + } + + /** + * Adds a PropertyChangeListener to the listener list. The listener is + * registered for all bound properties of this class. + *
+ * If {@code listener} is {@code null}, + * no exception is thrown and no action is performed. + * + * @param listener the property change listener to be added + * @see #removePropertyChangeListener + * @see #getPropertyChangeListeners + * @see #addPropertyChangeListener(String, java.beans.PropertyChangeListener) + */ + public void addPropertyChangeListener(PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * Removes a PropertyChangeListener from the listener list. This method + * should be used to remove PropertyChangeListeners that were registered + * for all bound properties of this class. + * + * If {@code listener} is {@code null}, + * no exception is thrown and no action is performed. + * + * @param listener the PropertyChangeListener to be removed + * @see #addPropertyChangeListener + * @see #getPropertyChangeListeners + * @see #removePropertyChangeListener(String, PropertyChangeListener) + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * Returns an array of all the property change listeners + * registered on this component. + * + * @return all of this ui's {@code PropertyChangeListener}s + * or an empty array if no property change + * listeners are currently registered + * @see #addPropertyChangeListener + * @see #removePropertyChangeListener + * @see #getPropertyChangeListeners(String) + */ + public PropertyChangeListener[] getPropertyChangeListeners() { + return propertyChangeSupport.getPropertyChangeListeners(); + } + + /** + * Adds a PropertyChangeListener to the listener list for a specific + * property. + * + * If {@code propertyName} or {@code listener} is {@code null}, + * no exception is thrown and no action is taken. + * + * @param propertyName one of the property names listed above + * @param listener the property change listener to be added + * @see #removePropertyChangeListener(String, PropertyChangeListener) + * @see #getPropertyChangeListeners(String) + * @see #addPropertyChangeListener(String, PropertyChangeListener) + */ + public void addPropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * Removes a {@code PropertyChangeListener} from the listener + * list for a specific property. This method should be used to remove + * {@code PropertyChangeListener}s + * that were registered for a specific bound property. + * + * If {@code propertyName} or {@code listener} is {@code null}, + * no exception is thrown and no action is taken. + * + * @param propertyName a valid property name + * @param listener the PropertyChangeListener to be removed + * @see #addPropertyChangeListener(String, PropertyChangeListener) + * @see #getPropertyChangeListeners(String) + * @see #removePropertyChangeListener(PropertyChangeListener) + */ + public void removePropertyChangeListener(String propertyName, + PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(propertyName, listener); + } + + /** + * Returns an array of all the listeners which have been associated + * with the named property. + * + * @return all of the {@code PropertyChangeListener}s associated with + * the named property; if no such listeners have been added or + * if {@code propertyName} is {@code null}, an empty + * array is returned + * @see #addPropertyChangeListener(String, PropertyChangeListener) + * @see #removePropertyChangeListener(String, PropertyChangeListener) + * @see #getPropertyChangeListeners + */ + public PropertyChangeListener[] getPropertyChangeListeners(String propertyName) { + return propertyChangeSupport.getPropertyChangeListeners(propertyName); + } + + /** + * Support for reporting bound property changes for Object properties. + * This method can be called when a bound property has changed and it will + * send the appropriate PropertyChangeEvent to any registered + * PropertyChangeListeners. + * + * @param propertyName the property whose value has changed + * @param oldValue the property's previous value + * @param newValue the property's new value + */ + protected void firePropertyChange(String propertyName, + Object oldValue, Object newValue) { + propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue); + } + + /** + * Notifies the {@code LayerUI} when any of its property are changed + * and enables updating every {@code JLayer} this {@code LayerUI} instance is set to. + * + * @param evt the PropertyChangeEvent generated by this {@code LayerUI} + * @param l the {@code JLayer} this LayerUI is set to + */ + public void applyPropertyChange(PropertyChangeEvent evt, JLayer extends V> l) { + } + + /** + * Returns the preferred size of the viewport for a view component. + * + * @return the preferred size of the viewport for a view component + * @see Scrollable#getPreferredScrollableViewportSize() + */ + public Dimension getPreferredScrollableViewportSize(JLayer extends V> l) { + if (l.getView() instanceof Scrollable) { + return ((Scrollable)l.getView()).getPreferredScrollableViewportSize(); + } + return l.getPreferredSize(); + } + + /** + * Returns a scroll increment, which is required for components + * that display logical rows or columns in order to completely expose + * one block of rows or columns, depending on the value of orientation. + * + * @return the "block" increment for scrolling in the specified direction + * @see Scrollable#getScrollableBlockIncrement(Rectangle, int, int) + */ + public int getScrollableBlockIncrement(JLayer extends V> l, + Rectangle visibleRect, + int orientation, int direction) { + if (l.getView() instanceof Scrollable) { + return ((Scrollable)l.getView()).getScrollableBlockIncrement( + visibleRect,orientation, direction); + } + return (orientation == SwingConstants.VERTICAL) ? visibleRect.height : + visibleRect.width; + } + + /** + * Returns {@code false} to indicate that the height of the viewport does not + * determine the height of the layer, unless the preferred height + * of the layer is smaller than the height of the viewport. + * + * @return whether the layer should track the height of the viewport + * @see Scrollable#getScrollableTracksViewportHeight() + */ + public boolean getScrollableTracksViewportHeight(JLayer extends V> l) { + if (l.getView() instanceof Scrollable) { + return ((Scrollable)l.getView()).getScrollableTracksViewportHeight(); + } + if (l.getParent() instanceof JViewport) { + return (((JViewport)l.getParent()).getHeight() > l.getPreferredSize().height); + } + return false; + } + + /** + * Returns {@code false} to indicate that the width of the viewport does not + * determine the width of the layer, unless the preferred width + * of the layer is smaller than the width of the viewport. + * + * @return whether the layer should track the width of the viewport + * @see Scrollable + * @see LayerUI#getScrollableTracksViewportWidth(JLayer) + */ + public boolean getScrollableTracksViewportWidth(JLayer extends V> l) { + if (l.getView() instanceof Scrollable) { + return ((Scrollable)l.getView()).getScrollableTracksViewportWidth(); + } + if (l.getParent() instanceof JViewport) { + return (((JViewport)l.getParent()).getWidth() > l.getPreferredSize().width); + } + return false; + } + + /** + * Returns a scroll increment, which is required for components + * that display logical rows or columns in order to completely expose + * one new row or column, depending on the value of orientation. + * Ideally, components should handle a partially exposed row or column + * by returning the distance required to completely expose the item. + *
+ * Scrolling containers, like JScrollPane, will use this method
+ * each time the user requests a unit scroll.
+ *
+ * @return The "unit" increment for scrolling in the specified direction.
+ * This value should always be positive.
+ * @see Scrollable#getScrollableUnitIncrement(Rectangle, int, int)
+ */
+ public int getScrollableUnitIncrement(JLayer extends V> l,
+ Rectangle visibleRect,
+ int orientation, int direction) {
+ if (l.getView() instanceof Scrollable) {
+ return ((Scrollable)l.getView()).getScrollableUnitIncrement(
+ visibleRect, orientation, direction);
+ }
+ return 1;
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this calls the view's {@code getBaseline()} method.
+ * Otherwise, the default implementation is called.
+ *
+ * @param c {@code JLayer} to return baseline resize behavior for
+ * @param width the width to get the baseline for
+ * @param height the height to get the baseline for
+ * @return baseline or a value < 0 indicating there is no reasonable
+ * baseline
+ */
+ public int getBaseline(JComponent c, int width, int height) {
+ JLayer l = (JLayer) c;
+ if (l.getView() != null) {
+ return l.getView().getBaseline(width, height);
+ }
+ return super.getBaseline(c, width, height);
+ }
+
+ /**
+ * If the {@code JLayer}'s view component is not {@code null},
+ * this calls the view's {@code getBaselineResizeBehavior()} method.
+ * Otherwise, the default implementation is called.
+ *
+ * @param c {@code JLayer} to return baseline resize behavior for
+ * @return an enum indicating how the baseline changes as the component
+ * size changes
+ */
+ public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c) {
+ JLayer l = (JLayer) c;
+ if (l.getView() != null) {
+ return l.getView().getBaselineResizeBehavior();
+ }
+ return super.getBaselineResizeBehavior(c);
+ }
+}
\ No newline at end of file
diff --git a/src/share/classes/javax/swing/text/GlyphView.java b/src/share/classes/javax/swing/text/GlyphView.java
index 087e9201545612c1782d31028a03a7724abd328c..64db8cd6cd129dc8882decad8c8f6788ee5c47b6 100644
--- a/src/share/classes/javax/swing/text/GlyphView.java
+++ b/src/share/classes/javax/swing/text/GlyphView.java
@@ -540,30 +540,7 @@ public class GlyphView extends View implements TabableView, Cloneable {
*/
@Override
public float getMinimumSpan(int axis) {
- switch (axis) {
- case View.X_AXIS:
- if (minimumSpan < 0) {
- minimumSpan = 0;
- int p0 = getStartOffset();
- int p1 = getEndOffset();
- while (p1 > p0) {
- int breakSpot = getBreakSpot(p0, p1);
- if (breakSpot == BreakIterator.DONE) {
- // the rest of the view is non-breakable
- breakSpot = p0;
- }
- minimumSpan = Math.max(minimumSpan,
- getPartialSpan(breakSpot, p1));
- // Note: getBreakSpot returns the *last* breakspot
- p1 = breakSpot - 1;
- }
- }
- return minimumSpan;
- case View.Y_AXIS:
- return super.getMinimumSpan(axis);
- default:
- throw new IllegalArgumentException("Invalid axis: " + axis);
- }
+ return super.getMinimumSpan(axis);
}
/**
diff --git a/src/share/classes/javax/swing/text/ParagraphView.java b/src/share/classes/javax/swing/text/ParagraphView.java
index 2b5f7826a08bc047b424731a7e0251626a2e0b82..c02ea4d810ea86b0e8e82d818ead79a115590a52 100644
--- a/src/share/classes/javax/swing/text/ParagraphView.java
+++ b/src/share/classes/javax/swing/text/ParagraphView.java
@@ -721,35 +721,7 @@ public class ParagraphView extends FlowView implements TabExpander {
@Override
protected SizeRequirements calculateMinorAxisRequirements(int axis,
SizeRequirements r) {
- r = super.calculateMinorAxisRequirements(axis, r);
-
- float min = 0;
- float glue = 0;
- int n = getLayoutViewCount();
- for (int i = 0; i < n; i++) {
- View v = getLayoutView(i);
- float span = v.getMinimumSpan(axis);
- if (v.getBreakWeight(axis, 0, v.getMaximumSpan(axis))
- > View.BadBreakWeight) {
- // find the longest non-breakable fragments at the view edges
- int p0 = v.getStartOffset();
- int p1 = v.getEndOffset();
- float start = findEdgeSpan(v, axis, p0, p0, p1);
- float end = findEdgeSpan(v, axis, p1, p0, p1);
- glue += start;
- min = Math.max(min, Math.max(span, glue));
- glue = end;
- } else {
- // non-breakable view
- glue += span;
- min = Math.max(min, glue);
- }
- }
- r.minimum = Math.max(r.minimum, (int) min);
- r.preferred = Math.max(r.minimum, r.preferred);
- r.maximum = Math.max(r.preferred, r.maximum);
-
- return r;
+ return super.calculateMinorAxisRequirements(axis, r);
}
/**
diff --git a/src/share/classes/javax/swing/text/WrappedPlainView.java b/src/share/classes/javax/swing/text/WrappedPlainView.java
index fb7aede73748731833974d6593167329e460235f..b845419ad781599e5bf8f57e8ccf8f0b91fb560f 100644
--- a/src/share/classes/javax/swing/text/WrappedPlainView.java
+++ b/src/share/classes/javax/swing/text/WrappedPlainView.java
@@ -327,13 +327,45 @@ public class WrappedPlainView extends BoxView implements TabExpander {
/**
* Return reasonable default values for the view dimensions. The standard
* text terminal size 80x24 is pretty suitable for the wrapped plain view.
+ *
+ * The size should not be larger than the component housing the view's
+ * container.
*/
private float getDefaultSpan(int axis) {
+ Container host = getContainer();
+ Component parent = null;
+
+ if (host != null) {
+ parent = host.getParent();
+ }
+
switch (axis) {
case View.X_AXIS:
- return 80 * metrics.getWidths()['M'];
+ int defaultWidth = 80 * metrics.getWidths()['M'];
+ int parentWidth = 0;
+
+ if (parent != null) {
+ parentWidth = parent.getWidth();
+ }
+
+ if (defaultWidth > parentWidth) {
+ return parentWidth;
+ }
+ return defaultWidth;
+
case View.Y_AXIS:
- return 24 * metrics.getHeight();
+ int defaultHeight = 24 * metrics.getHeight();
+ int parentHeight = 0;
+
+ if (parent != null) {
+ parentHeight = parent.getHeight();
+ }
+
+ if (defaultHeight > parentHeight) {
+ return parentHeight;
+ }
+ return defaultHeight;
+
default:
throw new IllegalArgumentException("Invalid axis: " + axis);
}
diff --git a/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
index 1b81007fe8e95d6048727ed0d4a53dde037ab2a6..c1efb0de52c4c1f8f4a77742818251130b618ffb 100644
--- a/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
+++ b/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
@@ -73,12 +73,7 @@ final class Win32ShellFolder2 extends ShellFolder {
private static native void initIDs();
- private static final boolean is98;
-
static {
- String osName = System.getProperty("os.name");
- is98 = (osName != null && osName.startsWith("Windows 98"));
-
initIDs();
}
@@ -305,7 +300,6 @@ final class Win32ShellFolder2 extends ShellFolder {
}, RuntimeException.class)
);
this.disposer.relativePIDL = relativePIDL;
- getAbsolutePath();
sun.java2d.Disposer.addRecord(this, disposer);
}
@@ -616,11 +610,8 @@ final class Win32ShellFolder2 extends ShellFolder {
public boolean isDirectory() {
if (isDir == null) {
// Folders with SFGAO_BROWSABLE have "shell extension" handlers and are
- // not traversable in JFileChooser. An exception is "My Documents" on
- // Windows 98.
- if (hasAttribute(ATTRIB_FOLDER)
- && (!hasAttribute(ATTRIB_BROWSABLE) ||
- (is98 && equals(Win32ShellFolderManager2.getPersonal())))) {
+ // not traversable in JFileChooser.
+ if (hasAttribute(ATTRIB_FOLDER) && !hasAttribute(ATTRIB_BROWSABLE)) {
isDir = Boolean.TRUE;
} else if (isLink()) {
ShellFolder linkLocation = getLinkLocation(false);
diff --git a/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java b/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
index 4471a3ec0daf3515cd0575b6aca0de766f6caea9..8b692fa685a09141bce7caef8fc7f799bf6dfd71 100644
--- a/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
+++ b/src/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java
@@ -105,9 +105,11 @@ public class Win32ShellFolderManager2 extends ShellFolderManager {
private static Win32ShellFolder2 network;
private static Win32ShellFolder2 personal;
- private static String osVersion = System.getProperty("os.version");
- private static final boolean useShell32Icons =
- (osVersion != null && osVersion.compareTo("5.1") >= 0);
+ private static final boolean USE_SHELL32_ICONS = AccessController.doPrivileged(new PrivilegedActiondir
represent a "computer" such as a node on the network, or
* "My Computer" on the desktop.
*/
- public boolean isComputerNode(File dir) {
+ public boolean isComputerNode(final File dir) {
if (dir != null && dir == getDrives()) {
return true;
} else {
- String path = dir.getAbsolutePath();
+ String path = AccessController.doPrivileged(new PrivilegedAction