aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/javax
diff options
context:
space:
mode:
authorasaha <none@none>2014-05-29 13:42:52 -0700
committerasaha <none@none>2014-05-29 13:42:52 -0700
commit5f73d6a29eb4d206d8d5a65a76efbcdc3cb32cad (patch)
tree11eabb3ecbfbecda3d653290b94293a3930f598b /src/share/classes/javax
parent1aa1cd411bc19380df9f2480ff41a2056c798499 (diff)
parentb9cdb7c9c27a8fe18aa07c224ff335cbb9054408 (diff)
Merge
Diffstat (limited to 'src/share/classes/javax')
-rw-r--r--src/share/classes/javax/accessibility/AccessibleContext.java23
-rw-r--r--src/share/classes/javax/sound/midi/spi/MidiDeviceProvider.java33
-rw-r--r--src/share/classes/javax/sound/midi/spi/MidiFileReader.java143
-rw-r--r--src/share/classes/javax/sound/midi/spi/MidiFileWriter.java78
-rw-r--r--src/share/classes/javax/sound/midi/spi/SoundbankReader.java58
-rw-r--r--src/share/classes/javax/swing/JComboBox.java22
-rw-r--r--src/share/classes/javax/swing/JComponent.java11
-rw-r--r--src/share/classes/javax/swing/JTable.java73
-rw-r--r--src/share/classes/javax/swing/JTree.java52
-rw-r--r--src/share/classes/javax/swing/MenuSelectionManager.java9
-rw-r--r--src/share/classes/javax/swing/border/LineBorder.java4
-rw-r--r--src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java6
-rw-r--r--src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java18
-rw-r--r--src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java82
-rw-r--r--src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java96
-rw-r--r--src/share/classes/javax/swing/text/JTextComponent.java104
-rw-r--r--src/share/classes/javax/swing/text/html/EditableView.java2
-rw-r--r--src/share/classes/javax/swing/text/html/HTMLEditorKit.java19
-rw-r--r--src/share/classes/javax/swing/text/html/ResourceLoader.java60
-rw-r--r--src/share/classes/javax/swing/text/html/parser/Parser.java9
-rw-r--r--src/share/classes/javax/swing/text/html/parser/ParserDelegator.java18
-rw-r--r--src/share/classes/javax/swing/text/html/parser/ResourceLoader.java60
-rw-r--r--src/share/classes/javax/swing/text/rtf/RTFReader.java22
23 files changed, 425 insertions, 577 deletions
diff --git a/src/share/classes/javax/accessibility/AccessibleContext.java b/src/share/classes/javax/accessibility/AccessibleContext.java
index 1c590318f..c8f5bd044 100644
--- a/src/share/classes/javax/accessibility/AccessibleContext.java
+++ b/src/share/classes/javax/accessibility/AccessibleContext.java
@@ -25,6 +25,9 @@
package javax.accessibility;
+import sun.awt.AWTAccessor;
+import sun.awt.AppContext;
+
import java.util.Locale;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
@@ -79,6 +82,26 @@ import java.awt.IllegalComponentStateException;
*/
public abstract class AccessibleContext {
+ /**
+ * The AppContext that should be used to dispatch events for this
+ * AccessibleContext
+ */
+ private volatile AppContext targetAppContext;
+
+ static {
+ AWTAccessor.setAccessibleContextAccessor(new AWTAccessor.AccessibleContextAccessor() {
+ @Override
+ public void setAppContext(AccessibleContext accessibleContext, AppContext appContext) {
+ accessibleContext.targetAppContext = appContext;
+ }
+
+ @Override
+ public AppContext getAppContext(AccessibleContext accessibleContext) {
+ return accessibleContext.targetAppContext;
+ }
+ });
+ }
+
/**
* Constant used to determine when the accessibleName property has
* changed. The old value in the PropertyChangeEvent will be the old
diff --git a/src/share/classes/javax/sound/midi/spi/MidiDeviceProvider.java b/src/share/classes/javax/sound/midi/spi/MidiDeviceProvider.java
index 4146d3d9f..b4c95a1ec 100644
--- a/src/share/classes/javax/sound/midi/spi/MidiDeviceProvider.java
+++ b/src/share/classes/javax/sound/midi/spi/MidiDeviceProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,26 +26,24 @@
package javax.sound.midi.spi;
import javax.sound.midi.MidiDevice;
-import javax.sound.midi.MidiUnavailableException;
/**
- * A <code>MidiDeviceProvider</code> is a factory or provider for a particular
- * type of MIDI device.
- * This mechanism allows the implementation to determine
- * how resources are managed in the creation and management of
- * a device.
+ * A {@code MidiDeviceProvider} is a factory or provider for a particular type
+ * of MIDI device. This mechanism allows the implementation to determine how
+ * resources are managed in the creation and management of a device.
*
* @author Kara Kytle
*/
public abstract class MidiDeviceProvider {
-
/**
* Indicates whether the device provider supports the device represented by
* the specified device info object.
- * @param info an info object that describes the device for which support is queried
- * @return <code>true</code> if the specified device is supported,
- * otherwise <code>false</code>
+ *
+ * @param info an info object that describes the device for which support
+ * is queried
+ * @return {@code true} if the specified device is supported, otherwise
+ * {@code false}
*/
public boolean isDeviceSupported(MidiDevice.Info info) {
@@ -59,21 +57,22 @@ public abstract class MidiDeviceProvider {
return false;
}
-
/**
- * Obtains the set of info objects representing the device
- * or devices provided by this <code>MidiDeviceProvider</code>.
+ * Obtains the set of info objects representing the device or devices
+ * provided by this {@code MidiDeviceProvider}.
+ *
* @return set of device info objects
*/
public abstract MidiDevice.Info[] getDeviceInfo();
-
/**
* Obtains an instance of the device represented by the info object.
- * @param info an info object that describes the desired device
+ *
+ * @param info an info object that describes the desired device
* @return device instance
* @throws IllegalArgumentException if the info object specified does not
- * match the info object for a device supported by this <code>MidiDeviceProvider</code>.
+ * match the info object for a device supported by this
+ * {@code MidiDeviceProvider}
*/
public abstract MidiDevice getDevice(MidiDevice.Info info);
}
diff --git a/src/share/classes/javax/sound/midi/spi/MidiFileReader.java b/src/share/classes/javax/sound/midi/spi/MidiFileReader.java
index 2c050b800..ecb72b32d 100644
--- a/src/share/classes/javax/sound/midi/spi/MidiFileReader.java
+++ b/src/share/classes/javax/sound/midi/spi/MidiFileReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,9 +35,10 @@ import javax.sound.midi.Sequence;
import javax.sound.midi.InvalidMidiDataException;
/**
- * A <code>MidiFileReader</code> supplies MIDI file-reading services. Classes implementing this
- * interface can parse the format information from one or more types of
- * MIDI file, and can produce a <code>Sequence</code> object from files of these types.
+ * A {@code MidiFileReader} supplies MIDI file-reading services. Classes
+ * implementing this interface can parse the format information from one or more
+ * types of MIDI file, and can produce a {@link Sequence} object from files of
+ * these types.
*
* @author Kara Kytle
* @since 1.3
@@ -45,98 +46,102 @@ import javax.sound.midi.InvalidMidiDataException;
public abstract class MidiFileReader {
/**
- * Obtains the MIDI file format of the input stream provided. The stream must
- * point to valid MIDI file data. In general, MIDI file readers may
+ * Obtains the MIDI file format of the input stream provided. The stream
+ * must point to valid MIDI file data. In general, MIDI file readers may
* need to read some data from the stream before determining whether they
- * support it. These parsers must
- * be able to mark the stream, read enough data to determine whether they
- * support the stream, and, if not, reset the stream's read pointer to its original
- * position. If the input stream does not support this, this method may fail
- * with an <code>IOException</code>.
- * @param stream the input stream from which file format information should be
- * extracted
- * @return a <code>MidiFileFormat</code> object describing the MIDI file format
- * @throws InvalidMidiDataException if the stream does not point to valid MIDI
- * file data recognized by the system
+ * support it. These parsers must be able to mark the stream, read enough
+ * data to determine whether they support the stream, and, if not, reset the
+ * stream's read pointer to its original position. If the input stream does
+ * not support this, this method may fail with an {@code IOException}.
+ *
+ * @param stream the input stream from which file format information
+ * should be extracted
+ * @return a {@code MidiFileFormat} object describing the MIDI file format
+ * @throws InvalidMidiDataException if the stream does not point to valid
+ * MIDI file data recognized by the system
* @throws IOException if an I/O exception occurs
* @see InputStream#markSupported
* @see InputStream#mark
*/
- public abstract MidiFileFormat getMidiFileFormat(InputStream stream) throws InvalidMidiDataException, IOException;
-
+ public abstract MidiFileFormat getMidiFileFormat(InputStream stream)
+ throws InvalidMidiDataException, IOException;
/**
- * Obtains the MIDI file format of the URL provided. The URL must
- * point to valid MIDI file data.
- * @param url the URL from which file format information should be
- * extracted
- * @return a <code>MidiFileFormat</code> object describing the MIDI file format
+ * Obtains the MIDI file format of the URL provided. The URL must point to
+ * valid MIDI file data.
+ *
+ * @param url the URL from which file format information should be
+ * extracted
+ * @return a {@code MidiFileFormat} object describing the MIDI file format
* @throws InvalidMidiDataException if the URL does not point to valid MIDI
- * file data recognized by the system
+ * file data recognized by the system
* @throws IOException if an I/O exception occurs
*/
- public abstract MidiFileFormat getMidiFileFormat(URL url) throws InvalidMidiDataException, IOException;
-
+ public abstract MidiFileFormat getMidiFileFormat(URL url)
+ throws InvalidMidiDataException, IOException;
/**
- * Obtains the MIDI file format of the <code>File</code> provided.
- * The <code>File</code> must point to valid MIDI file data.
- * @param file the <code>File</code> from which file format information should be
- * extracted
- * @return a <code>MidiFileFormat</code> object describing the MIDI file format
- * @throws InvalidMidiDataException if the <code>File</code> does not point to valid MIDI
- * file data recognized by the system
+ * Obtains the MIDI file format of the {@code File} provided. The
+ * {@code File} must point to valid MIDI file data.
+ *
+ * @param file the {@code File} from which file format information should
+ * be extracted
+ * @return a {@code MidiFileFormat} object describing the MIDI file format
+ * @throws InvalidMidiDataException if the {@code File} does not point to
+ * valid MIDI file data recognized by the system
* @throws IOException if an I/O exception occurs
*/
- public abstract MidiFileFormat getMidiFileFormat(File file) throws InvalidMidiDataException, IOException;
-
+ public abstract MidiFileFormat getMidiFileFormat(File file)
+ throws InvalidMidiDataException, IOException;
/**
- * Obtains a MIDI sequence from the input stream provided. The stream must
- * point to valid MIDI file data. In general, MIDI file readers may
- * need to read some data from the stream before determining whether they
- * support it. These parsers must
- * be able to mark the stream, read enough data to determine whether they
- * support the stream, and, if not, reset the stream's read pointer to its original
- * position. If the input stream does not support this, this method may fail
- * with an IOException.
- * @param stream the input stream from which the <code>Sequence</code> should be
- * constructed
- * @return a <code>Sequence</code> object based on the MIDI file data contained
- * in the input stream.
- * @throws InvalidMidiDataException if the stream does not point to valid MIDI
- * file data recognized by the system
+ * Obtains a MIDI sequence from the input stream provided. The stream must
+ * point to valid MIDI file data. In general, MIDI file readers may need to
+ * read some data from the stream before determining whether they support
+ * it. These parsers must be able to mark the stream, read enough data to
+ * determine whether they support the stream, and, if not, reset the
+ * stream's read pointer to its original position. If the input stream does
+ * not support this, this method may fail with an IOException.
+ *
+ * @param stream the input stream from which the {@code Sequence} should
+ * be constructed
+ * @return a {@code Sequence} object based on the MIDI file data contained
+ * in the input stream.
+ * @throws InvalidMidiDataException if the stream does not point to valid
+ * MIDI file data recognized by the system
* @throws IOException if an I/O exception occurs
* @see InputStream#markSupported
* @see InputStream#mark
*/
- public abstract Sequence getSequence(InputStream stream) throws InvalidMidiDataException, IOException;
-
+ public abstract Sequence getSequence(InputStream stream)
+ throws InvalidMidiDataException, IOException;
/**
- * Obtains a MIDI sequence from the URL provided. The URL must
- * point to valid MIDI file data.
- * @param url the URL for which the <code>Sequence</code> should be
- * constructed
- * @return a <code>Sequence</code> object based on the MIDI file data pointed
- * to by the URL
+ * Obtains a MIDI sequence from the URL provided. The URL must point to
+ * valid MIDI file data.
+ *
+ * @param url the URL for which the {@code Sequence} should be constructed
+ * @return a {@code Sequence} object based on the MIDI file data pointed to
+ * by the URL
* @throws InvalidMidiDataException if the URL does not point to valid MIDI
- * file data recognized by the system
+ * file data recognized by the system
* @throws IOException if an I/O exception occurs
*/
- public abstract Sequence getSequence(URL url) throws InvalidMidiDataException, IOException;
-
+ public abstract Sequence getSequence(URL url)
+ throws InvalidMidiDataException, IOException;
/**
- * Obtains a MIDI sequence from the <code>File</code> provided. The <code>File</code> must
- * point to valid MIDI file data.
- * @param file the <code>File</code> from which the <code>Sequence</code> should be
- * constructed
- * @return a <code>Sequence</code> object based on the MIDI file data pointed
- * to by the <code>File</code>
- * @throws InvalidMidiDataException if the <code>File</code> does not point to valid MIDI
- * file data recognized by the system
+ * Obtains a MIDI sequence from the {@code File} provided. The {@code File}
+ * must point to valid MIDI file data.
+ *
+ * @param file the {@code File} from which the {@code Sequence} should be
+ * constructed
+ * @return a {@code Sequence} object based on the MIDI file data pointed to
+ * by the {@code File}
+ * @throws InvalidMidiDataException if the {@code File} does not point to
+ * valid MIDI file data recognized by the system
* @throws IOException if an I/O exception occurs
*/
- public abstract Sequence getSequence(File file) throws InvalidMidiDataException, IOException;
+ public abstract Sequence getSequence(File file)
+ throws InvalidMidiDataException, IOException;
}
diff --git a/src/share/classes/javax/sound/midi/spi/MidiFileWriter.java b/src/share/classes/javax/sound/midi/spi/MidiFileWriter.java
index 531c54852..a1800f7f7 100644
--- a/src/share/classes/javax/sound/midi/spi/MidiFileWriter.java
+++ b/src/share/classes/javax/sound/midi/spi/MidiFileWriter.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,45 +30,44 @@ import java.io.IOException;
import java.io.OutputStream;
import javax.sound.midi.Sequence;
-import javax.sound.midi.MidiFileFormat;
/**
- * A <code>MidiFileWriter</code> supplies MIDI file-writing services. Classes
- * that implement this interface can write one or more types of MIDI file from
- * a <code>{@link Sequence}</code> object.
+ * A {@code MidiFileWriter} supplies MIDI file-writing services. Classes that
+ * implement this interface can write one or more types of MIDI file from a
+ * {@link Sequence} object.
*
* @author Kara Kytle
* @since 1.3
*/
public abstract class MidiFileWriter {
-
/**
* Obtains the set of MIDI file types for which file writing support is
* provided by this file writer.
- * @return array of file types. If no file types are supported,
- * an array of length 0 is returned.
+ *
+ * @return array of file types. If no file types are supported, an array of
+ * length 0 is returned.
*/
public abstract int[] getMidiFileTypes();
-
/**
- * Obtains the file types that this file writer can write from the
- * sequence specified.
- * @param sequence the sequence for which MIDI file type support
- * is queried
- * @return array of file types. If no file types are supported,
- * returns an array of length 0.
+ * Obtains the file types that this file writer can write from the sequence
+ * specified.
+ *
+ * @param sequence the sequence for which MIDI file type support is
+ * queried
+ * @return array of file types. If no file types are supported, returns an
+ * array of length 0.
*/
public abstract int[] getMidiFileTypes(Sequence sequence);
-
/**
* Indicates whether file writing support for the specified MIDI file type
* is provided by this file writer.
- * @param fileType the file type for which write capabilities are queried
- * @return <code>true</code> if the file type is supported,
- * otherwise <code>false</code>
+ *
+ * @param fileType the file type for which write capabilities are queried
+ * @return {@code true} if the file type is supported, otherwise
+ * {@code false}
*/
public boolean isFileTypeSupported(int fileType) {
@@ -81,14 +80,14 @@ public abstract class MidiFileWriter {
return false;
}
-
/**
* Indicates whether a MIDI file of the file type specified can be written
* from the sequence indicated.
- * @param fileType the file type for which write capabilities are queried
- * @param sequence the sequence for which file writing support is queried
- * @return <code>true</code> if the file type is supported for this sequence,
- * otherwise <code>false</code>
+ *
+ * @param fileType the file type for which write capabilities are queried
+ * @param sequence the sequence for which file writing support is queried
+ * @return {@code true} if the file type is supported for this sequence,
+ * otherwise {@code false}
*/
public boolean isFileTypeSupported(int fileType, Sequence sequence) {
@@ -101,35 +100,38 @@ public abstract class MidiFileWriter {
return false;
}
-
/**
* Writes a stream of bytes representing a MIDI file of the file type
* indicated to the output stream provided.
- * @param in sequence containing MIDI data to be written to the file
- * @param fileType type of the file to be written to the output stream
- * @param out stream to which the file data should be written
+ *
+ * @param in sequence containing MIDI data to be written to the file
+ * @param fileType type of the file to be written to the output stream
+ * @param out stream to which the file data should be written
* @return the number of bytes written to the output stream
* @throws IOException if an I/O exception occurs
* @throws IllegalArgumentException if the file type is not supported by
- * this file writer
+ * this file writer
* @see #isFileTypeSupported(int, Sequence)
- * @see #getMidiFileTypes(Sequence)
+ * @see #getMidiFileTypes(Sequence)
*/
- public abstract int write(Sequence in, int fileType, OutputStream out) throws IOException;
-
+ public abstract int write(Sequence in, int fileType, OutputStream out)
+ throws IOException;
/**
* Writes a stream of bytes representing a MIDI file of the file type
* indicated to the external file provided.
- * @param in sequence containing MIDI data to be written to the external file
- * @param fileType type of the file to be written to the external file
- * @param out external file to which the file data should be written
+ *
+ * @param in sequence containing MIDI data to be written to the external
+ * file
+ * @param fileType type of the file to be written to the external file
+ * @param out external file to which the file data should be written
* @return the number of bytes written to the file
* @throws IOException if an I/O exception occurs
* @throws IllegalArgumentException if the file type is not supported by
- * this file writer
+ * this file writer
* @see #isFileTypeSupported(int, Sequence)
- * @see #getMidiFileTypes(Sequence)
+ * @see #getMidiFileTypes(Sequence)
*/
- public abstract int write(Sequence in, int fileType, File out) throws IOException;
+ public abstract int write(Sequence in, int fileType, File out)
+ throws IOException;
}
diff --git a/src/share/classes/javax/sound/midi/spi/SoundbankReader.java b/src/share/classes/javax/sound/midi/spi/SoundbankReader.java
index fec137851..c7e82d996 100644
--- a/src/share/classes/javax/sound/midi/spi/SoundbankReader.java
+++ b/src/share/classes/javax/sound/midi/spi/SoundbankReader.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,60 +25,58 @@
package javax.sound.midi.spi;
-import java.io.InputStream;
-import java.io.IOException;
import java.io.File;
-
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
-import javax.sound.midi.Soundbank;
import javax.sound.midi.InvalidMidiDataException;
-
+import javax.sound.midi.Soundbank;
/**
- * A <code>SoundbankReader</code> supplies soundbank file-reading services.
- * Concrete subclasses of <code>SoundbankReader</code> parse a given
- * soundbank file, producing a {@link javax.sound.midi.Soundbank}
- * object that can be loaded into a {@link javax.sound.midi.Synthesizer}.
+ * A {@code SoundbankReader} supplies soundbank file-reading services. Concrete
+ * subclasses of {@code SoundbankReader} parse a given soundbank file, producing
+ * a {@link javax.sound.midi.Soundbank} object that can be loaded into a
+ * {@link javax.sound.midi.Synthesizer}.
*
* @since 1.3
* @author Kara Kytle
*/
public abstract class SoundbankReader {
-
/**
* Obtains a soundbank object from the URL provided.
- * @param url URL representing the soundbank.
+ *
+ * @param url URL representing the soundbank.
* @return soundbank object
- * @throws InvalidMidiDataException if the URL does not point to
- * valid MIDI soundbank data recognized by this soundbank reader
+ * @throws InvalidMidiDataException if the URL does not point to valid MIDI
+ * soundbank data recognized by this soundbank reader
* @throws IOException if an I/O error occurs
*/
- public abstract Soundbank getSoundbank(URL url) throws InvalidMidiDataException, IOException;
-
+ public abstract Soundbank getSoundbank(URL url)
+ throws InvalidMidiDataException, IOException;
/**
- * Obtains a soundbank object from the <code>InputStream</code> provided.
- * @param stream <code>InputStream</code> representing the soundbank
+ * Obtains a soundbank object from the {@code InputStream} provided.
+ *
+ * @param stream {@code InputStream} representing the soundbank
* @return soundbank object
- * @throws InvalidMidiDataException if the stream does not point to
- * valid MIDI soundbank data recognized by this soundbank reader
+ * @throws InvalidMidiDataException if the stream does not point to valid
+ * MIDI soundbank data recognized by this soundbank reader
* @throws IOException if an I/O error occurs
*/
- public abstract Soundbank getSoundbank(InputStream stream) throws InvalidMidiDataException, IOException;
-
+ public abstract Soundbank getSoundbank(InputStream stream)
+ throws InvalidMidiDataException, IOException;
/**
- * Obtains a soundbank object from the <code>File</code> provided.
- * @param file the <code>File</code> representing the soundbank
+ * Obtains a soundbank object from the {@code File} provided.
+ *
+ * @param file the {@code File} representing the soundbank
* @return soundbank object
- * @throws InvalidMidiDataException if the file does not point to
- * valid MIDI soundbank data recognized by this soundbank reader
+ * @throws InvalidMidiDataException if the file does not point to valid MIDI
+ * soundbank data recognized by this soundbank reader
* @throws IOException if an I/O error occurs
*/
- public abstract Soundbank getSoundbank(File file) throws InvalidMidiDataException, IOException;
-
-
-
+ public abstract Soundbank getSoundbank(File file)
+ throws InvalidMidiDataException, IOException;
}
diff --git a/src/share/classes/javax/swing/JComboBox.java b/src/share/classes/javax/swing/JComboBox.java
index 1074add12..a5af75305 100644
--- a/src/share/classes/javax/swing/JComboBox.java
+++ b/src/share/classes/javax/swing/JComboBox.java
@@ -1416,6 +1416,28 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
+ if (super.processKeyBinding(ks, e, condition, pressed)) {
+ return true;
+ }
+
+ if (!isEditable() || condition != WHEN_FOCUSED || getEditor() == null
+ || !Boolean.TRUE.equals(getClientProperty("JComboBox.isTableCellEditor"))) {
+ return false;
+ }
+
+ Component editorComponent = getEditor().getEditorComponent();
+ if (editorComponent instanceof JComponent) {
+ JComponent component = (JComponent) editorComponent;
+ return component.processKeyBinding(ks, e, WHEN_FOCUSED, pressed);
+ }
+ return false;
+ }
+
+ /**
* Sets the object that translates a keyboard character into a list
* selection. Typically, the first selection with a matching first
* character becomes the selected item.
diff --git a/src/share/classes/javax/swing/JComponent.java b/src/share/classes/javax/swing/JComponent.java
index d6f35ac3f..8a1bc1826 100644
--- a/src/share/classes/javax/swing/JComponent.java
+++ b/src/share/classes/javax/swing/JComponent.java
@@ -3985,6 +3985,17 @@ public abstract class JComponent extends Container implements Serializable,
* @since 1.4
*/
public AccessibleKeyBinding getAccessibleKeyBinding() {
+ // Try to get the linked label's mnemonic if it exists
+ Object o = getClientProperty(JLabel.LABELED_BY_PROPERTY);
+ if (o instanceof Accessible){
+ AccessibleContext ac = ((Accessible) o).getAccessibleContext();
+ if (ac != null){
+ AccessibleComponent comp = ac.getAccessibleComponent();
+ if (! (comp instanceof AccessibleExtendedComponent))
+ return null;
+ return ((AccessibleExtendedComponent)comp).getAccessibleKeyBinding();
+ }
+ }
return null;
}
} // inner class AccessibleJComponent
diff --git a/src/share/classes/javax/swing/JTable.java b/src/share/classes/javax/swing/JTable.java
index 81d40e575..e382fbd6c 100644
--- a/src/share/classes/javax/swing/JTable.java
+++ b/src/share/classes/javax/swing/JTable.java
@@ -34,7 +34,6 @@ import java.awt.print.*;
import java.beans.*;
-import java.io.Serializable;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
@@ -58,7 +57,6 @@ import sun.swing.SwingUtilities2;
import sun.swing.SwingUtilities2.Section;
import static sun.swing.SwingUtilities2.Section.*;
import sun.swing.PrintingStatus;
-import sun.swing.SwingLazyValue;
/**
* The <code>JTable</code> is used to display and edit regular two-dimensional tables
@@ -4043,7 +4041,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
}
// Restore the lead
int viewLeadIndex = modelSelection.getLeadSelectionIndex();
- if (viewLeadIndex != -1) {
+ if (viewLeadIndex != -1 && !modelSelection.isSelectionEmpty()) {
viewLeadIndex = convertRowIndexToView(viewLeadIndex);
}
SwingUtilities2.setLeadAnchorWithoutSelection(
@@ -5307,14 +5305,6 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
return retValue;
}
- private void setLazyValue(Hashtable h, Class c, String s) {
- h.put(c, new SwingLazyValue(s));
- }
-
- private void setLazyRenderer(Class c, String s) {
- setLazyValue(defaultRenderersByColumnClass, c, s);
- }
-
/**
* Creates default cell renderers for objects, numbers, doubles, dates,
* booleans, and icons.
@@ -5325,24 +5315,24 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
defaultRenderersByColumnClass = new UIDefaults(8, 0.75f);
// Objects
- setLazyRenderer(Object.class, "javax.swing.table.DefaultTableCellRenderer$UIResource");
+ defaultRenderersByColumnClass.put(Object.class, (UIDefaults.LazyValue) t -> new DefaultTableCellRenderer.UIResource());
// Numbers
- setLazyRenderer(Number.class, "javax.swing.JTable$NumberRenderer");
+ defaultRenderersByColumnClass.put(Number.class, (UIDefaults.LazyValue) t -> new NumberRenderer());
// Doubles and Floats
- setLazyRenderer(Float.class, "javax.swing.JTable$DoubleRenderer");
- setLazyRenderer(Double.class, "javax.swing.JTable$DoubleRenderer");
+ defaultRenderersByColumnClass.put(Float.class, (UIDefaults.LazyValue) t -> new DoubleRenderer());
+ defaultRenderersByColumnClass.put(Double.class, (UIDefaults.LazyValue) t -> new DoubleRenderer());
// Dates
- setLazyRenderer(Date.class, "javax.swing.JTable$DateRenderer");
+ defaultRenderersByColumnClass.put(Date.class, (UIDefaults.LazyValue) t -> new DateRenderer());
// Icons and ImageIcons
- setLazyRenderer(Icon.class, "javax.swing.JTable$IconRenderer");
- setLazyRenderer(ImageIcon.class, "javax.swing.JTable$IconRenderer");
+ defaultRenderersByColumnClass.put(Icon.class, (UIDefaults.LazyValue) t -> new IconRenderer());
+ defaultRenderersByColumnClass.put(ImageIcon.class, (UIDefaults.LazyValue) t -> new IconRenderer());
// Booleans
- setLazyRenderer(Boolean.class, "javax.swing.JTable$BooleanRenderer");
+ defaultRenderersByColumnClass.put(Boolean.class, (UIDefaults.LazyValue) t -> new BooleanRenderer());
}
/**
@@ -5420,10 +5410,6 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
}
}
- private void setLazyEditor(Class c, String s) {
- setLazyValue(defaultEditorsByColumnClass, c, s);
- }
-
/**
* Creates default cell editors for objects, numbers, and boolean values.
* @see DefaultCellEditor
@@ -5432,13 +5418,13 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
defaultEditorsByColumnClass = new UIDefaults(3, 0.75f);
// Objects
- setLazyEditor(Object.class, "javax.swing.JTable$GenericEditor");
+ defaultEditorsByColumnClass.put(Object.class, (UIDefaults.LazyValue) t -> new GenericEditor());
// Numbers
- setLazyEditor(Number.class, "javax.swing.JTable$NumberEditor");
+ defaultEditorsByColumnClass.put(Number.class, (UIDefaults.LazyValue) t -> new NumberEditor());
// Booleans
- setLazyEditor(Boolean.class, "javax.swing.JTable$BooleanEditor");
+ defaultEditorsByColumnClass.put(Boolean.class, (UIDefaults.LazyValue) t -> new BooleanEditor());
}
/**
@@ -6588,8 +6574,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
TableColumnModelListener, CellEditorListener, PropertyChangeListener,
AccessibleExtendedTable {
- int lastSelectedRow;
- int lastSelectedCol;
+ int previousFocusedRow;
+ int previousFocusedCol;
/**
* AccessibleJTable constructor
@@ -6604,8 +6590,10 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
tcm.addColumnModelListener(this);
tcm.getSelectionModel().addListSelectionListener(this);
JTable.this.getModel().addTableModelListener(this);
- lastSelectedRow = JTable.this.getSelectedRow();
- lastSelectedCol = JTable.this.getSelectedColumn();
+ previousFocusedRow = JTable.this.getSelectionModel().
+ getLeadSelectionIndex();
+ previousFocusedCol = JTable.this.getColumnModel().
+ getSelectionModel().getLeadSelectionIndex();
}
// Listeners to track model, etc. changes to as to re-place the other
@@ -6933,18 +6921,21 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
- int selectedRow = JTable.this.getSelectedRow();
- int selectedCol = JTable.this.getSelectedColumn();
- if (selectedRow != lastSelectedRow ||
- selectedCol != lastSelectedCol) {
- Accessible oldA = getAccessibleAt(lastSelectedRow,
- lastSelectedCol);
- Accessible newA = getAccessibleAt(selectedRow, selectedCol);
+ // Using lead selection index to cover both cases: node selected and node
+ // is focused but not selected (Ctrl+up/down)
+ int focusedRow = JTable.this.getSelectionModel().getLeadSelectionIndex();
+ int focusedCol = JTable.this.getColumnModel().getSelectionModel().
+ getLeadSelectionIndex();
+
+ if (focusedRow != previousFocusedRow ||
+ focusedCol != previousFocusedCol) {
+ Accessible oldA = getAccessibleAt(previousFocusedRow, previousFocusedCol);
+ Accessible newA = getAccessibleAt(focusedRow, focusedCol);
firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
- oldA, newA);
- lastSelectedRow = selectedRow;
- lastSelectedCol = selectedCol;
- }
+ oldA, newA);
+ previousFocusedRow = focusedRow;
+ previousFocusedCol = focusedCol;
+ }
}
diff --git a/src/share/classes/javax/swing/JTree.java b/src/share/classes/javax/swing/JTree.java
index 35603c5b1..707305312 100644
--- a/src/share/classes/javax/swing/JTree.java
+++ b/src/share/classes/javax/swing/JTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1664,6 +1664,11 @@ public class JTree extends JComponent implements Scrollable, Accessible
leadPath = newPath;
firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, newPath);
+
+ if (accessibleContext != null){
+ ((AccessibleJTree)accessibleContext).
+ fireActiveDescendantPropertyChange(oldValue, newPath);
+ }
}
/**
@@ -4129,23 +4134,6 @@ public class JTree extends JComponent implements Scrollable, Accessible
*
*/
public void valueChanged(TreeSelectionEvent e) {
- // Fixes 4546503 - JTree is sending incorrect active
- // descendant events
- TreePath oldLeadSelectionPath = e.getOldLeadSelectionPath();
- leadSelectionPath = e.getNewLeadSelectionPath();
-
- if (oldLeadSelectionPath != leadSelectionPath) {
- // Set parent to null so AccessibleJTreeNode computes
- // its parent.
- Accessible oldLSA = leadSelectionAccessible;
- leadSelectionAccessible = (leadSelectionPath != null)
- ? new AccessibleJTreeNode(JTree.this,
- leadSelectionPath,
- null) // parent
- : null;
- firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
- oldLSA, leadSelectionAccessible);
- }
firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
Boolean.valueOf(false), Boolean.valueOf(true));
}
@@ -4249,6 +4237,34 @@ public class JTree extends JComponent implements Scrollable, Accessible
}
}
+ /**
+ * Fire an active descendant property change notification.
+ * The active descendant is used for objects such as list,
+ * tree, and table, which may have transient children.
+ * It notifies screen readers the active child of the component
+ * has been changed so user can be notified from there.
+ *
+ * @param oldPath - lead path of previous active child
+ * @param newPath - lead path of current active child
+ *
+ */
+ void fireActiveDescendantPropertyChange(TreePath oldPath, TreePath newPath){
+ if(oldPath != newPath){
+ Accessible oldLSA = (oldPath != null)
+ ? new AccessibleJTreeNode(JTree.this,
+ oldPath,
+ null)
+ : null;
+
+ Accessible newLSA = (newPath != null)
+ ? new AccessibleJTreeNode(JTree.this,
+ newPath,
+ null)
+ : null;
+ firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
+ oldLSA, newLSA);
+ }
+ }
private AccessibleContext getCurrentAccessibleContext() {
Component c = getCurrentComponent();
diff --git a/src/share/classes/javax/swing/MenuSelectionManager.java b/src/share/classes/javax/swing/MenuSelectionManager.java
index 1f6ac77aa..3f83acbac 100644
--- a/src/share/classes/javax/swing/MenuSelectionManager.java
+++ b/src/share/classes/javax/swing/MenuSelectionManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@ import java.awt.event.*;
import javax.swing.event.*;
import sun.awt.AppContext;
+import sun.swing.SwingUtilities2;
/**
* A MenuSelectionManager owns the selection in menu hierarchy.
@@ -60,6 +61,12 @@ public class MenuSelectionManager {
if (msm == null) {
msm = new MenuSelectionManager();
context.put(MENU_SELECTION_MANAGER_KEY, msm);
+
+ // installing additional listener if found in the AppContext
+ Object o = context.get(SwingUtilities2.MENU_SELECTION_MANAGER_LISTENER_KEY);
+ if (o != null && o instanceof ChangeListener) {
+ msm.addChangeListener((ChangeListener) o);
+ }
}
return msm;
diff --git a/src/share/classes/javax/swing/border/LineBorder.java b/src/share/classes/javax/swing/border/LineBorder.java
index 57d3487e4..115bbec58 100644
--- a/src/share/classes/javax/swing/border/LineBorder.java
+++ b/src/share/classes/javax/swing/border/LineBorder.java
@@ -133,8 +133,8 @@ public class LineBorder extends AbstractBorder
int offs = this.thickness;
int size = offs + offs;
if (this.roundedCorners) {
- int arc = offs + size;
- outer = new RoundRectangle2D.Float(x, y, width, height, arc, arc);
+ float arc = .2f * offs;
+ outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
}
else {
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java b/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
index 50209c9e1..201028d2c 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -32,6 +32,8 @@ import java.awt.event.*;
import java.lang.reflect.Method;
+import sun.reflect.misc.MethodUtil;
+
/**
* The default editor for editable combo boxes. The editor is implemented as a JTextField.
*
@@ -98,8 +100,8 @@ public class BasicComboBoxEditor implements ComboBoxEditor,FocusListener {
// Must take the value from the editor and get the value and cast it to the new type.
Class<?> cls = oldValue.getClass();
try {
- Method method = cls.getMethod("valueOf", new Class[]{String.class});
- newValue = method.invoke(oldValue, new Object[] { editor.getText()});
+ Method method = MethodUtil.getMethod(cls, "valueOf", new Class[]{String.class});
+ newValue = MethodUtil.invoke(method, oldValue, new Object[] { editor.getText()});
} catch (Exception ex) {
// Fail silently and return the newValue (a String object)
}
diff --git a/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java b/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
index b3298e4f9..75456a52b 100644
--- a/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/src/share/classes/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,10 @@ import javax.swing.*;
import javax.swing.event.*;
import javax.swing.plaf.*;
+import static sun.swing.SwingUtilities2.drawHLine;
+import static sun.swing.SwingUtilities2.drawRect;
+import static sun.swing.SwingUtilities2.drawVLine;
+
/**
* Implementation of ScrollBarUI for the Basic Look and Feel
@@ -572,17 +576,17 @@ public class BasicScrollBarUI
g.translate(thumbBounds.x, thumbBounds.y);
g.setColor(thumbDarkShadowColor);
- g.drawRect(0, 0, w-1, h-1);
+ drawRect(g, 0, 0, w - 1, h - 1);
g.setColor(thumbColor);
- g.fillRect(0, 0, w-1, h-1);
+ g.fillRect(0, 0, w - 1, h - 1);
g.setColor(thumbHighlightColor);
- g.drawLine(1, 1, 1, h-2);
- g.drawLine(2, 1, w-3, 1);
+ drawVLine(g, 1, 1, h - 2);
+ drawHLine(g, 2, w - 3, 1);
g.setColor(thumbLightShadowColor);
- g.drawLine(2, h-2, w-2, h-2);
- g.drawLine(w-2, 1, w-2, h-3);
+ drawHLine(g, 2, w - 2, h - 2);
+ drawVLine(g, w - 2, 1, h - 3);
g.translate(-thumbBounds.x, -thumbBounds.y);
}
diff --git a/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java b/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
index d6b006916..e7764c810 100644
--- a/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
+++ b/src/share/classes/javax/swing/plaf/metal/MetalLookAndFeel.java
@@ -32,15 +32,13 @@ import javax.swing.plaf.*;
import javax.swing.*;
import javax.swing.plaf.basic.*;
import javax.swing.text.DefaultEditorKit;
+import javax.swing.UIDefaults.LazyValue;
import java.awt.Color;
-import java.awt.event.KeyEvent;
-import java.lang.reflect.*;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import sun.awt.*;
import sun.security.action.GetPropertyAction;
@@ -460,11 +458,9 @@ public class MetalLookAndFeel extends BasicLookAndFeel
new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
"getTextFieldBorder");
- Object dialogBorder = new MetalLazyValue(
- "javax.swing.plaf.metal.MetalBorders$DialogBorder");
+ LazyValue dialogBorder = t -> new MetalBorders.DialogBorder();
- Object questionDialogBorder = new MetalLazyValue(
- "javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
+ LazyValue questionDialogBorder = t -> new MetalBorders.QuestionDialogBorder();
Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
"ctrl C", DefaultEditorKit.copyAction,
@@ -1494,12 +1490,8 @@ public class MetalLookAndFeel extends BasicLookAndFeel
"ToolBar.floatingBackground", menuBackground,
"ToolBar.dockingForeground", primaryControlDarkShadow,
"ToolBar.floatingForeground", primaryControl,
- "ToolBar.rolloverBorder", new MetalLazyValue(
- "javax.swing.plaf.metal.MetalBorders",
- "getToolBarRolloverBorder"),
- "ToolBar.nonrolloverBorder", new MetalLazyValue(
- "javax.swing.plaf.metal.MetalBorders",
- "getToolBarNonrolloverBorder"),
+ "ToolBar.rolloverBorder", (LazyValue) t -> MetalBorders.getToolBarRolloverBorder(),
+ "ToolBar.nonrolloverBorder", (LazyValue) t -> MetalBorders.getToolBarNonrolloverBorder(),
"ToolBar.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[] {
"UP", "navigateUp",
@@ -1513,17 +1505,14 @@ public class MetalLookAndFeel extends BasicLookAndFeel
}),
// RootPane
- "RootPane.frameBorder", new MetalLazyValue(
- "javax.swing.plaf.metal.MetalBorders$FrameBorder"),
+ "RootPane.frameBorder", (LazyValue) t -> new MetalBorders.FrameBorder(),
"RootPane.plainDialogBorder", dialogBorder,
"RootPane.informationDialogBorder", dialogBorder,
- "RootPane.errorDialogBorder", new MetalLazyValue(
- "javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder"),
+ "RootPane.errorDialogBorder", (LazyValue) t -> new MetalBorders.ErrorDialogBorder(),
"RootPane.colorChooserDialogBorder", questionDialogBorder,
"RootPane.fileChooserDialogBorder", questionDialogBorder,
"RootPane.questionDialogBorder", questionDialogBorder,
- "RootPane.warningDialogBorder", new MetalLazyValue(
- "javax.swing.plaf.metal.MetalBorders$WarningDialogBorder"),
+ "RootPane.warningDialogBorder", (LazyValue) t -> new MetalBorders.WarningDialogBorder(),
// These bindings are only enabled when there is a default
// button set on the rootpane.
"RootPane.defaultButtonWindowKeyBindings", new Object[] {
@@ -2175,61 +2164,6 @@ public class MetalLookAndFeel extends BasicLookAndFeel
/**
- * MetalLazyValue is a slimmed down version of <code>ProxyLaxyValue</code>.
- * The code is duplicate so that it can get at the package private
- * classes in metal.
- */
- private static class MetalLazyValue implements UIDefaults.LazyValue {
- /**
- * Name of the class to create.
- */
- private String className;
- private String methodName;
-
- MetalLazyValue(String name) {
- this.className = name;
- }
-
- MetalLazyValue(String name, String methodName) {
- this(name);
- this.methodName = methodName;
- }
-
- public Object createValue(UIDefaults table) {
- try {
- final Class c = Class.forName(className);
-
- if (methodName == null) {
- return c.newInstance();
- }
- Method method = AccessController.doPrivileged(
- new PrivilegedAction<Method>() {
- public Method run() {
- Method[] methods = c.getDeclaredMethods();
- for (int counter = methods.length - 1; counter >= 0;
- counter--) {
- if (methods[counter].getName().equals(methodName)){
- methods[counter].setAccessible(true);
- return methods[counter];
- }
- }
- return null;
- }
- });
- if (method != null) {
- return method.invoke(null, (Object[])null);
- }
- } catch (ClassNotFoundException cnfe) {
- } catch (InstantiationException ie) {
- } catch (IllegalAccessException iae) {
- } catch (InvocationTargetException ite) {
- }
- return null;
- }
- }
-
-
- /**
* FontActiveValue redirects to the appropriate metal theme method.
*/
private static class FontActiveValue implements UIDefaults.ActiveValue {
diff --git a/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java b/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java
index 0bc74bd5c..0f96f9700 100644
--- a/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java
+++ b/src/share/classes/javax/swing/plaf/metal/MetalScrollBarUI.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,34 +25,24 @@
package javax.swing.plaf.metal;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.LayoutManager;
-import java.awt.Adjustable;
-import java.awt.event.AdjustmentListener;
-import java.awt.event.AdjustmentEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseListener;
-import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.Graphics;
+import java.awt.Color;
import java.awt.Dimension;
+import java.awt.Graphics;
import java.awt.Rectangle;
-import java.awt.Point;
-import java.awt.Insets;
-import java.awt.Color;
-import java.awt.IllegalComponentStateException;
-
-import java.beans.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import javax.swing.plaf.*;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JScrollBar;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicScrollBarUI;
+import static sun.swing.SwingUtilities2.drawHLine;
+import static sun.swing.SwingUtilities2.drawRect;
+import static sun.swing.SwingUtilities2.drawVLine;
+
/**
* Implementation of ScrollBarUI for the Metal Look and Feel
@@ -159,21 +149,21 @@ public class MetalScrollBarUI extends BasicScrollBarUI
if ( c.isEnabled() ) {
g.setColor( darkShadowColor );
- g.drawLine( 0, 0, 0, trackBounds.height - 1 );
- g.drawLine( trackBounds.width - 2, 0, trackBounds.width - 2, trackBounds.height - 1 );
- g.drawLine( 2, trackBounds.height - 1, trackBounds.width - 1, trackBounds.height - 1);
- g.drawLine( 2, 0, trackBounds.width - 2, 0 );
+ drawVLine(g, 0, 0, trackBounds.height - 1);
+ drawVLine(g, trackBounds.width - 2, 0, trackBounds.height - 1);
+ drawHLine(g, 2, trackBounds.width - 1, trackBounds.height - 1);
+ drawHLine(g, 2, trackBounds.width - 2, 0);
g.setColor( shadowColor );
// g.setColor( Color.red);
- g.drawLine( 1, 1, 1, trackBounds.height - 2 );
- g.drawLine( 1, 1, trackBounds.width - 3, 1 );
+ drawVLine(g, 1, 1, trackBounds.height - 2);
+ drawHLine(g, 1, trackBounds.width - 3, 1);
if (scrollbar.getValue() != scrollbar.getMaximum()) { // thumb shadow
int y = thumbRect.y + thumbRect.height - trackBounds.y;
- g.drawLine( 1, y, trackBounds.width-1, y);
+ drawHLine(g, 1, trackBounds.width - 1, y);
}
g.setColor(highlightColor);
- g.drawLine( trackBounds.width - 1, 0, trackBounds.width - 1, trackBounds.height - 1 );
+ drawVLine(g, trackBounds.width - 1, 0, trackBounds.height - 1);
} else {
MetalUtils.drawDisabledBorder(g, 0, 0, trackBounds.width, trackBounds.height );
}
@@ -193,19 +183,19 @@ public class MetalScrollBarUI extends BasicScrollBarUI
if ( c.isEnabled() ) {
g.setColor( darkShadowColor );
- g.drawLine( 0, 0, trackBounds.width - 1, 0 ); // top
- g.drawLine( 0, 2, 0, trackBounds.height - 2 ); // left
- g.drawLine( 0, trackBounds.height - 2, trackBounds.width - 1, trackBounds.height - 2 ); // bottom
- g.drawLine( trackBounds.width - 1, 2, trackBounds.width - 1, trackBounds.height - 1 ); // right
+ drawHLine(g, 0, trackBounds.width - 1, 0); // top
+ drawVLine(g, 0, 2, trackBounds.height - 2); // left
+ drawHLine(g, 0, trackBounds.width - 1, trackBounds.height - 2 ); // bottom
+ drawVLine(g, trackBounds.width - 1, 2, trackBounds.height - 1 ); // right
g.setColor( shadowColor );
// g.setColor( Color.red);
- g.drawLine( 1, 1, trackBounds.width - 2, 1 ); // top
- g.drawLine( 1, 1, 1, trackBounds.height - 3 ); // left
- g.drawLine( 0, trackBounds.height - 1, trackBounds.width - 1, trackBounds.height - 1 ); // bottom
+ drawHLine(g, 1, trackBounds.width - 2, 1 ); // top
+ drawVLine(g, 1, 1, trackBounds.height - 3 ); // left
+ drawHLine(g, 0, trackBounds.width - 1, trackBounds.height - 1 ); // bottom
if (scrollbar.getValue() != scrollbar.getMaximum()) { // thumb shadow
int x = thumbRect.x + thumbRect.width - trackBounds.x;
- g.drawLine( x, 1, x, trackBounds.height-1);
+ drawVLine(g, x, 1, trackBounds.height-1);
}
} else {
MetalUtils.drawDisabledBorder(g, 0, 0, trackBounds.width, trackBounds.height );
@@ -247,11 +237,11 @@ public class MetalScrollBarUI extends BasicScrollBarUI
g.fillRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );
g.setColor( thumbShadow );
- g.drawRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );
+ drawRect(g, 0, 0, thumbBounds.width - 2, thumbBounds.height - 1);
g.setColor( thumbHighlightColor );
- g.drawLine( 1, 1, thumbBounds.width - 3, 1 );
- g.drawLine( 1, 1, 1, thumbBounds.height - 2 );
+ drawHLine(g, 1, thumbBounds.width - 3, 1);
+ drawVLine(g, 1, 1, thumbBounds.height - 2);
bumps.setBumpArea( thumbBounds.width - 6, thumbBounds.height - 7 );
bumps.paintIcon( c, g, 3, 4 );
@@ -273,11 +263,11 @@ public class MetalScrollBarUI extends BasicScrollBarUI
g.fillRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );
g.setColor( thumbShadow );
- g.drawRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );
+ drawRect(g, 0, 0, thumbBounds.width - 1, thumbBounds.height - 2);
g.setColor( thumbHighlightColor );
- g.drawLine( 1, 1, thumbBounds.width - 3, 1 );
- g.drawLine( 1, 1, 1, thumbBounds.height - 3 );
+ drawHLine(g, 1, thumbBounds.width - 3, 1);
+ drawVLine(g, 1, 1, thumbBounds.height - 3);
bumps.setBumpArea( thumbBounds.width - 7, thumbBounds.height - 6 );
bumps.paintIcon( c, g, 4, 3 );
@@ -310,11 +300,11 @@ public class MetalScrollBarUI extends BasicScrollBarUI
}
g.setColor(thumbShadow);
- g.drawRect(0, 0, thumbBounds.width - 2, thumbBounds.height - 1);
+ drawRect(g, 0, 0, thumbBounds.width - 2, thumbBounds.height - 1);
g.setColor(thumbHighlightColor);
- g.drawLine(1, 1, thumbBounds.width - 3, 1);
- g.drawLine(1, 1, 1, thumbBounds.height - 2);
+ drawHLine(g, 1, thumbBounds.width - 3, 1);
+ drawVLine(g, 1, 1, thumbBounds.height - 2);
MetalUtils.drawGradient(c, g, "ScrollBar.gradient", 2, 2,
thumbBounds.width - 4,
@@ -352,11 +342,11 @@ public class MetalScrollBarUI extends BasicScrollBarUI
}
g.setColor(thumbShadow);
- g.drawRect(0, 0, thumbBounds.width - 1, thumbBounds.height - 2);
+ drawRect(g, 0, 0, thumbBounds.width - 1, thumbBounds.height - 2);
g.setColor(thumbHighlightColor);
- g.drawLine(1, 1, thumbBounds.width - 2, 1);
- g.drawLine(1, 1, 1, thumbBounds.height - 3);
+ drawHLine(g, 1, thumbBounds.width - 2, 1);
+ drawVLine(g, 1, 1, thumbBounds.height - 3);
MetalUtils.drawGradient(c, g, "ScrollBar.gradient", 2, 2,
thumbBounds.width - 3,
diff --git a/src/share/classes/javax/swing/text/JTextComponent.java b/src/share/classes/javax/swing/text/JTextComponent.java
index 72333b261..df313d132 100644
--- a/src/share/classes/javax/swing/text/JTextComponent.java
+++ b/src/share/classes/javax/swing/text/JTextComponent.java
@@ -24,18 +24,16 @@
*/
package javax.swing.text;
-import java.lang.reflect.Method;
+import com.sun.beans.util.Cache;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.beans.Transient;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Enumeration;
import java.util.Vector;
-import java.util.Map;
import java.util.concurrent.*;
@@ -1192,47 +1190,6 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
}
/**
- * Returns true if <code>klass</code> is NOT a JTextComponent and it or
- * one of its superclasses (stoping at JTextComponent) overrides
- * <code>processInputMethodEvent</code>. It is assumed this will be
- * invoked from within a <code>doPrivileged</code>, and it is also
- * assumed <code>klass</code> extends <code>JTextComponent</code>.
- */
- private static Boolean isProcessInputMethodEventOverridden(Class<?> klass) {
- if (klass == JTextComponent.class) {
- return Boolean.FALSE;
- }
- Boolean retValue = overrideMap.get(klass.getName());
-
- if (retValue != null) {
- return retValue;
- }
- Boolean sOverriden = isProcessInputMethodEventOverridden(
- klass.getSuperclass());
-
- if (sOverriden.booleanValue()) {
- // If our superclass has overriden it, then by definition klass
- // overrides it.
- overrideMap.put(klass.getName(), sOverriden);
- return sOverriden;
- }
- // klass's superclass didn't override it, check for an override in
- // klass.
- try {
- Class[] classes = new Class[1];
- classes[0] = InputMethodEvent.class;
-
- Method m = klass.getDeclaredMethod("processInputMethodEvent",
- classes);
- retValue = Boolean.TRUE;
- } catch (NoSuchMethodException nsme) {
- retValue = Boolean.FALSE;
- }
- overrideMap.put(klass.getName(), retValue);
- return retValue;
- }
-
- /**
* Fetches the current color used to render the
* caret.
*
@@ -3913,7 +3870,33 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
* Maps from class name to Boolean indicating if
* <code>processInputMethodEvent</code> has been overriden.
*/
- private static Map<String, Boolean> overrideMap;
+ private static Cache<Class<?>,Boolean> METHOD_OVERRIDDEN
+ = new Cache<Class<?>,Boolean>(Cache.Kind.WEAK, Cache.Kind.STRONG) {
+ /**
+ * Returns {@code true} if the specified {@code type} extends {@link JTextComponent}
+ * and the {@link JTextComponent#processInputMethodEvent} method is overridden.
+ */
+ @Override
+ public Boolean create(final Class<?> type) {
+ if (JTextComponent.class == type) {
+ return Boolean.FALSE;
+ }
+ if (get(type.getSuperclass())) {
+ return Boolean.TRUE;
+ }
+ return AccessController.doPrivileged(
+ new PrivilegedAction<Boolean>() {
+ public Boolean run() {
+ try {
+ type.getDeclaredMethod("processInputMethodEvent", InputMethodEvent.class);
+ return Boolean.TRUE;
+ } catch (NoSuchMethodException exception) {
+ return Boolean.FALSE;
+ }
+ }
+ });
+ }
+ };
/**
* Returns a string representation of this <code>JTextComponent</code>.
@@ -4938,39 +4921,16 @@ public abstract class JTextComponent extends JComponent implements Scrollable, A
*/
private boolean shouldSynthensizeKeyEvents() {
if (!checkedInputOverride) {
+ // Checks whether the client code overrides processInputMethodEvent.
+ // If it is overridden, need not to generate KeyTyped events for committed text.
+ // If it's not, behave as an passive input method client.
+ needToSendKeyTypedEvent = !METHOD_OVERRIDDEN.get(getClass());
checkedInputOverride = true;
- needToSendKeyTypedEvent =
- !isProcessInputMethodEventOverridden();
}
return needToSendKeyTypedEvent;
}
//
- // Checks whether the client code overrides processInputMethodEvent. If it is overridden,
- // need not to generate KeyTyped events for committed text. If it's not, behave as an
- // passive input method client.
- //
- private boolean isProcessInputMethodEventOverridden() {
- if (overrideMap == null) {
- overrideMap = Collections.synchronizedMap(new HashMap<String, Boolean>());
- }
- Boolean retValue = overrideMap.get(getClass().getName());
-
- if (retValue != null) {
- return retValue.booleanValue();
- }
- Boolean ret = AccessController.doPrivileged(new
- PrivilegedAction<Boolean>() {
- public Boolean run() {
- return isProcessInputMethodEventOverridden(
- JTextComponent.this.getClass());
- }
- });
-
- return ret.booleanValue();
- }
-
- //
// Checks whether a composed text in this text component
//
boolean composedTextExists() {
diff --git a/src/share/classes/javax/swing/text/html/EditableView.java b/src/share/classes/javax/swing/text/html/EditableView.java
index 3a5fa648e..3ef2c6556 100644
--- a/src/share/classes/javax/swing/text/html/EditableView.java
+++ b/src/share/classes/javax/swing/text/html/EditableView.java
@@ -73,7 +73,7 @@ class EditableView extends ComponentView {
Component c = getComponent();
Container host = getContainer();
- if (host != null &&
+ if (host instanceof JTextComponent &&
isVisible != ((JTextComponent)host).isEditable()) {
isVisible = ((JTextComponent)host).isEditable();
preferenceChanged(null, true, true);
diff --git a/src/share/classes/javax/swing/text/html/HTMLEditorKit.java b/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
index 29c753776..425ba5f0b 100644
--- a/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
+++ b/src/share/classes/javax/swing/text/html/HTMLEditorKit.java
@@ -26,7 +26,6 @@ package javax.swing.text.html;
import sun.awt.AppContext;
-import java.lang.reflect.Method;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
@@ -34,12 +33,13 @@ import java.net.MalformedURLException;
import java.net.URL;
import javax.swing.text.*;
import javax.swing.*;
-import javax.swing.border.*;
import javax.swing.event.*;
import javax.swing.plaf.TextUI;
import java.util.*;
import javax.accessibility.*;
import java.lang.ref.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* The Swing JEditorPane text component supports different kinds
@@ -414,14 +414,13 @@ public class HTMLEditorKit extends StyledEditorKit implements Accessible {
* HTMLEditorKit class
* @return a stream representing the resource
*/
- static InputStream getResourceAsStream(String name) {
- try {
- return ResourceLoader.getResourceAsStream(name);
- } catch (Throwable e) {
- // If the class doesn't exist or we have some other
- // problem we just try to call getResourceAsStream directly.
- return HTMLEditorKit.class.getResourceAsStream(name);
- }
+ static InputStream getResourceAsStream(final String name) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<InputStream>() {
+ public InputStream run() {
+ return HTMLEditorKit.class.getResourceAsStream(name);
+ }
+ });
}
/**
diff --git a/src/share/classes/javax/swing/text/html/ResourceLoader.java b/src/share/classes/javax/swing/text/html/ResourceLoader.java
deleted file mode 100644
index 1fd230bea..000000000
--- a/src/share/classes/javax/swing/text/html/ResourceLoader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.swing.text.html;
-
-import java.io.InputStream;
-
-/**
- * Simple class to load resources using the 1.2
- * security model. Since the html support is loaded
- * lazily, it's resources are potentially fetched with
- * applet code in the call stack. By providing this
- * functionality in a class that is only built on 1.2,
- * reflection can be used from the code that is also
- * built on 1.1 to call this functionality (and avoid
- * the evils of preprocessing). This functionality
- * is called from HTMLEditorKit.getResourceAsStream.
- *
- * @author Timothy Prinzing
- */
-class ResourceLoader implements java.security.PrivilegedAction {
-
- ResourceLoader(String name) {
- this.name = name;
- }
-
- public Object run() {
- Object o = HTMLEditorKit.class.getResourceAsStream(name);
- return o;
- }
-
- public static InputStream getResourceAsStream(String name) {
- java.security.PrivilegedAction a = new ResourceLoader(name);
- return (InputStream) java.security.AccessController.doPrivileged(a);
- }
-
- private String name;
-}
diff --git a/src/share/classes/javax/swing/text/html/parser/Parser.java b/src/share/classes/javax/swing/text/html/parser/Parser.java
index 384343712..79124461f 100644
--- a/src/share/classes/javax/swing/text/html/parser/Parser.java
+++ b/src/share/classes/javax/swing/text/html/parser/Parser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -2089,6 +2089,13 @@ class Parser implements DTDConstants {
// null end tag.
endTag(false);
continue;
+ } else if (textpos == 0) {
+ if (!legalElementContext(dtd.pcdata)) {
+ error("unexpected.pcdata");
+ }
+ if (last.breaksFlow()) {
+ space = false;
+ }
}
break;
diff --git a/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java b/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java
index cdea9579f..fbf5e1734 100644
--- a/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java
+++ b/src/share/classes/javax/swing/text/html/parser/ParserDelegator.java
@@ -22,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package javax.swing.text.html.parser;
import sun.awt.AppContext;
@@ -35,6 +34,8 @@ import java.io.DataInputStream;
import java.io.ObjectInputStream;
import java.io.Reader;
import java.io.Serializable;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* Responsible for starting up a new DocumentParser
@@ -111,14 +112,13 @@ public class ParserDelegator extends HTMLEditorKit.Parser implements Serializabl
* ParserDelegator class.
* @returns a stream representing the resource
*/
- static InputStream getResourceAsStream(String name) {
- try {
- return ResourceLoader.getResourceAsStream(name);
- } catch (Throwable e) {
- // If the class doesn't exist or we have some other
- // problem we just try to call getResourceAsStream directly.
- return ParserDelegator.class.getResourceAsStream(name);
- }
+ static InputStream getResourceAsStream(final String name) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<InputStream>() {
+ public InputStream run() {
+ return ParserDelegator.class.getResourceAsStream(name);
+ }
+ });
}
private void readObject(ObjectInputStream s)
diff --git a/src/share/classes/javax/swing/text/html/parser/ResourceLoader.java b/src/share/classes/javax/swing/text/html/parser/ResourceLoader.java
deleted file mode 100644
index 9b958f566..000000000
--- a/src/share/classes/javax/swing/text/html/parser/ResourceLoader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package javax.swing.text.html.parser;
-
-import java.io.InputStream;
-
-/**
- * Simple class to load resources using the 1.2
- * security model. Since the html support is loaded
- * lazily, it's resources are potentially fetched with
- * applet code in the call stack. By providing this
- * functionality in a class that is only built on 1.2,
- * reflection can be used from the code that is also
- * built on 1.1 to call this functionality (and avoid
- * the evils of preprocessing). This functionality
- * is called from ParserDelegator.getResourceAsStream.
- *
- * @author Timothy Prinzing
- */
-class ResourceLoader implements java.security.PrivilegedAction {
-
- ResourceLoader(String name) {
- this.name = name;
- }
-
- public Object run() {
- Object o = ParserDelegator.class.getResourceAsStream(name);
- return o;
- }
-
- public static InputStream getResourceAsStream(String name) {
- java.security.PrivilegedAction a = new ResourceLoader(name);
- return (InputStream) java.security.AccessController.doPrivileged(a);
- }
-
- private String name;
-}
diff --git a/src/share/classes/javax/swing/text/rtf/RTFReader.java b/src/share/classes/javax/swing/text/rtf/RTFReader.java
index ebef02d09..e7457584d 100644
--- a/src/share/classes/javax/swing/text/rtf/RTFReader.java
+++ b/src/share/classes/javax/swing/text/rtf/RTFReader.java
@@ -27,9 +27,9 @@ package javax.swing.text.rtf;
import java.lang.*;
import java.util.*;
import java.io.*;
-import java.awt.Font;
import java.awt.Color;
-
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import javax.swing.text.*;
/**
@@ -558,16 +558,14 @@ getCharacterSet(final String name)
{
char[] set = characterSets.get(name);
if (set == null) {
- InputStream charsetStream;
- charsetStream = java.security.AccessController.
- doPrivileged(new java.security.PrivilegedAction<InputStream>() {
- public InputStream run() {
- return RTFReader.class.getResourceAsStream
- ("charsets/" + name + ".txt");
- }
- });
- set = readCharset(charsetStream);
- defineCharacterSet(name, set);
+ InputStream charsetStream = AccessController.doPrivileged(
+ new PrivilegedAction<InputStream>() {
+ public InputStream run() {
+ return RTFReader.class.getResourceAsStream("charsets/" + name + ".txt");
+ }
+ });
+ set = readCharset(charsetStream);
+ defineCharacterSet(name, set);
}
return set;
}