[llvm-commits] [llvm-gcc-4.2] r43913 [48/80] - in /llvm-gcc-4.2/trunk: boehm-gc/ boehm-gc/Mac_files/ boehm-gc/cord/ boehm-gc/doc/ boehm-gc/include/ boehm-gc/include/private/ boehm-gc/tests/ libffi/ libffi/include/ libffi/src/ libffi/src/alpha/ libffi/src/arm/ libffi/src/cris/ libffi/src/frv/ libffi/src/ia64/ libffi/src/m32r/ libffi/src/m68k/ libffi/src/mips/ libffi/src/pa/ libffi/src/powerpc/ libffi/src/s390/ libffi/src/sh/ libffi/src/sh64/ libffi/src/sparc/ libffi/src/x86/ libffi/testsuite/ libffi/testsuite/config/ li...

Bill Wendling isanbard at gmail.com
Thu Nov 8 14:57:11 PST 2007


Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/ShortMessage.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/ShortMessage.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/ShortMessage.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/ShortMessage.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,336 @@
+/* ShortMessage.java -- A MIDI message no longer than 3 bytes
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A short MIDI message that is no longer than 3 bytes long.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public class ShortMessage extends MidiMessage
+{
+  /**
+   * Status byte for Time Code message.
+   */
+  public static final int MIDI_TIME_CODE = 0xF1;
+ 
+  /**
+   * Status byte for Song Position Pointer message. 
+   */
+  public static final int SONG_POSITION_POINTER = 0xF2;
+  
+  /**
+   * Status byte for Song Select message.
+   */
+  public static final int SONG_SELECT = 0xF3;
+  
+  /**
+   * Status byte for Tune Request message. 
+   */
+  public static final int TUNE_REQUEST = 0xF6;
+  
+  /**
+   * Status byte for End Of Exclusive message.
+   */
+  public static final int END_OF_EXCLUSIVE = 0xF7;
+  
+  /**
+   * Status byte for Timing Clock message. 
+   */
+  public static final int TIMING_CLOCK = 0xF8;
+  
+  /**
+   * Status byte for Start message. 
+   */
+  public static final int START = 0xFA;
+  
+  /**
+   * Status byte for Continue message. 
+   */
+  public static final int CONTINUE = 0xFB; 
+  
+  /**
+   * Status byte for Stop message. 
+   */
+  public static final int STOP = 0xFC; 
+  
+  /**
+   * Status byte for Active Sensing message.
+   */
+  public static final int ACTIVE_SENSING = 0xFE; 
+  
+  /**
+   * Status byte for System Reset message.
+   */
+  public static final int SYSTEM_RESET = 0xFF; 
+  
+  /**
+   * Status nibble for Note Off message.
+   */
+  public static final int NOTE_OFF = 0x80; 
+  
+  /**
+   * Status nibble for Note On message.
+   */
+  public static final int NOTE_ON = 0x90; 
+  
+  /**
+   * Status nibble for Poly Pressure message.
+   */
+  public static final int POLY_PRESSURE = 0xA0; 
+  
+  /**
+   * Status nibble for Control Change message.
+   */
+  public static final int CONTROL_CHANGE = 0xB0; 
+  
+  /**
+   * Status nibble for Program Change message.
+   */
+  public static final int PROGRAM_CHANGE = 0xC0; 
+  
+  /**
+   * Statue nibble for Channel Pressure message.
+   */
+  public static final int CHANNEL_PRESSURE = 0xD0;
+  
+  /**
+   * Status nibble for Pitch Bend message.
+   */
+  public static final int PITCH_BEND = 0xE0; 
+
+  // Create and initialize a default, arbitrary message.
+  private static byte[] defaultMessage;
+  static
+  {
+    defaultMessage = new byte[1];
+    defaultMessage[0] = (byte) STOP;
+  }
+  
+  /**
+   * Create a short MIDI message.
+   * 
+   * The spec requires that this represent a valid MIDI message, but doesn't
+   * specify what it should be.  We've chosen the STOP message for our
+   * implementation.
+   */
+  public ShortMessage()
+  {
+    this(defaultMessage);   
+  }
+  
+  /**
+   * Create a short MIDI message.
+   * 
+   * The data argument should be a valid MIDI message.  Unfortunately the spec
+   * does not allow us to throw an InvalidMidiDataException if data is invalid.
+   * 
+   * @param data the message data
+   */
+  protected ShortMessage(byte[] data)
+  {
+    super(data);
+  }
+
+  /**
+   * Set the MIDI message. 
+   * 
+   * @param status the status byte for this message
+   * @param data1 the first data byte for this message
+   * @param data2 the second data byte for this message
+   * @throws InvalidMidiDataException if status is bad, or data is out of range
+   */
+  public void setMessage(int status, int data1, int data2)
+    throws InvalidMidiDataException
+  {
+    length = getDataLength(status);
+    length++;
+    if (data == null || data.length < length)
+      data = new byte[length];
+    data[0] = (byte) status;
+    if (length > 1)
+    {
+      if (data1 < 0 || data1 > 127)
+        throw new InvalidMidiDataException("data1 (" + data1 
+                                           + ") must be between 0 and 127.");
+      data[1] = (byte) data1;
+      if (length > 2)
+      {
+        if (data2 < 0 || data2 > 127)
+          throw new InvalidMidiDataException("data2 (" + data2 
+                                             + ") must be between 0 and 127.");
+        data[2] = (byte) data2;
+      }
+    }
+  }
+  
+  public void setMessage(int command, int channel, int data1, int data2)
+    throws InvalidMidiDataException
+  {
+    // TODO: This could probably stand some error checking.
+    // It currently assumes command and channel are valid values.
+    setMessage(command + channel, data1, data2);
+  }
+  
+  /**
+   * Set the MIDI message to one that requires no data bytes.
+   * 
+   * @param status the status byte for this message
+   * @throws InvalidMidiDataException if status is bad, or requires data
+   */
+  public void setMessage(int status) throws InvalidMidiDataException
+  {
+    int length = getDataLength(status);
+    if (length != 0)
+      throw new InvalidMidiDataException("Status byte 0x"
+                                         + Integer.toHexString(status)
+                                         + " requires "
+                                         + length + " bytes of data.");
+    setMessage(status, 0, 0);
+  }
+
+  
+  /**
+   * Return the number of data bytes needed for a given MIDI status byte.
+   * 
+   * @param status the status byte for a short MIDI message
+   * @return the number of data bytes needed for this status byte
+   * @throws InvalidMidiDataException if status is an invalid status byte
+   */
+  protected final int getDataLength(int status) throws InvalidMidiDataException
+  {
+    int originalStatus = status;
+    
+    if ((status & 0xF0) != 0xF0)
+      status &= 0xF0;
+    
+    switch (status)
+    {
+    case NOTE_OFF:  
+    case NOTE_ON:  
+    case POLY_PRESSURE:  
+    case CONTROL_CHANGE:  
+    case PITCH_BEND:
+    case SONG_POSITION_POINTER:
+      return 2;
+        
+    case PROGRAM_CHANGE:
+    case CHANNEL_PRESSURE:
+    case SONG_SELECT:
+    case 0xF5:  // FIXME: unofficial bus select.  Not in spec??
+      return 1;
+      
+    case TUNE_REQUEST: 
+    case END_OF_EXCLUSIVE:
+    case TIMING_CLOCK:
+    case START:
+    case CONTINUE:
+    case STOP:
+    case ACTIVE_SENSING:
+    case SYSTEM_RESET:
+      return 0;
+      
+    default:
+      throw new InvalidMidiDataException("Invalid status: 0x" 
+                                         + Integer.toHexString(originalStatus));
+    }
+  }
+  
+  /**
+   * Get the channel information from this MIDI message, assuming it is a 
+   * MIDI channel message.
+   * 
+   * @return the MIDI channel for this message
+   */
+  public int getChannel()
+  {
+    return data[0] & 0x0F;
+  }
+  
+  /**
+   * Get the command nibble from this MIDI message, assuming it is a MIDI
+   * channel message.
+   * 
+   * @return the MIDI command for this message
+   */
+  public int getCommand()
+  {
+    return data[0] & 0xF0;
+  }
+  
+  /**
+   * Get the first data byte from this message, assuming it exists, and 
+   * zero otherwise.
+   * 
+   * @return the first data byte or zero if none exists.
+   */
+  public int getData1()
+  {
+    if (length > 1)
+      return data[1];
+    else
+      return 0;
+  }
+  
+  /**
+   * Get the second data byte from this message, assuming it exists, and 
+   * zero otherwise.
+   * 
+   * @return the second date byte or zero if none exists.
+   */
+  public int getData2()
+  {
+    if (length > 2)
+      return data[2];
+    else
+      return 0;
+  }
+  
+  /* Create a deep-copy clone of this object.
+   * @see java.lang.Object#clone()
+   */
+  public Object clone()
+  {
+    byte message[] = new byte[length];
+    System.arraycopy(data, 0, message, 0, length);
+    return new ShortMessage(message);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Soundbank.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Soundbank.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Soundbank.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Soundbank.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,101 @@
+/* Soundbank.java -- Container of Instruments to be loaded into a Synthesizer
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A Soundbank is a container for instruments which may be loaded into 
+ * a Synthesizer.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Soundbank
+{
+  /**
+   * Get the sound bank name.
+   * 
+   * @return the sound bank name
+   */
+  String getName();
+  
+  /**
+   * Get the sound bank version.
+   * 
+   * @return the sound bank version
+   */
+  String getVersion();
+
+  /**
+   * Get the sound bank vendor.
+   * 
+   * @return the sound bank vendor
+   */
+  String getVendor();
+  
+  
+  /**
+   * Get the sound bank description.
+   * 
+   * @return the sound bank description
+   */
+  String getDescription();
+  
+  /**
+   * Get an array of non-Instrument resources in this sound bank.
+   * 
+   * @return an array of non-instrument resources in this sound bank
+   */
+  SoundbankResource[] getResources();
+  
+  /**
+   * Get an array of Instruments in this sound bank.
+   * 
+   * @return an array of instruments in this sound bank
+   */
+  Instrument[] getInstruments();
+  
+  /**
+   * Get the Instrument for the given Patch.
+   * 
+   * @param patch the Patch to search for
+   * @return the Instrument corresponding to patch
+   */
+  Instrument getInstrument(Patch patch);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SoundbankResource.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SoundbankResource.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SoundbankResource.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SoundbankResource.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,104 @@
+/* SoundbankResource.java -- An audio resource from a sound bank
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * SoundbankResource objects represent audio data stored in a sound bank.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class SoundbankResource
+{
+  private final Soundbank soundbank;
+  private final String name;
+  private final Class dataClass;
+  
+  /**
+   * Create a SoundbankResource object.
+   * 
+   * @param soundbank the soundbank object containing this resource
+   * @param name the name of the resource
+   * @param dataClass the class used to represent the audio data
+   */
+  protected SoundbankResource(Soundbank soundbank, String name, Class dataClass)
+  {
+    this.soundbank = soundbank;   
+    this.name = name;
+    this.dataClass = dataClass;
+  }
+  
+  /**
+   * Get the sound bank containing this resource.
+   * 
+   * @return the sound bank in which this resource resides
+   */
+  public Soundbank getSoundbank()
+  {
+    return soundbank;
+  }
+  
+  /**
+   * Get the name of this resource.
+   * 
+   * @return the name of this resource
+   */
+  public String getName()
+  {
+    return name;
+  }
+  
+  /**
+   * Get the class used to represent the audio data for this resource.
+   * 
+   * @return the class used to represent the audio data for this resource
+   */
+  public Class getDataClass()
+  {
+    return dataClass;
+  }
+  
+  /**
+   * Get the audio data for this resource.
+   * 
+   * @return the audio data object for this resource
+   */
+  public abstract Object getData();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Synthesizer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Synthesizer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Synthesizer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Synthesizer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,173 @@
+/* Synthesizer.java -- A MIDI audio synthesizer interface
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Interface for MIDI audio synthesizer devices.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Synthesizer extends MidiDevice
+{
+  /**
+   * Get the maximum number of notes that the synth can play at once.
+   * 
+   * @return the maximum number of notes that the synth can play at once
+   */
+  public int getMaxPolyphony();
+  
+  /**
+   * The processing latency for this synth in microseconds.
+   * 
+   * @return the processing latency for this synth in microseconds
+   */
+  public long getLatency();
+  
+  /**
+   * Get the set of MIDI channels controlled by this synth.
+   * 
+   * @return an array of MIDI channels controlled by this synth
+   */
+  public MidiChannel[] getChannels();
+  
+  /**
+   * Get the current status for the voices produced by this synth.
+   * 
+   * @return an array of VoiceStatus objects, getMaxPolyphony() in length
+   */
+  public VoiceStatus[] getVoiceStatus();
+  
+  /**
+   * Returns true is this synth is capable of loading soundbank.
+   * 
+   * @param soundbank the Soundbank to examine
+   * @return true if soundbank can be loaded, false otherwise
+   */
+  public boolean isSoundbankSupported(Soundbank soundbank);
+  
+  /**
+   * Load an instrument into this synth.  The instrument must be part of a
+   * supported soundbank.
+   * 
+   * @param instrument the Instrument to load
+   * @return true if the instrument was loaded and false otherwise
+   * @throws IllegalArgumentException if this synth doesn't support instrument
+   */
+  public boolean loadInstrument(Instrument instrument);
+  
+  /**
+   * Unload an instrument from this synth.
+   * 
+   * @param instrument the Instrument to unload
+   * @throws IllegalArgumentException if this synth doesn't support instrument
+   */
+  public void unloadInstrument(Instrument instrument);
+  
+  /**
+   * Move an intrument from one place to another.  The instrument at the
+   * target location is unloaded.
+   * 
+   * @param from the instrument source
+   * @param to the instrument target
+   * @return if from was remapped
+   * @throws IllegalArgumentException
+   */
+  public boolean remapInstrument(Instrument from, Instrument to);
+  
+  /**
+   * Get the default Soundbank for this synth.  Return null if there is no
+   * default.
+   * 
+   * @return the default Soundbank for this synth, possibly null.
+   */
+  public Soundbank getDefaultSoundbank();
+  
+  /**
+   * Get an array containing all instruments in this synthesizer.
+   * 
+   * @return an array containing all instruments in this synthesizer
+   */
+  public Instrument[] getAvailableInstruments();
+  
+  /**
+   * Get an array containing all instruments loaded in this synthesizer.
+   * 
+   * @return an array containing all instruments loaded in this synthesizer
+   */
+  public Instrument[] getLoadedInstruments();
+  
+  /**
+   * Load all soundbank instruments into this synthesizer.
+   * 
+   * @param soundbank the Soundbank from which to load instruments
+   * @return true if all instruments were loaded, false othewise
+   * @throws IllegalArgumentException if the soundbank isn't supported by this
+   */
+  public boolean loadAllInstruments(Soundbank soundbank);
+  
+  /**
+   * Unload all soundbank instruments from this synthesizer.
+   * 
+   * @param soundbank the Soundbank containing the instruments to unload
+   * @throws IllegalArgumentException if the soundbank isn't supported by this
+   */
+  public void unloadAllInstruments(Soundbank soundbank);
+  
+  /**
+   * Load a subset of soundbank instruments into this synthesizer.  The 
+   * subset is defined by an array of Patch objects.
+   * 
+   * @param soundbank the Soundbank from which to load instruments
+   * @param patchList the array of patches identifying instruments to load
+   * @return true if instruments were loaded, false otherwise
+   * @throws IllegalArgumentException if the soundbank isn't supported by this
+   */
+  public boolean loadInstruments(Soundbank soundbank, Patch[] patchList);
+  
+  /**
+   * Unload a subset of soundbank instruments from this synthesizer.
+   * 
+   * @param soundbank the Soundbank containing the instruments to unload
+   * @param patchList the array of patches identifying instruments to unload
+   * @throws IllegalArgumentException if the soundbank isn't supported by this
+   */
+  public void unloadInstruments(Soundbank soundbank, Patch[] patchList);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SysexMessage.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SysexMessage.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SysexMessage.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/SysexMessage.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,139 @@
+/* SysexMessage.java -- System Exclusive MIDI message.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * A system exclusive MIDI message.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public class SysexMessage extends MidiMessage
+{
+  public static final int SYSTEM_EXCLUSIVE = 0xF0;
+  
+  public static final int SPECIAL_SYSTEM_EXCLUSIVE = 0xF7;
+  
+  /**
+   * Create a default valid system exclusive message.
+   * 
+   * The official specs don't specify what message is to be
+   * created.  Our implementation creates an empty 
+   * system exclusive message.
+   */
+  public SysexMessage()
+  {
+    super(new byte[2]);
+    data[0] = (byte) SYSTEM_EXCLUSIVE;
+    data[1] = (byte) ShortMessage.END_OF_EXCLUSIVE;
+  }
+  
+  /**
+   * Create a SysexMessage object.
+   * @param data a complete system exclusive message
+   */
+  protected SysexMessage(byte[] data)
+  {
+    super(data);   
+  }
+  
+  /**
+   * Set the sysex message.  The first data byte (status) must be
+   * 0xF0 or 0xF7.
+   *  
+   * @param data the message data
+   * @param length the length of the message data
+   * @throws InvalidMidiDataException if the status byte is not 0xF0 or 0xF7
+   */
+  public void setMessage(byte[] data, int length)
+    throws InvalidMidiDataException
+  {
+    if (data[0] != SYSTEM_EXCLUSIVE
+        && data[0] != SPECIAL_SYSTEM_EXCLUSIVE)
+      throw new InvalidMidiDataException("Sysex message starts with 0x"
+                                         + Integer.toHexString(data[0])
+                                         + " instead of 0xF0 or 0xF7");
+    super.setMessage(data, length);
+  }
+
+  /**
+   * Set the sysex message.  status must be either 0xF0 or 0xF7.
+   *  
+   * @param status the sysex statys byte (0xF0 or 0xF7)
+   * @param data the message data
+   * @param length the length of the message data
+   * @throws InvalidMidiDataException if status is not 0xF0 or 0xF7
+   */
+  public void setMessage(int status, byte[] data, int length)
+    throws InvalidMidiDataException
+  {
+    if (status != SYSTEM_EXCLUSIVE
+        && status != SPECIAL_SYSTEM_EXCLUSIVE)
+      throw new InvalidMidiDataException("Sysex message starts with 0x"
+                                         + Integer.toHexString(status)
+                                         + " instead of 0xF0 or 0xF7");
+    this.data = new byte[length+1];
+    this.data[0] = (byte) status;
+    System.arraycopy(data, 0, this.data, 1, length);
+    this.length = length+1;
+  }
+  
+  /**
+   * Get the data for this message, not including the status byte.
+   * @return the message data, not including the status byte
+   */
+  public byte[] getData()
+  {
+    byte[] result = new byte[length - 1];
+    System.arraycopy(data, 1, result, 0, length - 1);
+    return result;
+  }
+  
+  /* Create a deep-copy clone of this object.
+   * @see java.lang.Object#clone()
+   */
+  public Object clone()
+  {
+    byte message[] = new byte[length];
+    System.arraycopy(data, 0, message, 0, length);
+    return new SysexMessage(message); 
+  }
+}
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Track.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Track.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Track.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Track.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,165 @@
+/* Track.java -- A track of MIDI events
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+import java.util.HashSet;
+import java.util.Vector;
+
+/**
+ * A Track contains a list of timecoded MIDI events for processing 
+ * by a Sequencer.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public class Track
+{
+  /**
+   * The list of MidiEvents for this track. 
+   */
+  Vector events = new Vector();
+  
+  // A HashSet to speed processing
+  private HashSet eventSet = new HashSet();
+
+  // This is only instantiable within this package.
+  Track()
+  {
+  }
+
+  /**
+   * Add a new event to this track.  Specific events may only be added once.
+   * The event will be inserted into the appropriate spot in the event list
+   * based on its timecode.
+   * 
+   * @param event the event to add
+   * @return true if the event was added, false otherwise
+   */
+  public boolean add(MidiEvent event)
+  {
+    synchronized (events)
+    {
+      if (eventSet.contains(event))
+        return false;
+    
+      eventSet.add(event);
+
+      long targetTick = event.getTick();
+      int i = events.size() - 1;
+      while (i >= 0 && (((MidiEvent)events.get(i)).getTick() > targetTick))
+        i--;
+      events.add(i+1, event);
+      return true;
+    }
+  }
+    
+  /**
+   * Remove an event from this track.
+   * 
+   * @param event the event to remove
+   * @return true if the event was removed, false otherwise
+   */
+  public boolean remove(MidiEvent event)
+  {
+    synchronized (events)
+    {
+      if (! eventSet.remove(event))
+        return false;
+          
+      int i = events.indexOf(event);
+      if (i >= 0)
+        {
+          events.remove(i);
+          return true;
+        }
+         
+      throw new InternalError("event in set but not list");
+    }
+  }
+  
+  /**
+   * Get an event idetified by its order index
+   * 
+   * @param index the location of the event to get
+   * @return the event at index
+   * @throws ArrayIndexOutOfBoundsException if index is out of bounds
+   */
+  public MidiEvent get(int index) throws ArrayIndexOutOfBoundsException
+  {
+    synchronized (events)
+    {
+      try
+      {
+        return (MidiEvent) events.get(index);
+      }
+      catch (IndexOutOfBoundsException e)
+      {
+        throw (ArrayIndexOutOfBoundsException) 
+          new ArrayIndexOutOfBoundsException().initCause(e);
+      }
+    }
+  }
+  
+  
+  /**
+   * Get the number events in this track.
+   * 
+   * @return the number of events in this track
+   */
+  public int size()
+  {
+    return events.size();
+  }
+
+  /**
+   * Get the length of the track in MIDI ticks.
+   * 
+   * @return the length of the track in MIDI ticks
+   */
+  public long ticks()
+  {
+    synchronized (events)
+    {
+      int size = events.size();
+      return ((MidiEvent) events.get(size - 1)).getTick();
+    }
+  }
+ }
+

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Transmitter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Transmitter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Transmitter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/Transmitter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* Transmitter.java -- A interface for objects sending MIDI events
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * This interface specifies the methods required by objects which send
+ * MIDI events to Receivers, including MIDI IN ports and Sequencers.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public interface Transmitter
+{
+  /**
+   * Set the Receiver to which MIDI events will be sent.
+   * 
+   * @param receiver the Receiver to which MIDI events will be sent
+   */
+  public void setReceiver(Receiver receiver);
+  
+  /**
+   * Get the Receiver to which MIDI events will be sent (possibly null)
+   * 
+   * @return the Receiver to which MIDI events will be sent (possibly null)
+   */
+  public Receiver getReceiver();
+
+  /**
+   * Close this Transmitter, possibly releasing system resources.
+   * FIXME: Does this mean the Receiver is closed?  I think it must.
+   */
+  public void close();  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/VoiceStatus.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/VoiceStatus.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/VoiceStatus.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/VoiceStatus.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* VoiceStatus.java -- the current status of a Synthesizer voice
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi;
+
+/**
+ * Objects of this type define the status of a Synthesizer voice.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public class VoiceStatus
+{
+  /**
+   * True if this voice is processing a MIDI note.
+   */
+  public boolean active = false;
+  
+  /**
+   * The channel for this voice when active.
+   */
+  public int channel = 0;
+  
+  /**
+   * The bank of the voice when active.
+   */
+  public int bank = 0;
+  
+   /**
+   * The program for this voice when active.
+   */
+  public int program = 0;
+  
+  /**
+   * The note for this voice when active.
+   */
+  public int note = 0;
+  
+  /**
+   * The volume for this voice when active.
+   */
+  public int volume = 0;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiDeviceProvider.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,90 @@
+/* MidiDeviceProvider.java -- Abstract parent for a MIDI device provider.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import javax.sound.midi.*;
+
+/**
+ * The abstract base class for all MidiDeviceProvider types.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiDeviceProvider
+{
+  /**
+   * Returns true if this provider supports a specific MIDI device.
+   * 
+   * @param info the MIDI device descriptor
+   * @return true if this provider supports info
+   */
+  public boolean isDeviceSupported(MidiDevice.Info info)
+  {
+    MidiDevice.Info infos[] = getDeviceInfo();
+    
+    int i = infos.length;
+    
+    while (i > 0)
+    {
+      if (info.equals(infos[--i]))
+        return true;
+    }
+    
+    return false;
+  }
+  
+  /**
+   * Get the list descriptors for all MIDI devices supported by
+   * this provider.
+   * 
+   * @return an array of descriptors for all supported MIDI devices.
+   */
+  public abstract MidiDevice.Info[] getDeviceInfo();
+  
+  /**
+   * Get the MidiDevice for the MIDI device described by info
+   * 
+   * @param info the descriptor for the MIDI device we want
+   * @return the MidiDevice we're looking for
+   * @throws IllegalArgumentException is this provider doesn't support info
+   */
+  public abstract MidiDevice getDevice(MidiDevice.Info info)
+    throws IllegalArgumentException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileReader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,125 @@
+/* MidiFilerReader.java -- MIDI file reading services
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.MidiFileFormat;
+import javax.sound.midi.Sequence;
+
+/**
+ * The MidiFileReader abstract class defines the methods to be provided
+ * by a MIDI file reader.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiFileReader
+{
+  /**
+   * Read a MidiFileFormat from the given stream.
+   * 
+   * @param stream the stream from which to read the MIDI data
+   * @return the MidiFileFormat object
+   * @throws InvalidMidiDataException if the stream refers to invalid data
+   * @throws IOException if an I/O exception occurs while reading
+   */
+  public abstract MidiFileFormat getMidiFileFormat(InputStream stream)
+    throws InvalidMidiDataException, IOException;
+  
+  /**
+   * Read a MidiFileFormat from the given stream.
+   * 
+   * @param url the url from which to read the MIDI data
+   * @return the MidiFileFormat object
+   * @throws InvalidMidiDataException if the url refers to invalid data
+   * @throws IOException if an I/O exception occurs while reading
+   */
+  public abstract MidiFileFormat getMidiFileFormat(URL url)
+    throws InvalidMidiDataException, IOException;  
+
+  /**
+   * Read a MidiFileFormat from the given stream.
+   * 
+   * @param file the file from which to read the MIDI data
+   * @return the MidiFileFormat object
+   * @throws InvalidMidiDataException if the file refers to invalid data
+   * @throws IOException if an I/O exception occurs while reading
+   */
+  public abstract MidiFileFormat getMidiFileFormat(File file)
+    throws InvalidMidiDataException, IOException; 
+  
+  /**
+   * Read a Sequence from the given stream.
+   * 
+   * @param stream the stream from which to read the MIDI data
+   * @return the Sequence object
+   * @throws InvalidMidiDataException if the stream refers to invalid data
+   * @throws IOException if an I/O exception occurs while reading
+   */
+  public abstract Sequence getSequence(InputStream stream)
+    throws InvalidMidiDataException, IOException;
+  
+  /**
+   * Read a Sequence from the given stream.
+   * 
+   * @param url the url from which to read the MIDI data
+   * @return the Sequence object
+   * @throws InvalidMidiDataException if the url refers to invalid data
+   * @throws IOException if an I/O exception occurs while reading
+   */
+  public abstract Sequence getSequence(URL url)
+    throws InvalidMidiDataException, IOException;  
+
+  /**
+   * Read a Sequence from the given stream.
+   * 
+   * @param file the file from which to read the MIDI data
+   * @return the Sequence object
+   * @throws InvalidMidiDataException if the file refers to invalid data
+   * @throws IOException if an I/O exception occurs while reading
+   */
+  public abstract Sequence getSequence(File file)
+    throws InvalidMidiDataException, IOException; 
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/MidiFileWriter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,143 @@
+/* MidiFileWriter.java -- MIDI file writing services
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.sound.midi.Sequence;
+
+/**
+ * MidiFileWriter provides MIDI file writing services. 
+ * 
+ * There are three types of Standard MIDI File (SMF) formats, 
+ * represented by integers 0, 1, and 2.
+ * 
+ * Type 0 files contain a single track and represents a single song
+ * performance.
+ * Type 1 may contain multiple tracks for a single song performance.
+ * Type 2 may contain multiple tracks, each representing a
+ * separate song performance.
+ * 
+ * See http://en.wikipedia.org/wiki/MIDI#MIDI_file_formats for more
+ * information.
+ *  
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class MidiFileWriter
+{
+  /**
+   * Return the MIDI file types supported by this writer.
+   * 
+   * @return the MIDI file types, or an empty array
+   */
+  public abstract int[] getMidiFileTypes();
+  
+  /**
+   * Return the MIDI file types supported by this writer for the
+   * given sequence.
+   * 
+   * @param sequence the sequence we'd like to write
+   * @return the MIDI file types, or an empty array
+   */
+  public abstract int[] getMidiFileTypes(Sequence sequence);
+  
+  /**
+   * Returns true if this writer supports the given file type.
+   * 
+   * @param fileType the file type we're asking about
+   * @return true if this writer supports fileType, false otherwise
+   */
+  public boolean isFileTypeSupported(int fileType)
+  {
+    int types[] = getMidiFileTypes();
+    for (int i = types.length; i > 0;)
+    {
+      if (types[--i] == fileType)
+        return true;
+    }
+    return false;
+  }
+
+  /**
+   * Returns true if this writer supports the given file type for the
+   * given sequence.
+   * 
+   * @param fileType the file type we're asking about
+   * @param sequence the sequence we'd like to write
+   * @return true if this writer supports fileType, false otherwise
+   */
+  public boolean isFileTypeSupported(int fileType, Sequence sequence)
+  {
+    int types[] = getMidiFileTypes(sequence);
+    for (int i = types.length; i > 0;)
+    {
+      if (types[--i] == fileType)
+        return true;
+    }
+    return false;
+  }
+
+  /**
+   * Write a sequence to a stream using the specified MIDI file type.
+   * 
+   * @param in the sequence to write
+   * @param fileType the MIDI file type to use
+   * @param out the output stream to write to
+   * @return the number of byte written
+   * @throws IOException if an I/O exception happens
+   */
+  public abstract int write(Sequence in, int fileType, OutputStream out)
+    throws IOException;
+
+  /**
+   * Write a sequence to a file using the specified MIDI file type.
+   * 
+   * @param in the sequence to write
+   * @param fileType the MIDI file type to use
+   * @param out the file to write to
+   * @return the number of byte written
+   * @throws IOException if an I/O exception happens
+   */
+  public abstract int write(Sequence in, int fileType, File out)
+    throws IOException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/midi/spi/SoundbankReader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,97 @@
+/* SoundbankReader.java -- Soundbank file reading services
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.midi.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.midi.InvalidMidiDataException;
+import javax.sound.midi.Soundbank;
+
+/**
+ * The SoundbankReader abstract class defines the methods to be provided
+ * by a soundbank file reader.
+ * 
+ * @author Anthony Green (green at redhat.com)
+ * @since 1.3
+ *
+ */
+public abstract class SoundbankReader
+{
+  /**
+   * Get a Soundbank from the given URL.
+   * 
+   * @param url from which to read the Soundbank
+   * 
+   * @return the Soundbank object
+   * 
+   * @throws InvalidMidiDataException if the data provided by url cannot be recognized
+   * @throws IOException if the data provided by url cannot be read
+   */
+  public abstract Soundbank getSoundbank(URL url)
+    throws InvalidMidiDataException, IOException;
+  
+  /**
+   * Get a Soundbank from the given InputStream.
+   * 
+   * @param stream from which to read the Soundbank
+   * 
+   * @return the Soundbank object
+   * 
+   * @throws InvalidMidiDataException if the data provided by InputStream cannot be recognized
+   * @throws IOException if the data provided by InputStream cannot be read
+   */
+  public abstract Soundbank getSoundbank(InputStream stream)
+    throws InvalidMidiDataException, IOException;
+  
+  /**
+   * Get a Soundbank from the given File.
+   * 
+   * @param file from which to read the Soundbank
+   * 
+   * @return the Soundbank object
+   * 
+   * @throws InvalidMidiDataException if the data provided by File cannot be recognized
+   * @throws IOException if the data provided by File cannot be read
+   */
+  public abstract Soundbank getSoundbank(File file)
+    throws InvalidMidiDataException, IOException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFileFormat.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFileFormat.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFileFormat.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFileFormat.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,242 @@
+/* Audio file format
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This describes an audio file, including information about its length,
+ * the format of the audio data, and other things.
+ * @since 1.3
+ */
+public class AudioFileFormat
+{
+  /**
+   * An instance of this type describes a standard audio file format.
+   * @since 1.3
+   */
+  public static class Type
+  {
+    // This is kind of goofy since there are multiple extensions for
+    // some of these.
+
+    /** The AIFC format.  */
+    public static final Type AIFC = new Type("AIFC", "aifc");
+
+    /** The AIFF format.  */
+    public static final Type AIFF = new Type("AIFF", "aiff");
+
+    /** The AU format.  */
+    public static final Type AU = new Type("AU", "au");
+
+    /** The SND format.  */
+    public static final Type SND = new Type("SND", "snd");
+
+    /** The WAVE format.  */
+    public static final Type WAVE = new Type ("WAVE", "wav");
+
+    private String name;
+    private String extension;
+
+    /**
+     * Create a new Type given its name and file extension.
+     * The file extension does not include the ".".
+     * @param name the type's name
+     * @param extension the file extension
+     */
+    public Type(String name, String extension)
+    {
+      this.name = name;
+      this.extension = extension;
+    }
+
+    public final boolean equals(Object o)
+    {
+      if (! (o instanceof Type))
+        return false;
+      Type other = (Type) o;
+      return name.equals(other.name) && extension.equals(other.extension);
+    }
+
+    public final int hashCode()
+    {
+      return name.hashCode() + extension.hashCode();
+    }
+
+    /**
+     * Return the extension associated with this Type.
+     */
+    public String getExtension()
+    {
+      return extension;
+    }
+
+    /**
+     * Return the name of this Type.
+     */
+    public final String toString()
+    {
+      return name;
+    }
+  }
+
+  private int byteLength;
+  private AudioFormat format;
+  private Type type;
+  private int frameLength;
+  private Map properties;
+
+  /**
+   * Create a new AudioFileFormat given the type, the format, and the
+   * frame length.  The new object will have an unspecified byte length,
+   * and an empty properties map.
+   * @param type the type
+   * @param fmt the format
+   * @param frameLen the frame length
+   */
+  public AudioFileFormat(Type type, AudioFormat fmt, int frameLen)
+  {
+    this.byteLength = AudioSystem.NOT_SPECIFIED;
+    this.format = fmt;
+    this.type = type;
+    this.frameLength = frameLen;
+    this.properties = Collections.EMPTY_MAP;
+  }
+
+  /**
+   * Create a new AudioFileFormat given the type, the format, the
+   * frame length, and some properties.  The new object will have an 
+   * unspecified byte length.  A copy of the properties argument will
+   * be made, so changes to the map passed in will not affect the
+   * new AudioFileFormat.
+   * @param type the type
+   * @param fmt the format
+   * @param frameLen the frame length
+   * @param properties the properties
+   */
+  public AudioFileFormat(Type type, AudioFormat fmt, int frameLen,
+			 Map properties)
+  {
+    this.byteLength = AudioSystem.NOT_SPECIFIED;
+    this.format = fmt;
+    this.type = type;
+    this.frameLength = frameLen;
+    this.properties = Collections.unmodifiableMap(new HashMap(properties));
+  }
+
+  /**
+   * Create a new AudioFileFormat given the type, the byte length, the format,
+   * and the frame length.  The new object will have an empty properties map.
+   * @param type the type
+   * @param byteLen the byte length
+   * @param fmt the format
+   * @param frameLen the frame length
+   */
+  protected AudioFileFormat(Type type, int byteLen, AudioFormat fmt,
+			    int frameLen)
+  {
+    this.byteLength = byteLen;
+    this.format = fmt;
+    this.type = type;
+    this.frameLength = frameLen;
+    this.properties = Collections.EMPTY_MAP;
+  }
+
+  /**
+   * Return the byte length of this file format.
+   */
+  public int getByteLength()
+  {
+    return byteLength;
+  }
+
+  /**
+   * Return the AudioFormat associated with this file format.
+   */
+  public AudioFormat getFormat()
+  {
+    return format;
+  }
+
+  /**
+   * Return the frame length of this file format.
+   */
+  public int getFrameLength()
+  {
+    return frameLength;
+  }
+
+  /**
+   * Return the value of a property defined in this format.
+   * @param key the property name
+   * @return the value of the property, or null if the property is not defined
+   */
+  public Object getProperty(String key)
+  {
+    return properties.get(key);
+  }
+
+  /**
+   * Return the Type associated with this file format.
+   */
+  public Type getType()
+  {
+    return type;
+  }
+
+  /**
+   * Return the properties associated with this format, as a Map.
+   * The returned Map is unmodifiable.
+   */
+  public Map properties()
+  {
+    return properties;
+  }
+
+  /**
+   * Return a description of this AudioFileFormat.
+   */
+  public String toString()
+  {
+    return ("byteLength=" + byteLength + "; format=" + format
+	    + "; type=" + type + "; frameLength=" + frameLength);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFormat.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFormat.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFormat.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioFormat.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,345 @@
+/* An audio format
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This class describes an audio format, including its encoding,
+ * the number of channels, its frame rate, etc.
+ * @since 1.3
+ */
+public class AudioFormat
+{
+  /**
+   * This describes a given audio format encoding.
+   * @since 1.3
+   */
+  public static class Encoding
+  {
+    /** The ALAW encoding.  */
+    public static final Encoding ALAW = new Encoding("alaw");
+
+    /** The signed PCM encoding.  */
+    public static final Encoding PCM_SIGNED = new Encoding("pcm_signed");
+
+    /** The unsigned PCM encoding.  */
+    public static final Encoding PCM_UNSIGNED = new Encoding("pcm_unsigned");
+
+    /** The ULAW encoding.  */
+    public static final Encoding ULAW = new Encoding("ulaw");
+
+    private String name;
+
+    /**
+     * Create a new encoding descriptor, given its name.
+     * @param name the name
+     */
+    public Encoding(String name)
+    {
+      this.name = name;
+    }
+
+    public final boolean equals(Object o)
+    {
+      return super.equals(o);
+    }
+
+    public final int hashCode()
+    {
+      return super.hashCode();
+    }
+
+    /**
+     * Return the name of this encoding.
+     */
+    public final String toString()
+    {
+      return name;
+    }
+  }
+
+  /**
+   * True if the audio data is stored big-endian.
+   */
+  protected boolean bigEndian;
+
+  /**
+   * The number of channels of data in this format.
+   */
+  protected int channels;
+
+  /**
+   * The encoding of this format.
+   */
+  protected Encoding encoding;
+
+  /**
+   * The frame rate of this format.  This is the number of frames
+   * per second.
+   */
+  protected float frameRate;
+
+  /**
+   * The number of bytes per frame in this format.
+   */
+  protected int frameSize;
+
+  /**
+   * The number of samples per second.
+   */
+  protected float sampleRate;
+
+  /**
+   * The number of bits in each sample.
+   */
+  protected int sampleSizeInBits;
+
+  private Map properties;
+
+  /**
+   * Create a new audio format, given various attributes of it.
+   * The properties map for this format will be empty.
+   * 
+   * @param encoding the encoding for this format
+   * @param sampleRate the sample rate
+   * @param sampleSizeInBits the sample size, in bits
+   * @param channels the number of channels
+   * @param frameSize the frame size, in bytes
+   * @param frameRate the frame rate, in frames per second
+   * @param bigEndian true if the data is stored big-endian
+   */
+  public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
+		     int channels, int frameSize, float frameRate,
+		     boolean bigEndian)
+  {
+    this.encoding = encoding;
+    this.sampleRate = sampleRate;
+    this.sampleSizeInBits = sampleSizeInBits;
+    this.channels = channels;
+    this.frameSize = frameSize;
+    this.frameRate = frameRate;
+    this.bigEndian = bigEndian;
+    this.properties = Collections.EMPTY_MAP;
+  }
+
+  /**
+   * Create a new audio format, given various attributes of it.
+   * The properties map is copied by this constructor, so changes
+   * to the argument Map will not affect the new object.
+   *
+   * @param encoding the encoding for this format
+   * @param sampleRate the sample rate
+   * @param sampleSizeInBits the sample size, in bits
+   * @param channels the number of channels
+   * @param frameSize the frame size, in bytes
+   * @param frameRate the frame rate, in frames per second
+   * @param bigEndian true if the data is stored big-endian
+   * @param properties a map describing properties of this format
+   */
+  public AudioFormat(Encoding encoding, float sampleRate, int sampleSizeInBits,
+		     int channels, int frameSize, float frameRate,
+		     boolean bigEndian, Map properties)
+  {
+    this.encoding = encoding;
+    this.sampleRate = sampleRate;
+    this.sampleSizeInBits = sampleSizeInBits;
+    this.channels = channels;
+    this.frameSize = frameSize;
+    this.frameRate = frameRate;
+    this.bigEndian = bigEndian;
+    this.properties = Collections.unmodifiableMap(new HashMap(properties));
+  }
+
+  /**
+   * Create a new PCM-based audio format, given various attributes of it.
+   * The encoding will either be Encoding#PCM_SIGNED or Encoding#PCM_UNSIGNED.
+   * The frame size for this format will be derived from the sample size in
+   * bits and the number of channels, unless one of those is
+   * AudioSystem#NOT_SPECIFIED.  The frame rate will be the same as the sample
+   * rate, and the properties map will be empty.
+   * 
+   * @param sampleRate the sample rate
+   * @param sampleSizeInBits the sample size, in bits
+   * @param channels the number of channels
+   * @param signed true if this is a signed encoding
+   * @param bigEndian true if the data is stored big-endian
+   */
+  public AudioFormat(float sampleRate, int sampleSizeInBits,
+		     int channels, boolean signed, boolean bigEndian)
+  {
+    this.encoding = signed ? Encoding.PCM_SIGNED : Encoding.PCM_UNSIGNED;
+    this.sampleRate = sampleRate;
+    this.sampleSizeInBits = sampleSizeInBits;
+    this.channels = channels;
+    // It isn't clear whether channels can be NOT_SPECIFIED.
+    if (sampleSizeInBits == AudioSystem.NOT_SPECIFIED
+        || channels == AudioSystem.NOT_SPECIFIED)
+      this.frameSize = AudioSystem.NOT_SPECIFIED;
+    else
+      this.frameSize = (sampleSizeInBits + 7) / 8 * channels;
+    this.frameRate = sampleRate;
+    this.bigEndian = bigEndian;
+    this.properties = Collections.EMPTY_MAP;
+  }
+
+  /**
+   * Return the number of channels in this format.
+   */
+  public int getChannels()
+  {
+    return channels;
+  }
+
+  /**
+   * Return the encoding of this format.
+   */
+  public Encoding getEncoding()
+  {
+    return encoding;
+  }
+
+  /**
+   * Return the frame rate of this format.
+   */
+  public float getFrameRate()
+  {
+    return frameRate;
+  }
+
+  /**
+   * Return the frame size of this format.
+   */
+  public int getFrameSize()
+  {
+    return frameSize;
+  }
+
+  /**
+   * Given a key, return a property associated with this format;
+   * or null if this property is not set. 
+   * @param key the name of the property
+   * @return the value of the property, or null if the property is not set
+   */
+  public Object getProperty(String key)
+  {
+    return properties.get(key);
+  }
+
+  /**
+   * Return the sample rate of this format.
+   */
+  public float getSampleRate()
+  {
+    return sampleRate;
+  }
+
+  /**
+   * Return the sample size of this format, in bits.
+   */
+  public int getSampleSizeInBits()
+  {
+    return sampleSizeInBits;
+  }
+
+  /**
+   * Return true if this format is big endian, false otherwise.
+   * This only matters for formats whose sample size is greater than
+   * one byte.
+   */
+  public boolean isBigEndian()
+  {
+    return bigEndian;
+  }
+
+  /**
+   * Return true if this audio format matches another.
+   * @param fmt the format to match against
+   * @return true if they match, false otherwise
+   */
+  public boolean matches(AudioFormat fmt)
+  {
+    if (! encoding.equals(fmt.encoding)
+        || channels != fmt.channels
+        || sampleSizeInBits != fmt.sampleSizeInBits
+        || frameSize != fmt.frameSize)
+      return false;
+    if (sampleRate != AudioSystem.NOT_SPECIFIED
+        && fmt.sampleRate != AudioSystem.NOT_SPECIFIED
+        && sampleRate != fmt.sampleRate)
+      return false;
+    if (frameRate != AudioSystem.NOT_SPECIFIED
+        && fmt.frameRate != AudioSystem.NOT_SPECIFIED
+        && frameRate != fmt.frameRate)
+      return false;
+    if (sampleSizeInBits > 8)
+      return bigEndian == fmt.bigEndian;
+    return true;
+  }
+
+  /**
+   * Return a read-only Map holding the properties associated with 
+   * this format.
+   */
+  public Map properties()
+  {
+    return properties;
+  }
+
+  /**
+   * Return a description of this format.
+   */
+  public String toString()
+  {
+    StringBuffer result = new StringBuffer();
+    result.append(encoding);
+    result.append(" ");
+    result.append(sampleRate);
+    result.append(" Hz ");
+    result.append(sampleSizeInBits);
+    result.append(" bits ");
+    result.append(channels);
+    result.append(" channels");
+    if (sampleSizeInBits > 8)
+      result.append(bigEndian ? " big endian" : " little endian");
+    return result.toString();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioInputStream.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioInputStream.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioInputStream.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioInputStream.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,258 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * This is an InputStream which is specialized for reading audio files.
+ * In particular it only allows operations to act on a multiple of
+ * the audio stream's frame size.
+ * @since 1.3
+ */
+public class AudioInputStream extends InputStream
+{
+  /** The format of the audio stream.  */
+  protected AudioFormat format;
+
+  /** The length of the audio stream in frames.  */
+  protected long frameLength;
+
+  /** The current frame position, starting from frame zero.  */ 
+  protected long framePos;
+
+  /** The size of a frame in bytes.  */
+  protected int frameSize;
+
+  // I wonder why this class doesn't inherit from FilterInputStream.
+  private InputStream input;
+
+  // The saved frame position, used for mark/reset.
+  private long markedFramePos;
+
+  /**
+   * Create a new AudioInputStream given an underlying InputStream,
+   * the audio format, and the length of the data in frames.  The
+   * frame size is taken from the format.
+   * @param is the underlying input stream
+   * @param fmt the format of the data
+   * @param length the length of the data in frames
+   */
+  public AudioInputStream(InputStream is, AudioFormat fmt, long length)
+  {
+    this.format = fmt;
+    this.frameLength = length;
+    this.framePos = 0;
+    this.frameSize = fmt.getFrameSize();
+    this.input = is;
+  }
+
+  /**
+   * Create a new AudioInputStream given a TargetDataLine.  The audio
+   * format and the frame size are taken from the line.
+   * @param line the TargetDataLine
+   */
+  public AudioInputStream(TargetDataLine line)
+  {
+    this(new TargetInputStream(line), line.getFormat(),
+	 AudioSystem.NOT_SPECIFIED);
+  }
+
+  /**
+   * Return the number of bytes available to be read from the
+   * underlying stream.  This wrapper method ensures that the result
+   * is always a multiple of the frame size.
+   */
+  public int available() throws IOException
+  {
+    int result = input.available();
+    // Ensure result is a multiple of the frame size.
+    if (frameSize != AudioSystem.NOT_SPECIFIED)
+      result -= result % frameSize;
+    return result;
+  }
+
+  /**
+   * Close the stream.
+   */
+  public void close() throws IOException
+  {
+    input.close();
+  }
+
+  /**
+   * Get the format associated with this stream.
+   * @return the AudioFormat
+   */
+  public AudioFormat getFormat()
+  {
+    return format;
+  }
+
+  /**
+   * Get the length of this stream in frames.  Note that this
+   * may be AudioSystem#NOT_SPECIFIED.
+   * @return the length of the stream in frames
+   */
+  public long getFrameLength()
+  {
+    return frameLength;
+  }
+
+  public void mark(int limit)
+  {
+    input.mark(limit);
+    markedFramePos = framePos;
+  }
+
+  /**
+   * Return true if the underlying stream supports mark and reset,
+   * false otherwise.
+   */
+  public boolean markSupported()
+  {
+    return input.markSupported();
+  }
+
+  /**
+   * Read a single byte from the underlying stream.  If the frame
+   * size is set, and is not one byte, an IOException will be thrown.
+   */
+  public int read() throws IOException
+  {
+    if (frameSize != 1)
+      throw new IOException("frame size must be 1 for read()");
+    int result;
+    if (framePos == frameLength)
+      result = -1;
+    else
+      result = input.read();
+    if (result != -1)
+      ++framePos;
+    return result;
+  }
+
+  public int read(byte[] buf) throws IOException
+  {
+    return read(buf, 0, buf.length);
+  }
+
+  public int read(byte[] buf, int offset, int length) throws IOException
+  {
+    int result;
+    if (framePos == frameLength)
+      result = -1;
+    else
+      {
+	int myFrameSize = (frameSize == AudioSystem.NOT_SPECIFIED
+			   ? 1 : frameSize);
+	// Ensure length is a multiple of frame size.
+	length -= length % myFrameSize;
+
+	result = 0;
+	while (result == 0 || result % myFrameSize != 0)
+	  {
+	    int val = input.read(buf, offset, length);
+	    if (val < 0)
+	      {
+		// This is a weird situation as we might have read a
+		// frame already.  It isn't clear at all what to do if
+		// we only found a partial frame.  For now we just
+		// return whatever we did find.
+		if (result == 0)
+		  return -1;
+		result -= result % myFrameSize;
+		break;
+	      }
+	    result += val;
+	  }
+	// assert result % myFrameSize == 0;
+	framePos += result / myFrameSize;
+      }
+    return result;
+  }
+
+  public void reset() throws IOException
+  {
+    input.reset();
+    framePos = markedFramePos;    
+  }
+
+  public long skip(long n) throws IOException
+  {
+    if (frameSize != AudioSystem.NOT_SPECIFIED)
+      n -= n % frameSize;
+    long actual = input.skip(n);
+    if (frameSize != AudioSystem.NOT_SPECIFIED)
+      framePos += actual / frameSize;
+    return actual;
+  }
+
+  private static class TargetInputStream extends InputStream
+  {
+    private TargetDataLine line;
+    private byte[] buf;
+
+    /**
+     * Create a new TargetInputStream.
+     * @param line the line to wrap
+     */
+    public TargetInputStream(TargetDataLine line)
+    {
+      this.line = line;
+      // FIXME: do we have to call line.open()?
+    }
+
+    public synchronized int read() throws IOException
+    {
+      if (buf == null)
+	buf = new byte[1];
+      int count = read(buf, 0, 1);
+      if (count < 0)
+	return -1;
+      return buf[0];
+    }
+
+    public int read(byte[] buf, int offset, int length) throws IOException
+    {
+      return line.read(buf, offset, length);
+    }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioPermission.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioPermission.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioPermission.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioPermission.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.security.BasicPermission;
+
+/**
+ * This represents the permission to use an audio device.
+ * The only predefined permission names are "play" and "record".
+ * @since 1.3
+ */
+public class AudioPermission extends BasicPermission
+{
+  private static final long serialVersionUID = -5518053473477801126L;
+
+  /**
+   * Construct an AudioPermission with the given name.
+   * @param name the name of the permission, like "play" or "record"
+   */
+  public AudioPermission(String name)
+  {
+    super(name);
+  }
+
+  /**
+   * Construct an AudioPermission with the given name.
+   * @param name the name of the permission, like "play" or "record"
+   * @param actions the actions; should be null
+   */
+  public AudioPermission(String name, String actions)
+  {
+    super(name, actions);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioSystem.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioSystem.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioSystem.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/AudioSystem.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,749 @@
+/* Main interface to audio system
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import gnu.classpath.ServiceFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.sound.sampled.spi.AudioFileReader;
+import javax.sound.sampled.spi.AudioFileWriter;
+import javax.sound.sampled.spi.FormatConversionProvider;
+import javax.sound.sampled.spi.MixerProvider;
+
+/**
+ * This clas is the primary interface to the audio system.  It contains
+ * a number of static methods which can be used to access this package's
+ * functionality.
+ * 
+ * @since 1.3
+ */
+public class AudioSystem
+{
+  /**
+   * A constant which can be passed to a number of methods in this package,
+   * to indicate an unspecified value.
+   */
+  public static final int NOT_SPECIFIED = -1;
+
+  // This class is not instantiable.
+  private AudioSystem()
+  {
+  }
+
+  /**
+   * Return the file format of a given File.
+   * @param f the file to check
+   * @return the format of the file
+   * @throws UnsupportedAudioFileException if the file's format is not 
+   * recognized
+   * @throws IOException if there is an I/O error reading the file
+   */
+  public static AudioFileFormat getAudioFileFormat(File f)
+    throws UnsupportedAudioFileException, IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+    while (i.hasNext())
+      {
+        AudioFileReader reader = (AudioFileReader) i.next();
+        try
+          {
+            return reader.getAudioFileFormat(f);
+          }
+        catch (UnsupportedAudioFileException _)
+          {
+            // Try the next provider.
+          }
+      }
+    throw new UnsupportedAudioFileException("file type not recognized");
+  }
+
+  /**
+   * Return the file format of a given input stream.
+   * @param is the input stream to check
+   * @return the format of the stream
+   * @throws UnsupportedAudioFileException if the stream's format is not 
+   * recognized
+   * @throws IOException if there is an I/O error reading the stream
+   */
+  public static AudioFileFormat getAudioFileFormat(InputStream is)
+    throws UnsupportedAudioFileException, IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+    while (i.hasNext())
+      {
+        AudioFileReader reader = (AudioFileReader) i.next();
+        try
+          {
+            return reader.getAudioFileFormat(is);
+          }
+        catch (UnsupportedAudioFileException _)
+          {
+            // Try the next provider.
+          }
+      }
+    throw new UnsupportedAudioFileException("input stream type not recognized");
+  }
+
+  /**
+   * Return the file format of a given URL.
+   * @param url the URL to check
+   * @return the format of the URL
+   * @throws UnsupportedAudioFileException if the URL's format is not 
+   * recognized
+   * @throws IOException if there is an I/O error reading the URL
+   */
+  public static AudioFileFormat getAudioFileFormat(URL url)
+    throws UnsupportedAudioFileException, IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+    while (i.hasNext())
+      {
+        AudioFileReader reader = (AudioFileReader) i.next();
+        try
+          {
+            return reader.getAudioFileFormat(url);
+          }
+        catch (UnsupportedAudioFileException _)
+          {
+            // Try the next provider.
+          }
+      }
+    throw new UnsupportedAudioFileException("URL type not recognized");
+  }
+
+  /**
+   * Return an array of all the supported AudioFileFormat types.
+   * @return an array of unique types
+   */
+  public static AudioFileFormat.Type[] getAudioFileTypes()
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+    while (i.hasNext())
+      {
+        AudioFileWriter writer = (AudioFileWriter) i.next();
+        AudioFileFormat.Type[] types = writer.getAudioFileTypes();
+        for (int j = 0; j < types.length; ++j)
+          result.add(types[j]);
+      }
+    return (AudioFileFormat.Type[]) result.toArray(new AudioFileFormat.Type[result.size()]);
+  }
+
+  /**
+   * Return an array of all the supported AudioFileFormat types which match the
+   * given audio input stream
+   * @param ais the audio input stream
+   * @return an array of unique types
+   */
+  public static AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais)
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+    while (i.hasNext())
+      {
+        AudioFileWriter writer = (AudioFileWriter) i.next();
+        AudioFileFormat.Type[] types = writer.getAudioFileTypes(ais);
+        for (int j = 0; j < types.length; ++j)
+          result.add(types[j]);
+      }
+    return (AudioFileFormat.Type[]) result.toArray(new AudioFileFormat.Type[result.size()]);
+  }
+
+  /**
+   * Given an audio input stream, this will try to create a new audio input
+   * stream whose encoding matches the given target encoding.  If no provider
+   * offers this conversion, an exception is thrown. 
+   * @param targ the target encoding
+   * @param ais the original audio stream
+   * @return a new audio stream
+   * @throws IllegalArgumentException if the conversion cannot be made
+   */
+  public static AudioInputStream getAudioInputStream(AudioFormat.Encoding targ,
+						     AudioInputStream ais)
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+    while (i.hasNext())
+      {
+        FormatConversionProvider prov = (FormatConversionProvider) i.next();
+        if (! prov.isConversionSupported(targ, ais.getFormat()))
+          continue;
+        return prov.getAudioInputStream(targ, ais);
+      }
+    throw new IllegalArgumentException("encoding not supported for stream");
+ }
+
+  /**
+   * Given an audio input stream, this will try to create a new audio input
+   * stream whose format matches the given target format.  If no provider
+   * offers this conversion, an exception is thrown. 
+   * @param targ the target format
+   * @param ais the original audio stream
+   * @return a new audio stream
+   * @throws IllegalArgumentException if the conversion cannot be made
+   */
+  public static AudioInputStream getAudioInputStream(AudioFormat targ,
+						     AudioInputStream ais)
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+    while (i.hasNext())
+      {
+        FormatConversionProvider prov = (FormatConversionProvider) i.next();
+        if (! prov.isConversionSupported(targ, ais.getFormat()))
+          continue;
+        return prov.getAudioInputStream(targ, ais);
+      }
+    throw new IllegalArgumentException("format not supported for stream");
+   }
+
+  /**
+   * Return an audio input stream for the file.
+   * @param f the file to read
+   * @return an audio input stream for the file
+   * @throws UnsupportedAudioFileException if the file's audio format is not
+   * recognized
+   * @throws IOException if there is an error while reading the file
+   */
+  public static AudioInputStream getAudioInputStream(File f)
+    throws UnsupportedAudioFileException, IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+    while (i.hasNext())
+      {
+        AudioFileReader reader = (AudioFileReader) i.next();
+        try
+          {
+            return reader.getAudioInputStream(f);
+          }
+        catch (UnsupportedAudioFileException _)
+          {
+            // Try the next provider.
+          }
+      }
+    throw new UnsupportedAudioFileException("file type not recognized");
+  }
+
+  /**
+   * Return an audio input stream given an input stream.
+   * @param is the input stream
+   * @return an audio input stream
+   * @throws UnsupportedAudioFileException if the input stream's audio format
+   * is not supported by any of the installed providers
+   * @throws IOException if there is an error while reading the input stream
+   */
+  public static AudioInputStream getAudioInputStream(InputStream is)
+    throws UnsupportedAudioFileException, IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+    while (i.hasNext())
+      {
+        AudioFileReader reader = (AudioFileReader) i.next();
+        try
+          {
+            return reader.getAudioInputStream(is);
+          }
+        catch (UnsupportedAudioFileException _)
+          {
+            // Try the next provider.
+          }
+      }
+    throw new UnsupportedAudioFileException("input stream type not recognized");
+  }
+
+  /**
+   * Return an audio input stream for the given URL.
+   * @param url the URL
+   * @return an audio input stream
+   * @throws UnsupportedAudioFileException if the URL's audio format is not
+   * supported by any of the installed providers
+   * @throws IOException if there is an error while reading the URL
+   */
+  public static AudioInputStream getAudioInputStream(URL url)
+    throws UnsupportedAudioFileException, IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileReader.class);
+    while (i.hasNext())
+      {
+        AudioFileReader reader = (AudioFileReader) i.next();
+        try
+          {
+            return reader.getAudioInputStream(url);
+          }
+        catch (UnsupportedAudioFileException _)
+          {
+            // Try the next provider.
+          }
+      }
+    throw new UnsupportedAudioFileException("URL type not recognized");
+  }
+
+  /**
+   * Return a new clip which can be used for playing back an audio stream.
+   * @throws LineUnavailableException if a clip is not available for some
+   * reason
+   * @throws SecurityException if a clip cannot be made for security reasons
+   * @since 1.5
+   */
+  public static Clip getClip()
+    throws LineUnavailableException
+  {
+    Mixer.Info[] infos = getMixerInfo();
+    for (int i = 0; i < infos.length; ++i)
+      {
+        Mixer mix = getMixer(infos[i]);
+        Line[] lines = mix.getSourceLines();
+        for (int j = 0; j < lines.length; ++j)
+          {
+            if (lines[j] instanceof Clip)
+              return (Clip) lines[j];
+          }
+      }
+    throw new LineUnavailableException("no Clip available");
+  }
+
+  /**
+   * Return a new clip which can be used for playing back an audio stream.
+   * The clip is obtained from the indicated mixer.
+   * @param info the mixer to use
+   * @throws LineUnavailableException if a clip is not available for some
+   * reason
+   * @throws SecurityException if a clip cannot be made for security reasons
+   * @since 1.5
+   */
+  public static Clip getClip(Mixer.Info info)
+    throws LineUnavailableException
+  {
+    Mixer mix = getMixer(info);
+    Line[] lines = mix.getSourceLines();
+    for (int j = 0; j < lines.length; ++j)
+      {
+        if (lines[j] instanceof Clip)
+          return (Clip) lines[j];
+      }
+    throw new LineUnavailableException("no Clip available");
+  }
+
+  /**
+   * Return a line matching the provided description.  All the providers
+   * on the system are searched for a matching line.
+   * @param info description of the line
+   * @return the matching line
+   * @throws LineUnavailableException if no provider supplies a matching line
+   */
+  public static Line getLine(Line.Info info) throws LineUnavailableException
+  {
+    Mixer.Info[] infos = getMixerInfo();
+    for (int i = 0; i < infos.length; ++i)
+      {
+        Mixer mix = getMixer(infos[i]);
+        try
+        {
+          return mix.getLine(info);
+        }
+        catch (LineUnavailableException _)
+        {
+          // Try the next provider.
+        }
+      }
+    throw new LineUnavailableException("no Clip available");
+  }
+
+  /**
+   * Return a mixer matching the provided description.  All the providers
+   * on the system are searched for a matching mixer.
+   * @param info description of the mixer
+   * @return the matching mixer
+   * @throws IllegalArgumentException if no provider supplies a matching mixer
+   */
+  public static Mixer getMixer(Mixer.Info info)
+  {
+    Iterator i = ServiceFactory.lookupProviders(MixerProvider.class);
+    while (i.hasNext())
+      {
+        MixerProvider prov = (MixerProvider) i.next();
+        if (prov.isMixerSupported(info))
+          return prov.getMixer(info);
+      }
+    throw new IllegalArgumentException("mixer not found");
+  }
+
+  /**
+   * Return an array of descriptions of all the mixers provided on the system.
+   */
+  public static Mixer.Info[] getMixerInfo()
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(MixerProvider.class);
+    while (i.hasNext())
+      {
+        MixerProvider prov = (MixerProvider) i.next();
+        Mixer.Info[] is = prov.getMixerInfo();
+        for (int j = 0; j < is.length; ++j)
+          result.add(is[j]);
+      }
+    return (Mixer.Info[]) result.toArray(new Mixer.Info[result.size()]);
+  }
+
+  /**
+   * Return a source data line matching the given audio format.
+   * @param fmt the audio format
+   * @throws LineUnavailableException if no source data line matching
+   * this format is available
+   * @since 1.5
+   */
+  public static SourceDataLine getSourceDataLine(AudioFormat fmt)
+    throws LineUnavailableException
+  {
+    DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt);
+    Mixer.Info[] mixers = getMixerInfo();
+    for (int i = 0; i < mixers.length; ++i)
+      {
+        Mixer mix = getMixer(mixers[i]);
+        if (mix.isLineSupported(info))
+          return (SourceDataLine) mix.getLine(info);
+      }
+    throw new LineUnavailableException("source data line not found");
+  }
+
+  /**
+   * Return a target data line matching the given audio format.
+   * @param fmt the audio format
+   * @throws LineUnavailableException if no target data line matching
+   * this format is available
+   * @since 1.5
+   */
+  public static SourceDataLine getSourceDataLine(AudioFormat fmt,
+						 Mixer.Info mixer)
+    throws LineUnavailableException
+  {
+    DataLine.Info info = new DataLine.Info(SourceDataLine.class, fmt);
+    Mixer mix = getMixer(mixer);
+    if (mix.isLineSupported(info))
+      return (SourceDataLine) mix.getLine(info);
+    throw new LineUnavailableException("source data line not found");
+  }
+
+  /**
+   * Return an array of descriptions of all the source lines matching
+   * the given line description.
+   * @param info description of the lines to match
+   */
+  public static Line.Info[] getSourceLineInfo(Line.Info info)
+  {
+    HashSet result = new HashSet();
+    Mixer.Info[] infos = getMixerInfo();
+    for (int i = 0; i < infos.length; ++i)
+      {
+        Mixer mix = getMixer(infos[i]);
+        Line.Info[] srcs = mix.getSourceLineInfo(info);
+        for (int j = 0; j < srcs.length; ++j)
+          result.add(srcs[j]);
+      }
+    return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+  }
+
+  /**
+   * Find and return a target data line matching the given audio format.
+   * @param fmt the format to match
+   * @throws LineUnavailableException if no matching line was found 
+   * @since 1.5
+   */
+  public static TargetDataLine getTargetDataLine(AudioFormat fmt)
+    throws LineUnavailableException
+  {
+    DataLine.Info info = new DataLine.Info(TargetDataLine.class, fmt);
+    Mixer.Info[] mixers = getMixerInfo();
+    for (int i = 0; i < mixers.length; ++i)
+      {
+        Mixer mix = getMixer(mixers[i]);
+        if (mix.isLineSupported(info))
+          return (TargetDataLine) mix.getLine(info);
+      }
+    throw new LineUnavailableException("target data line not found");
+  }
+
+  /**
+   * Return a target data line matching the given audio format and
+   * mixer.
+   * @param fmt the audio format
+   * @param mixer the mixer description
+   * @return a target data line
+   * @throws LineUnavailableException if no matching target data line was
+   * found
+   * @since 1.5
+   */
+  public static TargetDataLine getTargetDataLine(AudioFormat fmt,
+						 Mixer.Info mixer)
+    throws LineUnavailableException
+  {
+    DataLine.Info info = new DataLine.Info(TargetDataLine.class, fmt);
+    Mixer mix = getMixer(mixer);
+    if (mix.isLineSupported(info))
+      return (TargetDataLine) mix.getLine(info);
+    throw new LineUnavailableException("target data line not found");
+  }
+
+  /**
+   * Given a source encoding, return an array of all target encodings to which
+   * data in this form can be converted.
+   * @param source the source encoding
+   */
+  public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat.Encoding source)
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+    while (i.hasNext())
+      {
+        FormatConversionProvider prov = (FormatConversionProvider) i.next();
+        if (! prov.isSourceEncodingSupported(source))
+          continue;
+        AudioFormat.Encoding[] es = prov.getTargetEncodings();
+        for (int j = 0; j < es.length; ++j)
+          result.add(es[j]);
+      }
+    return (AudioFormat.Encoding[]) result.toArray(new AudioFormat.Encoding[result.size()]);
+  }
+
+  /**
+   * Given a source format, return an array of all the target encodings to
+   * which data in this format can be converted.
+   * @param source the source format
+   */
+  public static AudioFormat.Encoding[] getTargetEncodings(AudioFormat source)
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+    while (i.hasNext())
+      {
+        FormatConversionProvider prov = (FormatConversionProvider) i.next();
+        AudioFormat.Encoding[] es = prov.getTargetEncodings(source);
+        for (int j = 0; j < es.length; ++j)
+          result.add(es[j]);
+      }
+    return (AudioFormat.Encoding[]) result.toArray(new AudioFormat.Encoding[result.size()]);
+  }
+
+  /**
+   * Given a target encoding and a source audio format, return an array of all
+   * matching audio formats to which data in this source format can be converted. 
+   * @param encoding the target encoding
+   * @param sourceFmt the source format
+   */
+  public static AudioFormat[] getTargetFormats(AudioFormat.Encoding encoding,
+					       AudioFormat sourceFmt)
+  {
+    HashSet result = new HashSet();
+    Iterator i = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+    while (i.hasNext())
+      {
+        FormatConversionProvider prov = (FormatConversionProvider) i.next();
+        AudioFormat[] es = prov.getTargetFormats(encoding, sourceFmt);
+        for (int j = 0; j < es.length; ++j)
+          result.add(es[j]);
+      }
+    return (AudioFormat[]) result.toArray(new AudioFormat[result.size()]);
+  }
+
+  /**
+   * Given a line description, return an array of descriptions of all
+   * the matching target lines.
+   * @param info the line description
+   */
+  public static Line.Info[] getTargetLineInfo(Line.Info info)
+  {
+    HashSet result = new HashSet();
+    Mixer.Info[] infos = getMixerInfo();
+    for (int i = 0; i < infos.length; ++i)
+      {
+        Mixer mix = getMixer(infos[i]);
+        Line.Info[] targs = mix.getTargetLineInfo(info);
+        for (int j = 0; j < targs.length; ++j)
+          result.add(targs[j]);
+      }
+    return (Line.Info[]) result.toArray(new Line.Info[result.size()]);
+  }
+
+  /**
+   * Return true if the currently installed providers are able to
+   * convert data from the given source format to the given target encoding.
+   * @param targ the target encoding
+   * @param source the source format
+   */
+  public static boolean isConversionSupported(AudioFormat.Encoding targ,
+					      AudioFormat source)
+  {
+    Iterator i 
+      = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+    while (i.hasNext())
+      {
+        FormatConversionProvider prov = (FormatConversionProvider) i.next();
+        if (prov.isConversionSupported(targ, source))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Return true if the currently installed providers are able to convert
+   * the given source format to the given target format.
+   * @param targ the target format
+   * @param source the source format
+   */
+  public static boolean isConversionSupported(AudioFormat targ,
+					      AudioFormat source)
+  {
+    Iterator i 
+      = ServiceFactory.lookupProviders(FormatConversionProvider.class);
+    while (i.hasNext())
+      {
+        FormatConversionProvider prov = (FormatConversionProvider) i.next();
+        if (prov.isConversionSupported(targ, source))
+          return true;
+      }
+    return false;
+  }
+
+  private static boolean isFileTypeSupported(AudioFileFormat.Type[] types,
+                                             AudioFileFormat.Type type)
+  {
+    for (int i = 0; i < types.length; ++i)
+      {
+        if (types[i].equals(type))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Return true if the given audio file format is supported by one of
+   * the providers installed on the system.
+   * @param type the audio file format type
+   */
+  public static boolean isFileTypeSupported(AudioFileFormat.Type type)
+  {
+    return isFileTypeSupported(getAudioFileTypes(), type);
+  }
+
+  /**
+   * Return true if the given audio file format is supported for the
+   * given audio input stream by one of the providers installed on the 
+   * system.
+   * @param type the audio file format type
+   * @param ais the audio input stream
+   */
+  public static boolean isFileTypeSupported(AudioFileFormat.Type type,
+					    AudioInputStream ais)
+  {
+    return isFileTypeSupported(getAudioFileTypes(ais), type);
+  }
+
+  /**
+   * Return true if some provider on the system supplies a line
+   * matching the argument. 
+   * @param info the line to match
+   */
+  public static boolean isLineSupported(Line.Info info)
+  {
+    Mixer.Info[] infos = getMixerInfo();
+    for (int i = 0; i < infos.length; ++i)
+      {
+        if (getMixer(infos[i]).isLineSupported(info))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Write an audio input stream to the given file, using the specified
+   * audio file format.  All the providers installed on the system will
+   * be searched to find one that supports this operation.
+   * @param ais the audio input stream to write
+   * @param type the desired audio file format type
+   * @param out the file to write to
+   * @return the number of bytes written
+   * @throws IOException if an I/O error occurs while writing
+   * @throws IllegalArgumentException if the file type is not supported
+   */
+  public static int write(AudioInputStream ais, AudioFileFormat.Type type,
+			  File out)
+    throws IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+    while (i.hasNext())
+      {
+        AudioFileWriter w = (AudioFileWriter) i.next();
+        if (w.isFileTypeSupported(type, ais))
+          return w.write(ais, type, out);
+      }
+    throw new IllegalArgumentException("file type not supported by system");
+  }
+
+  /**
+   * Write an audio input stream to the given output stream, using the
+   * specified audio file format.  All the providers installed on the
+   * system will be searched to find one that supports this operation.
+   * @param ais the audio input stream to write
+   * @param type the desired audio file format type
+   * @param os the output stream to write to
+   * @return the number of bytes written
+   * @throws IOException if an I/O error occurs while writing
+   * @throws IllegalArgumentException if the file type is not supported
+   */
+  public static int write(AudioInputStream ais, AudioFileFormat.Type type,
+			  OutputStream os)
+    throws IOException
+  {
+    Iterator i = ServiceFactory.lookupProviders(AudioFileWriter.class);
+    while (i.hasNext())
+      {
+        AudioFileWriter w = (AudioFileWriter) i.next();
+        if (w.isFileTypeSupported(type, ais))
+          return w.write(ais, type, os);
+      }
+    throw new IllegalArgumentException("file type not supported by system");
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/BooleanControl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/BooleanControl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/BooleanControl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/BooleanControl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,145 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A BooleanControl is a Control which has two states.
+ * @since 1.3
+ */
+public abstract class BooleanControl extends Control
+{
+  /**
+   * A Type specialized to represent a boolean control.
+   * @since 1.3
+   */
+  public static class Type extends Control.Type
+  {
+    // FIXME: correct constructions?
+
+    /**
+     * A control for applying reverb.
+     */
+    public final static Type APPLY_REVERB = new Type("Apply reverb");
+
+    /**
+     * A control for muting.
+     */
+    public final static Type MUTE = new Type("Mute");
+
+    /**
+     * Create a new Type given its name.
+     * @param name the name of the type
+     */
+    protected Type(String name)
+    {
+      super(name);
+    }
+  }
+
+  private Type type;
+  private boolean value;
+  private String trueLabel;
+  private String falseLabel;
+
+  /**
+   * Create a new boolean control, with the indicated Type and initial
+   * value.  The description strings will default to "true" and "false".
+   * @param type the type
+   * @param init the initial value
+   */
+  protected BooleanControl(Type type, boolean init)
+  {
+    super(type);
+    this.value = init;
+    this.trueLabel = "true";
+    this.falseLabel = "false";
+  }
+
+  /**
+   * Create a new boolean control, with the indicated Type, initial
+   * value, and labels.
+   * @param type the type
+   * @param init the initial value
+   * @param trueLabel the label for the true state
+   * @param falseLabel the label for the false state
+   */
+  protected BooleanControl(Type type, boolean init, String trueLabel,
+			   String falseLabel)
+  {
+    super(type);
+    this.value = init;
+    this.trueLabel = trueLabel;
+    this.falseLabel = falseLabel;
+  }
+
+  /**
+   * Return the label corresponding to the indicated state.
+   * @param state the state
+   * @return the true label or the false label, as appropriate
+   */
+  public String getStateLabel(boolean state)
+  {
+    return state ? trueLabel : falseLabel;
+  }
+
+  /**
+   * Return the current value of thhe control.
+   */
+  public boolean getValue()
+  {
+    return value;
+  }
+
+  /**
+   * Set the value of the control as indicated.
+   * @param value the new value
+   */
+  public void setValue(boolean value)
+  {
+    this.value = value;
+  }
+
+  /**
+   * Return a string describing this control.
+   */
+  public String toString()
+  {
+    return super.toString() + ": " + getStateLabel(value);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Clip.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Clip.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Clip.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Clip.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,115 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.io.IOException;
+
+/**
+ * A Clip represents some pre-loaded audio data.
+ * @since 1.3
+ */
+public interface Clip extends DataLine
+{
+  /**
+   * This can be passed to {@link #loop(int)} to indicate that looping
+   * should be done continuously.
+   */
+  int LOOP_CONTINUOUSLY = -1;
+
+  /**
+   * Return the frame length of this clip.
+   */
+  int getFrameLength();
+
+  /**
+   * Return the length of the clip in microseconds.
+   */
+  long getMicrosecondLength();
+
+  /**
+   * Start looping the clip.  Looping will occur count times, or, if count
+   * is LOOP_CONTINUOUSLY, will be done continuously.  A count of 0 indicates
+   * that any current looping should stop.
+   * @param count the number of times to loop
+   */
+  void loop(int count);
+
+  /**
+   * Open a clip, given an audio format and some data.
+   * @param fmt the format of the data
+   * @param data a byte array containing the audio data
+   * @param offset the offset of the first byte of data in the array
+   * @param len the length of the audio data in the array, in bytes
+   * @throws LineUnavailableException if the line cannot be opened
+   * @throws SecurityException if the line cannot be opened for security
+   * reasons
+   */
+  void open(AudioFormat fmt, byte[] data, int offset, int len)
+    throws LineUnavailableException;
+
+  /**
+   * Open a clip, given an audio input stream.
+   * @param ais the input stream
+   * @throws LineUnavailableException if the line cannot be opened
+   * @throws SecurityException if the line cannot be opened for security
+   * reasons
+   * @throws IOException if there is an I/O error while reading the stream
+   */
+  void open(AudioInputStream ais)
+    throws LineUnavailableException, IOException;
+
+  /**
+   * Set the position to the indicated frame.
+   * @param where new frame position
+   */
+  void setFramePosition(int where);
+
+  /**
+   * Set the loop begin and end points.  These are used by loop(int).
+   * @param begin the starting point
+   * @param end the ending point
+   */
+  void setLoopPoints(int begin, int end);
+
+  /**
+   * Set the position to the indicated microsecond.
+   * @param ms the new position in microseconds
+   */
+  void setMicrosecondPosition(long ms);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/CompoundControl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/CompoundControl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/CompoundControl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/CompoundControl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,102 @@
+/* Control consisting of several other controls
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A compound control provides control over several other controls.
+ * @since 1.3
+ */
+public abstract class CompoundControl extends Control
+{
+  /**
+   * This describes a single compound control.
+   * @since 1.3
+   */
+  public static class Type extends Control.Type
+  {
+    /**
+     * Create a new Type given its name.
+     * @param name the name of the type
+     */
+    protected Type(String name)
+    {
+      super(name);
+    }
+  }
+
+  private Control[] memberControls;
+
+  /**
+   * Create a new compound control given its type and members.
+   * @param type the type of the compound control
+   * @param members the members of the compound control
+   */
+  protected CompoundControl(Type type, Control[] members)
+  {
+    super(type);
+    // FIXME: clone?
+    this.memberControls = members;
+  }
+
+  /**
+   * Return the members of this compound control.
+   */
+  public Control[] getMemberControls()
+  {
+    // FIXME: clone?
+    return memberControls;
+  }
+
+  /**
+   * Return a string description of this compound control.
+   */
+  public String toString()
+  {
+    StringBuffer result = new StringBuffer();
+    result.append(super.toString());
+    result.append(": ");
+    for (int i = 0; i < memberControls.length; ++i)
+      {
+	if (i > 0)
+	  result.append(", ");
+	result.append(memberControls[i].toString());
+      }
+    return result.toString();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Control.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Control.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Control.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Control.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,111 @@
+/* Control over an attribute of a line
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A control provides the ability to affect some attribute of a line,
+ * for instance its volume.
+ * @since 1.3
+ */
+public abstract class Control
+{
+  /**
+   * This describes a single control.
+   * @since 1.3
+   */
+  public static class Type
+  {
+    private String name;
+
+    /**
+     * Create a new Type given its name.
+     * @param name the name of the type
+     */
+    protected Type(String name)
+    {
+      this.name = name;
+    }
+
+    public final boolean equals(Object o)
+    {
+      return super.equals(o);
+    }
+
+    public final int hashCode()
+    {
+      return super.hashCode();
+    }
+
+    /**
+     * Return the name of this Type.
+     */
+    public final String toString()
+    {
+      return name;
+    }
+  }
+
+  private Type type;
+
+  /**
+   * Create a new Control given its Type.
+   * @param type the type
+   */
+  protected Control(Type type)
+  {
+    this.type = type;
+  }
+
+  /**
+   * Return the Type of this Control.
+   */
+  public Type getType()
+  {
+    return type;
+  }
+
+  /**
+   * Return a String descrsibing this control.  In particular the
+   * value will include the name of the associated Type.
+   */
+  public String toString()
+  {
+    return type.toString();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/DataLine.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/DataLine.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/DataLine.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/DataLine.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,265 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * The DataLine interface adds data-related functionality to the Line
+ * interface.  For example, it adds methods to start and stop the data
+ * on the line.
+ * @since 1.3 
+ */
+public interface DataLine extends Line
+{
+  /**
+   * This class extends Line.Info with information specific to DataLine.
+   * In particular it adds information about buffer sizes, and about supported
+   * audio formats.
+   * @since 1.3
+   */
+  class Info extends Line.Info
+  {
+    private int minBufferSize;
+    private int maxBufferSize;
+    private AudioFormat[] formats;
+
+    /**
+     * Create a new Info given the line's class and a supported
+     * audio format.  The buffer sizes default to AudioSystem.NOT_SPECIFIED.
+     * @param klass the class of the line
+     * @param fmt the supported format
+     */
+    public Info(Class klass, AudioFormat fmt)
+    {
+      super(klass);
+      this.minBufferSize = AudioSystem.NOT_SPECIFIED;
+      this.maxBufferSize = AudioSystem.NOT_SPECIFIED;
+      this.formats = new AudioFormat[] { fmt };
+    }
+
+    /**
+     * Create a new Info given the line's class, the supported audio formats,
+     * the minimum buffer size, and the maximum buffer size.
+     * @param klass the class of the linee
+     * @param fmts the supported audio formats
+     * @param minSize the minimum buffer size
+     * @param maxSize the maximum buffer size
+     */
+    public Info(Class klass, AudioFormat[] fmts, int minSize, int maxSize)
+    {
+      super(klass);
+      this.minBufferSize = minSize;
+      this.maxBufferSize = maxSize;
+      this.formats = fmts;
+    }
+
+    /**
+     * Create a new Info given the line's class, a supported
+     * audio format, and a buffer size.  Both the minimum and maximum
+     * sizes are set from this size.
+     * @param klass the class of the line
+     * @param fmt the supported format
+     * @param size the buffer size
+     */
+    public Info(Class klass, AudioFormat fmt, int size)
+    {
+      super(klass);
+      this.minBufferSize = size;
+      this.maxBufferSize = size;
+      this.formats = new AudioFormat[] { fmt };
+    }
+
+    /**
+     * Return the supported audio formats.
+     */
+    public AudioFormat[] getFormats()
+    {
+      // FIXME: clone?
+      return formats;
+    }
+
+    /**
+     * Return the maximum buffer size.
+     */
+    public int getMaxBufferSize()
+    {
+      return maxBufferSize;
+    }
+
+    /**
+     * Return the minimum buffer size.
+     */
+    public int getMinBufferSize()
+    {
+      return minBufferSize;
+    }
+
+    /**
+     * Return true if the indicated audio format is supported by this
+     * Info, false otherwise.
+     * @param fmt the audio format
+     * @return true if the format is supported
+     */
+    public boolean isFormatSupported(AudioFormat fmt)
+    {
+      for (int i = 0; i < formats.length; ++i)
+	{
+	  if (fmt.matches(formats[i]))
+	    return true;
+	}
+      return false;
+    }
+
+    /**
+     * Return true if this Info matches another Info object.
+     */
+    public boolean matches(Line.Info o)
+    {
+      if (! super.matches(o) || ! (o instanceof Info))
+	return false;
+      Info other = (Info) o;
+      if (minBufferSize < other.minBufferSize
+	  || maxBufferSize > other.maxBufferSize)
+	return false;
+      for (int i = 0; i < formats.length; ++i)
+	{
+	  boolean ok = false;
+	  for (int j = 0; j < other.formats.length; ++j)
+	    {
+	      if (formats[i].matches(other.formats[j]))
+		{
+		  ok = true;
+		  break;
+		}
+	    }
+	  if (! ok)
+	    return false;
+	}
+      return true;
+    }
+
+    /**
+     * Return a description of this Info object.
+     */
+    public String toString()
+    {
+      StringBuffer result = new StringBuffer();
+      result.append("formats: [");
+      for (int i = 0; i < formats.length; ++i)
+	{
+	  if (i > 0)
+	    result.append(", ");
+	  result.append(formats[i].toString());
+	}
+      result.append("]; minBufferSize: ");
+      result.append(minBufferSize);
+      result.append("; maxBufferSize: ");
+      result.append(maxBufferSize);
+      return result.toString();
+    }
+  }
+
+  /**
+   * Return the number of bytes currently available on this DataLine.
+   */
+  int available();
+
+  /**
+   * This method blocks until whatever data is buffered in the
+   * DataLine's internal buffer has been drained.
+   */
+  void drain();
+
+  /**
+   * This flushes the DataLine by discarding any buffered data.
+   */
+  void flush();
+
+  /**
+   * Returns the size of the DataLine's internal buffer, in bytes.
+   */
+  int getBufferSize();
+
+  /**
+   * Return the current format of the data associated with this DataLine.
+   */
+  AudioFormat getFormat();
+
+  /**
+   * Return the current frame position.
+   */
+  int getFramePosition();
+
+  /**
+   * Return the volume level for this DataLine.
+   */
+  float getLevel();
+
+  /**
+   * Return the current frame position. 
+   * @since 1.5
+   */
+  long getLongFramePosition();
+
+  /**
+   * Return the number of microseconds this DataLine has been playing.
+   */
+  long getMicrosecondPosition();
+
+  /**
+   * Return true if this line is active, meaning that it is actively
+   * performing audio I/O.
+   */
+  boolean isActive();
+
+  /**
+   * Return true if this line is running, meaning that it has been
+   * started.  When the line is stopped, this method will return false.
+   */
+  boolean isRunning();
+
+  /**
+   * Start processing data.  This will emit a START event.
+   */
+  void start();
+
+  /**
+   * Stop processing data.  This will emit a STOP event.
+   */
+  void stop();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/EnumControl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/EnumControl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/EnumControl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/EnumControl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,126 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * An EnumControl is a Control which can take one of a specified set of
+ * values. 
+ * @since 1.3
+ */
+public abstract class EnumControl extends Control
+{
+  /**
+   * This Type describes an EnumControl.
+   * @since 1.3
+   */
+  public static class Type extends Control.Type
+  {
+    /** This describes an enum control used for reverb.  */
+    public static final Type REVERB = new Type("Reverb");
+
+    /**
+     * Create a new Type given its name.
+     * @param name the name of the type
+     */
+    protected Type(String name)
+    {
+      super(name);
+    }
+  }
+
+  private Object[] values;
+  private Object value;
+
+  /**
+   * Create a new enumerated control given its Type, the range of valid
+   * values, and its initial value.
+   * @param type the type
+   * @param values the valid values
+   * @param val the initial value
+   */
+  protected EnumControl(Type type, Object[] values, Object val)
+  {
+    super(type);
+    // FIXME: error checking: values.length>0, val in values... ?
+    // FIXME: clone here?
+    this.values = values;
+    this.value = val;
+  }
+
+  /**
+   * Return the current value of this control.
+   */
+  public Object getValue()
+  {
+    return value;
+  }
+
+  /**
+   * Return the valid values for this control.
+   */
+  public Object[] getValues()
+  {
+    // FIXME: clone here?
+    return values;
+  }
+
+  /**
+   * Set the value of this control.  If the indicated value is not among
+   * the valid values, this method will throw an IllegalArgumentException.
+   * @param value the new value
+   * @throws IllegalArgumentException if the new value is invalid
+   */
+  public void setValue(Object value)
+  {
+    for (int i = 0; i < values.length; ++i)
+      {
+	if (! values[i].equals(value))
+	  throw new IllegalArgumentException("value not supported");
+      }
+    this.value = value;
+  }
+
+  /**
+   * Return a string describing this control.
+   */
+  public String toString()
+  {
+    return super.toString() + ": " + value;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/FloatControl.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/FloatControl.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/FloatControl.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/FloatControl.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,267 @@
+/* Floating point control
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/** @since 1.3 */
+public abstract class FloatControl extends Control
+{
+  /**
+   * An instance of this class describes a particular floating point control.
+   * @since 1.3
+     */
+  public static class Type extends Control.Type
+  {
+    /** Auxiliary return gain.  */
+    public static final Type AUX_RETURN = new Type("AUX return");
+
+    /** Auxiliary send gain.  */
+    public static final Type AUX_SEND = new Type("AUX send");
+
+    /** Balance.  */
+    public static final Type BALANCE = new Type("Balance");
+
+    /** Master gain control.  */
+    public static final Type MASTER_GAIN = new Type("Master gain");
+
+    /** Control for panning.  */
+    public static final Type PAN = new Type("Pan");
+
+    /** Post-reverb gain.  */
+    public static final Type REVERB_RETURN = new Type("Reverb return");
+
+    /** Pre-reverb gain.  */
+    public static final Type REVERB_SEND = new Type("Reverb send");
+
+    /** Control the sample rate.  */
+    public static final Type SAMPLE_RATE = new Type("Sample rate");
+
+    /** Volume control.  */
+    public static final Type VOLUME = new Type("Volume");
+
+    /**
+     * Create a new type given its name.
+     * @param name the name of the type
+     */
+    protected Type(String name)
+    {
+      super(name);
+    }
+  }
+
+  private float minimum;
+  private float maximum;
+  private float precision;
+  private int updatePeriod;
+  private float value;
+  private String units;
+  private String minLabel;
+  private String maxLabel;
+  private String midLabel;
+
+  /**
+   * Create a new FloatControl given its type and various parameters.
+   * The minimum, maximum, and midpoint labels will all be the empty string.
+   * 
+   * @param type the type
+   * @param min the minimum valuee
+   * @param max the maximum value
+   * @param prec the precision
+   * @param update the update period
+   * @param init the initial value
+   * @param units the description of the units
+   */
+  protected FloatControl(Type type, float min, float max, float prec,
+			 int update, float init, String units)
+  {
+    super(type);
+    this.minimum = min;
+    this.maximum = max;
+    this.precision = prec;
+    this.updatePeriod = update;
+    this.value = init;
+    this.units = units;
+    this.minLabel = "";
+    this.maxLabel = "";
+    this.midLabel = "";
+  }
+
+  /**
+   * Create a new FloatControl given its type and various parameters.
+   * 
+   * @param type the type
+   * @param min the minimum valuee
+   * @param max the maximum value
+   * @param prec the precision
+   * @param update the update period
+   * @param init the initial value
+   * @param units the description of the units
+   * @param minLabel the label for the minimum value
+   * @param midLabel the label for the midpoint
+   * @param maxLabel the label for the maximum value
+   */
+  protected FloatControl(Type type, float min, float max, float prec,
+			 int update, float init, String units,
+			 String minLabel, String midLabel, String maxLabel)
+  {
+    super(type);
+    this.minimum = min;
+    this.maximum = max;
+    this.precision = prec;
+    this.updatePeriod = update;
+    this.value = init;
+    this.units = units;
+    this.minLabel = minLabel;
+    this.maxLabel = maxLabel;
+    this.midLabel = midLabel;
+  }
+
+  /**
+   * Return the maximum value of this control.
+   */
+  public float getMaximum()
+  {
+    return maximum;
+  }
+
+  /**
+   * Return the label for the minimum value of this control.
+   */
+  public String getMaxLabel()
+  {
+    return maxLabel;
+  }
+
+  /**
+   * Return the label for the midpoint of this control.
+   */
+  public String getMidLabel()
+  {
+    return midLabel;
+  }
+
+  /**
+   * Return the minimum value of this control.
+   */
+  public float getMinimum()
+  {
+    return minimum;
+  }
+
+  /**
+   * Return the label for the minimum value of this control.
+   */
+  public String getMinLabel()
+  {
+    return minLabel;
+  }
+
+  /**
+   * Return the precision of this control.
+   */
+  public float getPrecision()
+  {
+    return precision;
+  }
+
+  /**
+   * Return the name of the units for this control.
+   */
+  public String getUnits()
+  {
+    return units;
+  }
+
+  /**
+   * Return the update period of this control.
+   */
+  public int getUpdatePeriod()
+  {
+    return updatePeriod;
+  }
+
+  /**
+   * Return the current value of this control.
+   */
+  public float getValue()
+  {
+    return value;
+  }
+
+  /**
+   * Set the new value of this control.
+   * @param value the new value
+   * @throws IllegalArgumentException if the new value is greater than the
+   * maximum or less than the minimum.
+   */
+  public void setValue(float value)
+  {
+    if (value < minimum || value > maximum)
+      throw new IllegalArgumentException("value out of range");
+    this.value = value;
+  }
+
+  /**
+   * This tells the control to start at the starting value
+   * and to shift its value incrementally to the final value
+   * over the given time interval, specified in microseconds.
+   * The default implementation does not do this, but instead
+   * simply sets the value to the final value immediately.
+   * 
+   * @param from the starting value
+   * @param to the final value
+   * @param ms the number of microseconds
+   */
+  public void shift(float from, float to, int ms)
+  {
+    if (from < minimum || from > maximum
+        || to < minimum || to > maximum
+        || ms < 0)
+      throw new IllegalArgumentException("argument out of range");
+    // The default just sets the value to TO.
+    this.value = to;
+  }
+
+  /**
+   * Return a string describing this control.
+   */
+  public String toString()
+  {
+    return super.toString() + ": " + value;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Line.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Line.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Line.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Line.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,150 @@
+/* An input or output line
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Line represents a single input or output audio line.
+ * @since 1.3
+ */
+public interface Line
+{
+  /**
+   * An object of this type holds information about a Line.
+   * @since 1.3
+   */
+  class Info
+  {
+    private Class klass;
+
+    /**
+     * Create a new Info object.  The argument is the class of the line,
+     * for instance TargetDataLine.class.
+     * @param klass the class of the line
+     */
+    public Info(Class klass)
+    {
+      this.klass = klass;
+    }
+
+    /**
+     * Return the line's class.
+     */
+    public Class getLineClass()
+    {
+      return klass;
+    }
+
+    /**
+     * Return true if this Info object matches the given object.
+     * @param other the object to match
+     * @return true if they match, false otherwise
+     */
+    public boolean matches(Info other)
+    {
+      return klass.equals(other.klass);
+    }
+
+    /**
+     * Return a description of this Info object.
+     */
+    public String toString()
+    {
+      return klass.toString();
+    }
+  }
+
+  /**
+   * Add a listener which will be notified whenever this Line changes state.
+   * @param listener the listener to notify
+   */
+  void addLineListener(LineListener listener);
+  
+  /**
+   * Close this line.
+   */
+  void close();
+
+  /**
+   * Return the control associated with this Line that matches the
+   * argument.
+   * @param what the type of the control to match
+   * @return the associated control
+   * @throws IllegalArgumentException if a control of this type is not
+   * available for this line
+   */
+  Control getControl(Control.Type what);
+
+  /**
+   * Return an array of controls associated with this Line.  Note that
+   * this method will not return null -- if there are no controls, it
+   * will return a zero-length array.
+   */
+  Control[] getControls();
+
+  /**
+   * Return the Info object associated with this Line.
+   */
+  Info getLineInfo();
+
+  /**
+   * Return true if a Control matching the argument is available for this
+   * Line, false otherwise.
+   * @param what the type of the control to match
+   */
+  boolean isControlSupported(Control.Type what);
+
+  /**
+   * Return true if this line is open, false otherwise.
+   */
+  boolean isOpen();
+
+  /**
+   * Open this line.
+   * @throws LineUnavailableException if the line is unavailable for some
+   * reason
+   */
+  void open() throws LineUnavailableException;
+
+  /**
+   * Remove the listener from this Line; after this call the listener will
+   * no longer be notified when this Line changes state.
+   * @param listener the listener to remove
+   */
+  void removeLineListener(LineListener listener);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineEvent.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineEvent.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,170 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.EventObject;
+
+/**
+ * This class holds information about a state change of a Line.
+ * @specnote This class is not really serializable, and attempts to
+ * serialize it will throw {@link NotSerializableException}.
+ * @since 1.3
+ */
+public class LineEvent extends EventObject
+{
+  // We define this even though this class can't be serialized, in
+  // order to placate the compiler.
+  private static final long serialVersionUID = -1274246333383880410L;
+
+  /**
+   * This class represents the kinds of state changes that can occur
+   * to a Line.  The standard states are availabe as static instances.
+   * @since 1.3
+   */
+  public static class Type
+  {
+    /** An event of this type is posted when a Line closes.  */
+    public static final Type CLOSE = new Type("close");
+
+    /** An event of this type is posted when a Line opens.  */
+    public static final Type OPEN = new Type("open");
+
+    /** An event of this type is posted when a Line starts.  */
+    public static final Type START = new Type("start");
+
+    /** An event of this type is posted when a Line stops.  */
+    public static final Type STOP = new Type("stop");
+
+    private String name;
+
+    /**
+     * Create a new type with the indicated name.
+     * @param name the name
+     */
+    protected Type(String name)
+    {
+      this.name = name;
+    }
+
+    public final boolean equals(Object o)
+    {
+      return super.equals(o);
+    }
+
+    public final int hashCode()
+    {
+      return super.hashCode();
+    }
+
+    /**
+     * Return the name of this Type.
+     */
+    public String toString()
+    {
+      return name;
+    }
+  }
+
+  private Type type;
+  private long framePosition;
+  private Line line;
+
+  /**
+   * Create a new LineEvent with the indicated line, type, and frame position.
+   * @param line the line
+   * @param type the type of the event
+   * @param pos the frame position
+   */
+  public LineEvent(Line line, Type type, long pos)
+  {
+    super(line);
+    this.line = line;
+    this.type = type;
+    this.framePosition = pos;
+  }
+
+  /**
+   * Return the frame position associated with this event.
+   */
+  public final long getFramePosition()
+  {
+    return framePosition;
+  }
+
+  /**
+   * Return the Line associated with this event.
+   */
+  public final Line getLine()
+  {
+    return line;
+  }
+
+  /**
+   * Return the Type associated with this event.
+   */
+  public final Type getType()
+  {
+    return type;
+  }
+
+  /**
+   * Return a description of this event.
+   */
+  public String toString()
+  {
+    return ("type=" + type + "; framePosition=" + framePosition
+	    + "line=" + line);
+  }
+  
+  private void readObject(ObjectInputStream ois)
+    throws IOException
+  {
+    throw new NotSerializableException("LineEvent is not serializable");
+  }
+  
+  private void writeObject(ObjectOutputStream oos)
+    throws IOException
+  {
+    throw new NotSerializableException("LineEvent is not serializable");
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineListener.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineListener.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* Listener for Lines
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+import java.util.EventListener;
+
+/**
+ * This interface is used by classes which wish to be notified
+ * when the state of a Line changes.
+ * @since 1.3
+ */
+public interface LineListener extends EventListener
+{
+  /**
+   * This is called when the line's status changes.
+   * @param ev the event describing the change
+   */
+  void update(LineEvent ev);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineUnavailableException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineUnavailableException.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineUnavailableException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/LineUnavailableException.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/** @since 1.3 */
+public class LineUnavailableException extends Exception
+{
+  private static final long serialVersionUID = -2046718279487432130L;
+
+  /**
+   * Create a new LineUnavailableException.
+   */
+  public LineUnavailableException()
+  {
+  }
+
+  /**
+   * Create a new LineUnavailableException with the given message.
+   * @param msg the message
+   */
+  public LineUnavailableException(String msg)
+  {
+    super(msg);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Mixer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Mixer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Mixer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Mixer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,206 @@
+/* Mixers
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Mixer is a Line which itself holds multiple lines.
+ * @since 1.3
+ */
+public interface Mixer extends Line
+{
+  /**
+   * An Info object describes a mixer.
+   * @since 1.3
+   */
+  class Info
+  {
+    private String name;
+    private String description;
+    private String vendor;
+    private String version;
+
+    /**
+     * Create a new mixer description.
+     * @param name the name of the mixer
+     * @param vendor the vendor
+     * @param desc a descriptive string
+     * @param vers the mixer's version
+     */
+    protected Info(String name, String vendor, String desc, String vers)
+    {
+      this.name = name;
+      this.description = desc;
+      this.vendor = vendor;
+      this.version = vers;
+    }
+
+    public final boolean equals(Object o)
+    {
+      return super.equals(o);
+    }
+
+    public final int hashCode()
+    {
+      return super.hashCode();
+    }
+
+    /**
+     * Return the name of the mixer.
+     */
+    public final String getName()
+    {
+      return name;
+    }
+
+    /**
+     * Return the mixer's description.
+     */
+    public final String getDescription()
+    {
+      return description;
+    }
+
+    /**
+     * Return the mixer's vendor.
+     */
+    public final String getVendor()
+    {
+      return vendor;
+    }
+
+    /**
+     * Return the mixer's version.
+     */
+    public final String getVersion()
+    {
+      return version;
+    }
+
+    public final String toString()
+    {
+      return ("name=" + name + "; description=" + description
+	      + "; vendor=" + vendor + "; version=" + version);
+    }
+  }
+
+  /**
+   * Return a Line associated with this Mixer, given its description.
+   * @param info the description of the line to find
+   * @return the corresponding Line
+   * @throws LineUnavailableException if no Line matching the description
+   * exists in this Mixer
+   */
+  Line getLine(Line.Info info) throws LineUnavailableException;
+
+  /**
+   * Return the number of lines matching this description.
+   * @param info the description of the lines to find.
+   */
+  int getMaxLines(Line.Info info);
+
+  /**
+   * Return an Info object describing this Mixer.
+   */
+  Info getMixerInfo();
+
+  /**
+   * Return an array of Info objects describing all the source lines
+   * available in this Mixer.
+   */
+  Line.Info[] getSourceLineInfo();
+
+  /**
+   * Return an array of Info objects describing all the source lines
+   * available in this Mixer, which match the provided decsription.
+   * @param info the description of the source lines to find 
+   */
+  Line.Info[] getSourceLineInfo(Line.Info info);
+
+  /**
+   * Return an array of all the source lines available in this Mixer.
+   */
+  Line[] getSourceLines();
+
+  /**
+   * Return an array of Info objects describing all the target lines
+   * available in this Mixer.
+   */
+  Line.Info[] getTargetLineInfo();
+
+  /**
+   * Return an array of Info objects describing all the target lines
+   * available in this Mixer, which match the provided decsription.
+   * @param info the description of the target lines to find 
+   */
+  Line.Info[] getTargetLineInfo(Line.Info info);
+
+  /**
+   * Return an array of all the target lines available in this Mixer.
+   */
+  Line[] getTargetLines();
+
+  /**
+   * Return true if a Line matching the given description is supported
+   * by this Mixer, false otherwise.
+   * @param info the description of the line to find
+   */
+  boolean isLineSupported(Line.Info info);
+
+  /**
+   * Return true if this Mixer supports synchronization of the given set
+   * of lines.
+   * @param lines the lines to check
+   * @param sync true if the synchronization must be accurate at all times
+   */
+  boolean isSynchronizationSupported(Line[] lines, boolean sync);
+
+  /**
+   * Start synchronization on the given set of lines.
+   * @param lines the lines to synchronize, or null for all the lines
+   * @param sync true if the synchronization must be accurate at all times
+   * @throws IllegalArgumentException if the lines cannot be synchronized
+   */
+  void synchronize(Line[] lines, boolean sync);
+
+  /**
+   * Stop synchronization for the given set of lines.
+   * @param lines the lines to unsynchronize, or null for all the lines
+   */
+  void unsynchronize(Line[] lines);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Port.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Port.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Port.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/Port.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,135 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * A Port is a Line which represents an audio device, for instance
+ * a microphone.
+ * 
+ * @since 1.3
+ */
+public interface Port extends Line
+{
+  /**
+   * This describes a single port.
+   * @since 1.3
+   */
+  class Info extends Line.Info
+  {
+    // FIXME names?
+
+    /** A CD player.  */
+    public static final Info COMPACT_DISC = new Info(Port.class,
+						     "Compact Disc",
+						     true);
+
+    /** Headphones.  */
+    public static final Info HEADPHONE = new Info(Port.class, "Headphone",
+						  false);
+
+    /** Generic input line.  */
+    public static final Info LINE_IN = new Info(Port.class, "Line in",
+						true);
+
+    /** Generic output line.  */
+    public static final Info LINE_OUT = new Info(Port.class, "Line out",
+						 false);
+
+    /** A microphone.  */
+    public static final Info MICROPHONE = new Info(Port.class, "Microphone",
+						   true);
+
+    /** A speaker.  */
+    public static final Info SPEAKER = new Info(Port.class, "Speaker",
+						false);
+
+    private String name;
+    private boolean isSource;
+
+    /**
+     * Create a new Info object, given the line's class, the name,
+     * and an argument indicating whether this is an input or an output.
+     * @param klass the class of the line
+     * @param name the name of the line
+     * @param isSource true if this is an input source
+     */
+    public Info(Class klass, String name, boolean isSource)
+    {
+      super(klass);
+      this.name = name;
+      this.isSource = isSource;
+    }
+
+    public final boolean equals(Object o)
+    {
+      return super.equals(o);
+    }
+
+    public final int hashCode()
+    {
+      return super.hashCode();
+    }
+
+    /**
+     * Return the name of this object.
+     */
+    public String getName()
+    {
+      return name;
+    }
+
+    /**
+     * Return true if this describes an input line.
+     */
+    public boolean isSource()
+    {
+      return isSource;
+    }
+
+    public boolean matches(Line.Info other)
+    {
+      return super.matches(other) && equals(other);
+    }
+
+    public final String toString()
+    {
+      return super.toString() + "; name=" + name + "; isSource=" + isSource;
+    }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/ReverbType.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/ReverbType.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/ReverbType.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/ReverbType.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,144 @@
+/* Reverb attributes 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This represents a reverb effect which can be applied to an audio signal.
+ * @since 1.3
+ */
+public class ReverbType
+{
+  private String name;
+  private int earlyReflectionDelay;
+  private float earlyReflectionIntensity;
+  private int lateReflectionDelay;
+  private float lateReflectionIntensity;
+  private int decayTime;
+
+  /**
+   * Create a new ReverbType given its attributes.
+   * @param name the name of this type
+   * @param earlyDelay the early delay time in microseconds
+   * @param earlyInten the early intensity in decibels
+   * @param lateDelay the late delay time in microseconds
+   * @param lateInten the late intensity in decibels
+   * @param decay the decay time in microseconds
+   */
+  protected ReverbType(String name, int earlyDelay, float earlyInten,
+		       int lateDelay, float lateInten, int decay)
+  {
+    this.name = name;
+    this.earlyReflectionDelay = earlyDelay;
+    this.earlyReflectionIntensity = earlyInten;
+    this.lateReflectionDelay = lateDelay;
+    this.lateReflectionIntensity = lateInten;
+    this.decayTime = decay;
+  }
+
+  public final boolean equals(Object o)
+  {
+    return super.equals(o);
+  }
+
+  public final int hashCode()
+  {
+    return super.hashCode();
+  }
+
+  /**
+   * Return the decay time.
+   */
+  public final int getDecayTime()
+  {
+    return decayTime;
+  }
+
+  /**
+   * Return the early reflection delay.
+   */
+  public final int getEarlyReflectionDelay()
+  {
+    return earlyReflectionDelay;
+  }
+
+  /**
+   * Return the early reflection intensity.
+   */
+  public final float getEarlyReflectionIntensity()
+  {
+    return earlyReflectionIntensity;
+  }
+
+  /**
+   * Return the late reflection delay.
+   */
+  public final int getLateReflectionDelay()
+  {
+    return lateReflectionDelay;
+  }
+
+  /**
+   * Return the late reflection intensity.
+   */
+  public final float getLateReflectionIntensity()
+  {
+    return lateReflectionIntensity;
+  }
+
+  /**
+   * Return the name of this ReverbType.
+   * @since 1.5
+   */
+  public String getName()
+  {
+    return name;
+  }
+
+  /**
+   * Return a description of this ReverbType.
+   */
+  public final String toString()
+  {
+    return ("name=" + name + "; earlyReflectionDelay=" + earlyReflectionDelay
+	    + "; earlyReflectionIntensity=" + earlyReflectionIntensity
+	    + "; lateReflectionDelay=" + lateReflectionDelay
+	    + "; lateReflectionIntensity=" + lateReflectionIntensity
+	    + "; decayTime=" + decayTime);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/SourceDataLine.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/SourceDataLine.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/SourceDataLine.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/SourceDataLine.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,77 @@
+/* Output data line.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This is a DataLine to which data may be written.
+ * @since 1.3
+ */
+public interface SourceDataLine extends DataLine
+{
+  /**
+   * Open the line, given the desired audio format.
+   * @param fmt the format to use
+   * @throws LineUnavailableException if the line is not available for
+   * some reason
+   * @throws SecurityException if this is prevented by the security manager
+   */
+  void open(AudioFormat fmt)
+    throws LineUnavailableException;
+
+  /**
+   * Open the line, given the desired audio format and the buffer size.
+   * @param fmt the format to use
+   * @param size the buffer size
+   * @throws LineUnavailableException if the line is not available for
+   * some reason
+   * @throws SecurityException if this is prevented by the security manager
+   */
+  void open(AudioFormat fmt, int size)
+    throws LineUnavailableException;
+
+  /**
+   * Write audio data to this line.  The data must be an integral number
+   * of frames, as determined by the audio format.
+   * @param buf a byte array of audio data
+   * @param offset index of the first byte in the array to use
+   * @param length the number of bytes to write
+   * @return the number of bytes written
+   */
+  int write(byte[] buf, int offset, int length);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/TargetDataLine.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/TargetDataLine.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/TargetDataLine.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/TargetDataLine.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* Input data line.
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * This is a DataLine from which data may be read.
+ * @since 1.3
+ */
+public interface TargetDataLine extends DataLine
+{
+  /**
+   * Open the line using the indicated audio format.
+   * @param fmt the format to use
+   * @throws LineUnavailableException if the line is not available for
+   * some reason
+   * @throws SecurityException if this operation is prevented by the
+   * security manager
+   */
+  void open(AudioFormat fmt)
+    throws LineUnavailableException;
+
+  /**
+   * Open the line using the indicated audio format and buffer size.
+   * @param fmt the format to use
+   * @throws LineUnavailableException if the line is not available for
+   * some reason
+   * @throws SecurityException if this operation is prevented by the
+   * security manager
+   */
+  void open(AudioFormat fmt, int size)
+    throws LineUnavailableException;
+
+  /**
+   * Read data from the line into the given buffer.  The requested data
+   * should be an integral number of framaes, as determined by the audio
+   * format.
+   * @param buf the buffer into which the data is put
+   * @param offset the initial offset at which to write
+   * @param length the maximum number of bytes to read
+   * @return the actual number of bytes read
+   */
+  int read(byte[] buf, int offset, int length);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/UnsupportedAudioFileException.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,65 @@
+/* 
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled;
+
+/**
+ * An exception of this type is thrown when an operation is attempted
+ * on a file whose format is unrecognized.
+ * @since 1.3
+ */
+public class UnsupportedAudioFileException extends Exception
+{
+  private static final long serialVersionUID = -139127412623160368L;
+
+  /**
+   * Create a new UnsupportedAudioFileException.
+   */
+  public UnsupportedAudioFileException()
+  {
+  }
+
+  /**
+   * Create a new UnsupportedAudioFileException with the indicated message.
+   * @param msg the message
+   */
+  public UnsupportedAudioFileException(String msg)
+  {
+    super(msg);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileReader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,146 @@
+/* Audio file reader API
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioInputStream;
+import javax.sound.sampled.UnsupportedAudioFileException;
+
+/**
+ * This abstract class defines the interface to audio file readers.
+ * A concrete provider subclass will implement the methods declared
+ * here.  These methods can be used to determine the format of
+ * files, and to retrieve an AudioInputStream for a file. 
+ * @since 1.3
+ */
+public abstract class AudioFileReader
+{
+  /**
+   * The default constructor.  Note that this class is abstract and
+   * thus not directly instantiable.
+   */
+  public AudioFileReader()
+  {
+  }
+
+  /**
+   * Return the format of the given file as deduced by this provider.
+   * If the format of the file is not recognized, throws an exception.
+   * This will also throw an exception if there is an I/O error when
+   * reading the file.
+   * @param file the file to examine
+   * @return the audio file format
+   * @throws UnsupportedAudioFileException if the file's format is not
+   * recognized
+   * @throws IOException if there is an I/O error while reading the file
+   */
+  public abstract AudioFileFormat getAudioFileFormat(File file)
+    throws UnsupportedAudioFileException, IOException;
+
+  /**
+   * Return the format of the given input stream as deduced by this provider.
+   * If the format of the stream is not recognized, throws an exception.
+   * This will also throw an exception if there is an I/O error when
+   * reading the stream.  Note that providers typically use mark and reset
+   * on the stream when examining the data, and as a result an IOException
+   * may be thrown if the stream does not support these.
+   * @param is the stream to examine
+   * @return the audio file format
+   * @throws UnsupportedAudioFileException if the stream's format is not
+   * recognized
+   * @throws IOException if there is an I/O error while reading the stream
+   */
+  public abstract AudioFileFormat getAudioFileFormat(InputStream is)
+    throws UnsupportedAudioFileException, IOException;
+
+  /**
+   * Return the format of the given URL as deduced by this provider.
+   * If the format of the URL is not recognized, throws an exception.
+   * This will also throw an exception if there is an I/O error when
+   * reading the URL.
+   * @param url the URL to examine
+   * @return the audio file format
+   * @throws UnsupportedAudioFileException if the URL's format is not
+   * recognized
+   * @throws IOException if there is an I/O error while reading the URL
+   */
+  public abstract AudioFileFormat getAudioFileFormat(URL url)
+    throws UnsupportedAudioFileException, IOException;
+
+  /**
+   * Return an AudioInputStream for the given file.  The file is assumed
+   * to hold valid audio data.  
+   * @param file the file to read
+   * @return an AudioInputStream for the file
+   * @throws UnsupportedAudioFileException if the file's type is not
+   * recognized
+   * @throws IOException if there is an error while reading the file 
+   */
+  public abstract AudioInputStream getAudioInputStream(File file)
+    throws UnsupportedAudioFileException, IOException;
+
+  /**
+   * Return an AudioInputStream wrapping the given input stream.  The stream
+   * is assumed to hold valid audio data.  
+   * @param is the input stream to wrap
+   * @return an AudioInputStream for the stream
+   * @throws UnsupportedAudioFileException if the stream's type is not
+   * recognized
+   * @throws IOException if there is an error while reading the stream 
+   */
+  public abstract AudioInputStream getAudioInputStream(InputStream is)
+    throws UnsupportedAudioFileException, IOException;
+
+  /**
+   * Return an AudioInputStream for the given URL.  The URL is assumed
+   * to hold valid audio data.  
+   * @param url the URL to read
+   * @return an AudioInputStream for the URL
+   * @throws UnsupportedAudioFileException if the URL's type is not
+   * recognized
+   * @throws IOException if there is an error while reading the URL 
+   */
+  public abstract AudioInputStream getAudioInputStream(URL url)
+    throws UnsupportedAudioFileException, IOException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/AudioFileWriter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,131 @@
+/* Audio file writer API
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.sound.sampled.AudioFileFormat;
+import javax.sound.sampled.AudioInputStream;
+
+/**
+ * This abstract class provides an API for writing audio files.  Concrete
+ * subclasses implement the methods declared here.
+ * @since 1.3
+ */
+public abstract class AudioFileWriter
+{
+  /**
+   * Creat a new audio file writer.
+   */
+  public AudioFileWriter()
+  {
+  }
+
+  /**
+   * Return an array of all audio file format types supported by this
+   * provider.
+   */
+  public abstract AudioFileFormat.Type[] getAudioFileTypes();
+
+  /**
+   * Return an array of all the audio file format types supported by this
+   * provider, which can be written given the input stream.
+   * @param ais the audio input stream
+   */
+  public abstract AudioFileFormat.Type[] getAudioFileTypes(AudioInputStream ais);
+
+  /**
+   * Return true if the indicated type is supported by this provider.
+   * @param type the audio file format type
+   */
+  public boolean isFileTypeSupported(AudioFileFormat.Type type)
+  {
+    AudioFileFormat.Type[] types = getAudioFileTypes();
+    for (int i = 0; i < types.length; ++i)
+      {
+        if (type.equals(types[i]))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Return true if the indicated type is supported by this provider,
+   * and can be written from the given audio input stream.
+   * @param type the audio file format type
+   * @param ais the audio input stream to write
+   */
+  public boolean isFileTypeSupported(AudioFileFormat.Type type,
+				     AudioInputStream ais)
+  {
+    AudioFileFormat.Type[] types = getAudioFileTypes(ais);
+    for (int i = 0; i < types.length; ++i)
+      {
+        if (type.equals(types[i]))
+          return true;
+      }
+    return false;
+  }
+
+  /**
+   * Write audio data to a file.
+   * @param ais the audio input stream to write
+   * @param type the desired audio file format type
+   * @param out the file to write to
+   * @return the number of bytes written
+   * @throws IOException if an I/O error occurs when writing
+   */
+  public abstract int write(AudioInputStream ais, AudioFileFormat.Type type,
+			    File out)
+    throws IOException;
+
+  /**
+   * Write audio data to an output stream.
+   * @param ais the audio input stream to write
+   * @param type the desired audio file format type
+   * @param os the output stream
+   * @return the number of bytes written
+   * @throws IOException if an I/O error occurs when writing
+   */
+  public abstract int write(AudioInputStream ais, AudioFileFormat.Type type,
+			    OutputStream os)
+    throws IOException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/FormatConversionProvider.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,179 @@
+/* Format conversion API
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import javax.sound.sampled.AudioFormat;
+import javax.sound.sampled.AudioInputStream;
+
+/**
+ * A format conversion provider supplies methods for converting between 
+ * different audio formats.  This abstract class defines the interface
+ * to this functionality; concrete subclasses will implement the methods
+ * declared here.
+ * @since 1.3
+ */
+public abstract class FormatConversionProvider
+{
+  /**
+   * Create a new format conversion provider.
+   */
+  public FormatConversionProvider()
+  {
+  }
+
+  /**
+   * Return an audio input stream given the desired target encoding and
+   * another audio input stream.  The data in the given stream will be
+   * converted to the desired encoding.
+   * @param encoding the encoding
+   * @param source the source audio input stream
+   * @return a new audio input stream
+   * @throws IllegalArgumentException if the conversion is not supported
+   */
+  public abstract AudioInputStream getAudioInputStream(AudioFormat.Encoding encoding,
+						       AudioInputStream source);
+
+  /**
+   * Return an audio input stream given the desired target format and
+   * another audio input stream.  The data in the given stream will be
+   * converted to the desired format.
+   * @param format the format
+   * @param source the source audio input stream
+   * @return a new audio input stream
+   * @throws IllegalArgumentException if the conversion is not supported
+   */
+  public abstract AudioInputStream getAudioInputStream(AudioFormat format,
+						       AudioInputStream source);
+
+  /**
+   * Return an array of all the source encodings supported by this conversion
+   * provider.
+   */
+  public abstract AudioFormat.Encoding[] getSourceEncodings();
+
+  /**
+   * Return an array of all the target encodings supported by this conversion
+   * provider.
+   */
+  public abstract AudioFormat.Encoding[] getTargetEncodings();
+
+  /**
+   * Return an array of all the target encodings that are available for a given
+   * source format.
+   * @param fmt the source format
+   * @return an array of supported target encodings
+   */
+  public abstract AudioFormat.Encoding[] getTargetEncodings(AudioFormat fmt);
+
+  /**
+   * Return a array of all the target formats that match given target encoding,
+   * and to which this provider can convert the source format.
+   * @param targ the target encoding to match
+   * @param src the source format
+   * @return an array of supported target formats
+   */
+  public abstract AudioFormat[] getTargetFormats(AudioFormat.Encoding targ,
+						 AudioFormat src);
+
+  /**
+   * Return true if this provider supports conversion from the given
+   * source format to the given target encoding.
+   * @param targ the target encoding
+   * @param src the source format
+   * @return true if the conversion is supported
+   */
+  public boolean isConversionSupported(AudioFormat.Encoding targ,
+				       AudioFormat src)
+  {
+    AudioFormat.Encoding[] encodings = getTargetEncodings(src);
+    for (int i = 0; i < encodings.length; ++i)
+      {
+	if (targ.equals(encodings[i]))
+	  return true;
+      }
+    return false;
+  }
+
+  /**
+   * Return true if this provider supports conversions from the given
+   * source format to the given target format.
+   * @param targ the source format
+   * @param src the target format
+   * @return true if the conversion is supported
+   */
+  public boolean isConversionSupported(AudioFormat targ, AudioFormat src)
+  {
+    AudioFormat[] encodings = getTargetFormats(targ.getEncoding(), src);
+    return encodings.length > 0;
+  }
+
+  /**
+   * Return true if an encoding matching the argument is supported as a
+   * source encoding by this provider.
+   * @param src the source encoding
+   * @return true if it is supported
+   */
+  public boolean isSourceEncodingSupported(AudioFormat.Encoding src)
+  {
+    AudioFormat.Encoding[] srcs = getSourceEncodings();
+    for (int i = 0; i < srcs.length; ++i)
+      {
+	if (src.equals(srcs[i]))
+	  return true;
+      }
+    return false;
+  }
+
+  /**
+   * Return true if an encoding matching the argument is supported as a 
+   * target encoding by this provider.
+   * @param targ the target encoding
+   * @return true if it is supported
+   */
+  public boolean isTargetEncodingSupported(AudioFormat.Encoding targ)
+  {
+    AudioFormat.Encoding[] encodings = getTargetEncodings();
+    for (int i = 0; i < encodings.length; ++i)
+      {
+	if (targ.equals(encodings[i]))
+	  return true;
+      }
+    return false;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sound/sampled/spi/MixerProvider.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,86 @@
+/* Mixer API
+   Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sound.sampled.spi;
+
+import javax.sound.sampled.Mixer;
+
+/**
+ * This abstract class defines an interface to mixer providers.
+ * Concrete subclasses will implement the methods in this class.
+ * @since 1.3
+ */
+public abstract class MixerProvider
+{
+  /**
+   * Create a new mixer provider.
+   */
+  public MixerProvider()
+  {
+  }
+
+  /**
+   * Return a mixer that matches the given info object.
+   * @param info description of the mixer to match
+   * @return the mixer
+   * @throws IllegalArgumentException if no mixer matches the description
+   */
+  public abstract Mixer getMixer(Mixer.Info info);
+
+  /**
+   * Return an array of info objects describing all the mixers provided by
+   * this provider.
+   */
+  public abstract Mixer.Info[] getMixerInfo();
+
+  /**
+   * Return true if a mixer matching the provided description is supported.
+   * @param info description of the mixer to match
+   * @return true if it is supported by this provider
+   */
+  public boolean isMixerSupported(Mixer.Info info)
+  {
+    Mixer.Info[] infos = getMixerInfo();
+    for (int i = 0; i < infos.length; ++i)
+      {
+	if (info.equals(infos[i]))
+	  return true;
+      }
+    return false;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEvent.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEvent.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,78 @@
+/* ConnectionEvent.java 
+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.sql.SQLException;
+import java.util.EventObject;
+
+/**
+ * @since 1.4
+ */
+public class ConnectionEvent extends EventObject 
+{
+  private static final long serialVersionUID = -4843217645290030002L;
+
+  // Note that the name is chosen for serialization.
+  private SQLException ex;
+
+  /**
+   * @since 1.4
+   */
+  public ConnectionEvent(PooledConnection con)
+  {
+    super(con);
+  }
+
+  /**
+   * @since 1.4
+   */
+  public ConnectionEvent(PooledConnection con, SQLException ex)
+  {
+    super(con);
+    this.ex = ex;
+  }
+
+  /**
+   * @since 1.4
+   */
+  public SQLException getSQLException()
+  {
+    return ex;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEventListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEventListener.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEventListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionEventListener.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,57 @@
+/* ConnectionEventListener.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.util.EventListener;
+
+/**
+ * @since 1.4
+ */
+public interface ConnectionEventListener extends EventListener 
+{
+  /**
+   * @since 1.4
+   */
+  void connectionClosed(ConnectionEvent event);
+
+  /**
+   * @since 1.4
+   */
+  void connectionErrorOccurred(ConnectionEvent event);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionPoolDataSource.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionPoolDataSource.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionPoolDataSource.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/ConnectionPoolDataSource.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* ConnectionPoolDataSource.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.io.PrintWriter;
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface ConnectionPoolDataSource 
+{
+  /**
+   * @since 1.4
+   */
+  PooledConnection getPooledConnection() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  PooledConnection getPooledConnection(String user, String password)
+    throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  PrintWriter getLogWriter() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  void setLogWriter(PrintWriter out) throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  void setLoginTimeout(int seconds) throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  int getLoginTimeout() throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/DataSource.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/DataSource.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/DataSource.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/DataSource.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,80 @@
+/* DataSource.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface DataSource 
+{
+  /**
+   * @since 1.4
+   */
+  Connection getConnection() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  Connection getConnection(String username, String password)
+    throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  PrintWriter getLogWriter() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  void setLogWriter(PrintWriter out) throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  void setLoginTimeout(int seconds) throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  int getLoginTimeout() throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/PooledConnection.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/PooledConnection.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/PooledConnection.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/PooledConnection.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,68 @@
+/* PooledConnection.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface PooledConnection 
+{
+  /**
+   * @since 1.4
+   */
+  Connection getConnection() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  void close() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  void addConnectionEventListener(ConnectionEventListener listener);
+
+  /**
+   * @since 1.4
+   */
+  void removeConnectionEventListener(ConnectionEventListener listener);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSet.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSet.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,187 @@
+/* RowSet.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Map;
+
+/**
+ * @since 1.4
+ */
+public interface RowSet extends ResultSet 
+{
+  String getUrl() throws SQLException;
+
+  void setUrl(String url) throws SQLException;
+
+  String getDataSourceName();
+
+  void setDataSourceName(String name) throws SQLException;
+
+  String getUsername();
+
+  void setUsername(String name) throws SQLException;
+
+  String getPassword();
+
+  void setPassword(String password) throws SQLException;
+
+  int getTransactionIsolation();
+
+  void setTransactionIsolation(int level) throws SQLException;
+
+  Map getTypeMap() throws SQLException;
+
+  void setTypeMap(Map map) throws SQLException;
+
+  String getCommand();
+
+  void setCommand(String cmd) throws SQLException;
+
+  boolean isReadOnly();
+
+  void setReadOnly(boolean value) throws SQLException;
+
+  int getMaxFieldSize() throws SQLException;
+
+  void setMaxFieldSize(int max) throws SQLException;
+
+  int getMaxRows() throws SQLException;
+
+  void setMaxRows(int max) throws SQLException;
+
+  boolean getEscapeProcessing() throws SQLException;
+
+  void setEscapeProcessing(boolean enable) throws SQLException;
+
+  int getQueryTimeout() throws SQLException;
+
+  void setQueryTimeout(int seconds) throws SQLException;
+
+  void setType(int type) throws SQLException;
+
+  void setConcurrency(int concurrency) throws SQLException;
+
+  void setNull(int parameterIndex, int sqlType) throws SQLException;
+
+  void setNull(int paramIndex, int sqlType, String typeName) throws
+      SQLException;
+
+  void setBoolean(int parameterIndex, boolean x) throws SQLException;
+
+  void setByte(int parameterIndex, byte x) throws SQLException;
+
+  void setShort(int parameterIndex, short x) throws SQLException;
+
+  void setInt(int parameterIndex, int x) throws SQLException;
+
+  void setLong(int parameterIndex, long x) throws SQLException;
+
+  void setFloat(int parameterIndex, float x) throws SQLException;
+
+  void setDouble(int parameterIndex, double x) throws SQLException;
+
+  void setBigDecimal(int parameterIndex, BigDecimal x) throws
+      SQLException;
+
+  void setString(int parameterIndex, String x) throws SQLException;
+
+  void setBytes(int parameterIndex, byte[] x) throws SQLException;
+
+  void setDate(int parameterIndex, Date x) throws SQLException;
+
+  void setTime(int parameterIndex, Time x) throws SQLException;
+
+  void setTimestamp(int parameterIndex, Timestamp x) throws
+      SQLException;
+
+  void setAsciiStream(int parameterIndex, InputStream x, int length)
+      throws SQLException;
+
+  void setBinaryStream(int parameterIndex, InputStream x, int length)
+      throws SQLException;
+
+  void setCharacterStream(int parameterIndex, Reader reader, int
+      length) throws SQLException;
+
+  void setObject(int parameterIndex, Object x, int targetSqlType, int
+      scale) throws SQLException;
+
+  void setObject(int parameterIndex, Object x, int targetSqlType)
+      throws SQLException;
+
+  void setObject(int parameterIndex, Object x) throws SQLException;
+
+  void setRef(int i, Ref x) throws SQLException;
+
+  void setBlob(int i, Blob x) throws SQLException;
+
+  void setClob(int i, Clob x) throws SQLException;
+
+  void setArray(int i, Array x) throws SQLException;
+
+  void setDate(int parameterIndex, Date x, Calendar cal) throws
+      SQLException;
+
+  void setTime(int parameterIndex, Time x, Calendar cal) throws
+      SQLException;
+
+  void setTimestamp(int parameterIndex, Timestamp x, Calendar cal)
+      throws SQLException;
+
+  void clearParameters() throws SQLException;
+
+  void execute() throws SQLException;
+
+  void addRowSetListener(RowSetListener listener);
+
+  void removeRowSetListener(RowSetListener listener);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetEvent.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetEvent.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,52 @@
+/* RowSetEvent.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.util.EventObject;
+
+/**
+ * @since 1.4
+ */
+public class RowSetEvent extends EventObject 
+{
+  public RowSetEvent(RowSet source)
+  {
+    super(source);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetInternal.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetInternal.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetInternal.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetInternal.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,74 @@
+/* RowSetInternal.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface RowSetInternal 
+{
+  /**
+   * @since 1.4
+   */
+  Object[] getParams() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  Connection getConnection() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  void setMetaData(RowSetMetaData md) throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  ResultSet getOriginal() throws SQLException;
+
+  /**
+   * @since 1.4
+   */
+  ResultSet getOriginalRow() throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetListener.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetListener.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,53 @@
+/* RowSetListener.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.util.EventListener;
+
+/**
+ * @since 1.4
+ */
+public interface RowSetListener extends EventListener 
+{
+  void rowSetChanged(RowSetEvent event);
+
+  void rowChanged(RowSetEvent event);
+
+  void cursorMoved(RowSetEvent event);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetMetaData.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetMetaData.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetMetaData.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetMetaData.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,95 @@
+/* RowSetMetaData.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface RowSetMetaData extends ResultSetMetaData 
+{
+  void setColumnCount(int columnCount) throws SQLException;
+
+  void setAutoIncrement(int columnIndex, boolean property)
+    throws SQLException;
+
+  void setCaseSensitive(int columnIndex, boolean property)
+    throws SQLException;
+
+  void setSearchable(int columnIndex, boolean property)
+    throws SQLException;
+
+  void setCurrency(int columnIndex, boolean property)
+    throws SQLException;
+
+  void setNullable(int columnIndex, int property) throws SQLException;
+
+  void setSigned(int columnIndex, boolean property)
+    throws SQLException;
+
+  void setColumnDisplaySize(int columnIndex, int size)
+    throws SQLException;
+
+  void setColumnLabel(int columnIndex, String label)
+    throws SQLException;
+
+  void setColumnName(int columnIndex, String columnName)
+    throws SQLException;
+
+  void setSchemaName(int columnIndex, String schemaName)
+    throws SQLException;
+
+  void setPrecision(int columnIndex, int precision)
+    throws SQLException;
+
+  void setScale(int columnIndex, int scale) throws SQLException;
+
+  void setTableName(int columnIndex, String tableName)
+    throws SQLException;
+
+  void setCatalogName(int columnIndex, String catalogName)
+    throws SQLException;
+
+  void setColumnType(int columnIndex, int SQLType) throws SQLException;
+
+  void setColumnTypeName(int columnIndex, String typeName)
+    throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetReader.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetReader.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetReader.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetReader.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,49 @@
+/* RowSetReader.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface RowSetReader 
+{
+  void readData(RowSetInternal caller) throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetWriter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetWriter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetWriter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/RowSetWriter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,49 @@
+/* RowSetWriter.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface RowSetWriter 
+{
+  boolean writeData(RowSetInternal caller) throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XAConnection.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XAConnection.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XAConnection.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XAConnection.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* XAConnection.java --
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.sql.SQLException;
+
+import javax.transaction.xa.XAResource;
+
+/**
+ * @since 1.4
+ */
+public interface XAConnection extends PooledConnection 
+{
+  XAResource getXAResource() throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XADataSource.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XADataSource.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XADataSource.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/XADataSource.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,61 @@
+/* XADataSource.java 
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.sql;
+
+import java.io.PrintWriter;
+import java.sql.SQLException;
+
+/**
+ * @since 1.4
+ */
+public interface XADataSource 
+{
+  XAConnection getXAConnection() throws SQLException;
+
+  XAConnection getXAConnection(String user, String password) throws
+      SQLException;
+
+  PrintWriter getLogWriter() throws SQLException;
+
+  void setLogWriter(PrintWriter out) throws SQLException;
+
+  void setLoginTimeout(int seconds) throws SQLException;
+
+  int getLoginTimeout() throws SQLException;
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/package.html?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/sql/package.html Thu Nov  8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.sql package.
+   Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.sql</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractAction.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractAction.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractAction.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractAction.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,276 @@
+/* AbstractAction.java --
+   Copyright (C) 2002, 2004, 2005, 2006  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.util.HashMap;
+
+import javax.swing.event.SwingPropertyChangeSupport;
+
+/**
+ * A base class for implementing the {@link Action} interface.
+ * 
+ * @author Andrew Selkirk
+ */
+public abstract class AbstractAction
+  implements Action, Cloneable, Serializable
+{
+  private static final long serialVersionUID = -6803159439231523484L;
+
+  /**
+   * A flag that indicates whether or not the action is enabled.
+   */
+  protected boolean enabled = true;
+  
+  /**
+   * Provides support for property change event notification. 
+   */
+  protected SwingPropertyChangeSupport changeSupport =
+    new SwingPropertyChangeSupport(this);
+
+  /**
+   * store
+   */
+  private transient HashMap store = new HashMap();
+
+  /**
+   * Creates a new action with no properties set.
+   */
+  public AbstractAction()
+  {
+    // Nothing to do.
+  }
+
+  /**
+   * Creates a new action with the specified name.  The name is stored as a 
+   * property with the key {@link Action#NAME}, and no other properties are
+   * initialised.
+   *
+   * @param name  the name (<code>null</code> permitted).
+   */
+  public AbstractAction(String name)
+  {
+    putValue(NAME, name);
+  }
+
+  /**
+   * Creates a new action with the specified name and icon.  The name is stored
+   * as a property with the key {@link Action#NAME}, the icon is stored as a
+   * property with the key {@link Action#SMALL_ICON}, and no other properties 
+   * are initialised.
+   *
+   * @param name  the name (<code>null</code> permitted).
+   * @param icon  the icon (<code>null</code> permitted).
+   */
+  public AbstractAction(String name, Icon icon)
+  {
+    putValue(NAME, name);
+    putValue(SMALL_ICON, icon);
+  }
+
+  /**
+   * Returns a clone of the action.
+   *
+   * @return A clone of the action.
+   *
+   * @exception CloneNotSupportedException if there is a problem cloning the
+   *            action.
+   */
+  protected Object clone() throws CloneNotSupportedException
+  {
+    AbstractAction copy = (AbstractAction) super.clone();
+    copy.store = (HashMap) store.clone();
+    return copy;
+  }
+
+  /**
+   * Returns the value associated with the specified key.
+   * 
+   * @param key  the key (not <code>null</code>).
+   * 
+   * @return The value associated with the specified key, or 
+   *         <code>null</code> if the key is not found.
+   *         
+   * @see #putValue(String, Object)
+   */
+  public Object getValue(String key)
+  {
+    return store.get(key);
+  }
+
+  /**
+   * Sets the value associated with the specified key and sends a 
+   * {@link java.beans.PropertyChangeEvent} to all registered listeners.  
+   * The standard keys are: 
+   * <ul>
+   * <li>{@link #NAME}</li>
+   * <li>{@link #SHORT_DESCRIPTION}</li> 
+   * <li>{@link #LONG_DESCRIPTION}</li>
+   * <li>{@link #SMALL_ICON}</li> 
+   * <li>{@link #ACTION_COMMAND_KEY}</li>
+   * <li>{@link #ACCELERATOR_KEY}</li> 
+   * <li>{@link #MNEMONIC_KEY}</li>
+   * </ul>
+   * Any existing value associated with the key will be overwritten.
+   * 
+   * @param key  the key (not <code>null</code>).
+   * @param value  the value (<code>null</code> permitted).
+   */
+  public void putValue(String key, Object value)
+  {
+    Object old = getValue(key);
+    if ((old == null && value != null) || (old != null && !old.equals(value)))
+    {
+      store.put(key, value);
+      firePropertyChange(key, old, value);
+    }
+  }
+
+  /**
+   * Returns the flag that indicates whether or not the action is enabled.
+   *
+   * @return The flag.
+   * 
+   * @see #setEnabled(boolean)
+   */
+  public boolean isEnabled()
+  {
+    return enabled;
+  }
+
+  /**
+   * Sets the flag that indicates whether or not the action is enabled and, if
+   * the value of the flag changed from the previous setting, sends a 
+   * {@link java.beans.PropertyChangeEvent} to all registered listeners (using 
+   * the property name 'enabled').
+   *
+   * @param enabled  the new flag value.
+   * 
+   * @see #isEnabled()
+   */
+  public void setEnabled(boolean enabled)
+  {
+    if (enabled != this.enabled)
+    {
+      this.enabled = enabled;
+      firePropertyChange("enabled", !this.enabled, this.enabled);
+    }
+  }
+
+  /**
+   * Returns an array of the keys for the property values that have been 
+   * defined via the {@link #putValue(String, Object)} method (or the class
+   * constructor).
+   * 
+   * @return An array of keys.
+   */
+  public Object[] getKeys()
+  {
+    return store.keySet().toArray();
+  }
+
+  /**
+   * Sends a {@link PropertyChangeEvent} for the named property to all 
+   * registered listeners.
+   *
+   * @param propertyName  the property name.
+   * @param oldValue  the old value of the property.
+   * @param newValue  the new value of the property.
+   */
+  protected void firePropertyChange(String propertyName, Object oldValue,
+                                    Object newValue)
+  {
+    changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+  }
+  
+  /**
+   * Sends a {@link PropertyChangeEvent} for the named property to all
+   * registered listeners.  This private method is called by the 
+   * {@link #setEnabled(boolean)} method.
+   *
+   * @param propertyName  the property name.
+   * @param oldValue  the old value of the property.
+   * @param newValue  the new value of the property.
+   */
+  private void firePropertyChange(String propertyName, boolean oldValue, 
+                                  boolean newValue)
+  {
+    changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+  }
+
+  /**
+   * Registers a listener to receive {@link PropertyChangeEvent} notifications
+   * from this action.
+   *
+   * @param listener the listener.
+   * 
+   * @see #removePropertyChangeListener(PropertyChangeListener)
+   */
+  public void addPropertyChangeListener(PropertyChangeListener listener)
+  {
+    changeSupport.addPropertyChangeListener(listener);
+  }
+
+  /**
+   * Deregisters a listener so that it no longer receives 
+   * {@link PropertyChangeEvent} notifications from this action.
+   *
+   * @param listener the listener.
+   * 
+   * @see #addPropertyChangeListener(PropertyChangeListener)
+   */
+  public void removePropertyChangeListener(PropertyChangeListener listener)
+  {
+    changeSupport.removePropertyChangeListener(listener);
+  }
+
+  /**
+   * Returns all registered listeners.
+   *
+   * @return An array of listeners.
+   * 
+   * @since 1.4
+   */
+  public PropertyChangeListener[] getPropertyChangeListeners()
+  {
+    return changeSupport.getPropertyChangeListeners();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractButton.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractButton.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractButton.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractButton.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,2493 @@
+/* AbstractButton.java -- Provides basic button functionality.
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import gnu.classpath.NotImplementedException;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.ItemSelectable;
+import java.awt.LayoutManager;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.image.ImageObserver;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Serializable;
+import java.util.Enumeration;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleIcon;
+import javax.accessibility.AccessibleRelation;
+import javax.accessibility.AccessibleRelationSet;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
+import javax.accessibility.AccessibleValue;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.plaf.ButtonUI;
+import javax.swing.plaf.basic.BasicHTML;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Position;
+import javax.swing.text.View;
+
+
+/**
+ * Provides an abstract implementation of common button behaviour,
+ * data model and look & feel.
+ *
+ * <p>This class is supposed to serve as a base class for
+ * several kinds of buttons with similar but non-identical semantics:
+ * toggle buttons (radio buttons and checkboxes), simple push buttons,
+ * menu items, etc.</p>
+ *
+ * <p>Buttons have many properties, some of which are stored in this class
+ * while others are delegated to the button's model. The following properties
+ * are available:</p>
+ *
+ * <table>
+ * <tr><th>Property               </th><th>Stored in</th><th>Bound?</th></tr>
+ *
+ * <tr><td>action                 </td><td>button</td> <td>no</td></tr>
+ * <tr><td>actionCommand          </td><td>model</td>  <td>no</td></tr>
+ * <tr><td>borderPainted          </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>contentAreaFilled      </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>disabledIcon           </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>disabledSelectedIcon   </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>displayedMnemonicIndex </td><td>button</td> <td>no</td></tr>
+ * <tr><td>enabled                </td><td>model</td>  <td>no</td></tr>
+ * <tr><td>focusPainted           </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>horizontalAlignment    </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>horizontalTextPosition </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>icon                   </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>iconTextGap            </td><td>button</td> <td>no</td></tr>
+ * <tr><td>label (same as text)   </td><td>model</td>  <td>yes</td></tr>
+ * <tr><td>margin                 </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>multiClickThreshold    </td><td>button</td> <td>no</td></tr>
+ * <tr><td>pressedIcon            </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>rolloverEnabled        </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>rolloverIcon           </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>rolloverSelectedIcon   </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>selected               </td><td>model</td>  <td>no</td></tr>
+ * <tr><td>selectedIcon           </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>selectedObjects        </td><td>button</td> <td>no</td></tr>
+ * <tr><td>text                   </td><td>model</td>  <td>yes</td></tr>
+ * <tr><td>UI                     </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>verticalAlignment      </td><td>button</td> <td>yes</td></tr>
+ * <tr><td>verticalTextPosition   </td><td>button</td> <td>yes</td></tr>
+ *
+ * </table>
+ *
+ * <p>The various behavioral aspects of these properties follows:</p>
+ *
+ * <ul> 
+ *
+ * <li>When non-bound properties stored in the button change, the button
+ * fires ChangeEvents to its ChangeListeners.</li>
+ * 
+ * <li>When bound properties stored in the button change, the button fires
+ * PropertyChangeEvents to its PropertyChangeListeners</li>
+ *
+ * <li>If any of the model's properties change, it fires a ChangeEvent to
+ * its ChangeListeners, which include the button.</li>
+ *
+ * <li>If the button receives a ChangeEvent from its model, it will
+ * propagate the ChangeEvent to its ChangeListeners, with the ChangeEvent's
+ * "source" property set to refer to the button, rather than the model. The
+ * the button will request a repaint, to paint its updated state.</li>
+ *
+ * <li>If the model's "selected" property changes, the model will fire an
+ * ItemEvent to its ItemListeners, which include the button, in addition to
+ * the ChangeEvent which models the property change. The button propagates
+ * ItemEvents directly to its ItemListeners.</li>
+ *
+ * <li>If the model's armed and pressed properties are simultaneously
+ * <code>true</code>, the model will fire an ActionEvent to its
+ * ActionListeners, which include the button. The button will propagate
+ * this ActionEvent to its ActionListeners, with the ActionEvent's "source"
+ * property set to refer to the button, rather than the model.</li>
+ *
+ * </ul>
+ *
+ * @author Ronald Veldema (rveldema at cs.vu.nl)
+ * @author Graydon Hoare (graydon at redhat.com)
+ */
+
+public abstract class AbstractButton extends JComponent
+  implements ItemSelectable, SwingConstants
+{
+  private static final long serialVersionUID = -937921345538462020L;
+
+  /**
+   * An extension of ChangeListener to be serializable.
+   */
+  protected class ButtonChangeListener
+    implements ChangeListener, Serializable
+  {
+    private static final long serialVersionUID = 1471056094226600578L;
+
+    /**
+     * The spec has no public/protected constructor for this class, so do we.
+     */
+    ButtonChangeListener()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * Notified when the target of the listener changes its state.
+     *
+     * @param ev the ChangeEvent describing the change
+     */
+    public void stateChanged(ChangeEvent ev)
+    {
+      AbstractButton.this.fireStateChanged();
+      repaint();
+    }
+  }
+
+  /** The icon displayed by default. */
+  Icon default_icon;
+
+  /** The icon displayed when the button is pressed. */
+  Icon pressed_icon;
+
+  /** The icon displayed when the button is disabled. */
+  Icon disabledIcon;
+
+  /** The icon displayed when the button is selected. */
+  Icon selectedIcon;
+
+  /** The icon displayed when the button is selected but disabled. */
+  Icon disabledSelectedIcon;
+
+  /** The icon displayed when the button is rolled over. */
+  Icon rolloverIcon;
+
+  /** The icon displayed when the button is selected and rolled over. */
+  Icon rolloverSelectedIcon;
+
+  /** The icon currently displayed. */
+  Icon current_icon;
+
+  /** The text displayed in the button. */
+  String text;
+
+  /**
+   * The gap between icon and text, if both icon and text are
+   * non-<code>null</code>.
+   */
+  int iconTextGap;
+
+  /** The vertical alignment of the button's text and icon. */
+  int verticalAlignment;
+
+  /** The horizontal alignment of the button's text and icon. */
+  int horizontalAlignment;
+
+  /** The horizontal position of the button's text relative to its icon. */
+  int horizontalTextPosition;
+
+  /** The vertical position of the button's text relative to its icon. */
+  int verticalTextPosition;
+
+  /** Whether or not the button paints its border. */
+  boolean borderPainted;
+
+  /** Whether or not the button paints its focus state. */
+  boolean focusPainted;
+
+  /** Whether or not the button fills its content area. */
+  boolean contentAreaFilled;
+  
+  /** Whether rollover is enabled. */
+  boolean rollOverEnabled;
+
+  /** The action taken when the button is clicked. */
+  Action action;
+
+  /** The button's current state. */
+  protected ButtonModel model;
+
+  /** The margin between the button's border and its label. */
+  Insets margin;
+
+  /**
+   * A hint to the look and feel class, suggesting which character in the
+   * button's label should be underlined when drawing the label.
+   */
+  int mnemonicIndex;
+
+  /** Listener the button uses to receive ActionEvents from its model.  */
+  protected ActionListener actionListener;
+
+  /** Listener the button uses to receive ItemEvents from its model.  */
+  protected ItemListener itemListener;
+
+  /** Listener the button uses to receive ChangeEvents from its model.  */  
+  protected ChangeListener changeListener;
+
+  /**
+   * The time in milliseconds in which clicks get coalesced into a single
+   * <code>ActionEvent</code>.
+   */
+  long multiClickThreshhold;
+  
+  /**
+   * Listener the button uses to receive PropertyChangeEvents from its
+   * Action.
+   */
+  PropertyChangeListener actionPropertyChangeListener;
+  
+  /** ChangeEvent that is fired to button's ChangeEventListeners  */  
+  protected ChangeEvent changeEvent = new ChangeEvent(this);
+  
+  /**
+   * Indicates if the borderPainted property has been set by a client
+   * program or by the UI.
+   *
+   * @see #setUIProperty(String, Object)
+   * @see LookAndFeel#installProperty(JComponent, String, Object)
+   */
+  private boolean clientBorderPaintedSet = false;
+
+  /**
+   * Indicates if the rolloverEnabled property has been set by a client
+   * program or by the UI.
+   *
+   * @see #setUIProperty(String, Object)
+   * @see LookAndFeel#installProperty(JComponent, String, Object)
+   */
+  private boolean clientRolloverEnabledSet = false;
+
+  /**
+   * Indicates if the iconTextGap property has been set by a client
+   * program or by the UI.
+   *
+   * @see #setUIProperty(String, Object)
+   * @see LookAndFeel#installProperty(JComponent, String, Object)
+   */
+  private boolean clientIconTextGapSet = false;
+
+  /**
+   * Indicates if the contentAreaFilled property has been set by a client
+   * program or by the UI.
+   *
+   * @see #setUIProperty(String, Object)
+   * @see LookAndFeel#installProperty(JComponent, String, Object)
+   */
+  private boolean clientContentAreaFilledSet = false;
+
+  /**
+   * Fired in a PropertyChangeEvent when the "borderPainted" property changes.
+   */
+  public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
+  
+  /**
+   * Fired in a PropertyChangeEvent when the "contentAreaFilled" property
+   * changes.
+   */
+  public static final String CONTENT_AREA_FILLED_CHANGED_PROPERTY =
+    "contentAreaFilled";
+  
+  /**
+   * Fired in a PropertyChangeEvent when the "disabledIcon" property changes.
+   */
+  public static final String DISABLED_ICON_CHANGED_PROPERTY = "disabledIcon";
+  
+  /**
+   * Fired in a PropertyChangeEvent when the "disabledSelectedIcon" property
+   * changes.
+   */
+  public static final String DISABLED_SELECTED_ICON_CHANGED_PROPERTY =
+    "disabledSelectedIcon";
+  
+  /**
+   * Fired in a PropertyChangeEvent when the "focusPainted" property changes.
+   */
+  public static final String FOCUS_PAINTED_CHANGED_PROPERTY = "focusPainted";
+
+  /**
+   * Fired in a PropertyChangeEvent when the "horizontalAlignment" property
+   * changes.
+   */
+  public static final String HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY =
+    "horizontalAlignment";
+
+  /**
+   * Fired in a PropertyChangeEvent when the "horizontalTextPosition" property
+   * changes.
+   */
+  public static final String HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY =
+    "horizontalTextPosition";
+
+  /**
+   * Fired in a PropertyChangeEvent when the "icon" property changes. */
+  public static final String ICON_CHANGED_PROPERTY = "icon";
+
+  /** Fired in a PropertyChangeEvent when the "margin" property changes. */
+  public static final String MARGIN_CHANGED_PROPERTY = "margin";
+
+  /** Fired in a PropertyChangeEvent when the "mnemonic" property changes. */
+  public static final String MNEMONIC_CHANGED_PROPERTY = "mnemonic";
+
+  /** Fired in a PropertyChangeEvent when the "model" property changes. */
+  public static final String MODEL_CHANGED_PROPERTY = "model";
+
+  /** Fired in a PropertyChangeEvent when the "pressedIcon" property changes. */
+  public static final String PRESSED_ICON_CHANGED_PROPERTY = "pressedIcon";
+
+  /**
+   * Fired in a PropertyChangeEvent when the "rolloverEnabled" property
+   * changes.
+   */
+  public static final String ROLLOVER_ENABLED_CHANGED_PROPERTY =
+    "rolloverEnabled";
+
+  /**
+   * Fired in a PropertyChangeEvent when the "rolloverIcon" property changes.
+   */
+  public static final String ROLLOVER_ICON_CHANGED_PROPERTY = "rolloverIcon";
+  
+  /**
+   * Fired in a PropertyChangeEvent when the "rolloverSelectedIcon" property
+   * changes.
+   */
+  public static final String ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY =
+    "rolloverSelectedIcon";
+  
+  /**
+   * Fired in a PropertyChangeEvent when the "selectedIcon" property changes.
+   */
+  public static final String SELECTED_ICON_CHANGED_PROPERTY = "selectedIcon";
+
+  /** Fired in a PropertyChangeEvent when the "text" property changes. */
+  public static final String TEXT_CHANGED_PROPERTY = "text";
+
+  /**
+   * Fired in a PropertyChangeEvent when the "verticalAlignment" property
+   * changes.
+   */
+  public static final String VERTICAL_ALIGNMENT_CHANGED_PROPERTY =
+    "verticalAlignment";
+
+  /**
+   * Fired in a PropertyChangeEvent when the "verticalTextPosition" property
+   * changes.
+   */
+  public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY =
+    "verticalTextPosition";
+
+  /**
+   * A Java Accessibility extension of the AbstractButton.
+   */
+  protected abstract class AccessibleAbstractButton
+    extends AccessibleJComponent implements AccessibleAction, AccessibleValue,
+                                            AccessibleText
+  {
+    private static final long serialVersionUID = -5673062525319836790L;
+    
+    protected AccessibleAbstractButton()
+    {
+      // Nothing to do here yet.
+    }
+
+    /**
+     * Returns the accessible state set of this object. In addition to the
+     * superclass's states, the <code>AccessibleAbstractButton</code>
+     * supports the following states: {@link AccessibleState#ARMED},
+     * {@link AccessibleState#FOCUSED}, {@link AccessibleState#PRESSED} and
+     * {@link AccessibleState#CHECKED}.
+     *
+     * @return the current state of this accessible object
+     */
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      AccessibleStateSet state = super.getAccessibleStateSet();
+
+      if (getModel().isArmed())
+        state.add(AccessibleState.ARMED);
+      if (getModel().isPressed())
+        state.add(AccessibleState.PRESSED);
+      if (isSelected())
+        state.add(AccessibleState.CHECKED);
+
+      return state;
+    }
+
+    /**
+     * Returns the accessible name for the button.
+     */
+    public String getAccessibleName()
+    {
+      String result = super.getAccessibleName();
+      if (result == null)
+        result = text;
+      return result;
+    }
+
+    /**
+     * Returns the accessible icons of this object. If the AbstractButton's
+     * icon is an Accessible, and it's AccessibleContext is an AccessibleIcon,
+     * then this AccessibleIcon is returned, otherwise <code>null</code>.
+     *
+     * @return the accessible icons of this object, or <code>null</code> if
+     *         there is no accessible icon
+     */
+    public AccessibleIcon[] getAccessibleIcon()
+    {
+      AccessibleIcon[] ret = null;
+      Icon icon = getIcon();
+      if (icon instanceof Accessible)
+        {
+          AccessibleContext ctx = ((Accessible) icon).getAccessibleContext();
+          if (ctx instanceof AccessibleIcon)
+            {
+              ret = new AccessibleIcon[]{ (AccessibleIcon) ctx };
+            }
+        }
+      return ret;
+    }
+
+    /**
+     * Returns the accessible relations of this AccessibleAbstractButton.
+     * If the AbstractButton is part of a ButtonGroup, then all the buttons
+     * in this button group are added as targets in a MEMBER_OF relation,
+     * otherwise an empty relation set is returned (from super).
+     *
+     * @return the accessible relations of this AccessibleAbstractButton
+     */
+    public AccessibleRelationSet getAccessibleRelationSet()
+    {
+      AccessibleRelationSet relations = super.getAccessibleRelationSet();
+      ButtonModel model = getModel();
+      if (model instanceof DefaultButtonModel)
+        {
+          ButtonGroup group = ((DefaultButtonModel) model).getGroup();
+          if (group != null)
+            {
+              Object[] target = new Object[group.getButtonCount()];
+              Enumeration els = group.getElements();
+              
+              for (int index = 0; els.hasMoreElements(); ++index)
+                {
+                  target[index] = els.nextElement();
+                }
+
+              AccessibleRelation rel =
+                new AccessibleRelation(AccessibleRelation.MEMBER_OF);
+              rel.setTarget(target);
+              relations.add(rel);
+            }
+        }
+      return relations;
+    }
+
+    /**
+     * Returns the accessible action associated with this object. For buttons,
+     * this will be <code>this</code>.
+     *
+     * @return <code>this</code>
+     */
+    public AccessibleAction getAccessibleAction()
+    {
+      return this;
+    }
+
+    /**
+     * Returns the accessible value of this AccessibleAbstractButton, which
+     * is always <code>this</code>.
+     *
+     * @return the accessible value of this AccessibleAbstractButton, which
+     *         is always <code>this</code>
+     */
+    public AccessibleValue getAccessibleValue()
+    {
+      return this;
+    }
+
+    /**
+     * Returns the number of accessible actions that are supported by this
+     * object. Buttons support one action by default ('press button'), so this
+     * method always returns <code>1</code>.
+     *
+     * @return <code>1</code>, the number of supported accessible actions
+     */
+    public int getAccessibleActionCount()
+    {
+      return 1;
+    }
+
+    /**
+     * Returns a description for the action with the specified index or
+     * <code>null</code> if such action does not exist.
+     *
+     * @param actionIndex the zero based index to the actions
+     *
+     * @return a description for the action with the specified index or
+     *         <code>null</code> if such action does not exist
+     */
+    public String getAccessibleActionDescription(int actionIndex)
+    {
+      String descr = null;
+      if (actionIndex == 0)
+        {
+          // FIXME: Supply localized descriptions in the UIDefaults.
+          descr = UIManager.getString("AbstractButton.clickText");
+        }
+      return descr;
+    }
+
+    /**
+     * Performs the acccessible action with the specified index on this object.
+     * Since buttons have only one action by default (which is to press the
+     * button), this method performs a 'press button' when the specified index
+     * is <code>0</code> and nothing otherwise.
+     *
+     * @param actionIndex a zero based index into the actions of this button
+     *
+     * @return <code>true</code> if the specified action has been performed
+     *         successfully, <code>false</code> otherwise
+     */
+    public boolean doAccessibleAction(int actionIndex)
+    {
+      boolean retVal = false;
+      if (actionIndex == 0)
+        {
+          doClick();
+          retVal = true;
+        }
+      return retVal;
+    }
+
+    /**
+     * Returns the current value of this object as a number. This
+     * implementation returns an <code>Integer(1)</code> if the button is
+     * selected, <code>Integer(0)</code> if the button is not selected.
+     *
+     * @return the current value of this object as a number
+     */
+    public Number getCurrentAccessibleValue()
+    {
+      Integer retVal;
+      if (isSelected())
+        retVal = new Integer(1);
+      else
+        retVal = new Integer(0);
+      return retVal;
+    }
+
+    /**
+     * Sets the current accessible value as object. If the specified number 
+     * is 0 the button will be deselected, otherwise the button will
+     * be selected.
+     *
+     * @param value 0 for deselected button, other for selected button
+     *
+     * @return <code>true</code> if the value has been set, <code>false</code>
+     *         otherwise
+     */
+    public boolean setCurrentAccessibleValue(Number value)
+    {
+      boolean retVal = false;
+      if (value != null)
+        {
+          if (value.intValue() == 0)
+            setSelected(false);
+          else
+            setSelected(true);
+          retVal = true;
+        }
+      return retVal;
+    }
+
+    /**
+     * Returns the minimum accessible value for the AccessibleAbstractButton,
+     * which is <code>0</code>.
+     *
+     * @return the minimimum accessible value for the AccessibleAbstractButton,
+     *         which is <code>0</code>
+     */
+    public Number getMinimumAccessibleValue()
+    {
+      return new Integer(0);
+    }
+
+    /**
+     * Returns the maximum accessible value for the AccessibleAbstractButton,
+     * which is <code>1</code>.
+     *
+     * @return the maximum accessible value for the AccessibleAbstractButton,
+     *         which is <code>1</code>
+     */
+    public Number getMaximumAccessibleValue()
+    {
+      return new Integer(1);
+    }
+
+    /**
+     * Returns the accessible text for this AccessibleAbstractButton. This
+     * will be <code>null</code> if the button has a non-HTML label, otherwise
+     * <code>this</code>.
+     *
+     * @return the accessible text for this AccessibleAbstractButton
+     */
+    public AccessibleText getAccessibleText()
+    {
+      AccessibleText accessibleText = null;
+      if (getClientProperty(BasicHTML.propertyKey) != null)
+        accessibleText = this;
+
+      return accessibleText;
+    }
+
+    /**
+     * Returns the index of the label's character at the specified point,
+     * relative to the local bounds of the button. This only works for
+     * HTML labels.
+     *
+     * @param p the point, relative to the buttons local bounds
+     *
+     * @return the index of the label's character at the specified point
+     */
+    public int getIndexAtPoint(Point p)
+    {
+      int index = -1;
+      View view = (View) getClientProperty(BasicHTML.propertyKey);
+      if (view != null)
+        {
+          Rectangle shape = new Rectangle(0, 0, getWidth(), getHeight());
+          index = view.viewToModel(p.x, p.y, shape, new Position.Bias[1]);
+        }
+      return index;
+    }
+
+    /**
+     * Returns the bounds of the character at the specified index of the
+     * button's label. This will only work for HTML labels.
+     *
+     * @param i the index of the character of the label
+     *
+     * @return the bounds of the character at the specified index of the
+     *         button's label
+     */
+    public Rectangle getCharacterBounds(int i)
+    {
+      Rectangle rect = null;
+      View view = (View) getClientProperty(BasicHTML.propertyKey);
+      if (view != null)
+        {
+          Rectangle shape = new Rectangle(0, 0, getWidth(), getHeight());
+          try
+            {
+              Shape s = view.modelToView(i, shape, Position.Bias.Forward);
+              rect = s.getBounds();
+            }
+          catch (BadLocationException ex)
+            {
+              rect = null;
+            }
+        }
+      return rect;
+    }
+
+    /**
+     * Returns the number of characters in the button's label.
+     *
+     * @return the bounds of the character at the specified index of the
+     *         button's label
+     */
+    public int getCharCount()
+    {
+      int charCount;
+      View view = (View) getClientProperty(BasicHTML.propertyKey);
+      if (view != null)
+        {
+          charCount = view.getDocument().getLength();
+        }
+      else
+        {
+          charCount = getAccessibleName().length();
+        }
+      return charCount;
+    }
+
+    /**
+     * This always returns <code>-1</code> since there is no caret in a button.
+     *
+     * @return <code>-1</code> since there is no caret in a button
+     */
+    public int getCaretPosition()
+    {
+      return -1;
+    }
+
+    public String getAtIndex(int value0, int value1)
+      throws NotImplementedException
+    {
+      return null; // TODO
+    }
+
+    public String getAfterIndex(int value0, int value1)
+      throws NotImplementedException
+    {
+      return null; // TODO
+    }
+
+    public String getBeforeIndex(int value0, int value1)
+      throws NotImplementedException
+    {
+      return null; // TODO
+    }
+
+    /**
+     * Returns the text attribute for the character at the specified character
+     * index.
+     *
+     * @param i the character index
+     *
+     * @return the character attributes for the specified character or
+     *         <code>null</code> if the character has no attributes
+     */
+    public AttributeSet getCharacterAttribute(int i)
+    {
+      AttributeSet atts = null;
+      View view = (View) getClientProperty(BasicHTML.propertyKey); 
+      if (view != null)
+        {
+          
+        }
+      return atts;
+    }
+
+    /**
+     * This always returns <code>-1</code> since
+     * button labels can't be selected.
+     *
+     * @return <code>-1</code>, button labels can't be selected
+     */
+    public int getSelectionStart()
+    {
+      return -1;
+    }
+
+    /**
+     * This always returns <code>-1</code> since
+     * button labels can't be selected.
+     *
+     * @return <code>-1</code>, button labels can't be selected
+     */
+    public int getSelectionEnd()
+    {
+      return -1;
+    }
+
+    /**
+     * Returns the selected text. This always returns <code>null</code> since
+     * button labels can't be selected.
+     *
+     * @return <code>null</code>, button labels can't be selected
+     */
+    public String getSelectedText()
+    {
+      return null;
+    }
+  }
+
+  /**
+   * Creates a new AbstractButton object. Subclasses should call the following
+   * sequence in their constructor in order to initialize the button correctly:
+   * <pre>
+   * super();
+   * init(text, icon);
+   * </pre>
+   *
+   * The {@link #init(String, Icon)} method is not called automatically by this
+   * constructor.
+   *
+   * @see #init(String, Icon)
+   */
+  public AbstractButton()
+  {
+    actionListener = createActionListener();
+    changeListener = createChangeListener();
+    itemListener = createItemListener();
+
+    horizontalAlignment = CENTER;
+    horizontalTextPosition = TRAILING;
+    verticalAlignment = CENTER;
+    verticalTextPosition = CENTER;
+    borderPainted = true;
+    contentAreaFilled = true;
+    focusPainted = true;
+    setFocusable(true);
+    setAlignmentX(CENTER_ALIGNMENT);
+    setAlignmentY(CENTER_ALIGNMENT);
+    setDisplayedMnemonicIndex(-1);
+    setOpaque(true);
+    text = "";
+    updateUI();
+  }
+
+  /**
+   * Get the model the button is currently using.
+   *
+   * @return The current model
+   */
+  public ButtonModel getModel()
+  {
+      return model;
+  }
+
+  /**
+   * Set the model the button is currently using. This un-registers all 
+   * listeners associated with the current model, and re-registers them
+   * with the new model.
+   *
+   * @param newModel The new model
+   */
+  public void setModel(ButtonModel newModel)
+  {
+    if (newModel == model)
+      return;
+
+    if (model != null)
+      {
+        model.removeActionListener(actionListener);
+        model.removeChangeListener(changeListener);
+        model.removeItemListener(itemListener);
+      }
+    ButtonModel old = model;
+    model = newModel;
+    if (model != null)
+      {
+        model.addActionListener(actionListener);
+        model.addChangeListener(changeListener);
+        model.addItemListener(itemListener);
+      }
+    firePropertyChange(MODEL_CHANGED_PROPERTY, old, model);
+    revalidate();
+    repaint();
+  }
+
+ protected void init(String text, Icon icon) 
+ {
+    // If text is null, we fall back to the empty
+    // string (which is set using AbstractButton's
+    // constructor).
+    // This way the behavior of the JDK is matched.
+    if(text != null)
+      setText(text);
+
+    if (icon != null)
+      default_icon = icon;
+ }
+ 
+  /**
+   * <p>Returns the action command string for this button's model.</p>
+   *
+   * <p>If the action command was set to <code>null</code>, the button's
+   * text (label) is returned instead.</p>
+   *
+   * @return The current action command string from the button's model
+   */
+  public String getActionCommand()
+  {
+    String ac = model.getActionCommand();
+    if (ac != null)
+      return ac;
+    else
+      return text;
+  }
+
+  /**
+   * Sets the action command string for this button's model.
+   *
+   * @param actionCommand The new action command string to set in the button's
+   * model.
+   */
+  public void setActionCommand(String actionCommand)
+  {
+    if (model != null)
+      model.setActionCommand(actionCommand);
+  }
+
+  /**
+   * Adds an ActionListener to the button's listener list. When the
+   * button's model is clicked it fires an ActionEvent, and these
+   * listeners will be called.
+   *
+   * @param l The new listener to add
+   */
+  public void addActionListener(ActionListener l)
+  {
+    listenerList.add(ActionListener.class, l);
+  }
+
+  /**
+   * Removes an ActionListener from the button's listener list.
+   *
+   * @param l The listener to remove
+   */
+  public void removeActionListener(ActionListener l)
+  {
+    listenerList.remove(ActionListener.class, l);
+  }
+
+  /**
+   * Returns all added <code>ActionListener</code> objects.
+   * 
+   * @return an array of listeners
+   * 
+   * @since 1.4
+   */
+  public ActionListener[] getActionListeners()
+  {
+    return (ActionListener[]) listenerList.getListeners(ActionListener.class);
+  }
+
+  /**
+   * Adds an ItemListener to the button's listener list. When the button's
+   * model changes state (between any of ARMED, ENABLED, PRESSED, ROLLOVER
+   * or SELECTED) it fires an ItemEvent, and these listeners will be
+   * called.
+   *
+   * @param l The new listener to add
+   */
+  public void addItemListener(ItemListener l)
+  {
+    listenerList.add(ItemListener.class, l);
+  }
+
+  /**
+   * Removes an ItemListener from the button's listener list.
+   *
+   * @param l The listener to remove
+   */
+  public void removeItemListener(ItemListener l)
+  {
+    listenerList.remove(ItemListener.class, l);
+  }
+
+  /**
+   * Returns all added <code>ItemListener</code> objects.
+   * 
+   * @return an array of listeners
+   * 
+   * @since 1.4
+   */
+  public ItemListener[] getItemListeners()
+  {
+    return (ItemListener[]) listenerList.getListeners(ItemListener.class);
+  }
+
+  /**
+   * Adds a ChangeListener to the button's listener list. When the button's
+   * model changes any of its (non-bound) properties, these listeners will be
+   * called. 
+   *
+   * @param l The new listener to add
+   */
+  public void addChangeListener(ChangeListener l)
+  {
+    listenerList.add(ChangeListener.class, l);
+  }
+
+  /**
+   * Removes a ChangeListener from the button's listener list.
+   *
+   * @param l The listener to remove
+   */
+  public void removeChangeListener(ChangeListener l)
+  {
+    listenerList.remove(ChangeListener.class, l);
+  }
+
+  /**
+   * Returns all added <code>ChangeListener</code> objects.
+   * 
+   * @return an array of listeners
+   * 
+   * @since 1.4
+   */
+  public ChangeListener[] getChangeListeners()
+  {
+    return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
+  }
+
+  /**
+   * Calls {@link ItemListener#itemStateChanged} on each ItemListener in
+   * the button's listener list.
+   *
+   * @param e The event signifying that the button's model changed state
+   */
+  protected void fireItemStateChanged(ItemEvent e)
+  {
+    e.setSource(this);
+    ItemListener[] listeners = getItemListeners();
+ 
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].itemStateChanged(e);
+  }
+
+  /**
+   * Calls {@link ActionListener#actionPerformed} on each {@link
+   * ActionListener} in the button's listener list.
+   *
+   * @param e The event signifying that the button's model was clicked
+   */
+  protected void fireActionPerformed(ActionEvent e)
+  {
+	// Dispatch a copy of the given ActionEvent in order to
+	// set the source and action command correctly.
+    ActionEvent ae = new ActionEvent(
+        this,
+        e.getID(),
+        getActionCommand(),
+        e.getWhen(),
+        e.getModifiers());
+
+    ActionListener[] listeners = getActionListeners();
+    
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].actionPerformed(ae);
+  }
+
+  /**
+   * Calls {@link ChangeListener#stateChanged} on each {@link ChangeListener}
+   * in the button's listener list.
+   */
+  protected void fireStateChanged()
+  {
+    ChangeListener[] listeners = getChangeListeners();
+
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].stateChanged(changeEvent);
+  }
+
+  /**
+   * Get the current keyboard mnemonic value. This value corresponds to a
+   * single key code (one of the {@link java.awt.event.KeyEvent} VK_*
+   * codes) and is used to activate the button when pressed in conjunction
+   * with the "mouseless modifier" of the button's look and feel class, and
+   * when focus is in one of the button's ancestors.
+   *
+   * @return The button's current keyboard mnemonic
+   */
+  public int getMnemonic()
+  {
+    ButtonModel mod = getModel();
+    if (mod != null)
+      return mod.getMnemonic();
+    return -1;
+  }
+
+  /**
+   * Set the current keyboard mnemonic value. This value corresponds to a
+   * single key code (one of the {@link java.awt.event.KeyEvent} VK_*
+   * codes) and is used to activate the button when pressed in conjunction
+   * with the "mouseless modifier" of the button's look and feel class, and
+   * when focus is in one of the button's ancestors.
+   *
+   * @param mne A new mnemonic to use for the button
+   */
+  public void setMnemonic(char mne)
+  {
+    setMnemonic((int) mne);
+  }
+
+  /**
+   * Set the current keyboard mnemonic value. This value corresponds to a
+   * single key code (one of the {@link java.awt.event.KeyEvent} VK_*
+   * codes) and is used to activate the button when pressed in conjunction
+   * with the "mouseless modifier" of the button's look and feel class, and
+   * when focus is in one of the button's ancestors.
+   *
+   * @param mne A new mnemonic to use for the button
+   */
+  public void setMnemonic(int mne)
+  {
+    ButtonModel mod = getModel();
+    int old = -1;
+    if (mod != null)
+      old = mod.getMnemonic();
+
+    if (old != mne)
+      {
+        if (mod != null)
+          mod.setMnemonic(mne);
+
+        if (text != null && !text.equals(""))
+          {
+            // Since lower case char = upper case char for
+            // mnemonic, we will convert both text and mnemonic
+            // to upper case before checking if mnemonic character occurs
+            // in the menu item text.
+            int upperCaseMne = Character.toUpperCase((char) mne);
+            String upperCaseText = text.toUpperCase();
+            setDisplayedMnemonicIndex(upperCaseText.indexOf(upperCaseMne));
+          }
+
+        firePropertyChange(MNEMONIC_CHANGED_PROPERTY, old, mne);
+        revalidate();
+        repaint();
+      }
+  }
+
+  /** 
+   * Sets the button's mnemonic index. The mnemonic index is a hint to the
+   * look and feel class, suggesting which character in the button's label
+   * should be underlined when drawing the label. If the mnemonic index is
+   * -1, no mnemonic will be displayed. 
+   * 
+   * If no mnemonic index is set, the button will choose a mnemonic index
+   * by default, which will be the first occurrence of the mnemonic
+   * character in the button's text.
+   *
+   * @param index An offset into the "text" property of the button
+   * @throws IllegalArgumentException If <code>index</code> is not within the
+   * range of legal offsets for the "text" property of the button.
+   * @since 1.4
+   */
+
+  public void setDisplayedMnemonicIndex(int index)
+  {
+    if (index < -1 || (text != null && index >= text.length()))
+      throw new IllegalArgumentException();
+  
+    mnemonicIndex = index;
+  }
+  
+  /** 
+   * Get the button's mnemonic index, which is an offset into the button's
+   * "text" property.  The character specified by this offset should be
+   * underlined when the look and feel class draws this button.
+   *
+   * @return An index into the button's "text" property
+   */
+  public int getDisplayedMnemonicIndex()
+  {
+    return mnemonicIndex;
+  }
+  
+
+  /**
+   * Set the "rolloverEnabled" property. When rollover is enabled, and the
+   * look and feel supports it, the button will change its icon to
+   * rolloverIcon, when the mouse passes over it.
+   *
+   * @param r Whether or not to enable rollover icon changes
+   */
+  public void setRolloverEnabled(boolean r)
+  {
+    clientRolloverEnabledSet = true;
+    if (rollOverEnabled != r)
+      {
+        rollOverEnabled = r;
+        firePropertyChange(ROLLOVER_ENABLED_CHANGED_PROPERTY, !r, r);
+        revalidate();
+        repaint();
+      }
+  }
+
+  /**
+   * Returns whether or not rollover icon changes are enabled on the
+   * button.
+   *
+   * @return The state of the "rolloverEnabled" property
+   */
+  public boolean isRolloverEnabled()
+  {
+    return rollOverEnabled;
+  }
+
+  /**
+   * Set the value of the button's "selected" property. Selection is only
+   * meaningful for toggle-type buttons (check boxes, radio buttons).
+   *
+   * @param s New value for the property
+   */
+  public void setSelected(boolean s)
+  {
+    ButtonModel mod = getModel();
+    if (mod != null)
+      mod.setSelected(s);
+  }
+
+  /**
+   * Get the value of the button's "selected" property. Selection is only
+   * meaningful for toggle-type buttons (check boxes, radio buttons).
+   *
+   * @return The value of the property
+   */
+  public boolean isSelected()
+  {
+    ButtonModel mod = getModel();
+    if (mod != null)
+      return mod.isSelected();
+    return false;
+  }
+
+  /**
+   * Enables or disables the button. A button will neither be selectable
+   * nor preform any actions unless it is enabled.
+   *
+   * @param b Whether or not to enable the button
+   */
+  public void setEnabled(boolean b)
+  {
+    // Do nothing if state does not change.
+    if (b == isEnabled())
+      return;
+    super.setEnabled(b);
+    setFocusable(b);
+    ButtonModel mod = getModel();
+    if (mod != null)
+      mod.setEnabled(b);
+  }
+
+  /** 
+   * Set the horizontal alignment of the button's text and icon. The
+   * alignment is a numeric constant from {@link SwingConstants}. It must
+   * be one of: <code>RIGHT</code>, <code>LEFT</code>, <code>CENTER</code>,
+   * <code>LEADING</code> or <code>TRAILING</code>.  The default is
+   * <code>CENTER</code>.
+   * 
+   * @return The current horizontal alignment
+   * 
+   * @see #setHorizontalAlignment(int)
+   */
+  public int getHorizontalAlignment()
+  {
+    return horizontalAlignment;
+  }
+
+  /**
+   * Set the horizontal alignment of the button's text and icon. The
+   * alignment is a numeric constant from {@link SwingConstants}. It must
+   * be one of: <code>RIGHT</code>, <code>LEFT</code>, <code>CENTER</code>,
+   * <code>LEADING</code> or <code>TRAILING</code>.  The default is
+   * <code>CENTER</code>.
+   *
+   * @param a The new horizontal alignment
+   * @throws IllegalArgumentException If alignment is not one of the legal
+   * constants.
+   * 
+   * @see #getHorizontalAlignment()
+   */
+  public void setHorizontalAlignment(int a)
+  {
+    if (horizontalAlignment == a)
+      return;
+    if (a != LEFT && a != CENTER && a != RIGHT && a != LEADING 
+        && a != TRAILING)
+      throw new IllegalArgumentException("Invalid alignment.");
+    int old = horizontalAlignment;
+    horizontalAlignment = a;
+    firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Get the horizontal position of the button's text relative to its
+   * icon. The position is a numeric constant from {@link
+   * SwingConstants}. It must be one of: <code>RIGHT</code>,
+   * <code>LEFT</code>, <code>CENTER</code>, <code>LEADING</code> or
+   * <code>TRAILING</code>.  The default is <code>TRAILING</code>.
+   *
+   * @return The current horizontal text position
+   */
+  public int getHorizontalTextPosition()
+  {
+    return horizontalTextPosition;
+  }
+
+  /**
+   * Set the horizontal position of the button's text relative to its
+   * icon. The position is a numeric constant from {@link
+   * SwingConstants}. It must be one of: <code>RIGHT</code>,
+   * <code>LEFT</code>, <code>CENTER</code>, <code>LEADING</code> or
+   * <code>TRAILING</code>. The default is <code>TRAILING</code>.
+   *
+   * @param t The new horizontal text position
+   * @throws IllegalArgumentException If position is not one of the legal
+   * constants.
+   */
+  public void setHorizontalTextPosition(int t)
+  {
+    if (horizontalTextPosition == t)
+      return;
+    if (t != LEFT && t != CENTER && t != RIGHT && t != LEADING 
+        && t != TRAILING)
+      throw new IllegalArgumentException("Invalid alignment.");
+
+    int old = horizontalTextPosition;
+    horizontalTextPosition = t;
+    firePropertyChange(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Get the vertical alignment of the button's text and icon. The
+   * alignment is a numeric constant from {@link SwingConstants}. It must
+   * be one of: <code>CENTER</code>, <code>TOP</code>, or
+   * <code>BOTTOM</code>. The default is <code>CENTER</code>.
+   *
+   * @return The current vertical alignment
+   * 
+   * @see #setVerticalAlignment(int)
+   */
+  public int getVerticalAlignment()
+  {
+    return verticalAlignment;
+  }
+
+  /**
+   * Set the vertical alignment of the button's text and icon. The
+   * alignment is a numeric constant from {@link SwingConstants}. It must
+   * be one of: <code>CENTER</code>, <code>TOP</code>, or
+   * <code>BOTTOM</code>. The default is <code>CENTER</code>.
+   *
+   * @param a The new vertical alignment
+   * @throws IllegalArgumentException If alignment is not one of the legal
+   * constants.
+   * 
+   * @see #getVerticalAlignment()
+   */
+  public void setVerticalAlignment(int a)
+  {
+    if (verticalAlignment == a)
+      return;
+    if (a != TOP && a != CENTER && a != BOTTOM)
+      throw new IllegalArgumentException("Invalid alignment.");
+
+    int old = verticalAlignment;
+    verticalAlignment = a;
+    firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Get the vertical position of the button's text relative to its
+   * icon. The alignment is a numeric constant from {@link
+   * SwingConstants}. It must be one of: <code>CENTER</code>,
+   * <code>TOP</code>, or <code>BOTTOM</code>. The default is
+   * <code>CENTER</code>.
+   *
+   * @return The current vertical position
+   */
+  public int getVerticalTextPosition()
+  {
+    return verticalTextPosition;
+  }
+
+  /**
+   * Set the vertical position of the button's text relative to its
+   * icon. The alignment is a numeric constant from {@link
+   * SwingConstants}. It must be one of: <code>CENTER</code>,
+   * <code>TOP</code>, or <code>BOTTOM</code>. The default is
+   * <code>CENTER</code>.
+   *
+   * @param t The new vertical position
+   * @throws IllegalArgumentException If position is not one of the legal
+   * constants.
+   */
+  public void setVerticalTextPosition(int t)
+  {
+    if (verticalTextPosition == t)
+      return;
+    if (t != TOP && t != CENTER && t != BOTTOM)
+      throw new IllegalArgumentException("Invalid alignment.");
+    
+    int old = verticalTextPosition;
+    verticalTextPosition = t;
+    firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Set the value of the "borderPainted" property. If set to
+   * <code>false</code>, the button's look and feel class should not paint
+   * a border for the button. The default is <code>true</code>.
+   *
+   * @return The current value of the property.
+   */
+  public boolean isBorderPainted()
+  {
+    return borderPainted;
+  }
+
+  /**
+   * Set the value of the "borderPainted" property. If set to
+   * <code>false</code>, the button's look and feel class should not paint
+   * a border for the button. The default is <code>true</code>.
+   *
+   * @param b The new value of the property.
+   */
+  public void setBorderPainted(boolean b)
+  {
+    clientBorderPaintedSet = true;
+    if (borderPainted == b)
+      return;
+    boolean old = borderPainted;
+    borderPainted = b;
+    firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, old, b);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Get the value of the "action" property. 
+   *
+   * @return The current value of the "action" property
+   */
+  public Action getAction()
+  {
+    return action;
+  }
+
+  /**
+   * <p>Set the button's "action" property, subscribing the new action to the
+   * button, as an ActionListener, if it is not already subscribed. The old
+   * Action, if it exists, is unsubscribed, and the button is unsubscribed
+   * from the old Action if it was previously subscribed as a
+   * PropertyChangeListener.</p>
+   *
+   * <p>This method also configures several of the button's properties from
+   * the Action, by calling {@link #configurePropertiesFromAction}, and
+   * subscribes the button to the Action as a PropertyChangeListener.
+   * Subsequent changes to the Action will thus reconfigure the button 
+   * automatically.</p>
+   *
+   * @param a The new value of the "action" property
+   */
+  public void setAction(Action a)
+  {
+    if (action != null)
+      {
+        action.removePropertyChangeListener(actionPropertyChangeListener);
+        removeActionListener(action);
+        if (actionPropertyChangeListener != null)
+          {
+            action.removePropertyChangeListener(actionPropertyChangeListener);
+            actionPropertyChangeListener = null;
+          }
+      }
+
+    Action old = action;
+    action = a;
+    configurePropertiesFromAction(action);
+    if (action != null)
+      {
+        actionPropertyChangeListener = createActionPropertyChangeListener(a);      
+        action.addPropertyChangeListener(actionPropertyChangeListener);
+        addActionListener(action);
+      }
+  }
+
+  /**
+   * Return the button's default "icon" property.
+   *
+   * @return The current default icon
+   */
+  public Icon getIcon()
+  {
+    return default_icon;
+  }
+
+  /**
+   * Set the button's default "icon" property. This icon is used as a basis
+   * for the pressed and disabled icons, if none are explicitly set.
+   *
+   * @param i The new default icon
+   */
+  public void setIcon(Icon i)
+  {
+    if (default_icon == i)
+      return;
+    
+    Icon old = default_icon;      
+    default_icon = i;      
+    firePropertyChange(ICON_CHANGED_PROPERTY, old, i);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Return the button's "text" property. This property is synonymous with
+   * the "label" property.
+   *
+   * @return The current "text" property
+   */
+  public String getText()
+  {
+    return text;
+  }
+
+  /**
+   * Set the button's "label" property. This property is synonymous with the
+   * "text" property.
+   *
+   * @param label The new "label" property
+   *
+   * @deprecated use <code>setText(text)</code>
+   */
+  public void setLabel(String label)
+  {
+    setText(label);
+  }
+
+  /**
+   * Return the button's "label" property. This property is synonymous with
+   * the "text" property.
+   *
+   * @return The current "label" property
+   *
+   * @deprecated use <code>getText()</code>
+   */
+  public String getLabel()
+  {
+    return getText();
+  }
+
+  /**
+   * Set the button's "text" property. This property is synonymous with the
+   * "label" property.
+   *
+   * @param t The new "text" property
+   */
+  public void setText(String t)
+  {
+    if (text == t)
+      return;
+    
+    String old = text;
+    text = t;
+    firePropertyChange(TEXT_CHANGED_PROPERTY, old, t);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Set the value of the {@link #iconTextGap} property.
+   * 
+   * @param i The new value of the property
+   * 
+   * @since 1.4
+   */
+  public void setIconTextGap(int i)
+  {
+    clientIconTextGapSet = true;
+    if (iconTextGap == i)
+      return;
+    
+    int old = iconTextGap;
+    iconTextGap = i;
+    firePropertyChange("iconTextGap", new Integer(old), new Integer(i));
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Get the value of the {@link #iconTextGap} property.
+   *
+   * @return The current value of the property
+   * 
+   * @since 1.4
+   */
+  public int getIconTextGap()
+  {
+    return iconTextGap;
+  }
+
+  /**
+   * Return the button's "margin" property, which is an {@link Insets} object
+   * describing the distance between the button's border and its text and
+   * icon.
+   *
+   * @return The current "margin" property
+   */
+  public Insets getMargin()
+  {
+    return margin;
+  }
+
+  /**
+   * Set the button's "margin" property, which is an {@link Insets} object
+   * describing the distance between the button's border and its text and
+   * icon.
+   *
+   * @param m The new "margin" property
+   */
+  public void setMargin(Insets m)
+  {
+    if (margin == m)
+      return;
+    
+    Insets old = margin;
+    margin = m;
+    firePropertyChange(MARGIN_CHANGED_PROPERTY, old, m);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Return the button's "pressedIcon" property. The look and feel class
+   * should paint this icon when the "pressed" property of the button's
+   * {@link ButtonModel} is <code>true</code>. This property may be
+   * <code>null</code>, in which case the default icon is used.
+   *
+   * @return The current "pressedIcon" property
+   */
+  public Icon getPressedIcon()
+  {
+    return pressed_icon;
+  }
+
+  /**
+   * Set the button's "pressedIcon" property. The look and feel class
+   * should paint this icon when the "pressed" property of the button's
+   * {@link ButtonModel} is <code>true</code>. This property may be
+   * <code>null</code>, in which case the default icon is used.
+   *
+   * @param pressedIcon The new "pressedIcon" property
+   */
+  public void setPressedIcon(Icon pressedIcon)
+  {
+    if (pressed_icon == pressedIcon)
+      return;
+    
+    Icon old = pressed_icon;
+    pressed_icon = pressedIcon;
+    firePropertyChange(PRESSED_ICON_CHANGED_PROPERTY, old, pressed_icon);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Return the button's "disabledIcon" property. The look and feel class
+   * should paint this icon when the "enabled" property of the button's
+   * {@link ButtonModel} is <code>false</code>. This property may be
+   * <code>null</code>, in which case an icon is constructed, based on the
+   * default icon.
+   *
+   * @return The current "disabledIcon" property
+   */
+  public Icon getDisabledIcon()
+  {
+    if (disabledIcon == null && default_icon instanceof ImageIcon)
+      {
+        Image iconImage = ((ImageIcon) default_icon).getImage();
+        Image grayImage = GrayFilter.createDisabledImage(iconImage);
+        disabledIcon = new ImageIcon(grayImage);
+      }
+      
+    return disabledIcon;
+  }
+
+  /**
+   * Set the button's "disabledIcon" property. The look and feel class should
+   * paint this icon when the "enabled" property of the button's {@link
+   * ButtonModel} is <code>false</code>. This property may be
+   * <code>null</code>, in which case an icon is constructed, based on the
+   * default icon.
+   *
+   * @param d The new "disabledIcon" property
+   */
+  public void setDisabledIcon(Icon d)
+  {
+    if (disabledIcon == d)
+      return;
+    Icon old = disabledIcon;
+    disabledIcon = d;
+    firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, old, d);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Return the button's "paintFocus" property. This property controls
+   * whether or not the look and feel class will paint a special indicator
+   * of focus state for the button. If it is false, the button still paints
+   * when focused, but no special decoration is painted to indicate the
+   * presence of focus.
+   *
+   * @return The current "paintFocus" property
+   */
+  public boolean isFocusPainted()
+  {
+    return focusPainted;
+  }
+
+  /**
+   * Set the button's "paintFocus" property. This property controls whether
+   * or not the look and feel class will paint a special indicator of focus
+   * state for the button. If it is false, the button still paints when
+   * focused, but no special decoration is painted to indicate the presence
+   * of focus.
+   *
+   * @param p The new "paintFocus" property
+   */
+  public void setFocusPainted(boolean p)
+  {
+    if (focusPainted == p)
+      return;
+    
+    boolean old = focusPainted;
+    focusPainted = p;
+    firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, p);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Verifies that a particular key is one of the valid constants used for
+   * describing horizontal alignment and positioning. The valid constants
+   * are the following members of {@link SwingConstants}:
+   * <code>RIGHT</code>, <code>LEFT</code>, <code>CENTER</code>,
+   * <code>LEADING</code> or <code>TRAILING</code>.
+   *
+   * @param key The key to check
+   * @param exception A message to include in an IllegalArgumentException
+   *
+   * @return the value of key
+   *
+   * @throws IllegalArgumentException If key is not one of the valid constants
+   *
+   * @see #setHorizontalTextPosition(int)
+   * @see #setHorizontalAlignment(int)
+   */
+  protected  int checkHorizontalKey(int key, String exception)
+  {
+    switch (key)
+      {
+      case SwingConstants.RIGHT:
+      case SwingConstants.LEFT:
+      case SwingConstants.CENTER:
+      case SwingConstants.LEADING:
+      case SwingConstants.TRAILING:
+        break;
+      default:
+        throw new IllegalArgumentException(exception);
+      }
+    return key;
+  }
+
+  /**
+   * Verifies that a particular key is one of the valid constants used for
+   * describing vertical alignment and positioning. The valid constants are
+   * the following members of {@link SwingConstants}: <code>TOP</code>,
+   * <code>BOTTOM</code> or <code>CENTER</code>.
+   *
+   * @param key The key to check
+   * @param exception A message to include in an IllegalArgumentException
+   *
+   * @return the value of key
+   *
+   * @throws IllegalArgumentException If key is not one of the valid constants
+   *
+   * @see #setVerticalTextPosition(int)
+   * @see #setVerticalAlignment(int)
+   */
+  protected  int checkVerticalKey(int key, String exception)
+  {
+    switch (key)
+      {
+      case SwingConstants.TOP:
+      case SwingConstants.BOTTOM:
+      case SwingConstants.CENTER:
+        break;
+      default:
+        throw new IllegalArgumentException(exception);
+      }
+    return key;
+  }
+
+  /**
+   * Configure various properties of the button by reading properties
+   * of an {@link Action}. The mapping of properties is as follows:
+   *
+   * <table>
+   *
+   * <tr><th>Action keyed property</th> <th>AbstractButton property</th></tr>
+   *
+   * <tr><td>NAME                 </td> <td>text                   </td></tr>
+   * <tr><td>SMALL_ICON           </td> <td>icon                   </td></tr>
+   * <tr><td>SHORT_DESCRIPTION    </td> <td>toolTipText            </td></tr>
+   * <tr><td>MNEMONIC_KEY         </td> <td>mnemonic               </td></tr>
+   * <tr><td>ACTION_COMMAND_KEY   </td> <td>actionCommand          </td></tr>
+   *
+   * </table>
+   *
+   * <p>In addition, this method always sets the button's "enabled" property to
+   * the value of the Action's "enabled" property.</p>
+   *
+   * <p>If the provided Action is <code>null</code>, the text, icon, and
+   * toolTipText properties of the button are set to <code>null</code>, and
+   * the "enabled" property is set to <code>true</code>; the mnemonic and
+   * actionCommand properties are unchanged.</p>
+   *
+   * @param a An Action to configure the button from
+   */
+  protected void configurePropertiesFromAction(Action a)
+  {
+    if (a == null)
+      {
+        setText(null);
+        setIcon(null);
+        setEnabled(true);
+        setToolTipText(null);
+      }
+    else
+      {
+        setText((String) (a.getValue(Action.NAME)));
+        setIcon((Icon) (a.getValue(Action.SMALL_ICON)));
+        setEnabled(a.isEnabled());
+        setToolTipText((String) (a.getValue(Action.SHORT_DESCRIPTION)));
+        if (a.getValue(Action.MNEMONIC_KEY) != null)
+          setMnemonic(((Integer) (a.getValue(Action.MNEMONIC_KEY))).intValue());
+        String actionCommand = (String) (a.getValue(Action.ACTION_COMMAND_KEY));
+
+        // Set actionCommand to button's text by default if it is not specified
+        if (actionCommand != null)
+          setActionCommand((String) (a.getValue(Action.ACTION_COMMAND_KEY)));
+        else
+          setActionCommand(getText());
+      }
+  }
+
+  /**
+   * <p>A factory method which should return an {@link ActionListener} that
+   * propagates events from the button's {@link ButtonModel} to any of the
+   * button's ActionListeners. By default, this is an inner class which
+   * calls {@link AbstractButton#fireActionPerformed} with a modified copy
+   * of the incoming model {@link ActionEvent}.</p>
+   *
+   * <p>The button calls this method during construction, stores the
+   * resulting ActionListener in its <code>actionListener</code> member
+   * field, and subscribes it to the button's model. If the button's model
+   * is changed, this listener is unsubscribed from the old model and
+   * subscribed to the new one.</p>
+   *
+   * @return A new ActionListener 
+   */
+  protected  ActionListener createActionListener()
+  {
+    return new ActionListener()
+      {
+        public void actionPerformed(ActionEvent e)
+        {
+          AbstractButton.this.fireActionPerformed(e);
+        }
+      };
+  }
+
+  /**
+   * <p>A factory method which should return a {@link PropertyChangeListener}
+   * that accepts changes to the specified {@link Action} and reconfigure
+   * the {@link AbstractButton}, by default using the {@link
+   * #configurePropertiesFromAction} method.</p>
+   *
+   * <p>The button calls this method whenever a new Action is assigned to
+   * the button's "action" property, via {@link #setAction}, and stores the
+   * resulting PropertyChangeListener in its
+   * <code>actionPropertyChangeListener</code> member field. The button
+   * then subscribes the listener to the button's new action. If the
+   * button's action is changed subsequently, the listener is unsubscribed
+   * from the old action and subscribed to the new one.</p>
+   *
+   * @param a The Action which will be listened to, and which should be 
+   * the same as the source of any PropertyChangeEvents received by the
+   * new listener returned from this method.
+   *
+   * @return A new PropertyChangeListener
+   */
+  protected  PropertyChangeListener createActionPropertyChangeListener(Action a)
+  {
+    return new PropertyChangeListener()
+      {
+        public void propertyChange(PropertyChangeEvent e)
+        {
+          Action act = (Action) (e.getSource());
+          if (e.getPropertyName().equals("enabled"))
+            setEnabled(act.isEnabled());
+          else if (e.getPropertyName().equals(Action.NAME))
+            setText((String) (act.getValue(Action.NAME)));
+          else if (e.getPropertyName().equals(Action.SMALL_ICON))
+            setIcon((Icon) (act.getValue(Action.SMALL_ICON)));
+          else if (e.getPropertyName().equals(Action.SHORT_DESCRIPTION))
+            setToolTipText((String) (act.getValue(Action.SHORT_DESCRIPTION)));
+          else if (e.getPropertyName().equals(Action.MNEMONIC_KEY))
+            if (act.getValue(Action.MNEMONIC_KEY) != null)
+              setMnemonic(((Integer) (act.getValue(Action.MNEMONIC_KEY)))
+                          .intValue());
+          else if (e.getPropertyName().equals(Action.ACTION_COMMAND_KEY))
+            setActionCommand((String) (act.getValue(Action.ACTION_COMMAND_KEY)));
+        }
+      };
+  }
+
+  /**
+   * <p>Factory method which creates a {@link ChangeListener}, used to
+   * subscribe to ChangeEvents from the button's model. Subclasses of
+   * AbstractButton may wish to override the listener used to subscribe to
+   * such ChangeEvents. By default, the listener just propagates the
+   * {@link ChangeEvent} to the button's ChangeListeners, via the {@link
+   * AbstractButton#fireStateChanged} method.</p>
+   *
+   * <p>The button calls this method during construction, stores the
+   * resulting ChangeListener in its <code>changeListener</code> member
+   * field, and subscribes it to the button's model. If the button's model
+   * is changed, this listener is unsubscribed from the old model and
+   * subscribed to the new one.</p>
+   *
+   * @return The new ChangeListener
+   */
+  protected ChangeListener createChangeListener()
+  {
+    return new ButtonChangeListener();
+  }
+
+  /**
+   * <p>Factory method which creates a {@link ItemListener}, used to
+   * subscribe to ItemEvents from the button's model. Subclasses of
+   * AbstractButton may wish to override the listener used to subscribe to
+   * such ItemEvents. By default, the listener just propagates the
+   * {@link ItemEvent} to the button's ItemListeners, via the {@link
+   * AbstractButton#fireItemStateChanged} method.</p>
+   *
+   * <p>The button calls this method during construction, stores the
+   * resulting ItemListener in its <code>changeListener</code> member
+   * field, and subscribes it to the button's model. If the button's model
+   * is changed, this listener is unsubscribed from the old model and
+   * subscribed to the new one.</p>
+   *
+   * <p>Note that ItemEvents are only generated from the button's model
+   * when the model's <em>selected</em> property changes. If you want to
+   * subscribe to other properties of the model, you must subscribe to
+   * ChangeEvents.
+   *
+   * @return The new ItemListener
+   */
+  protected  ItemListener createItemListener()
+  {
+    return new ItemListener()
+      {
+        public void itemStateChanged(ItemEvent e)
+        {
+          AbstractButton.this.fireItemStateChanged(e);
+        }
+      };
+  }
+
+  /**
+   * Programmatically perform a "click" on the button: arming, pressing,
+   * waiting, un-pressing, and disarming the model.
+   */
+  public void doClick()
+  {
+    doClick(100);
+  }
+
+  /**
+   * Programmatically perform a "click" on the button: arming, pressing,
+   * waiting, un-pressing, and disarming the model.
+   *
+   * @param pressTime The number of milliseconds to wait in the pressed state
+   */
+  public void doClick(int pressTime)
+  {
+    ButtonModel mod = getModel();
+    if (mod != null)
+      {
+        mod.setArmed(true);
+        mod.setPressed(true);
+        try
+          {
+            java.lang.Thread.sleep(pressTime);
+          }
+        catch (java.lang.InterruptedException e)
+          {
+            // probably harmless
+          }
+        mod.setPressed(false);
+        mod.setArmed(false);
+      }
+  }
+
+  /**
+   * Return the button's disabled selected icon. The look and feel class
+   * should paint this icon when the "enabled" property of the button's model
+   * is <code>false</code> and its "selected" property is
+   * <code>true</code>. This icon can be <code>null</code>, in which case
+   * it is synthesized from the button's selected icon.
+   *
+   * @return The current disabled selected icon
+   */
+  public Icon getDisabledSelectedIcon()
+  {
+    return disabledSelectedIcon;
+  }
+
+  /**
+   * Set the button's disabled selected icon. The look and feel class
+   * should paint this icon when the "enabled" property of the button's model
+   * is <code>false</code> and its "selected" property is
+   * <code>true</code>. This icon can be <code>null</code>, in which case
+   * it is synthesized from the button's selected icon.
+   *
+   * @param icon The new disabled selected icon
+   */
+  public void setDisabledSelectedIcon(Icon icon)
+  {
+    if (disabledSelectedIcon == icon)
+      return;
+    
+    Icon old = disabledSelectedIcon;
+    disabledSelectedIcon = icon;
+    firePropertyChange(DISABLED_SELECTED_ICON_CHANGED_PROPERTY, old, icon);
+    revalidate();
+    repaint();        
+  }
+
+  /**
+   * Return the button's rollover icon. The look and feel class should
+   * paint this icon when the "rolloverEnabled" property of the button is
+   * <code>true</code> and the mouse rolls over the button.
+   *
+   * @return The current rollover icon
+   */
+  public Icon getRolloverIcon()
+  {
+    return rolloverIcon;
+  }
+
+  /**
+   * Set the button's rollover icon and sets the <code>rolloverEnabled</code>
+   * property to <code>true</code>. The look and feel class should
+   * paint this icon when the "rolloverEnabled" property of the button is
+   * <code>true</code> and the mouse rolls over the button.
+   *
+   * @param r The new rollover icon
+   */
+  public void setRolloverIcon(Icon r)
+  {
+    if (rolloverIcon == r)
+      return;
+    
+    Icon old = rolloverIcon;
+    rolloverIcon = r;
+    firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old, rolloverIcon);
+    setRolloverEnabled(true);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Return the button's rollover selected icon. The look and feel class
+   * should paint this icon when the "rolloverEnabled" property of the button
+   * is <code>true</code>, the "selected" property of the button's model is
+   * <code>true</code>, and the mouse rolls over the button.
+   *
+   * @return The current rollover selected icon
+   */
+  public Icon getRolloverSelectedIcon()
+  {
+    return rolloverSelectedIcon;
+  }
+
+  /**
+   * Set the button's rollover selected icon and sets the 
+   * <code>rolloverEnabled</code> property to <code>true</code>. The look and 
+   * feel class should paint this icon when the "rolloverEnabled" property of 
+   * the button is <code>true</code>, the "selected" property of the button's 
+   * model is <code>true</code>, and the mouse rolls over the button.
+   *
+   * @param r The new rollover selected icon.
+   */
+  public void setRolloverSelectedIcon(Icon r)
+  {
+    if (rolloverSelectedIcon == r)
+      return;
+    
+    Icon old = rolloverSelectedIcon;
+    rolloverSelectedIcon = r;
+    firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old, r);
+    setRolloverEnabled(true);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Return the button's selected icon. The look and feel class should
+   * paint this icon when the "selected" property of the button's model is
+   * <code>true</code>, and either the "rolloverEnabled" property of the
+   * button is <code>false</code> or the mouse is not currently rolled
+   * over the button.
+   *
+   * @return The current selected icon
+   */
+  public Icon getSelectedIcon()
+  {
+    return selectedIcon;
+  }
+
+  /**
+   * Set the button's selected icon. The look and feel class should
+   * paint this icon when the "selected" property of the button's model is
+   * <code>true</code>, and either the "rolloverEnabled" property of the
+   * button is <code>false</code> or the mouse is not currently rolled
+   * over the button.
+   *
+   * @param s The new selected icon
+   */
+  public void setSelectedIcon(Icon s)
+  {
+    if (selectedIcon == s)
+      return;
+    
+    Icon old = selectedIcon;
+    selectedIcon = s;
+    firePropertyChange(SELECTED_ICON_CHANGED_PROPERTY, old, s);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Returns an single-element array containing the "text" property of the
+   * button if the "selected" property of the button's model is
+   * <code>true</code>, otherwise returns <code>null</code>.
+   *
+   * @return The button's "selected object" array
+   */
+  public Object[] getSelectedObjects()
+  {
+    if (isSelected())
+      {
+        Object[] objs = new Object[1];
+        objs[0] = getText();
+        return objs;
+      }
+    else
+      {
+        return null;
+      }
+  }
+
+  /**
+   * Called when image data becomes available for one of the button's icons.
+   *
+   * @param img The image being updated
+   * @param infoflags One of the constant codes in {@link ImageObserver} used
+   *     to describe updated portions of an image.
+   * @param x X coordinate of the region being updated
+   * @param y Y coordinate of the region being updated
+   * @param w Width of the region beign updated
+   * @param h Height of the region being updated
+   *
+   * @return <code>true</code> if img is equal to the button's current icon,
+   *     otherwise <code>false</code>
+   */
+  public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
+                             int h)
+  {
+    return current_icon == img;
+  }
+
+  /**
+   * Returns the value of the button's "contentAreaFilled" property. This
+   * property indicates whether the area surrounding the text and icon of
+   * the button should be filled by the look and feel class.  If this
+   * property is <code>false</code>, the look and feel class should leave
+   * the content area transparent.
+   *
+   * @return The current value of the "contentAreaFilled" property
+   */
+  public boolean isContentAreaFilled()
+  {
+    return contentAreaFilled;
+  }
+
+  /**
+   * Sets the value of the button's "contentAreaFilled" property. This
+   * property indicates whether the area surrounding the text and icon of
+   * the button should be filled by the look and feel class.  If this
+   * property is <code>false</code>, the look and feel class should leave
+   * the content area transparent.
+   *
+   * @param b The new value of the "contentAreaFilled" property
+   */
+  public void setContentAreaFilled(boolean b)
+  {
+    clientContentAreaFilledSet = true;
+    if (contentAreaFilled == b)
+      return;
+    
+    // The JDK sets the opaque property to the value of the contentAreaFilled
+    // property, so should we do.
+    setOpaque(b);
+    boolean old = contentAreaFilled;
+    contentAreaFilled = b;
+    firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
+   }
+
+  /**
+   * Paints the button's border, if the button's "borderPainted" property is
+   * <code>true</code>, by out calling to the button's look and feel class.
+   *
+   * @param g The graphics context used to paint the border
+   */
+  protected void paintBorder(Graphics g)
+  {
+    if (isBorderPainted())
+      super.paintBorder(g);
+  }
+
+  /**
+   * Returns a string, used only for debugging, which identifies or somehow
+   * represents this button. The exact value is implementation-defined.
+   *
+   * @return A string representation of the button
+   */
+  protected String paramString()
+  {
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",defaultIcon=");
+    if (getIcon() != null)
+      sb.append(getIcon());
+    sb.append(",disabledIcon=");
+    if (getDisabledIcon() != null)
+      sb.append(getDisabledIcon());
+    sb.append(",disabledSelectedIcon=");
+    if (getDisabledSelectedIcon() != null)
+      sb.append(getDisabledSelectedIcon());
+    sb.append(",margin=");
+    if (getMargin() != null)
+      sb.append(getMargin());
+    sb.append(",paintBorder=").append(isBorderPainted());
+    sb.append(",paintFocus=").append(isFocusPainted());
+    sb.append(",pressedIcon=");
+    if (getPressedIcon() != null)
+      sb.append(getPressedIcon());
+    sb.append(",rolloverEnabled=").append(isRolloverEnabled());
+    sb.append(",rolloverIcon=");
+    if (getRolloverIcon() != null)
+      sb.append(getRolloverIcon());
+    sb.append(",rolloverSelected=");
+    if (getRolloverSelectedIcon() != null)
+      sb.append(getRolloverSelectedIcon());
+    sb.append(",selectedIcon=");
+    if (getSelectedIcon() != null)
+      sb.append(getSelectedIcon());
+    sb.append(",text=");
+    if (getText() != null)
+      sb.append(getText());
+    return sb.toString();
+  }
+
+  /**
+   * Set the "UI" property of the button, which is a look and feel class
+   * responsible for handling the button's input events and painting it.
+   *
+   * @param ui The new "UI" property
+   */
+  public void setUI(ButtonUI ui)
+  {
+    super.setUI(ui);
+  }
+  
+  /**
+   * Set the "UI" property of the button, which is a look and feel class
+   * responsible for handling the button's input events and painting it.
+   *
+   * @return The current "UI" property
+   */
+  public ButtonUI getUI()
+  {
+    return (ButtonUI) ui;
+  }
+  
+  /**
+   * Set the "UI" property to a class constructed, via the {@link
+   * UIManager}, from the current look and feel. This should be overridden
+   * for each subclass of AbstractButton, to retrieve a suitable {@link
+   * ButtonUI} look and feel class.
+   */
+  public void updateUI()
+  {
+    // TODO: What to do here?
+  }
+
+  /**
+   * Returns the current time in milliseconds in which clicks gets coalesced
+   * into a single <code>ActionEvent</code>.
+   *
+   * @return the time in milliseconds
+   * 
+   * @since 1.4
+   */
+  public long getMultiClickThreshhold()
+  {
+    return multiClickThreshhold;
+  }
+
+  /**
+   * Sets the time in milliseconds in which clicks gets coalesced into a single
+   * <code>ActionEvent</code>.
+   *
+   * @param threshhold the time in milliseconds
+   * 
+   * @since 1.4
+   */
+  public void setMultiClickThreshhold(long threshhold)
+  {
+    if (threshhold < 0)
+      throw new IllegalArgumentException();
+
+    multiClickThreshhold = threshhold;
+  }
+
+  /**
+   * Adds the specified component to this AbstractButton. This overrides the
+   * default in order to install an {@link OverlayLayout} layout manager
+   * before adding the component. The layout manager is only installed if
+   * no other layout manager has been installed before.
+   *
+   * @param comp the component to be added
+   * @param constraints constraints for the layout manager
+   * @param index the index at which the component is added
+   *
+   * @since 1.5
+   */
+  protected void addImpl(Component comp, Object constraints, int index)
+  {
+    // We use a client property here, so that no extra memory is used in
+    // the common case with no layout manager.
+    if (getClientProperty("AbstractButton.customLayoutSet") == null)
+      setLayout(new OverlayLayout(this));
+    super.addImpl(comp, constraints, index);
+  }
+
+  /**
+   * Sets a layout manager on this AbstractButton. This is overridden in order
+   * to detect if the application sets a custom layout manager. If no custom
+   * layout manager is set, {@link #addImpl(Component, Object, int)} installs
+   * an OverlayLayout before adding a component.
+   *
+   * @param layout the layout manager to install
+   *
+   * @since 1.5
+   */
+  public void setLayout(LayoutManager layout)
+  {
+    // We use a client property here, so that no extra memory is used in
+    // the common case with no layout manager.
+    putClientProperty("AbstractButton.customLayoutSet", Boolean.TRUE);
+    super.setLayout(layout);
+  }
+
+  /**
+   * Helper method for
+   * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+   * 
+   * @param propertyName the name of the property
+   * @param value the value of the property
+   *
+   * @throws IllegalArgumentException if the specified property cannot be set
+   *         by this method
+   * @throws ClassCastException if the property value does not match the
+   *         property type
+   * @throws NullPointerException if <code>c</code> or
+   *         <code>propertyValue</code> is <code>null</code>
+   */
+  void setUIProperty(String propertyName, Object value)
+  {
+    if (propertyName.equals("borderPainted"))
+      {
+        if (! clientBorderPaintedSet)
+          {
+            setBorderPainted(((Boolean) value).booleanValue());
+            clientBorderPaintedSet = false;
+          }
+      }
+    else if (propertyName.equals("rolloverEnabled"))
+      {
+        if (! clientRolloverEnabledSet)
+          {
+            setRolloverEnabled(((Boolean) value).booleanValue());
+            clientRolloverEnabledSet = false;
+          }
+      }
+    else if (propertyName.equals("iconTextGap"))
+      {
+        if (! clientIconTextGapSet)
+          {
+            setIconTextGap(((Integer) value).intValue());
+            clientIconTextGapSet = false;
+          }
+      }
+    else if (propertyName.equals("contentAreaFilled"))
+      {
+        if (! clientContentAreaFilledSet)
+          {
+            setContentAreaFilled(((Boolean) value).booleanValue());
+            clientContentAreaFilledSet = false;
+          }
+      }
+    else
+      {
+        super.setUIProperty(propertyName, value);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractCellEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractCellEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractCellEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractCellEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,195 @@
+/* AbstractCellEditor.java --
+   Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.EventObject;
+
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.EventListenerList;
+
+/**
+ * An abstract superclass for table and tree cell editors. This provides some
+ * common shared functionality.
+ *
+ * @author Andrew Selkirk
+ */
+public abstract class AbstractCellEditor
+  implements CellEditor, Serializable
+{
+  private static final long serialVersionUID = -1048006551406220959L;
+
+  /**
+   * Our Swing event listeners.
+   */
+  protected EventListenerList listenerList;
+
+  /**
+   * The cached ChangeEvent.
+   */
+  protected transient ChangeEvent changeEvent;
+
+  /**
+   * Creates a new instance of AbstractCellEditor.
+   */
+  public AbstractCellEditor() 
+  {
+    listenerList = new EventListenerList();
+    changeEvent = new ChangeEvent(this);
+  }
+
+  /**
+   * Returns <code>true</code> if the cell is editable using
+   * <code>event</code>, <code>false</code>
+   * if it's not. The default behaviour is to return <code>true</code>.
+   *
+   * @param event an event
+   *
+   * @return <code>true</code> if the cell is editable using
+   *     <code>event</code>, <code>false</code> if it's not
+   */
+  public boolean isCellEditable(EventObject event) 
+  {
+    return true;
+  } 
+
+  /**
+   * Returns <code>true</code> if the editing cell should be selected,
+   * <code>false</code> otherwise. This is usually returning <code>true</code>,
+   * but in some special cases it might be useful not to switch cell selection
+   * when editing one cell.
+   *
+   * @param event an event
+   *
+   * @return <code>true</code> if the editing cell should be selected,
+   *     <code>false</code> otherwise
+   */
+  public boolean shouldSelectCell(EventObject event) 
+  {
+    return true;
+  }
+
+  /**
+   * Stop editing the cell and accept any partial value that has been entered
+   * into the cell.
+   *
+   * @return <code>true</code> if editing has been stopped successfully,
+   *     <code>false</code>otherwise
+   */
+  public boolean stopCellEditing() 
+  {
+    fireEditingStopped();
+    return true;
+  }
+
+  /**
+   * Stop editing the cell and do not accept any partial value that has
+   * been entered into the cell.
+   */
+  public void cancelCellEditing() 
+  {
+    fireEditingCanceled();
+  } 
+
+  /**
+   * Adds a CellEditorListener to the list of CellEditorListeners of this
+   * CellEditor.
+   *
+   * @param listener the CellEditorListener to add
+   */
+  public void addCellEditorListener(CellEditorListener listener)
+  {
+    listenerList.add(CellEditorListener.class, listener);
+  }
+
+  /**
+   * Removes the specified CellEditorListener from the list of the
+   * CellEditorListeners of this CellEditor.
+   *
+   * @param listener the CellEditorListener to remove
+   */
+  public void removeCellEditorListener(CellEditorListener listener)
+  {
+    listenerList.remove(CellEditorListener.class, listener);
+  }
+	
+  /**
+   * Returns the list of CellEditorListeners that have been registered
+   * in this CellEditor.
+   *
+   * @return the list of CellEditorListeners that have been registered
+   *     in this CellEditor
+   *
+   * @since 1.4
+   */
+  public CellEditorListener[] getCellEditorListeners()
+  {
+    return (CellEditorListener[]) listenerList.getListeners(
+        CellEditorListener.class);
+  }
+
+  /**
+   * Notifies all registered listeners that the editing of the cell has has been
+   * stopped.
+   */
+  protected void fireEditingStopped()
+  {
+    CellEditorListener[] listeners = getCellEditorListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      {
+        listeners[index].editingStopped(changeEvent);
+      }
+  }
+
+  /**
+   * Notifies all registered listeners that the editing of the cell has
+   * has been canceled.
+   */
+  protected void fireEditingCanceled()
+  {
+    CellEditorListener[] listeners = getCellEditorListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      {
+        listeners[index].editingCanceled(changeEvent);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractListModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractListModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractListModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractListModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,181 @@
+/* AbstractListModel.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.EventListener;
+
+import javax.swing.event.EventListenerList;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+/**
+ * Provides standard implementations of some methods in {@link ListModel}.
+ *
+ * @author Ronald Veldema
+ * @author Andrew Selkirk
+ */
+public abstract class AbstractListModel implements ListModel, Serializable
+{
+  private static final long serialVersionUID = -3285184064379168730L;
+
+  /** List of ListDataListeners called for each change to the list. */
+  protected EventListenerList listenerList;
+
+  /**
+   * Creates a new model instance - initialises the event listener list.
+   */
+  public AbstractListModel()
+  {
+    listenerList = new EventListenerList();
+  }
+
+  /**
+   * Add a listener object to this model. The listener will be called
+   * any time the set of elements in the model is changed.
+   *
+   * @param listener The listener to add
+   */
+  public void addListDataListener(ListDataListener listener)
+  {
+    listenerList.add(ListDataListener.class, listener);
+  }
+
+  /**
+   * Add a listener object to this model. The listener will no longer be
+   * called when the set of elements in the model is changed.
+   *
+   * @param listener The listener to remove
+   */
+  public void removeListDataListener(ListDataListener listener)
+  {
+    listenerList.remove(ListDataListener.class, listener);
+  }
+
+  /**
+   * Call {@link ListDataListener#contentsChanged} on each element of the
+   * {@link #listenerList} which is a {@link ListDataListener}. The event
+   * fired has type {@link ListDataEvent#CONTENTS_CHANGED} and represents a
+   * change to the data elements in the range [startIndex, endIndex]
+   * inclusive.
+   *
+   * @param source The source of the change, typically <code>this</code>
+   * @param startIndex The index of the first element which changed
+   * @param endIndex The index of the last element which changed
+   */
+  protected void fireContentsChanged(Object source, int startIndex,
+                                     int endIndex)
+  {
+    ListDataEvent event = new ListDataEvent(source, ListDataEvent.CONTENTS_CHANGED,
+                                            startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].contentsChanged(event);
+  }
+
+  /**
+   * Call {@link ListDataListener#intervalAdded} on each element of the
+   * {@link #listenerList} which is a {@link ListDataListener}. The event
+   * fired has type {@link ListDataEvent#INTERVAL_ADDED} and represents an
+   * addition of the data elements in the range [startIndex, endIndex]
+   * inclusive.
+   *
+   * @param source The source of the change, typically <code>this</code>
+   * @param startIndex The index of the first new element
+   * @param endIndex The index of the last new element
+   */
+  protected void fireIntervalAdded(Object source, int startIndex, int endIndex)
+  {
+    ListDataEvent event =
+      new ListDataEvent(source, ListDataEvent.INTERVAL_ADDED,
+			startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].intervalAdded(event);
+  }
+
+  /**
+   * Call {@link ListDataListener#intervalRemoved} on each element of the
+   * {@link #listenerList} which is a {@link ListDataListener}. The event
+   * fired has type {@link ListDataEvent#INTERVAL_REMOVED} and represents a
+   * removal of the data elements in the range [startIndex, endIndex]
+   * inclusive.
+   *
+   * @param source The source of the change, typically <code>this</code>
+   * @param startIndex The index of the first element removed
+   * @param endIndex The index of the last element removed
+   */
+  protected void fireIntervalRemoved(Object source, int startIndex,
+                                     int endIndex)
+  {
+    ListDataEvent event =
+      new ListDataEvent(source, ListDataEvent.INTERVAL_REMOVED,
+			startIndex, endIndex);
+    ListDataListener[] listeners = getListDataListeners();
+
+    for (int index = 0; index < listeners.length; index++)
+      listeners[index].intervalRemoved(event);
+  }
+
+  /**
+   * Return the subset of {@link EventListener} objects found in this
+   * object's {@link #listenerList} which are elements of the specified
+   * type.
+   *
+   * @param listenerType The type of listeners to select
+   *
+   * @return The set of listeners of the specified type
+   */
+  public EventListener[] getListeners(Class listenerType)
+  {
+    return listenerList.getListeners(listenerType);
+  }
+
+  /**
+   * A synonym for <code>getListeners(ListDataListener.class)</code>.
+   *
+   * @return The set of ListDataListeners found in the {@link #listenerList}
+   */
+  public ListDataListener[] getListDataListeners()
+  {
+    return (ListDataListener[]) getListeners(ListDataListener.class);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractSpinnerModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractSpinnerModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractSpinnerModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/AbstractSpinnerModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,119 @@
+/* AbstractSpinnerModel.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.util.EventListener;
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+
+/**
+ * Provides standard implementations for some of the methods in
+ * {@link SpinnerModel}.
+ *
+ * @author Ka-Hing Cheung
+ */
+public abstract class AbstractSpinnerModel implements SpinnerModel
+{
+  private ChangeEvent changeEvent = new ChangeEvent(this);
+  
+  protected EventListenerList listenerList = new EventListenerList();
+
+  /**
+   * Creates an <code>AbstractSpinnerModel</code>.
+   */
+  public AbstractSpinnerModel()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Adds a <code>ChangeListener</code>.
+   *
+   * @param listener the listener to add
+   */
+  public void addChangeListener(ChangeListener listener)
+  {
+    listenerList.add(ChangeListener.class, listener);
+  }
+
+  /**
+   * Gets all the listeners that are of a particular type.
+   *
+   * @param c the type of listener
+   * @return the listeners that are of the specific type
+   */
+  public EventListener[] getListeners(Class c)
+  {
+    return listenerList.getListeners(c);
+  }
+
+  /**
+   * Gets all the <code>ChangeListener</code>s.
+   *
+   * @return all the <code>ChangeListener</code>s
+   */
+  public ChangeListener[] getChangeListeners()
+  {
+    return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
+  }
+
+  /**
+   * Remove a particular listener.
+   *
+   * @param listener the listener to remove
+   */
+  public void removeChangeListener(ChangeListener listener)
+  {
+    listenerList.remove(ChangeListener.class, listener);
+  }
+
+  /**
+   * Fires a <code>ChangeEvent</code> to all the <code>ChangeListener</code>s
+   * added to this model
+   */
+  protected void fireStateChanged()
+  {
+    ChangeListener[] listeners = getChangeListeners();
+
+    for (int i = 0; i < listeners.length; ++i)
+      listeners[i].stateChanged(changeEvent);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Action.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Action.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Action.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Action.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,153 @@
+/* Action.java --
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.event.ActionListener;
+import java.beans.PropertyChangeListener;
+
+/**
+ * Provides a convenient central point of control for some task
+ * that can be triggered by more than one control in a Swing user interface
+ * (for example, a menu item and a toolbar button).
+ * 
+ * @see AbstractButton#setAction(Action)
+ * 
+ * @author Ronald Veldema (rveldema at cs.vu.nl)
+ * @author Andrew Selkirk
+ */
+public interface Action extends ActionListener {
+
+  /**
+   * A key to access the default property for the action (this is not used).
+   */
+  String DEFAULT = "Default";
+
+  /**
+   * A key to access the long description for the action.
+   */
+  String LONG_DESCRIPTION = "LongDescription";
+
+  /**
+   * A key to access the name for the action.
+   */
+  String NAME = "Name";
+
+  /**
+   * A key to access the short description for the action (the short
+   * description is typically used as the tool tip text).
+   */
+  String SHORT_DESCRIPTION = "ShortDescription";
+
+  /**
+   * A key to access the icon for the action.
+   */
+  String SMALL_ICON = "SmallIcon";
+
+  /**
+   * A key to access the {@link KeyStroke} used as the accelerator for the
+   * action.
+   */
+  String ACCELERATOR_KEY = "AcceleratorKey";
+
+  /**
+   * A key to access the action command string for the action.
+   */
+  String ACTION_COMMAND_KEY = "ActionCommandKey";
+
+  /**
+   * A key to access the mnemonic for the action.
+   */
+  String MNEMONIC_KEY = "MnemonicKey";
+
+  /**
+   * Returns the value associated with the specified key.
+   * 
+   * @param key  the key (not <code>null</code>).
+   * 
+   * @return The value associated with the specified key, or 
+   *         <code>null</code> if the key is not found.
+   */
+  Object getValue(String key);
+
+  /**
+   * Sets the value associated with the specified key and sends a 
+   * {@link java.beans.PropertyChangeEvent} to all registered listeners.  
+   * The standard keys are defined in this interface: {@link #NAME}, 
+   * {@link #SHORT_DESCRIPTION}, {@link #LONG_DESCRIPTION}, 
+   * {@link #SMALL_ICON}, {@link #ACTION_COMMAND_KEY}, 
+   * {@link #ACCELERATOR_KEY} and {@link #MNEMONIC_KEY}. Any existing value 
+   * associated with the key will be overwritten.  
+   * 
+   * @param key  the key (not <code>null</code>).
+   * @param value  the value (<code>null</code> permitted).
+   */
+  void putValue(String key, Object value);
+
+  /**
+   * Returns the flag that indicates whether or not this action is enabled.
+   * 
+   * @return The flag.
+   */
+  boolean isEnabled();
+
+  /**
+   * Sets the flag that indicates whether or not this action is enabled.  If
+   * the value changes, a {@link java.beans.PropertyChangeEvent} is sent to 
+   * all registered listeners.
+   * 
+   * @param b  the new value of the flag.
+   */
+  void setEnabled(boolean b);
+
+  /**
+   * Registers a listener to receive notification whenever one of the
+   * action's properties is modified.
+   * 
+   * @param listener  the listener.
+   */
+  void addPropertyChangeListener(PropertyChangeListener listener);
+
+  /**
+   * Deregisters a listener so that it no longer receives notification of
+   * changes to the action's properties. 
+   * 
+   * @param listener  the listener.
+   */
+  void removePropertyChangeListener(PropertyChangeListener listener);
+
+} // Action

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ActionMap.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ActionMap.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ActionMap.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ActionMap.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,195 @@
+/* ActionMap.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * Maps arbitrary keys (usually Strings) to {@link Action} instances. This
+ * is used in combination with {@link InputMap}s.
+ *
+ * If a component receives an input event, this is looked up in
+ * the component's <code>InputMap</code>. The result is an object which
+ * serves as a key to the components <code>ActionMap</code>. Finally
+ * the <code>Action</code> that is stored is executed.
+ *
+ * @author Andrew Selkirk
+ * @author Michael Koch
+ */
+public class ActionMap
+  implements Serializable
+{
+  private static final long serialVersionUID = -6277518704513986346L;
+
+  /**
+   * actionMap
+   */
+  private Map actionMap = new HashMap();
+
+  /**
+   * parent
+   */
+  private ActionMap parent;
+
+  /**
+   * Creates a new <code>ActionMap</code> instance.
+   */
+  public ActionMap()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Returns an action associated with an object.
+   *
+   * @param key the key of the enty
+   *
+   * @return the action associated with key, may be null
+   */
+  public Action get(Object key)
+  {
+    Object result = actionMap.get(key);
+
+    if (result == null && parent != null)
+      result = parent.get(key);
+
+    return (Action) result;
+  }
+
+  /**
+   * Puts a new <code>Action</code> into the <code>ActionMap</code>.
+   * If action is null an existing entry will be removed.
+   *
+   * @param key the key for the entry
+   * @param action the action.
+   */
+  public void put(Object key, Action action)
+  {
+    if (action == null)
+      actionMap.remove(key);
+    else
+      actionMap.put(key, action);
+  }
+
+  /**
+   * Remove an entry from the <code>ActionMap</code>.
+   *
+   * @param key the key of the entry to remove
+   */
+  public void remove(Object key)
+  {
+    actionMap.remove(key);
+  }
+
+  /**
+   * Returns the parent of this <code>ActionMap</code>.
+   *
+   * @return the parent, may be null.
+   */
+  public ActionMap getParent()
+  {
+    return parent;
+  }
+
+  /**
+   * Sets a parent for this <code>ActionMap</code>.
+   *
+   * @param parentMap the new parent
+   */
+  public void setParent(ActionMap parentMap)
+  {
+    if (parentMap != this)
+      parent = parentMap;
+  }
+
+  /**
+   * Returns the number of entries in this <code>ActionMap</code>.
+   *
+   * @return the number of entries
+   */
+  public int size()
+  {
+    return actionMap.size();
+  }
+
+  /**
+   * Clears the <code>ActionMap</code>.
+   */
+  public void clear()
+  {
+    actionMap.clear();
+  }
+
+  /**
+   * Returns all keys of entries in this <code>ActionMap</code>.
+   *
+   * @return an array of keys
+   */
+  public Object[] keys()
+  {
+    if (size() != 0)
+      return actionMap.keySet().toArray();
+    return null;
+  }
+
+  /**
+   * Returns all keys of entries in this <code>ActionMap</code>
+   * and all its parents.
+   *
+   * @return an array of keys
+   */
+  public Object[] allKeys()
+  {
+    Set set = new HashSet();
+
+    if (parent != null)
+      set.addAll(Arrays.asList(parent.allKeys()));
+
+    set.addAll(actionMap.keySet());
+    if (set.size() != 0)
+      return set.toArray();
+    return null;
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BorderFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BorderFactory.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BorderFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BorderFactory.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,456 @@
+/* BorderFactory.java --
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import javax.swing.border.BevelBorder;
+import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.EtchedBorder;
+import javax.swing.border.LineBorder;
+import javax.swing.border.MatteBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * A factory for commonly used borders.
+ *
+ * @author original author unknown
+ */
+public class BorderFactory
+{
+  private BorderFactory()
+  {
+    // Do nothing.
+  }
+
+  /**
+   * Creates a line border withe the specified color.
+   *
+   * @param color A color to use for the line.
+   *
+   * @return The Border object
+   */
+  public static Border createLineBorder(Color color)
+  {
+    return createLineBorder(color, 1);
+  }
+
+  /**
+   * Creates a line border withe the specified color and width. The width
+   * applies to all 4 sides of the border. To specify widths individually for
+   * the top, bottom, left, and right, use
+   * createMatteBorder(int,int,int,int,Color).
+   *
+   * @param color A color to use for the line.
+   * @param thickness An int specifying the width in pixels.
+   *
+   * @return The Border object
+   */
+  public static Border createLineBorder(Color color, int thickness)
+  {
+    return new LineBorder(color, thickness);
+  }
+
+  /**
+   * Created a border with a raised beveled edge, using brighter shades of
+   * the component's current background color for highlighting, and darker
+   * shading for shadows. (In a raised border, highlights are on top and
+   * shadows are underneath.)
+   *
+   * @return The Border object
+   */
+  public static Border createRaisedBevelBorder()
+  {
+    return new BevelBorder(BevelBorder.RAISED);
+  }
+
+  /**
+   * Created a border with a lowered beveled edge, using brighter shades of
+   * the component's current background color for highlighting, and darker
+   * shading for shadows. (In a lowered border, shadows are on top and
+   * highlights are underneath.)
+   *
+   * @return The Border object
+   */
+  public static Border createLoweredBevelBorder()
+  {
+    return new BevelBorder(BevelBorder.LOWERED);
+  }
+
+  /**
+   * Create a beveled border of the specified type, using brighter shades of
+   * the component's current background color for highlighting, and darker
+   * shading for shadows. (In a lowered border, shadows are on top and
+   * highlights are underneath.).
+   *
+   * @param type An int specifying either BevelBorder.LOWERED or
+   *     BevelBorder.RAISED
+   *
+   * @return The Border object
+   */
+  public static Border createBevelBorder(int type)
+  {
+    return new BevelBorder(type);
+  }
+
+  /**
+   * Create a beveled border of the specified type, using the specified
+   * highlighting and shadowing. The outer edge of the highlighted area uses
+   * a brighter shade of the highlight color. The inner edge of the shadow
+   * area uses a brighter shade of the shadaw color.
+   *
+   * @param type An int specifying either BevelBorder.LOWERED or
+   *     BevelBorder.RAISED
+   * @param highlight A Color object for highlights
+   * @param shadow A Color object for shadows
+   *
+   * @return The Border object
+   */
+  public static Border createBevelBorder(int type, Color highlight, Color shadow)
+  {
+    return new BevelBorder(type, highlight, shadow);
+  }
+
+  /**
+   * Create a beveled border of the specified type, using the specified colors
+   * for the inner and outer highlight and shadow areas.
+   *
+   * @param type An int specifying either BevelBorder.LOWERED or
+   *     BevelBorder.RAISED
+   * @param highlightOuter A Color object for the outer edge of the
+   *     highlight area
+   * @param highlightInner A Color object for the inner edge of the
+   *     highlight area
+   * @param shadowOuter A Color object for the outer edge of the shadow area
+   * @param shadowInner A Color object for the inner edge of the shadow area
+   *
+   * @return The Border object
+   */
+  public static Border createBevelBorder(int type, Color highlightOuter,
+                                         Color highlightInner,
+                                         Color shadowOuter, Color shadowInner)
+  {
+    return new BevelBorder(type, highlightOuter, highlightInner, shadowOuter,
+                           shadowInner);
+  }
+
+  /**
+   * Create a border with an "etched" look using the component's current
+   * background color for highlighting and shading.
+   *
+   * @return The Border object
+   */
+  public static Border createEtchedBorder()
+  {
+    return new EtchedBorder();
+  }
+
+  /**
+   * Create a border with an "etched" look using the component's current
+   * background color for highlighting and shading.
+   *
+   * @return The Border object
+   */
+  public static Border createEtchedBorder(int etchType)
+  {
+    return new EtchedBorder(etchType);
+  }
+
+  /**
+   * Create a border with an "etched" look using the specified highlighting and
+   * shading colors.
+   *
+   * @param highlight A Color object for the border highlights
+   * @param shadow A Color object for the border shadows
+   *
+   * @return The Border object
+   */
+  public static Border createEtchedBorder(Color highlight, Color shadow)
+  {
+    return new EtchedBorder(highlight, shadow);
+  }
+
+  /**
+   * Create a border with an "etched" look using the specified highlighting and
+   * shading colors.
+   *
+   * @param highlight A Color object for the border highlights
+   * @param shadow A Color object for the border shadows
+   *
+   * @return The Border object
+   */
+  public static Border createEtchedBorder(int etchType, Color highlight,
+                                          Color shadow)
+  {
+    return new EtchedBorder(etchType, highlight, shadow);
+  }
+
+  /**
+   * Create a new title border specifying the text of the title, using the
+   * default border (etched), using the default text position (sitting on the
+   * top line) and default justification (left) and using the default font and
+   * text color determined by the current look and feel.
+   *
+   * @param title A String containing the text of the title
+   *
+   * @return The TitledBorder object
+   */
+  public static TitledBorder createTitledBorder(String title)
+  {
+    return new TitledBorder(title);
+  }
+
+  /**
+   * Create a new title border with an empty title specifying the border
+   * object, using the default text position (sitting on the top line) and
+   * default justification (left) and using the default font, text color,
+   * and border determined by the current look and feel. (The Motif and Windows
+   * look and feels use an etched border; The Java look and feel use a
+   * gray border.)
+   *
+   * @param border The Border object to add the title to
+   *
+   * @return The TitledBorder object
+   */
+  public static TitledBorder createTitledBorder(Border border)
+  {
+    return new TitledBorder(border);
+  }
+
+  /**
+   * Add a title to an existing border, specifying the text of the title, using
+   * the default positioning (sitting on the top line) and default
+   * justification (left) and using the default font and text color determined
+   * by the current look and feel.
+   *
+   * @param border The Border object to add the title to
+   * @param title A String containing the text of the title
+   *
+   * @return The TitledBorder object
+   */
+  public static TitledBorder createTitledBorder(Border border, String title)
+  {
+    return new TitledBorder(border, title);
+  }
+
+  /**
+   * Add a title to an existing border, specifying the text of the title along
+   * with its positioning, using the default font and text color determined by
+   * the current look and feel.
+   *
+   * @param border The Border object to add the title to
+   * @param title A String containing the text of the title
+   * @param titleJustification An int specifying the left/right position of
+   *     the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
+   *     TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
+   * @param titlePosition An int specifying the vertical position of the text
+   *     in relation to the border -- one of: TitledBorder.ABOVE_TOP,
+   *     TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
+   *     TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
+   *     line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION
+   *     (top).
+   *
+   * @return The TitledBorder object
+   */
+  public static TitledBorder createTitledBorder(Border border, String title,
+                                                int titleJustification,
+                                                int titlePosition)
+  {
+    return new TitledBorder(border, title, titleJustification, titlePosition);
+  }
+
+  /**
+   * Add a title to an existing border, specifying the text of the title along
+   * with its positioning and font, using the default text color determined by
+   * the current look and feel.
+   *
+   * @param border - the Border object to add the title to
+   * @param title - a String containing the text of the title
+   * @param titleJustification - an int specifying the left/right position of
+   *     the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
+   *     TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
+   * @param titlePosition - an int specifying the vertical position of the
+   *     text in relation to the border -- one of: TitledBorder.ABOVE_TOP,
+   *     TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
+   *     TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
+   *     line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
+   * @param titleFont - a Font object specifying the title font
+   *
+   * @return The TitledBorder object
+   */
+  public static TitledBorder createTitledBorder(Border border, String title,
+                                                int titleJustification,
+                                                int titlePosition,
+                                                Font titleFont)
+  {
+    return new TitledBorder(border, title, titleJustification, titlePosition,
+                            titleFont);
+  }
+
+  /**
+   * Add a title to an existing border, specifying the text of the title along
+   * with its positioning, font, and color.
+   *
+   * @param border - the Border object to add the title to
+   * @param title - a String containing the text of the title
+   * @param titleJustification - an int specifying the left/right position of
+   *     the title -- one of TitledBorder.LEFT, TitledBorder.CENTER, or
+   *     TitledBorder.RIGHT, TitledBorder.DEFAULT_JUSTIFICATION (left).
+   * @param titlePosition - an int specifying the vertical position of the text
+   *     in relation to the border -- one of: TitledBorder.ABOVE_TOP,
+   *     TitledBorder.TOP (sitting on the top line), TitledBorder.BELOW_TOP,
+   *     TitledBorder.ABOVE_BOTTOM, TitledBorder.BOTTOM (sitting on the bottom
+   *     line), TitledBorder.BELOW_BOTTOM, or TitledBorder.DEFAULT_POSITION (top).
+   * @param titleFont - a Font object specifying the title font
+   * @param titleColor - a Color object specifying the title color
+   *
+   * @return The TitledBorder object
+   */
+  public static TitledBorder createTitledBorder(Border border, String title,
+                                                int titleJustification,
+                                                int titlePosition,
+                                                Font titleFont, Color titleColor)
+  {
+    return new TitledBorder(border, title, titleJustification, titlePosition,
+                            titleFont, titleColor);
+  }
+
+  /**
+   * Creates an empty border that takes up no space. (The width of the top,
+   * bottom, left, and right sides are all zero.)
+   *
+   * @return The Border object
+   */
+  public static Border createEmptyBorder()
+  {
+    return new EmptyBorder(0, 0, 0, 0);
+  }
+
+  /**
+   * Creates an empty border that takes up no space but which does no drawing,
+   * specifying the width of the top, left, bottom, and right sides.
+   *
+   * @param top An int specifying the width of the top in pixels
+   * @param left An int specifying the width of the left side in pixels
+   * @param bottom An int specifying the width of the right side in pixels
+   * @param right An int specifying the width of the bottom in pixels
+   *
+   * @return The Border object
+   */
+  public static Border createEmptyBorder(int top, int left, int bottom,
+                                         int right)
+  {
+    return new EmptyBorder(top, left, bottom, right);
+  }
+
+  /**
+   * Create a compound border with a null inside edge and a null outside edge.
+   *
+   * @return The CompoundBorder object
+   */
+  public static CompoundBorder createCompoundBorder()
+  {
+    return new CompoundBorder();
+  }
+
+  /**
+   * Create a compound border specifying the border objects to use for the
+   * outside and inside edges.
+   *
+   * @param outsideBorder A Border object for the outer edge of the
+   *     compound border
+   * @param insideBorder A Border object for the inner edge of the
+   *     compound border
+   *
+   * @return The CompoundBorder object
+   */
+  public static CompoundBorder createCompoundBorder(Border outsideBorder,
+                                                    Border insideBorder)
+  {
+    return new CompoundBorder(outsideBorder, insideBorder);
+  }
+
+  /**
+   * Create a matte-look border using a solid color. (The difference between
+   * this border and a line border is that you can specify the individual border
+   * dimensions.)
+   * 
+   * @param top
+   *          An int specifying the width of the top in pixels
+   * @param left
+   *          An int specifying the width of the left side in pixels
+   * @param bottom
+   *          An int specifying the width of the right side in pixels
+   * @param right
+   *          An int specifying the width of the bottom in pixels
+   * @param color
+   *          A Color to use for the border
+   * @return The MatteBorder object
+   */
+  public static MatteBorder createMatteBorder(int top, int left, int bottom,
+                                              int right, Color color)
+  {
+    return new MatteBorder(top, left, bottom, right, color);
+  }
+
+  /**
+   * Create a matte-look border that consists of multiple tiles of a specified
+   * icon. Multiple copies of the icon are placed side-by-side to fill up the
+   * border area.
+   *
+   * Note:
+   * If the icon doesn't load, the border area is painted gray.
+   *
+   * @param top An int specifying the width of the top in pixels
+   * @param left An int specifying the width of the left side in pixels
+   * @param bottom An int specifying the width of the right side in pixels
+   * @param right An int specifying the width of the bottom in pixels
+   * @param tileIcon The Icon object used for the border tiles
+   *
+   * @return The MatteBorder object
+   */
+  public static MatteBorder createMatteBorder(int top, int left, int bottom,
+                                              int right, Icon tileIcon)
+  {
+    return new MatteBorder(top, left, bottom, right, tileIcon);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoundedRangeModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoundedRangeModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoundedRangeModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoundedRangeModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,193 @@
+/* BoundedRangeModel.java --
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+/**
+ * The data model that represents a <i>range</i> that is constrained to fit 
+ * within specified <i>bounds</i>.  The range is defined as <code>value</code> 
+ * to <code>value + extent</code>, where both <code>value</code> and 
+ * <code>extent</code> are integers, and <code>extent >= 0</code>.   The bounds
+ * are defined by integers <code>minimum</code> and <code>maximum</code>.  
+ * <p>
+ * This type of model is used in components that display a range of values,
+ * like {@link JProgressBar} and {@link JSlider}.
+ *
+ * @author Andrew Selkirk
+ */
+public interface BoundedRangeModel
+{
+  /**
+   * Returns the current value for the model.
+   * 
+   * @return The current value for the model.
+   *
+   * @see #setValue(int)
+   */
+  int getValue();
+
+  /**
+   * Sets the value for the model and sends a {@link ChangeEvent} to
+   * all registered listeners.  The new value must satisfy the constraint
+   * <code>min <= value <= value + extent <= max</code>.
+   * 
+   * @param value the value
+   *
+   * @see #getValue()
+   */
+  void setValue(int value);
+
+  /**
+   * Returns the lower bound for the model.  The start of the model's range 
+   * (see {@link #getValue()}) cannot be less than this lower bound.
+   * 
+   * @return The lower bound for the model.
+   *
+   * @see #setMinimum(int)
+   * @see #getMaximum()
+   */
+  int getMinimum();
+
+  /**
+   * Sets the lower bound for the model and sends a {@link ChangeEvent} to all
+   * registered listeners.  The new minimum must be less than or equal to the
+   * start value of the model's range (as returned by {@link #getValue()}).
+   * 
+   * @param minimum the minimum value
+   *
+   * @see #getMinimum()
+   */
+  void setMinimum(int minimum);
+
+  /**
+   * Returns the upper bound for the model.  This sets an upper limit for the
+   * end value of the model's range ({@link #getValue()} + 
+   * {@link #getExtent()}).
+   * 
+   * @return The upper bound for the model.
+   *
+   * @see #setMaximum(int)
+   * @see #getMinimum()
+   */
+  int getMaximum();
+
+  /**
+   * Sets the upper bound for the model and sends a {@link ChangeEvent} to all
+   * registered listeners.  The new maximum must be greater than or equal to the
+   * end value of the model's range (as returned by {@link #getValue()} + 
+   * {@link #getExtent()}).
+   * 
+   * @param maximum the maximum value
+   *
+   * @see #getMaximum()
+   */
+  void setMaximum(int maximum);
+
+  /**
+   * Returns the value of the <code>valueIsAdjusting</code> property.
+   * 
+   * @return <code>true</code> if value is adjusting,
+   * otherwise <code>false</code>
+   *
+   * @see #setValueIsAdjusting(boolean)
+   */
+  boolean getValueIsAdjusting();
+
+  /**
+   * Sets the <code>valueIsAdjusting</code> property.
+   * 
+   * @param adjusting <code>true</code> if adjusting,
+   * <code>false</code> otherwise
+   *
+   * @see #getValueIsAdjusting()
+   */
+  void setValueIsAdjusting(boolean adjusting);
+
+  /**
+   * Returns the current extent.
+   *
+   * @return the extent
+   *
+   * @see #setExtent(int)
+   */
+  int getExtent();
+
+  /**
+   * Sets the extent, which is the length of the model's range, and sends a
+   * {@link ChangeEvent} to all registered listeners.
+   * 
+   * @param extent the extent
+   *
+   * @see #getExtent()
+   */
+  void setExtent(int extent);
+
+  /**
+   * Sets all the properties for the model in a single call.
+   * 
+   * @param value the value
+   * @param extent the extent
+   * @param minimum the minimum value
+   * @param maximum the maximum value
+   * @param adjusting a flag that indicates the model is being adjusted 
+   *                  continuously.
+   */
+  void setRangeProperties(int value, int extent, int minimum, int maximum,
+                          boolean adjusting);
+
+  /**
+   * Adds a <code>ChangeListener</code> to this object.
+   * 
+   * @param listener the listener to add
+   * 
+   * @see #removeChangeListener(ChangeListener)
+   */
+  void addChangeListener(ChangeListener listener);
+
+  /**
+   * Removes a <code>ChangeListener</code> from this object.
+   * 
+   * @param listener the listener to remove
+   *
+   * @see #addChangeListener(ChangeListener)
+   */
+  void removeChangeListener(ChangeListener listener);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Box.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Box.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Box.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Box.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,290 @@
+/* Box.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.AWTError;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.LayoutManager;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
+/**
+ * A component that uses a {@link BoxLayout} as Layout Manager.
+ *
+ * In addition to that, this class provides a set of static methods for
+ * creating some filler components ('struts' and 'glue') for use in
+ * containers that are laid out using BoxLayout.
+ *
+ * @author Ronald Veldema (rveldema at cs.vu.nl)
+ */
+public class Box extends JComponent implements Accessible
+{
+  private static final long serialVersionUID = 1525417495883046342L;
+  
+  /**
+   * Provides accessibility support for <code>Box</code>es.
+   */
+  protected class AccessibleBox extends Container.AccessibleAWTContainer
+  {
+    private static final long serialVersionUID = -7775079816389931944L;
+  
+    protected AccessibleBox()
+    {
+      // Nothing to do here.
+    }
+    
+    public AccessibleRole getAccessibleRole()
+    {
+      return null;
+    }
+  }
+
+  /**
+   * A component that servers as a filler in BoxLayout controlled containers.
+   */
+  public static class Filler extends JComponent implements Accessible
+  {
+    private static final long serialVersionUID = -1204263191910183998L;
+  
+    /**
+     * Provides accessibility support for <code>Box.Filler</code>.
+     */
+    protected class AccessibleBoxFiller
+      extends Component.AccessibleAWTComponent
+    {
+      private static final long serialVersionUID = 164963348357479321L;
+      
+      protected AccessibleBoxFiller()
+      {
+        // Nothing to do here.
+      }
+      
+      public AccessibleRole getAccessibleRole()
+      {
+        return null;
+      }
+    }
+    
+    private transient Dimension min, pref, max;
+    
+    /**
+     * Creates a new instance of Filler.
+     *
+     * @param min the minimum size of the filler.
+     * @param pref the preferred size of the filler.
+     * @param max the maximum size of the filler.
+     */
+    public Filler(Dimension min, Dimension pref, Dimension max)
+    {
+      changeShape(min, pref, max);
+    }
+    
+    /**
+     * Changes the dimensions of this Filler.
+     *
+     * @param min the new minimum size of the filler.
+     * @param pref the new preferred size of the filler.
+     * @param max the new maximum size of the filler.
+     */
+    public void changeShape(Dimension min, Dimension pref, Dimension max)
+    {
+      this.min = min;
+      this.pref = pref;
+      this.max = max;    
+    }
+    
+    public AccessibleContext getAccessibleContext()
+    {
+      if (accessibleContext == null)
+        accessibleContext = new AccessibleBoxFiller();
+      return accessibleContext;
+    }
+    
+    /**
+     * Returns the maximum size of this Filler.
+     *
+     * @return the maximum size of this Filler.
+     */
+    public Dimension getMaximumSize()
+    {
+      return max;
+    }
+    
+    /**
+     * Returns the minimum size of this Filler.
+     *
+     * @return the minimum size of this Filler.
+     */
+    public Dimension getMinimumSize()
+    {
+      return min;
+    }
+    
+    /**
+     * Returns the preferred size of this Filler.
+     *
+     * @return the preferred size of this Filler.
+     */
+    public Dimension getPreferredSize()
+    {
+      return pref;
+    }
+  }
+  
+  /**
+   * Creates a new Box component, that lays out its children according
+   * to the <code>axis</code> parameter.
+   *
+   * @param axis the orientation of the BoxLayout.
+   *
+   * @see BoxLayout#X_AXIS
+   * @see BoxLayout#Y_AXIS
+   * @see BoxLayout#LINE_AXIS
+   * @see BoxLayout#PAGE_AXIS
+   */
+  public Box(int axis)
+  {
+    super.setLayout(new BoxLayout(this, axis));	
+  }
+  
+  /**
+   * Creates a filler component which acts as glue between components.
+   * It does not take space unless some extra space is available. If extra
+   * space is available, this component can expand in both X and Y directions.
+   *
+   * @return a glue-like filler component.
+   */
+  public static Component createGlue()
+  {
+    Filler glue = new Filler(new Dimension(0, 0), new Dimension(0, 0),
+                             new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
+    return glue;
+  }
+  
+  public static Box createHorizontalBox()
+  {
+    return new Box(BoxLayout.X_AXIS);
+  }
+  
+  /**
+   * Creates a filler component which acts as glue between components.
+   * It does not take space unless some extra space is available. If extra
+   * space is available, this component can expand in the X direction.
+   *
+   * @return a glue-like filler component.
+   */
+  public static Component createHorizontalGlue()
+  {
+    Filler glue = new Filler(new Dimension(0, 0), new Dimension(0, 0),
+                             new Dimension(Short.MAX_VALUE, 0));
+    return glue;
+  }
+  
+  /**
+   * Creates a filler component which acts as strut between components.
+   * It will fill exactly the specified horizontal size.
+   *
+   * @param width the width of this strut in pixels.
+   *
+   * @return a strut-like filler component.
+   */
+  public static Component createHorizontalStrut(int width)
+  {
+    Filler strut = new Filler(new Dimension(width, 0),
+                              new Dimension(width, 0),
+                              new Dimension(width, Integer.MAX_VALUE));
+    return strut;
+  }
+  
+  public static Component createRigidArea(Dimension d)
+  {
+    return new Filler(d, d, d);
+  }
+  
+  public static Box createVerticalBox()
+  {
+    return new Box(BoxLayout.Y_AXIS);
+  }
+  
+  /**
+   * Creates a filler component which acts as glue between components.
+   * It does not take space unless some extra space is available. If extra
+   * space is available, this component can expand in the Y direction.
+   *
+   * @return a glue-like filler component.
+   */
+  public static Component createVerticalGlue()
+  {
+    return createGlue();
+  }
+  
+  /**
+   * Creates a filler component which acts as strut between components.
+   * It will fill exactly the specified vertical size.
+   *
+   * @param height the height of this strut in pixels.
+   *
+   * @return a strut-like filler component.
+   */
+  public static Component createVerticalStrut(int height)
+  {
+    Filler strut = new Filler(new Dimension(0, height),
+                              new Dimension(0, height),
+                              new Dimension(Integer.MAX_VALUE, height));
+    return strut;
+  }
+  
+  public void setLayout(LayoutManager l)
+  {
+    throw new AWTError("Not allowed to set layout managers for boxes.");
+  }
+  
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleBox();
+    return accessibleContext;
+  }
+  
+  
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoxLayout.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoxLayout.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoxLayout.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/BoxLayout.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,451 @@
+/* BoxLayout.java -- A layout for swing components.
+   Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.AWTError;
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager2;
+import java.io.Serializable;
+
+/**
+ * A layout that stacks the children of a container in a Box, either
+ * horizontally or vertically.
+ *
+ * @author Ronald Veldema (rveldema at cs.vu.nl)
+ * @author Roman Kennke (roman at kennke.org)
+ */
+public class BoxLayout implements LayoutManager2, Serializable
+{
+
+  /**
+   * Specifies that components are laid out left to right.
+   */
+  public static final int X_AXIS = 0;
+
+  /**
+   * Specifies that components are laid out top to bottom.
+   */
+  public static final int Y_AXIS = 1;
+
+  /**
+   * Specifies that components are laid out in the direction of a line of text.
+   */
+  public static final int LINE_AXIS = 2;
+
+  /**
+   * Sepcifies that components are laid out in the direction of the line flow.
+   */
+  public static final int PAGE_AXIS = 3;
+
+  /*
+   * Needed for serialization.
+   */
+  private static final long serialVersionUID = -2474455742719112368L;
+
+  /*
+   * The container given to the constructor.
+   */
+  private Container container;
+  
+  /**
+   * Current type of component layouting. Defaults to X_AXIS.
+   */
+  private int way = X_AXIS;
+
+  /**
+   * The size requirements of the containers children for the X direction.
+   */
+  private SizeRequirements[] xChildren;
+
+  /**
+   * The size requirements of the containers children for the Y direction.
+   */
+  private SizeRequirements[] yChildren;
+
+  /**
+   * The size requirements of the container to be laid out for the X direction.
+   */
+  private SizeRequirements xTotal;
+
+  /**
+   * The size requirements of the container to be laid out for the Y direction.
+   */
+  private SizeRequirements yTotal;
+
+  /**
+   * The offsets of the child components in the X direction.
+   */
+  private int[] offsetsX;
+
+  /**
+   * The offsets of the child components in the Y direction.
+   */
+  private int[] offsetsY;
+
+  /**
+   * The spans of the child components in the X direction.
+   */
+  private int[] spansX;
+
+  /**
+   * The spans of the child components in the Y direction.
+   */
+  private int[] spansY;
+
+  /**
+   * Constructs a <code>BoxLayout</code> object.
+   *
+   * @param container The container that needs to be laid out.
+   * @param way The orientation of the components.
+   *
+   * @exception AWTError If way has an invalid value.
+   */
+  public BoxLayout(Container container, int way)
+  {
+    if (way != X_AXIS && way != Y_AXIS && way != LINE_AXIS && way != PAGE_AXIS)
+      throw new AWTError("Invalid axis");
+
+    int width = 0;
+    int height = 0;
+    this.container = container;
+    this.way = way;
+  }
+
+  /**
+   * Adds a component to the layout. Not used in BoxLayout.
+   *
+   * @param name The name of the component to add.
+   * @param component the component to add to the layout.
+   */
+  public void addLayoutComponent(String name, Component component)
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Removes a component from the layout. Not used in BoxLayout.
+   *
+   * @param component The component to remove from the layout.
+   */
+  public void removeLayoutComponent(Component component)
+  {
+    // Nothing to do here.
+  }
+
+  private boolean isHorizontalIn(Container parent)
+  {
+    ComponentOrientation orientation = parent.getComponentOrientation();
+    return this.way == X_AXIS 
+      || (this.way == LINE_AXIS 
+          && orientation.isHorizontal())
+      || (this.way == PAGE_AXIS
+          && (!orientation.isHorizontal()));
+  }
+
+  
+
+  /**
+   * Returns the preferred size of the layout.
+   *
+   * @param parent The container that needs to be laid out.
+   *
+   * @return The dimension of the layout.
+   */
+  public Dimension preferredLayoutSize(Container parent)
+  {
+    synchronized (container.getTreeLock())
+      {
+        if (container != parent)
+          throw new AWTError("BoxLayout can't be shared");
+
+        checkTotalRequirements();
+        Insets i = container.getInsets();
+        return new Dimension(xTotal.preferred + i.left + i.right,
+                             yTotal.preferred + i.top + i.bottom);
+      }
+  }
+
+  /**
+   * Returns the minimum size of the layout.
+   *
+   * @param parent The container that needs to be laid out.
+   *
+   * @return The dimension of the layout.
+   */
+  public Dimension minimumLayoutSize(Container parent)
+  {
+    synchronized (container.getTreeLock())
+      {
+        if (container != parent)
+          throw new AWTError("BoxLayout can't be shared");
+
+        checkTotalRequirements();
+        Insets i = container.getInsets();
+        return new Dimension(xTotal.minimum + i.left + i.right,
+                             yTotal.minimum + i.top + i.bottom);
+      }
+  }
+
+  /**
+   * Lays out the specified container using this layout.
+   *
+   * @param parent The container that needs to be laid out.
+   */
+  public void layoutContainer(Container parent)
+  {
+    synchronized (container.getTreeLock())
+      {
+        if (container != parent)
+          throw new AWTError("BoxLayout can't be shared");
+      
+        checkLayout();
+        Component[] children = container.getComponents();
+        Insets in = container.getInsets();
+        for (int i = 0; i < children.length; i++)
+          children[i].setBounds(offsetsX[i] + in.left, offsetsY[i] + in.top,
+                                spansX[i], spansY[i]);
+      }
+  }
+
+  /**
+   * Adds a component to the layout. Not used in BoxLayout
+   *
+   * @param child The component to add to the layout.
+   * @param constraints The constraints for the component in the layout.
+   */
+  public void addLayoutComponent(Component child, Object constraints)
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Returns the alignment along the X axis for the container.
+   *
+   * @param parent The container that needs to be laid out.
+   *
+   * @return The alignment.
+   */
+  public float getLayoutAlignmentX(Container parent)
+  {
+    synchronized (container.getTreeLock())
+      {
+        if (container != parent)
+          throw new AWTError("BoxLayout can't be shared");
+
+        checkTotalRequirements();
+        return xTotal.alignment;
+      }
+  }
+
+  /**
+   * Returns the alignment along the Y axis for the container.
+   *
+   * @param parent The container that needs to be laid out.
+   *
+   * @return The alignment.
+   */
+  public float getLayoutAlignmentY(Container parent)
+  {
+    synchronized (container.getTreeLock())
+      {
+        if (container != parent)
+          throw new AWTError("BoxLayout can't be shared");
+
+        checkTotalRequirements();
+        return yTotal.alignment;
+      }
+  }
+
+  /**
+   * Invalidates the layout.
+   *
+   * @param parent The container that needs to be laid out.
+   */
+  public void invalidateLayout(Container parent)
+  {
+    if (container != parent)
+      throw new AWTError("BoxLayout can't be shared");
+
+    synchronized (container.getTreeLock())
+      {
+        xChildren = null;
+        yChildren = null;
+        xTotal = null;
+        yTotal = null;
+        offsetsX = null;
+        offsetsY = null;
+        spansX = null;
+        spansY = null;
+      }
+  }
+
+  /**
+   * Returns the maximum size of the layout gived the components
+   * in the given container.
+   *
+   * @param parent The container that needs to be laid out.
+   *
+   * @return The dimension of the layout.
+   */
+  public Dimension maximumLayoutSize(Container parent)
+  {
+    synchronized (container.getTreeLock())
+      {
+        if (container != parent)
+          throw new AWTError("BoxLayout can't be shared");
+
+        checkTotalRequirements();
+        Insets i = container.getInsets();
+        int xDim = xTotal.maximum + i.left + i.right;
+        int yDim = yTotal.maximum + i.top + i.bottom;
+        
+        // Check for overflow
+        if (xDim < xTotal.maximum)
+          xDim = Integer.MAX_VALUE;
+        if (yDim < yTotal.maximum)
+          yDim = Integer.MAX_VALUE;
+        return new Dimension(xDim, yDim);
+      }
+  }
+
+  /**
+   * Makes sure that the xTotal and yTotal fields are set up correctly. A call
+   * to {@link #invalidateLayout} sets these fields to null and they have to be
+   * recomputed.
+   */
+  private void checkTotalRequirements()
+  {
+    if (xTotal == null || yTotal == null)
+      {
+        checkRequirements();
+        if (isHorizontalIn(container))
+          {
+            xTotal = SizeRequirements.getTiledSizeRequirements(xChildren);
+            yTotal = SizeRequirements.getAlignedSizeRequirements(yChildren);
+          }
+        else
+          {
+            xTotal = SizeRequirements.getAlignedSizeRequirements(xChildren);
+            yTotal = SizeRequirements.getTiledSizeRequirements(yChildren);
+          }
+      }
+  }
+
+  /**
+   * Makes sure that the xChildren and yChildren fields are correctly set up.
+   * A call to {@link #invalidateLayout(Container)} sets these fields to null,
+   * so they have to be set up again.
+   */
+  private void checkRequirements()
+  {
+    if (xChildren == null || yChildren == null)
+      {
+        Component[] children = container.getComponents();
+        xChildren = new SizeRequirements[children.length];
+        yChildren = new SizeRequirements[children.length];
+        for (int i = 0; i < children.length; i++)
+          {
+            if (! children[i].isVisible())
+              {
+                xChildren[i] = new SizeRequirements();
+                yChildren[i] = new SizeRequirements();
+              }
+            else
+              {
+                xChildren[i] =
+                  new SizeRequirements(children[i].getMinimumSize().width,
+                                       children[i].getPreferredSize().width,
+                                       children[i].getMaximumSize().width,
+                                       children[i].getAlignmentX());
+                yChildren[i] =
+                  new SizeRequirements(children[i].getMinimumSize().height,
+                                       children[i].getPreferredSize().height,
+                                       children[i].getMaximumSize().height,
+                                       children[i].getAlignmentY());
+              }
+          }
+      }
+  }
+
+  /**
+   * Makes sure that the offsetsX, offsetsY, spansX and spansY fields are set
+   * up correctly. A call to {@link #invalidateLayout} sets these fields
+   * to null and they have to be recomputed.
+   */
+  private void checkLayout()
+  {
+    if (offsetsX == null || offsetsY == null || spansX == null
+        || spansY == null)
+      {
+        checkRequirements();
+        checkTotalRequirements();
+        int len = container.getComponents().length;
+        offsetsX = new int[len];
+        offsetsY = new int[len];
+        spansX = new int[len];
+        spansY = new int[len];
+
+        Insets in = container.getInsets();
+        int width = container.getWidth() - in.left - in.right;
+        int height = container.getHeight() - in.top - in.bottom;
+
+        if (isHorizontalIn(container))
+          {
+            SizeRequirements.calculateTiledPositions(width,
+                                                     xTotal, xChildren,
+                                                     offsetsX, spansX);
+            SizeRequirements.calculateAlignedPositions(height,
+                                                       yTotal, yChildren,
+                                                       offsetsY, spansY);
+          }
+        else
+          {
+            SizeRequirements.calculateAlignedPositions(width,
+                                                       xTotal, xChildren,
+                                                       offsetsX, spansX);
+            SizeRequirements.calculateTiledPositions(height,
+                                                     yTotal, yChildren,
+                                                     offsetsY, spansY);
+          }
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonGroup.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonGroup.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonGroup.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonGroup.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,219 @@
+/* ButtonGroup.java --
+   Copyright (C) 2002, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+
+/**
+ * Logically groups a set of buttons, so that only one of the buttons in
+ * a <code>ButtonGroup</code> can be selected at the same time. If one
+ * button in a <code>ButtonGroup</code> is selected, all other buttons
+ * are automatically deselected.
+ *
+ * While <code>ButtonGroup</code> can be used for all buttons that are derived
+ * from {@link AbstractButton}, it is normally only used for
+ * {@link JRadioButton}s, {@link JRadioButtonMenuItem}s and
+ * {@link JToggleButton}s.
+ *
+ * You could use it for {@link JCheckBox}es, but for the sake of usability
+ * this is strongly discouraged because the common expectation of checkboxes
+ * is that the user is allowed to make multiple selections.
+ *
+ * It makes no sense to put {@link JButton}s or {@link JMenuItem}s in
+ * a <code>ButtonGroup</code> because they don't implement the
+ * <code>selected</code> semantics.
+ *
+ * @author original author unknown
+ */
+public class ButtonGroup implements Serializable
+{
+  private static final long serialVersionUID = 4259076101881721375L;
+
+  /** Stores references to the buttons added to this button group. */
+  protected Vector buttons = new Vector();
+
+  /** The currently selected button model. */
+  ButtonModel sel;
+
+  /**
+   * Creates a new button group.
+   */
+  public ButtonGroup()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Adds a button to this group.  If the button is in the selected state, then:
+   * <ul>
+   *   <li>if the group has no current selection, the new button becomes the 
+   *     selected button for the group;</li>
+   *   <li>if the group already has a selected button, the new button is set to
+   *     "not selected".</li>
+   * </ul>
+   *
+   * @param b the button to add (<code>null</code> is ignored).
+   */
+  public void add(AbstractButton b)
+  {
+    if (b == null)
+      return;
+    b.getModel().setGroup(this);
+    if (b.isSelected())
+      {
+        if (sel == null)
+          sel = b.getModel();
+        else
+          b.setSelected(false);
+      }    
+    buttons.addElement(b);
+  }
+
+  /**
+   * Removes the specified button from this group.  If the button is the 
+   * selected button, the current selection is set to <code>null</code>.  
+   * The group for the removed button's model is set to <code>null</code>.  
+   *
+   * @param b the button to remove (<code>null</code> is ignored).
+   */
+  public void remove(AbstractButton b)
+  {
+    if (b == null)
+      return;
+    b.getModel().setGroup(null);
+    if (b.getModel() == sel)
+      sel = null;
+    buttons.removeElement(b);
+  }
+
+  /**
+   * Returns the currently added buttons.
+   *
+   * @return <code>Enumeration</code> over all added buttons
+   */
+  public Enumeration getElements()
+  {
+    return buttons.elements();
+  }
+
+  /**
+   * Returns the currently selected button model.
+   *
+   * @return the currently selected button model, null if none was selected
+   *         yet
+   */
+  public ButtonModel getSelection()
+  {
+    return sel;
+  }
+
+  /**
+   * Returns the button that has the specified model, or <code>null</code> if
+   * there is no such button in the group.
+   *
+   * @param m  the button model.
+   *
+   * @return The button that has the specified model, or <code>null</code>.
+   */
+  AbstractButton findButton(ButtonModel m)
+  {
+    for (int i = 0; i < buttons.size(); i++)
+      {
+        AbstractButton a = (AbstractButton) buttons.get(i);
+        if (a.getModel() == m)
+          return a;
+      }
+    return null;
+  }
+
+  /**
+   * Sets the currently selected button model. Only one button of a group can
+   * be selected at a time.
+   *
+   * @param m the model to select
+   * @param b true if this button is to be selected, false otherwise
+   */
+  public void setSelected(ButtonModel m, boolean b)
+  {
+    if ((sel != m || b) && (! b || sel == m))
+      return;
+
+    if (b && sel != m)
+      {
+        ButtonModel old = sel;
+        sel = m;
+        
+        if (old != null)
+          old.setSelected(false);
+        AbstractButton button = findButton(old);
+        if (button != null)
+          button.repaint();
+      }
+    else if (!b && sel == m)
+      m.setSelected(true);
+  }
+
+  /**
+   * Checks if the given <code>ButtonModel</code> is selected in this button
+   * group.
+   *
+   * @param m  the button model (<code>null</code> permitted).
+   *
+   * @return <code>true</code> if <code>m</code> is the selected button model
+   *     in this group, and <code>false</code> otherwise.
+   */
+  public boolean isSelected(ButtonModel m)
+  {
+    return m == sel;
+  }
+
+  /**
+   * Return the number of buttons in this button group.
+   *
+   * @return the number of buttons
+   *
+   * @since 1.3
+   */
+  public int getButtonCount()
+  {
+    return buttons.size();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ButtonModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,301 @@
+/* ButtonModel.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.ItemSelectable;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemListener;
+
+import javax.swing.event.ChangeListener;
+
+/**
+ * The data model that is used in all kinds of buttons.
+ */
+public interface ButtonModel extends ItemSelectable
+{  
+
+  /**
+   * Returns <code>true</code> if the button is armed, <code>false</code>
+   * otherwise.
+   *
+   * A button is armed, when the user has pressed the mouse over it, but has
+   * not yet released the mouse.
+   * 
+   * @return <code>true</code> if the button is armed, <code>false</code>
+   *         otherwise
+   *
+   * @see #setArmed(boolean)
+   */
+  boolean isArmed();
+
+  /**
+   * Sets the armed flag of the button.
+   *
+   * A button is armed, when the user has pressed the mouse over it, but has
+   * not yet released the mouse.
+   *
+   * @param b <code>true</code> if the button is armed, <code>false</code>
+   *        otherwise
+   *
+   * @see #isArmed()
+   */
+  void setArmed(boolean b);
+
+  /**
+   * Returns <code>true</code> if the button is enabled, <code>false</code>
+   * otherwise.
+   *
+   * When a button is disabled, it is usually grayed out and the user cannot
+   * change its state.
+   *
+   * @return <code>true</code> if the button is enabled, <code>false</code>
+   *         otherwise
+   *
+   * @see #setEnabled(boolean)
+   */
+  boolean isEnabled();
+
+  /**
+   * Sets the enabled flag of the button.
+   *
+   * When a button is disabled, it is usually grayed out and the user cannot
+   * change its state.
+   *
+   * @param b <code>true</code> if the button is enabled, <code>false</code>
+   *        otherwise
+   *
+   * @see #isEnabled()
+   */
+  void setEnabled(boolean b);
+
+  /**
+   * Sets the pressed flag of the button.
+   *
+   * The button usually gets pressed when the user clicks on a button, it will
+   * be un-pressed when the user releases the mouse.
+   *
+   * @param b <code>true</code> if the button is pressed, <code>false</code>
+   *        otherwise
+   *
+   * @see #isPressed()
+   */
+  void setPressed(boolean b);
+
+  /**
+   * Returns <code>true</code> if the button is pressed, <code>false</code>
+   * otherwise.
+   *
+   * The button usually gets pressed when the user clicks on a button, it will
+   * be un-pressed when the user releases the mouse.
+   *
+   * @return <code>true</code> if the button is pressed, <code>false</code>
+   *         otherwise
+   *
+   * @see #setPressed(boolean)
+   */
+  boolean isPressed();
+
+  /**
+   * Removes an {@link ActionListener} from the list of registered listeners.
+   *
+   * @param l the action listener to remove
+   *
+   * @see #addActionListener(ActionListener)
+   */
+  void removeActionListener(ActionListener l);
+
+  /**
+   * Adds an {@link ActionListener} to the list of registered listeners.
+   *
+   * An <code>ActionEvent</code> is usually fired when the user clicks on a
+   * button.
+   * 
+   * @param l the action listener to add
+   *
+   * @see #removeActionListener(ActionListener)
+   */
+  void addActionListener(ActionListener l);
+
+  /**
+   * Adds an {@link ItemListener} to the list of registered listeners.
+   *
+   * An <code>ItemEvent</code> is usually fired when a button's selected
+   * state changes. This applies only to buttons that support the selected
+   * flag.
+   *
+   * @param l the item listener to add
+   *
+   * @see #removeItemListener(ItemListener)
+   */
+  void addItemListener(ItemListener l);
+
+  /**
+   * Adds an {@link ItemListener} to the list of registered listeners.
+   *
+   * @param l the item listener to add
+   *
+   * @see #removeItemListener(ItemListener)
+   */
+  void removeItemListener(ItemListener l);
+
+  /**
+   * Adds an {@link ChangeListener} to the list of registered listeners.
+   *
+   * A <code>ChangeEvent</code> is fired when any one of the button's flags
+   * changes.
+   *
+   * @param l the change listener to add
+   *
+   * @see #removeChangeListener(ChangeListener)
+   */
+  void addChangeListener(ChangeListener l);
+
+  /**
+   * Adds an {@link ChangeListener} to the list of registered listeners.
+   *
+   * @param l the change listener to add
+   *
+   * @see #removeChangeListener(ChangeListener)
+   */
+  void removeChangeListener(ChangeListener l);
+
+  /**
+   * Sets the rollover flag of the button.
+   *
+   * A button is rollover-ed, when the user has moved the mouse over it, but has
+   * not yet pressed the mouse.
+   *
+   * @param b <code>true</code> if the button is rollover, <code>false</code>
+   *        otherwise
+   *
+   * @see #isRollover()
+   */
+  void setRollover(boolean b);
+
+  /**
+   * Returns <code>true</code> if the button is rollover-ed, <code>false</code>
+   * otherwise.
+   *
+   * A button is rollover-ed, when the user has moved the mouse over it, but has
+   * not yet pressed the mouse.
+   *
+   * @return <code>true</code> if the button is rollover, <code>false</code>
+   *         otherwise
+   *
+   * @see #setRollover(boolean)
+   */
+  boolean isRollover();
+
+  /**
+   * Returns the keyboard mnemonic for the button. This specifies a shortcut
+   * or accelerator key that can be used to activate the button.
+   * 
+   * @return the keyboard mnemonic for the button
+   *
+   * @see #setMnemonic(int)
+   */
+  int  getMnemonic();
+
+  /**
+   * Sets the keyboard mnemonic for the button. This specifies a shortcut
+   * or accelerator key that can be used to activate the button.
+   * 
+   * @param key the keyboard mnemonic for the button
+   *
+   * @see #getMnemonic()
+   */
+  void setMnemonic(int key);
+
+  /**
+   * Sets the action command for the button. This will be used in
+   * <code>ActionEvents</code> fired by the button.
+   *
+   * @param s the action command to set
+   *
+   * @see #getActionCommand()
+   */
+  void setActionCommand(String s);
+
+  /**
+   * Returns the action command of the button.
+   *
+   * @return the action command of the button
+   *
+   * @see #setActionCommand(String)
+   */
+  String getActionCommand();
+
+  /**
+   * Sets the button group for the button. Some kinds of button (e.g. radio
+   * buttons) allow only one button within a button group selected at any one
+   * time.
+   *
+   * @param group the button group to set
+   */
+  void setGroup(ButtonGroup group);
+
+  /**
+   * Sets the selected flag of the button.
+   *
+   * Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons)
+   * can be in one of two states: selected or unselected. The selected state
+   * is usually toggled by clicking on the button.
+   * 
+   * @param b <code>true</code> if the button is selected, <code>false</code>
+   *        otherwise
+   *
+   * @see #isSelected()
+   */
+  void setSelected(boolean b);
+
+  /**
+   * Returns <code>true</code> if the button is selected, <code>false</code>
+   * otherwise.
+   *
+   * Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons)
+   * can be in one of two states: selected or unselected. The selected state
+   * is usually toggled by clicking on the button.
+   * 
+   * @return <code>true</code> if the button is selected, <code>false</code>
+   *         otherwise
+   *
+   * @see #setSelected(boolean)
+   */
+  boolean isSelected();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,108 @@
+/* CellEditor.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.util.EventObject;
+
+import javax.swing.event.CellEditorListener;
+import javax.swing.event.ChangeEvent;
+
+/**
+ * Provides edit capabilities for components that display cells like
+ * {@link JTable}, {@link JList} and {@link JTree}.
+ *
+ * @author Andrew Selkirk
+ */
+public interface CellEditor
+{
+  /**
+   * Returns the current value for the <code>CellEditor</code>.
+   * 
+   * @return The value.
+   */
+  Object getCellEditorValue();
+
+  /**
+   * Returns <code>true</code> if the specified event makes the editor 
+   * editable, and <code>false</code> otherwise.
+   * 
+   * @param event  the event.
+   * 
+   * @return A boolean.
+   */
+  boolean isCellEditable(EventObject event);
+
+  /**
+   * shouldSelectCell
+   * @param event TODO
+   * @return boolean
+   */
+  boolean shouldSelectCell(EventObject event);
+
+  /**
+   * Signals to the <code>CellEditor</code> that it should stop editing, 
+   * accepting the current cell value, and returns <code>true</code> if the
+   * editor actually stops editing, and <code>false</code> otherwise.
+   * 
+   * @return A boolean.
+   */
+  boolean stopCellEditing();
+
+  /**
+   * Signals to the <code>CellEditor</code> that it should cancel editing.
+   */
+  void cancelCellEditing();
+
+  /**
+   * Registers a listener to receive {@link ChangeEvent} notifications from the 
+   * <code>CellEditor</code>.
+   * 
+   * @param listener  the listener.
+   */
+  void addCellEditorListener(CellEditorListener listener);
+
+  /**
+   * Deregisters a listener so that it no longer receives {@link ChangeEvent} 
+   * notifications from the <code>CellEditor</code>.
+   * 
+   * @param listener  the listener.
+   */
+  void removeCellEditorListener(CellEditorListener listener);
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellRendererPane.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellRendererPane.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellRendererPane.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CellRendererPane.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,251 @@
+/* CellRendererPane.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
+/**
+ * Paints the cells of JList, JTable and JTree.
+ * It intercepts the usual paint tree, so that we don't walk up and
+ * repaint everything.
+ *
+ * @author Andrew Selkirk
+ */
+public class CellRendererPane extends Container implements Accessible
+{
+  private static final long serialVersionUID = -7642183829532984273L;
+
+  /**
+   * Provides accessibility support for CellRendererPanes.
+   */
+  protected class AccessibleCellRendererPane extends AccessibleAWTContainer
+  {
+    private static final long serialVersionUID = -8981090083147391074L;
+
+    /**
+     * Constructor AccessibleCellRendererPane
+     */
+    protected AccessibleCellRendererPane()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * getAccessibleRole
+     * @return AccessibleRole
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.PANEL;
+    }
+  }
+
+  /**
+   * accessibleContext
+   */
+  protected AccessibleContext accessibleContext = null;
+
+  /**
+   * Constructs a new CellRendererPane.
+   */
+  public CellRendererPane()
+  {
+    setVisible(false);
+  }
+
+  /**
+   * Should not be called.
+   *
+   * @param graphics not used here
+   */
+  public void update(Graphics graphics)
+  {
+    //Nothing to do here.
+  }
+
+  /**
+   * Despite normal behaviour this does <em>not</em> cause the container
+   * to be invalidated. This prevents propagating up the paint tree.
+   */
+  public void invalidate()
+  {
+    // Overridden to do nothing.
+  }
+
+  /**
+   * Should not be called.
+   *
+   * @param graphics not used here
+   */
+  public void paint(Graphics graphics)
+  {
+    // Overridden to do nothing.
+  }
+
+  /**
+   * Overridden to check if a component is already a child of this Container.
+   * If it's already a child, nothing is done. Otherwise we pass this to
+   * <code>super.addImpl()</code>.
+   *
+   * @param c the component to add
+   * @param constraints not used here
+   * @param index not used here
+   */
+  protected void addImpl(Component c, Object constraints, int index)
+  {
+    if (!isAncestorOf(c))
+      {
+        super.addImpl(c, constraints, index);
+      }
+  }
+
+  /**
+   * Paints the specified component <code>c</code> on the {@link Graphics}
+   * context <code>graphics</code>. The Graphics context is tranlated to
+   * (x,y) and the components bounds are set to (w,h). If
+   * <code>shouldValidate</code>
+   * is set to true, then the component is validated before painting.
+   *
+   * @param graphics the graphics context to paint on
+   * @param c the component to be painted
+   * @param p the parent of the component
+   * @param x the X coordinate of the upper left corner where c should
+            be painted
+   * @param y the Y coordinate of the upper left corner where c should
+            be painted
+   * @param w the width of the components drawing area
+   * @param h the height of the components drawing area
+   * @param shouldValidate if <code>c</code> should be validated before
+   *        painting
+   */
+  public void paintComponent(Graphics graphics, Component c,
+                             Container p, int x, int y, int w, int h, 
+                             boolean shouldValidate)
+  {
+    // reparent c
+    addImpl(c, null, 0);
+
+    Rectangle oldClip = graphics.getClipBounds();
+    boolean translated = false;
+    try
+      {
+        // translate to (x,y)
+        graphics.translate(x, y);
+        translated = true;
+        graphics.clipRect(0, 0, w, h);
+        // set bounds of c
+        c.setBounds(0, 0, w, h);
+
+        // validate if necessary
+        if (shouldValidate)
+          {
+            c.validate();
+          }
+
+        // paint component
+        c.paint(graphics);
+      }
+    finally
+      {
+        // untranslate g
+        if (translated)
+          graphics.translate(-x, -y);
+        graphics.setClip(oldClip);
+      }
+  }
+
+  /**
+   * Paints the specified component <code>c</code> on the {@link Graphics}
+   * context <code>graphics</code>. The Graphics context is tranlated to (x,y)
+   * and the components bounds are set to (w,h). The component is <em>not</em>
+   * validated before painting.
+   *
+   * @param graphics the graphics context to paint on
+   * @param c the component to be painted
+   * @param p the parent of the component
+   * @param x the X coordinate of the upper left corner where c should
+            be painted
+   * @param y the Y coordinate of the upper left corner where c should
+            be painted
+   * @param w the width of the components drawing area
+   * @param h the height of the components drawing area
+   */
+  public void paintComponent(Graphics graphics, Component c,
+                             Container p, int x, int y, int w, int h)
+  {
+    paintComponent(graphics, c, p, x, y, w, h, false);
+  }
+
+  /**
+   * Paints the specified component <code>c</code> on the {@link Graphics}
+   * context <code>g</code>. The Graphics context is tranlated to (r.x,r.y) and
+   * the components bounds are set to (r.width,r.height).
+   * The component is <em>not</em>
+   * validated before painting.
+   *
+   * @param graphics the graphics context to paint on
+   * @param c the component to be painted
+   * @param p the component on which we paint
+   * @param r the bounding rectangle of c
+   */
+  public void paintComponent(Graphics graphics, Component c,
+                             Container p, Rectangle r)
+  {
+    paintComponent(graphics, c, p, r.x, r.y, r.width, r.height);
+  }
+
+  /**
+   * getAccessibleContext <em>TODO</em>
+   * @return AccessibleContext
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleCellRendererPane();
+
+    return accessibleContext;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,96 @@
+/* ComboBoxEditor.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.event.ActionListener;
+
+/**
+ * Provides edit capabilities for {@link JComboBox}es.
+ *
+ * @author Andrew Selkirk
+ * @author Olga Rodimina
+ */
+public interface ComboBoxEditor
+{
+  /**
+   * This method returns component that will be used by the combo box to
+   * display/edit currently selected item in the combo box.
+   *
+   * @return Component that will be used by the combo box to display/edit
+   *         currently selected item
+   */
+  Component getEditorComponent();
+
+  /**
+   * Sets item that should be editted when any editting operation is performed
+   * by the user. The value is always equal to the currently selected value
+   * in the combo box. Thus, whenever a different value is selected from the
+   * combo box list then this method should be called to change editting item
+   * to the new selected item.
+   *
+   * @param item item that is currently selected in the combo box
+   */
+  void setItem(Object item);
+
+  /**
+   * This method returns item that is currently editable.
+   *
+   * @return Item in the combo box that is currently editable
+   */
+  Object getItem();
+
+  /**
+   * selectAll
+   */
+  void selectAll();
+
+  /**
+   * This method adds specified ActionListener to this ComboBoxEditor.
+   *
+   * @param listener
+   */
+  void addActionListener(ActionListener listener);
+
+  /**
+   * This method removes given ActionListener from this ComboBoxEditor.
+   *
+   * @param listener TODO
+   */
+  void removeActionListener(ActionListener listener);
+} // ComboBoxEditor

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComboBoxModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,69 @@
+/* ComboBoxModel.java --
+   Copyright (C) 2002, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+/**
+ * The data model for a {@link JComboBox}. This model keeps track of elements 
+ * contained in the <code>JComboBox</code> as well as the current
+ * combo box selection. Whenever the selection in the <code>JComboBox</code> 
+ * changes, the <code>ComboBoxModel</code> should fire a {@link ListDataEvent}
+ * to the model's {@link ListDataListener}s.
+ *
+ * @author Andrew Selkirk
+ */
+public interface ComboBoxModel extends ListModel
+{
+  /**
+   * Sets the selected item in the combo box. Classes implementing this 
+   * interface should fire a {@link ListDataEvent} to all registered 
+   * {@link ListDataListener}s to indicate that the selection has changed.
+   *
+   * @param item  the selected item (<code>null</code> permitted).
+   */
+  void setSelectedItem(Object item);
+
+  /**
+   * Returns the currently selected item in the combo box.
+   *
+   * @return The selected item (possibly <code>null</code>).
+   */
+  Object getSelectedItem();
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CompatibilityFocusTraversalPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CompatibilityFocusTraversalPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CompatibilityFocusTraversalPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/CompatibilityFocusTraversalPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,164 @@
+/* CompatibilityFocusTraversalPolicy.java -- Provides compatibility to old
+                                             focus API
+   Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.FocusTraversalPolicy;
+import java.util.HashMap;
+
+/**
+ * Provides compatibility to the older focus API in
+ * {@link JComponent#setNextFocusableComponent(Component)}.
+ *
+ * @author Roman Kennke (kennke at aicas.com)
+ */
+class CompatibilityFocusTraversalPolicy
+  extends FocusTraversalPolicy
+{
+
+  /**
+   * The focus traversal policy that has been installed on the focus cycle
+   * root before, and to which we fall back.
+   */
+  private FocusTraversalPolicy fallback;
+
+  /**
+   * Maps components to their next focused components.
+   */
+  private HashMap forward;
+
+  /**
+   * Maps components to their previous focused components.
+   */
+  private HashMap backward;
+
+  /**
+   * Creates a new CompatibilityFocusTraversalPolicy with the specified
+   * policy as fallback.
+   *
+   * @param p the fallback policy
+   */
+  CompatibilityFocusTraversalPolicy(FocusTraversalPolicy p)
+  {
+    fallback = p;
+    forward = new HashMap();
+    backward = new HashMap();
+  }
+
+  public Component getComponentAfter(Container root, Component current)
+  {
+    Component next = (Component) forward.get(current);
+    if (next == null && fallback != null)
+      next = fallback.getComponentAfter(root, current);
+    return next;
+  }
+
+  public Component getComponentBefore(Container root, Component current)
+  {
+    Component previous = (Component) backward.get(current);
+    if (previous == null && fallback != null)
+      previous = fallback.getComponentAfter(root, current);
+    return previous;
+  }
+
+  public Component getFirstComponent(Container root)
+  {
+    Component first = null;
+    if (fallback != null)
+      first = fallback.getFirstComponent(root);
+    return first;
+  }
+
+  public Component getLastComponent(Container root)
+  {
+    Component last = null;
+    if (fallback != null)
+      last = fallback.getLastComponent(root);
+    return last;
+  }
+
+  public Component getDefaultComponent(Container root)
+  {
+    Component def = null;
+    if (fallback != null)
+      def = fallback.getDefaultComponent(root);
+    return def;
+  }
+
+  /**
+   * Sets a next focused component for a specified component. This is called
+   * by {@link JComponent#setNextFocusableComponent(Component)}.
+   *
+   * @param current the current component
+   * @param next the next focused component
+   */
+  void setNextFocusableComponent(Component current, Component next)
+  {
+    forward.put(current, next);
+    backward.put(next, current);
+  }
+
+  /**
+   * Sets a next focused component for a specified component. This is called
+   * by {@link JComponent#setNextFocusableComponent(Component)}.
+   *
+   * @param current the current component
+   * @param next the next focused component
+   */
+  void addNextFocusableComponent(Component current, Component next)
+  {
+    forward.put(current, next);
+    backward.put(next, current);
+  }
+
+  /**
+   * Removes a focused component mapping. This is called
+   * by {@link JComponent#setNextFocusableComponent(Component)}.
+   *
+   * @param current the current component
+   * @param next the next focused component
+   */
+  void removeNextFocusableComponent(Component current, Component next)
+  {
+    forward.remove(current);
+    backward.remove(next);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComponentInputMap.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComponentInputMap.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComponentInputMap.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ComponentInputMap.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,141 @@
+/* ComponentInputMap.java --
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+
+/**
+ * An {@link InputMap} that is associated with a particular {@link JComponent}.
+ * The component is notified when its <code>ComponentInputMap</code> changes.
+ *
+ * @author Andrew Selkirk
+ * @author Michael Koch
+ */
+public class ComponentInputMap extends InputMap
+{
+  /**
+   * The component to notify.
+   */
+  private JComponent component;
+
+  /**
+   * Creates <code>ComponentInputMap</code> object that notifies the given
+   * component about changes to it.
+   *
+   * @param comp the component to notify
+   *
+   * @exception IllegalArgumentException if comp is null
+   */
+  public ComponentInputMap(JComponent comp)
+  {
+    if (comp == null)
+      throw new IllegalArgumentException();
+    
+    this.component = comp;
+  }
+
+  /**
+   * Puts a new entry into the <code>InputMap</code>.
+   * If actionMapKey is null an existing entry will be removed.
+   *
+   * @param keystroke the keystroke for the entry
+   * @param value the action.
+   */
+  public void put(KeyStroke keystroke, Object value)
+  {
+    super.put(keystroke, value);
+    if (component != null)
+      component.updateComponentInputMap(this);
+  }
+
+  /**
+   * Clears the <code>InputMap</code>.
+   */
+  public void clear()
+  {
+    super.clear();
+    if (component != null)
+      component.updateComponentInputMap(this);
+  }
+
+  /**
+   * Remove an entry from the <code>InputMap</code>.
+   *
+   * @param keystroke the key of the entry to remove
+   */
+  public void remove(KeyStroke keystroke)
+  {
+    super.remove(keystroke);
+    if (component != null)
+      component.updateComponentInputMap(this);
+  }
+
+  /**
+   * Sets a parent for this <code>ComponentInputMap</code>.
+   *
+   * @param parentMap the new parent
+   *
+   * @exception IllegalArgumentException if parentMap is not a
+   * <code>ComponentInputMap</code> or not associated with the same component
+   */
+  public void setParent(InputMap parentMap)
+  {
+    if (parentMap != null && !(parentMap instanceof ComponentInputMap))
+      throw new IllegalArgumentException("ComponentInputMaps can only have " +
+                                         "ComponentInputMaps for parents");
+    
+    if (parentMap != null && 
+        ((ComponentInputMap) parentMap).getComponent() != component)
+      throw new 
+        IllegalArgumentException("ComponentInputMaps' parents must " +
+                                 "be associated with the same JComponents");
+   
+    super.setParent(parentMap);
+    if (component != null)
+      component.updateComponentInputMap(this);
+  }
+
+  /**
+   * Returns the component to notify about changes.
+   *
+   * @return a <code>JComponent</code> object
+   */
+  public JComponent getComponent()
+  {
+    return component;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DebugGraphics.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DebugGraphics.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DebugGraphics.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DebugGraphics.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1125 @@
+/* DebugGraphics.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.image.ImageObserver;
+import java.io.PrintStream;
+import java.text.AttributedCharacterIterator;
+
+
+/**
+ * An extension of {@link Graphics} that can be used for debugging
+ * custom Swing widgets. <code>DebugGraphics</code> has the ability to
+ * draw slowly and can log drawing actions.
+ *
+ * @author Andrew Selkirk
+ */
+public class DebugGraphics extends Graphics
+{
+  /**
+   * LOG_OPTION
+   */
+  public static final int LOG_OPTION = 1;
+
+  /**
+   * FLASH_OPTION
+   */
+  public static final int FLASH_OPTION = 2;
+
+  /**
+   * BUFFERED_OPTION
+   */
+  public static final int BUFFERED_OPTION = 4;
+
+  /**
+   * NONE_OPTION
+   */
+  public static final int NONE_OPTION = -1;
+
+  static Color debugFlashColor = Color.RED;
+  static int debugFlashCount = 10;
+  static int debugFlashTime = 1000;
+  static PrintStream debugLogStream = System.out;
+
+  /**
+   * Counts the created DebugGraphics objects. This is used by the
+   * logging facility.
+   */
+  static int counter = 0;
+
+  /**
+   * graphics
+   */
+  Graphics graphics;
+
+  /**
+   * buffer
+   */
+  Image buffer;
+
+  /**
+   * debugOptions
+   */
+  int debugOptions;
+
+  /**
+   * graphicsID
+   */
+  int graphicsID;
+
+  /**
+   * xOffset
+   */
+  int xOffset;
+
+  /**
+   * yOffset
+   */
+  int yOffset;
+
+  /**
+   * Creates a <code>DebugGraphics</code> object.
+   */
+  public DebugGraphics()
+  {
+    counter++;
+  }
+
+  /**
+   * Creates a <code>DebugGraphics</code> object.
+   *
+   * @param graphics The <code>Graphics</code> object to wrap
+   * @param component TODO
+   */
+  public DebugGraphics(Graphics graphics, JComponent component)
+  {
+    this(graphics);
+    // FIXME: What shall we do with component ?
+  }
+
+  /**
+   * Creates a <code>DebugGraphics</code> object.
+   *
+   * @param graphics The <code>Graphics</code> object to wrap
+   */
+  public DebugGraphics(Graphics graphics)
+  {
+    this();
+    this.graphics = graphics;
+  }
+
+  /**
+   * Sets the color to draw stuff with.
+   * 
+   * @param color The color
+   */
+  public void setColor(Color color)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Setting color: " + color);
+
+    graphics.setColor(color);
+  }
+
+  /**
+   * Creates a overrides <code>Graphics.create</code> to create a
+   * <code>DebugGraphics</code> object.
+   *
+   * @return a new <code>DebugGraphics</code> object.
+   */
+  public Graphics create()
+  {
+    DebugGraphics copy = new DebugGraphics(graphics.create());
+    copy.debugOptions = debugOptions;
+    return copy;
+  }
+
+  /**
+   * Creates a overrides <code>Graphics.create</code> to create a
+   * <code>DebugGraphics</code> object.
+   *
+   * @param x the x coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
+   *
+   * @return a new <code>DebugGraphics</code> object.
+   */
+  public Graphics create(int x, int y, int width, int height)
+  {
+    DebugGraphics copy = new DebugGraphics(graphics.create(x, y, width,
+                                                           height));
+    copy.debugOptions = debugOptions;
+    return copy;
+  }
+
+  /**
+   * flashColor
+   *
+   * @return Color
+   */
+  public static Color flashColor()
+  {
+    return debugFlashColor;
+  }
+
+  /**
+   * setFlashColor
+   *
+   * @param color the color to use for flashing
+   */
+  public static void setFlashColor(Color color)
+  {
+    debugFlashColor = color;
+  }
+
+  /**
+   * flashTime
+   *
+   * @return The time in milliseconds
+   */
+  public static int flashTime()
+  {
+    return debugFlashTime;
+  }
+
+  /**
+   * setFlashTime
+   *
+   * @param time The time in milliseconds
+   */
+  public static void setFlashTime(int time)
+  {
+    debugFlashTime = time;
+  }
+
+  /**
+   * flashCount
+   *
+   * @return The number of flashes
+   */
+  public static int flashCount()
+  {
+    return debugFlashCount;
+  }
+
+  /**
+   * setFlashCount
+   *
+   * @param count The number of flashes
+   */
+  public static void setFlashCount(int count)
+  {
+    debugFlashCount = count;
+  }
+
+  /**
+   * logStream
+   *
+   * @return The <code>PrintStream</code> to write logging messages to
+   */
+  public static PrintStream logStream()
+  {
+    return debugLogStream;
+  }
+
+  /**
+   * setLogStream
+   *
+   * @param stream The currently set <code>PrintStream</code>.
+   */
+  public static void setLogStream(PrintStream stream)
+  {
+    debugLogStream = stream;
+  }
+
+  /**
+   * getFont
+   *
+   * @return The font
+   */
+  public Font getFont()
+  {
+    return graphics.getFont();
+  }
+
+  /**
+   * setFont
+   *
+   * @param font The font to use for drawing text
+   */
+  public void setFont(Font font)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Setting font: " + font);
+
+    graphics.setFont(font);
+  }
+
+  /**
+   * Returns the color used for drawing.
+   * 
+   * @return The color.
+   */
+  public Color getColor()
+  {
+    return graphics.getColor();
+  }
+
+  /**
+   * Returns the font metrics of the current font.
+   *
+   * @return a <code>FontMetrics</code> object
+   */
+  public FontMetrics getFontMetrics()
+  {
+    return graphics.getFontMetrics();
+  }
+
+  /**
+   * Returns the font metrics for a given font.
+   *
+   * @param font the font to get the metrics for
+   *
+   * @return a <code>FontMetrics</code> object
+   */
+  public FontMetrics getFontMetrics(Font font)
+  {
+    return graphics.getFontMetrics(font);
+  }
+
+  /**
+   * translate
+   *
+   * @param x the x coordinate
+   * @param y the y coordinate
+   */
+  public void translate(int x, int y)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Translating by: " + new Point(x, y));
+
+    graphics.translate(x, y);
+  }
+
+  /**
+   * setPaintMode
+   */
+  public void setPaintMode()
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Setting paint mode");
+
+    graphics.setPaintMode();
+  }
+
+  /**
+   * setXORMode
+   *
+   * @param color the color
+   */
+  public void setXORMode(Color color)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Setting XOR mode: " + color);
+
+    graphics.setXORMode(color);
+  }
+
+  /**
+   * getClipBounds
+   *
+   * @return Rectangle
+   */
+  public Rectangle getClipBounds()
+  {
+    return graphics.getClipBounds();
+  }
+
+  /**
+   * Intersects the current clip region with the given region.
+   *
+   * @param x The x-position of the region
+   * @param y The y-position of the region
+   * @param width The width of the region
+   * @param height The height of the region
+   */
+  public void clipRect(int x, int y, int width, int height)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().print(prefix() + " Setting clipRect: "
+                          + new Rectangle(x, y, width, height));
+      }
+
+    graphics.clipRect(x, y, width, height);
+
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(" Netting clipRect: " + graphics.getClipBounds());
+  }
+
+  /**
+   * Sets the clipping region.
+   *
+   * @param x The x-position of the region
+   * @param y The y-position of the region
+   * @param width The width of the region
+   * @param height The height of the region
+   */
+  public void setClip(int x, int y, int width, int height)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Setting new clipRect: "
+                            + new Rectangle(x, y, width, height));
+      }
+
+    graphics.setClip(x, y, width, height);
+  }
+
+  /**
+   * Returns the current clipping region.
+   *
+   * @return Shape
+   */
+  public Shape getClip()
+  {
+    return graphics.getClip();
+  }
+
+  /**
+   * Sets the current clipping region
+   *
+   * @param shape The clippin region
+   */
+  public void setClip(Shape shape)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Setting new clipRect: " + shape);
+
+    graphics.setClip(shape);
+  }
+
+  private void sleep(int milliseconds)
+  {
+    try
+      {
+        Thread.sleep(milliseconds);
+      }
+    catch (InterruptedException e)
+      {
+        // Ignore this.
+      }
+  }
+  
+  /**
+   * Draws a rectangle.
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
+   */
+  public void drawRect(int x, int y, int width, int height)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing rect: "
+                            + new Rectangle(x, y, width, height));
+      }
+
+    if ((debugOptions & FLASH_OPTION) != 0)
+      {
+        Color color = graphics.getColor();
+        for (int index = 0; index < (debugFlashCount - 1); ++index)
+          {
+            graphics.setColor(color);
+            graphics.drawRect(x, y, width, height);
+            sleep(debugFlashTime);
+            graphics.setColor(debugFlashColor);
+            graphics.drawRect(x, y, width, height);
+            sleep(debugFlashTime);
+          }
+        graphics.setColor(color);
+      }
+
+    graphics.drawRect(x, y, width, height);
+  }
+
+  /**
+   * Draws a filled rectangle.
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
+   */
+  public void fillRect(int x, int y, int width, int height)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Filling rect: "
+                            + new Rectangle(x, y, width, height));
+      }
+
+    if ((debugOptions & FLASH_OPTION) != 0)
+      {
+        Color color = graphics.getColor();
+        for (int index = 0; index < (debugFlashCount - 1); ++index)
+          {
+            graphics.setColor(color);
+            graphics.fillRect(x, y, width, height);
+            sleep(debugFlashTime);
+            graphics.setColor(debugFlashColor);
+            graphics.fillRect(x, y, width, height);
+            sleep(debugFlashTime);
+          }
+        graphics.setColor(color);
+      }
+
+    graphics.fillRect(x, y, width, height);
+  }
+
+  /**
+   * clearRect
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
+   */
+  public void clearRect(int x, int y, int width, int height)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Clearing rect: "
+                            + new Rectangle(x, y, width, height));
+      }
+
+    graphics.clearRect(x, y, width, height);
+  }
+
+  /**
+   * drawRoundRect
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
+   * @param arcWidth TODO
+   * @param arcHeight TODO
+   */
+  public void drawRoundRect(int x, int y, int width, int height, 
+			    int arcWidth, int arcHeight)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing round rect: "
+                            + new Rectangle(x, y, width, height)
+                            + " arcWidth: " + arcWidth
+                            + " arcHeight: " + arcHeight);
+      }
+
+    graphics.drawRoundRect(x, y, width, height, arcWidth, arcHeight);
+  }
+
+  /**
+   * fillRoundRect
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
+   * @param arcWidth TODO
+   * @param arcHeight TODO
+   */
+  public void fillRoundRect(int x, int y, int width, int height, 
+			    int arcWidth, int arcHeight)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Filling round rect: "
+                            + new Rectangle(x, y, width, height)
+                            + " arcWidth: " + arcWidth
+                            + " arcHeight: " + arcHeight);
+      }
+
+    graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
+  }
+
+  /**
+   * drawLine
+   *
+   * @param x1 The x-position of the start 
+   * @param y1 The y-position of the start
+   * @param x2 The x-position of the end
+   * @param y2 The y-position of the end
+   */
+  public void drawLine(int x1, int y1, int x2, int y2)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing line: from (" + x1 + ", "
+                            + y1 + ") to (" + x2 + ", " + y2 + ")");
+      }
+
+    graphics.drawLine(x1, y1, x2, y2);
+  }
+
+  /**
+   * draw3DRect
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
+   * @param raised TODO
+   */
+  public void draw3DRect(int x, int y, int width, int height, boolean raised)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing 3D rect: "
+                            + new Rectangle(x, y, width, height)
+                            + "Raised bezel: " + raised);
+      }
+
+    graphics.draw3DRect(x, y, width, height, raised);
+  }
+
+  /**
+   * fill3DRect
+   *
+   * @param x The x-position of the rectangle
+   * @param y The y-position of the rectangle
+   * @param width The width of the rectangle
+   * @param height The height of the rectangle
+   * @param raised TODO
+   */
+  public void fill3DRect(int x, int y, int width, int height, boolean raised)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Filling 3D rect: "
+                            + new Rectangle(x, y, width, height)
+                            + "Raised bezel: " + raised);
+      }
+
+    graphics.fill3DRect(x, y, width, height, raised);
+  }
+
+  /**
+   * drawOval
+   *
+   * @param x the x coordinate
+   * @param y the y coordiante
+   * @param width the width
+   * @param height the height
+   */
+  public void drawOval(int x, int y, int width, int height)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing oval: "
+                            + new Rectangle(x, y, width, height));
+      }
+
+    graphics.drawOval(x, y, width, height);
+  }
+
+  /**
+   * fillOval
+   *
+   * @param x the x coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
+   */
+  public void fillOval(int x, int y, int width, int height)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Filling oval: "
+                            + new Rectangle(x, y, width, height));
+      }
+
+    graphics.fillOval(x, y, width, height);
+  }
+
+  /**
+   * drawArc
+   *
+   * @param x the x coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
+   * @param startAngle TODO
+   * @param arcAngle TODO
+   */
+  public void drawArc(int x, int y, int width, int height, 
+		      int startAngle, int arcAngle)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing arc: "
+                            + new Rectangle(x, y, width, height)
+                            + " startAngle: " + startAngle
+                            + " arcAngle: " + arcAngle);
+      }
+
+    graphics.drawArc(x, y, width, height, startAngle, arcAngle);
+  }
+
+  /**
+   * fillArc
+   *
+   * @param x the coordinate
+   * @param y the y coordinate
+   * @param width the width
+   * @param height the height
+   * @param startAngle TODO
+   * @param arcAngle TODO
+   */
+  public void fillArc(int x, int y, int width, int height, 
+		      int startAngle, int arcAngle)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Filling arc: "
+                            + new Rectangle(x, y, width, height)
+                            + " startAngle: " + startAngle
+                            + " arcAngle: " + arcAngle);
+      }
+
+    graphics.fillArc(x, y, width, height, startAngle, arcAngle);
+  }
+
+  /**
+   * drawPolyline
+   *
+   * @param xpoints TODO
+   * @param ypoints TODO
+   * @param npoints TODO
+   */
+  public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing polyline: nPoints: " + npoints
+                            + " X's: " + xpoints + " Y's: " + ypoints);
+      }
+
+    graphics.drawPolyline(xpoints, ypoints, npoints);
+  }
+
+  /**
+   * drawPolygon
+   *
+   * @param xpoints TODO
+   * @param ypoints TODO
+   * @param npoints TODO
+   */
+  public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints
+                            + " X's: " + xpoints + " Y's: " + ypoints);
+      }
+
+    graphics.drawPolygon(xpoints, ypoints, npoints);
+  }
+
+  /**
+   * fillPolygon
+   *
+   * @param xpoints TODO
+   * @param ypoints TODO
+   * @param npoints TODO
+   */
+  public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing polygon: nPoints: " + npoints
+                            + " X's: " + xpoints + " Y's: " + ypoints);
+      }
+
+    graphics.fillPolygon(xpoints, ypoints, npoints);
+  }
+
+  /**
+   * drawString
+   *
+   * @param string the string
+   * @param x the x coordinate
+   * @param y the y coordinate
+   */
+  public void drawString(String string, int x, int y)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing string: \"" + string
+                            + "\" at: " + new Point(x, y));
+      }
+
+    graphics.drawString(string, x, y);
+  }
+
+  /**
+   * drawString
+   *
+   * @param iterator TODO
+   * @param x the x coordinate
+   * @param y the y coordinate
+   */
+  public void drawString(AttributedCharacterIterator iterator,
+			 int x, int y)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing string: \"" + iterator
+                            + "\" at: " + new Point(x, y));
+      }
+
+    graphics.drawString(iterator, x, y);
+  }
+
+  /**
+   * drawBytes
+   * 
+   * @param data TODO
+   * @param offset TODO
+   * @param length TODO
+   * @param x the x coordinate
+   * @param y the y coordinate
+   */
+  public void drawBytes(byte[] data, int offset, int length,
+			int x, int y)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Drawing bytes at: " + new Point(x, y));
+
+    graphics.drawBytes(data, offset, length, x, y);
+  }
+
+  /**
+   * drawChars
+   * 
+   * @param data array of characters to draw
+   * @param offset offset in array
+   * @param length number of characters in array to draw
+   * @param x x-position
+   * @param y y-position
+   */
+  public void drawChars(char[] data, int offset, int length, 
+			int x, int y)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      logStream().println(prefix() + " Drawing chars at: " + new Point(x, y));
+
+    if ((debugOptions & FLASH_OPTION) != 0)
+      {
+        Color color = graphics.getColor();
+        for (int index = 0; index < (debugFlashCount - 1); ++index)
+          {
+            graphics.setColor(color);
+            graphics.drawChars(data, offset, length, x, y);
+            sleep(debugFlashTime);
+            graphics.setColor(debugFlashColor);
+            graphics.drawChars(data, offset, length, x, y);
+            sleep(debugFlashTime);
+          }
+        graphics.setColor(color);
+      }
+
+    graphics.drawChars(data, offset, length, x, y);
+  }
+
+  /**
+   * drawImage
+   *
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param observer The image observer
+   * @return boolean
+   */
+  public boolean drawImage(Image image, int x, int y,
+			   ImageObserver observer)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing image: " + image + " at: "
+                          + new Point(x, y));
+      }
+
+    return graphics.drawImage(image, x, y, observer);
+  }
+
+  /**
+   * drawImage
+   * 
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param width The width of the area to draw the image
+   * @param height The height of the area to draw the image
+   * @param observer The image observer
+   *
+   * @return boolean
+   */
+  public boolean drawImage(Image image, int x, int y, int width, 
+			   int height, ImageObserver observer)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing image: " + image
+                            + " at: " + new Rectangle(x, y, width, height));
+      }
+
+    return graphics.drawImage(image, x, y, width, height, observer);
+  }
+
+  /**
+   * drawImage
+   * 
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param background The color for the background in the opaque regions
+   * of the image
+   * @param observer The image observer
+   *
+   * @return boolean
+   */
+  public boolean drawImage(Image image, int x, int y, 
+			   Color background, ImageObserver observer)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing image: " + image
+                            + " at: " + new Point(x, y)
+                            + ", bgcolor: " + background);
+      }
+
+    return graphics.drawImage(image, x, y, background, observer);
+  }
+
+  /**
+   * drawImage
+   * 
+   * @param image The image to draw
+   * @param x The x position
+   * @param y The y position
+   * @param width The width of the area to draw the image
+   * @param height The height of the area to draw the image
+   * @param background The color for the background in the opaque regions
+   * of the image
+   * @param observer The image observer
+   *
+   * @return boolean
+   */
+  public boolean drawImage(Image image, int x, int y, int width, int height, 
+			   Color background, ImageObserver observer)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing image: " + image
+                            + " at: " + new Rectangle(x, y, width, height)
+                            + ", bgcolor: " + background);
+      }
+
+    return graphics.drawImage(image, x, y, width, height, background, observer);
+  }
+
+  /**
+   * drawImage
+   * 
+   * @param image The image to draw
+   * @param dx1 TODO
+   * @param dy1 TODO
+   * @param dx2 TODO
+   * @param dy2 TODO
+   * @param sx1 TODO
+   * @param sy1 TODO
+   * @param sx2 TODO
+   * @param sy2 TODO
+   * @param observer The image observer
+   * 
+   * @return boolean
+   */
+  public boolean drawImage(Image image, int dx1, int dy1,
+			   int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
+			   ImageObserver observer)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing image: " + image
+                         + " destination: " + new Rectangle(dx1, dy1, dx2, dy2)
+                         + " source: " + new Rectangle(sx1, sy1, sx2, sy2));
+      }
+
+    return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer);
+  }
+
+  /**
+   * drawImage
+   *
+   * @param image The image to draw
+   * @param dx1 TODO
+   * @param dy1 TODO
+   * @param dx2 TODO
+   * @param dy2 TODO
+   * @param sx1 TODO
+   * @param sy1 TODO
+   * @param sx2 TODO
+   * @param sy2 TODO
+   * @param background The color for the background in the opaque regions
+   * of the image
+   * @param observer The image observer
+   *
+   * @return boolean
+   */
+  public boolean drawImage(Image image, int dx1, int dy1,
+			   int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
+			   Color background, ImageObserver observer)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Drawing image: " + image
+                         + " destination: " + new Rectangle(dx1, dy1, dx2, dy2)
+                         + " source: " + new Rectangle(sx1, sy1, sx2, sy2)
+                         + ", bgcolor: " + background);
+      }
+
+    return graphics.drawImage(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, background, observer);
+  }
+
+  /**
+   * copyArea
+   *
+   * @param x The x position of the source area
+   * @param y The y position of the source area
+   * @param width The width of the area
+   * @param height The height of the area
+   * @param destx The x position of the destination area
+   * @param desty The y posiiton of the destination area
+   */
+  public void copyArea(int x, int y, int width, int height, 
+		       int destx, int desty)
+  {
+    if ((debugOptions & LOG_OPTION) != 0)
+      {
+        logStream().println(prefix() + " Copying area from: "
+                            +  new Rectangle(x, y, width, height)
+                            + " to: " + new Point(destx, desty));
+      }
+
+    graphics.copyArea(x, y, width, height, destx, desty);
+  }
+
+  /**
+   * Releases all system resources that this <code>Graphics</code> is using.
+   */
+  public void dispose()
+  {
+    graphics.dispose();
+    graphics = null;
+  }
+
+  /**
+   * isDrawingBuffer
+   *
+   * @return boolean
+   */
+  public boolean isDrawingBuffer()
+  {
+    return false; // TODO
+  }
+
+  /**
+   * setDebugOptions
+   *
+   * @param options the debug options
+   */
+  public void setDebugOptions(int options)
+  {
+    debugOptions = options;
+    if ((debugOptions & LOG_OPTION) != 0)
+      if (options == NONE_OPTION)
+        logStream().println(prefix() + "Disabling debug");
+      else
+        logStream().println(prefix() + "Enabling debug");
+  }
+
+  /**
+   * getDebugOptions
+   *
+   * @return the debug options
+   */
+  public int getDebugOptions()
+  {
+    return debugOptions;
+  }
+
+  /**
+   * Creates and returns the prefix that should be prepended to all logging
+   * messages. The prefix is made up like this:
+   * 
+   * <code>Graphics(<counter>-1)</code> where counter is an integer number
+   * saying how many DebugGraphics objects have been created so far. The second
+   * number always seem to be 1 on Sun's JDK, this has to be investigated a
+   * little more.
+   *
+   * @return the prefix that should be prepended to all logging
+   *         messages
+   */
+  private String prefix()
+  {
+    return "Graphics(" + counter + "-1)";
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultBoundedRangeModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,475 @@
+/* DefaultBoundedRangeModel.java -- Default implementation
+   of BoundedRangeModel.
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.EventListener;
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+
+/**
+ * The default implementation of <code>BoundedRangeModel</code>.
+ *
+ * @author Andrew Selkirk (aselkirk at sympatico.ca)
+ * @author Sascha Brawer (brawer at dandelis.ch)
+ */
+public class DefaultBoundedRangeModel
+  implements BoundedRangeModel, Serializable
+{
+  /**
+   * The identifier of this class in object serialization. Verified
+   * using the serialver tool of Sun J2SE 1.4.1_01.
+   */
+  private static final long serialVersionUID = 5034068491295259790L;
+
+  /**
+   * An event that is sent to all registered {@link ChangeListener}s
+   * when the state of this range model has changed.
+   *
+   * <p>The event object is created on demand, the first time it
+   * is actually needed.</p>
+   *
+   * @see #fireStateChanged()
+   */
+  protected transient ChangeEvent changeEvent;
+
+  /**
+   * The list of the currently registered EventListeners.
+   */
+  protected EventListenerList listenerList = new EventListenerList();
+
+  /**
+   * The current value of the range model, which is always between
+   * {@link #minimum} and ({@link #maximum} - {@link #extent}). In a
+   * scroll bar visualization of a {@link BoundedRangeModel}, the
+   * <code>value</code> is displayed as the position of the thumb.
+   */
+  private int value;
+
+  /**
+   * The current extent of the range model, which is a number greater
+   * than or equal to zero. In a scroll bar visualization of a {@link
+   * BoundedRangeModel}, the <code>extent</code> is displayed as the
+   * size of the thumb.
+   */
+  private int extent;
+
+  /**
+   * The current minimum value of the range model, which is always
+   * less than or equal to {@link #maximum}.
+   */
+  private int minimum;
+
+  /**
+   * The current maximum value of the range model, which is always
+   * greater than or equal to {@link #minimum}.
+   */
+  private int maximum;
+
+  /**
+   * A property that indicates whether the value of this {@link
+   * BoundedRangeModel} is going to change in the immediate future.
+   */
+  private boolean isAdjusting;
+
+  /**
+   * Constructs a <code>DefaultBoundedRangeModel</code> with default
+   * values for the properties. The properties <code>value</code>,
+   * <code>extent</code> and <code>minimum</code> will be initialized
+   * to zero; <code>maximum</code> will be set to 100; the property
+   * <code>valueIsAdjusting</code> will be <code>false</code>.
+   */
+  public DefaultBoundedRangeModel()
+  {
+    // The fields value, extent, minimum have the default value 0, and
+    // isAdjusting is already false. These fields no not need to be
+    // set explicitly.
+    maximum = 100;
+  }
+
+  /**
+   * Constructs a <code>DefaultBoundedRangeModel</code> with the
+   * specified values for some properties.
+   *
+   * @param value the initial value of the range model, which must be
+   *     a number between <code>minimum</code> and <code>(maximum -
+   *     extent)</code>. In a scroll bar visualization of a {@link
+   *     BoundedRangeModel}, the <code>value</code> is displayed as the
+   *     position of the thumb.
+   * @param extent the initial extent of the range model, which is a
+   *     number greater than or equal to zero. In a scroll bar
+   *     visualization of a {@link BoundedRangeModel}, the
+   *     <code>extent</code> is displayed as the size of the thumb.
+   * @param minimum the initial minimal value of the range model.
+   * @param maximum the initial maximal value of the range model.
+   *
+   * @throws IllegalArgumentException if the following condition is
+   *     not satisfied: <code>minimum <= value <= value + extent <=
+   *     maximum</code>.
+   */
+  public DefaultBoundedRangeModel(int value, int extent, int minimum,
+                                  int maximum)
+  {
+    if (!(minimum <= value && extent >= 0 && (value + extent) <= maximum))
+      throw new IllegalArgumentException();
+
+    this.value = value;
+    this.extent = extent;
+    this.minimum = minimum;
+    this.maximum = maximum;
+
+    // The isAdjusting field already has a false value by default.
+  }
+
+  /**
+   * Returns a string with all relevant properties of this range
+   * model.
+   *
+   * @return a string representing the object
+   */
+  public String toString()
+  {
+    return getClass().getName()
+      + "[value=" + value
+      + ", extent=" + extent
+      + ", min=" + minimum
+      + ", max=" + maximum
+      + ", adj=" + isAdjusting
+      + ']';
+  }
+
+  /**
+   * Returns the current value of this bounded range model.  In a
+   * scroll bar visualization of a {@link BoundedRangeModel}, the
+   * <code>value</code> is displayed as the position of the thumb.
+   *
+   * @return the value
+   */
+  public int getValue()
+  {
+    return value;
+  }
+
+  /**
+   * Changes the current value of this bounded range model. In a
+   * scroll bar visualization of a {@link BoundedRangeModel}, the
+   * <code>value</code> is displayed as the position of the thumb;
+   * changing the <code>value</code> of a scroll bar's model
+   * thus moves the thumb to a different position.
+   *
+   * @param value the value
+   */
+  public void setValue(int value)
+  {
+    value = Math.max(minimum, value);
+    if (value + extent > maximum)
+      value = maximum - extent;
+
+    if (value != this.value)
+      {
+        this.value = value;
+        fireStateChanged();
+      }
+  }
+
+  /**
+   * Returns the current extent of this bounded range model, which is
+   * a number greater than or equal to zero. In a scroll bar
+   * visualization of a {@link BoundedRangeModel}, the
+   * <code>extent</code> is displayed as the size of the thumb.
+   *
+   * @return the extent
+   */
+  public int getExtent()
+  {
+    return extent;
+  }
+
+  /**
+   * Changes the current extent of this bounded range model. In a
+   * scroll bar visualization of a {@link BoundedRangeModel}, the
+   * <code>extent</code> is displayed as the size of the thumb.
+   *
+   * @param extent the new extent of the range model, which is a
+   *     number greater than or equal to zero.
+   */
+  public void setExtent(int extent)
+  {
+    extent = Math.max(extent, 0);
+    if (value + extent > maximum)
+      extent = maximum - value;
+
+    if (extent != this.extent)
+      {
+        this.extent = extent;
+        fireStateChanged();
+      }
+  }
+
+  /**
+   * Returns the current minimal value of this bounded range model.
+   */
+  public int getMinimum()
+  {
+    return minimum;
+  }
+
+  /**
+   * Changes the current minimal value of this bounded range model.
+   *
+   * @param minimum the new minimal value.
+   */
+  public void setMinimum(int minimum)
+  {
+    int value, maximum;
+
+    maximum = Math.max(minimum, this.maximum);
+    value = Math.max(minimum, this.value);
+
+    setRangeProperties(value, extent, minimum, maximum, isAdjusting);
+  }
+
+  /**
+   * Returns the current maximal value of this bounded range model.
+   *
+   * @return the maximum
+   */
+  public int getMaximum()
+  {
+    return maximum;
+  }
+
+  /**
+   * Changes the current maximal value of this bounded range model.
+   *
+   * @param maximum the new maximal value.
+   */
+  public void setMaximum(int maximum)
+  {
+    int value, extent, minimum;
+
+    minimum = Math.min(this.minimum, maximum);
+    extent = Math.min(this.extent, maximum - minimum);
+    value = Math.min(this.value, maximum - extent);
+
+    setRangeProperties(value, extent, minimum, maximum, isAdjusting);
+  }
+
+  /**
+   * Returns whether or not the value of this bounded range model is
+   * going to change in the immediate future. Scroll bars set this
+   * property to <code>true</code> while the thumb is being dragged
+   * around; when the mouse is relased, they set the property to
+   * <code>false</code> and post a final {@link ChangeEvent}.
+   *
+   * @return <code>true</code> if the value will change soon again;
+   *     <code>false</code> if the value will probably not change soon.
+   */
+  public boolean getValueIsAdjusting()
+  {
+    return isAdjusting;
+  }
+
+  /**
+   * Specifies whether or not the value of this bounded range model is
+   * going to change in the immediate future. Scroll bars set this
+   * property to <code>true</code> while the thumb is being dragged
+   * around; when the mouse is relased, they set the property to
+   * <code>false</code>.
+   *
+   * @param isAdjusting <code>true</code> if the value will change
+   *     soon again; <code>false</code> if the value will probably not
+   *     change soon.
+   */
+  public void setValueIsAdjusting(boolean isAdjusting)
+  {
+    if (isAdjusting == this.isAdjusting)
+      return;
+
+    this.isAdjusting = isAdjusting;
+    fireStateChanged();
+  }
+
+  /**
+   * Sets all properties.
+   *
+   * @param value the new value of the range model.  In a scroll bar
+   *     visualization of a {@link BoundedRangeModel}, the
+   *     <code>value</code> is displayed as the position of the thumb.
+   * @param extent the new extent of the range model, which is a
+   *     number greater than or equal to zero. In a scroll bar
+   *     visualization of a {@link BoundedRangeModel}, the
+   *     <code>extent</code> is displayed as the size of the thumb.
+   * @param minimum the new minimal value of the range model.
+   * @param maximum the new maximal value of the range model.
+   * @param isAdjusting whether or not the value of this bounded range
+   *     model is going to change in the immediate future. Scroll bars set
+   *     this property to <code>true</code> while the thumb is being
+   *     dragged around; when the mouse is relased, they set the property
+   *     to <code>false</code>.
+   */
+  public void setRangeProperties(int value, int extent, int minimum,
+                                 int maximum, boolean isAdjusting)
+  {
+    minimum = Math.min(Math.min(minimum, maximum), value);
+    maximum = Math.max(value, maximum);
+    if (extent + value > maximum)
+      extent = maximum - value;
+    extent = Math.max(0, extent);
+
+    if ((value == this.value)
+        && (extent == this.extent)
+        && (minimum == this.minimum)
+        && (maximum == this.maximum)
+        && (isAdjusting == this.isAdjusting))
+      return;
+
+    this.value = value;
+    this.extent = extent;
+    this.minimum = minimum;
+    this.maximum = maximum;
+    this.isAdjusting = isAdjusting;
+		
+    fireStateChanged();
+  }
+
+  /**
+   * Subscribes a ChangeListener to state changes.
+   *
+   * @param listener the listener to be subscribed.
+   */
+  public void addChangeListener(ChangeListener listener)
+  {
+    listenerList.add(ChangeListener.class, listener);
+  }
+
+  /**
+   * Cancels the subscription of a ChangeListener.
+   *
+   * @param listener the listener to be unsubscribed.
+   */
+  public void removeChangeListener(ChangeListener listener)
+  {
+    listenerList.remove(ChangeListener.class, listener);
+  }
+
+  /**
+   * Sends a {@link ChangeEvent} to any registered {@link
+   * ChangeListener}s.
+   *
+   * @see #addChangeListener(ChangeListener)
+   * @see #removeChangeListener(ChangeListener)
+   */
+  protected void fireStateChanged()
+  {
+    ChangeListener[] listeners = getChangeListeners();
+    
+    if (changeEvent == null)
+      changeEvent = new ChangeEvent(this);
+
+    for (int i = listeners.length - 1; i >= 0; --i)
+      listeners[i].stateChanged(changeEvent);
+  }
+
+  /**
+   * Retrieves the current listeners of the specified class.
+   *
+   * @param listenerType the class of listeners; usually {@link
+   *     ChangeListener}<code>.class</code>.
+   *
+   * @return an array with the currently subscribed listeners, or
+   *     an empty array if there are currently no listeners.
+   *
+   * @since 1.3
+   */
+  public EventListener[] getListeners(Class listenerType)
+  {
+    return listenerList.getListeners(listenerType);
+  }
+
+  /**
+   * Returns all <code>ChangeListeners</code> that are currently
+   * subscribed for changes to this
+   * <code>DefaultBoundedRangeModel</code>.
+   *
+   * @return an array with the currently subscribed listeners, or
+   *     an empty array if there are currently no listeners.
+   *
+   * @since 1.4
+   */
+  public ChangeListener[] getChangeListeners()
+  {
+    return (ChangeListener[]) getListeners(ChangeListener.class);
+  }
+  
+  /**
+   * Provides serialization support.
+   *
+   * @param stream  the output stream (<code>null</code> not permitted).
+   *
+   * @throws IOException  if there is an I/O error.
+   */
+  private void writeObject(ObjectOutputStream stream) 
+    throws IOException 
+  {
+    stream.defaultWriteObject();
+  }
+
+  /**
+   * Provides serialization support.
+   *
+   * @param stream  the input stream (<code>null</code> not permitted).
+   *
+   * @throws IOException  if there is an I/O error.
+   * @throws ClassNotFoundException  if there is a classpath problem.
+   */
+  private void readObject(ObjectInputStream stream)
+    throws ClassNotFoundException, IOException
+  {
+    stream.defaultReadObject();
+    listenerList = new EventListenerList();
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultButtonModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultButtonModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultButtonModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultButtonModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,578 @@
+/* DefaultButtonModel.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.ItemSelectable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.io.Serializable;
+import java.util.EventListener;
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+
+/**
+ * The default implementation of {@link ButtonModel}.
+ * The purpose of this class is to model the dynamic state of an abstract
+ * button. The concrete button type holding this state may be a a "toggle"
+ * button (checkbox, radio button) or a "push" button (menu button, button).
+ * If the model is disabled, only the "selected" property can be changed. An
+ * attempt to change the "armed", "rollover" or "pressed" properties  while
+ * the model is disabled will be blocked. Any successful (non-blocked) change
+ * to the model's properties will trigger the firing of a ChangeEvent. Any
+ * change to the "selected" property will trigger the firing of an ItemEvent
+ * in addition to ChangeEvent. This is true whether the model is enabled or
+ * not. One other state change is special: the transition from "enabled,
+ * armed and pressed" to "enabled, armed and not-pressed". This is considered
+ * the "trailing edge" of a successful mouse click, and therefore fires an
+ * ActionEvent in addition to a ChangeEvent. In all other respects this class
+ * is just a container of boolean flags.
+ *
+ * @author Graydon Hoare (graydon_at_redhat.com)
+ */
+public class DefaultButtonModel implements ButtonModel, Serializable
+{
+  /** DOCUMENT ME! */
+  private static final long serialVersionUID = -5342609566534980231L;
+
+  /**
+   * Indicates that the button is <em>partially</em> committed to being
+   * pressed, but not entirely. This usually happens when a user has pressed
+   * but not yet released the mouse button.
+   */
+  public static final int ARMED = 1;
+
+  /**
+   * State constant indicating that the button is enabled. Buttons cannot be
+   * pressed or selected unless they are enabled.
+   */
+  public static final int ENABLED = 8;
+
+  /**
+   * State constant indicating that the user is holding down the button. When
+   * this transitions from true to false, an ActionEvent may be fired,
+   * depending on the value of the "armed" property.
+   */
+  public static final int PRESSED = 4;
+
+  /**
+   * State constant indicating that the mouse is currently positioned over the
+   * button.
+   */
+  public static final int ROLLOVER = 16;
+
+  /**
+   * State constant indicating that the button is selected. This constant is
+   * only meaningful for toggle-type buttons (radio buttons, checkboxes).
+   */
+  public static final int SELECTED = 2;
+
+  /**
+   * Represents the "state properties" (armed, enabled, pressed, rollover and
+   * selected) by a bitwise combination of integer constants.
+   */
+  protected int stateMask = ENABLED;
+
+  /**
+   * List of ItemListeners, ChangeListeners, and ActionListeners registered on
+   * this model.
+   */
+  protected EventListenerList listenerList = new EventListenerList();
+
+  /** The single ChangeEvent this model (re)uses to call its ChangeListeners. */
+  protected ChangeEvent changeEvent = new ChangeEvent(this);
+
+  /**
+   * The group this model belongs to. Only one button in a group may be
+   * selected at any given time.
+   */
+  protected ButtonGroup group;
+
+  /**
+   * The key code (one of {@link java.awt.event.KeyEvent} VK_) used to press
+   * this button via a keyboard interface.
+   */
+  protected int mnemonic = KeyEvent.VK_UNDEFINED;
+
+  /**
+   * The string used as the "command" property of any ActionEvent this model
+   * sends.
+   */
+  protected String actionCommand;
+
+  /**
+   * Creates a new DefaultButtonModel object.
+   */
+  public DefaultButtonModel()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Return <code>null</code>. Use {@link AbstractButton} if you wish to
+   * interface with a button via an {@link ItemSelectable} interface.
+   *
+   * @return <code>null</code>
+   */
+  public Object[] getSelectedObjects()
+  {
+    return null;
+  }
+
+  /**
+   * Returns a specified class of listeners.
+   *
+   * @param listenerType the type of listener to return
+   *
+   * @return array of listeners
+   */
+  public EventListener[] getListeners(Class listenerType)
+  {
+    return listenerList.getListeners(listenerType);
+  }
+
+  /**
+   * Add an ActionListener to the model. Usually only called to subscribe an
+   * AbstractButton's listener to the model.
+   *
+   * @param l The listener to add
+   */
+  public void addActionListener(ActionListener l)
+  {
+    listenerList.add(ActionListener.class, l);
+  }
+
+  /**
+   * Remove an ActionListener to the model. Usually only called to unsubscribe
+   * an AbstractButton's listener to the model.
+   *
+   * @param l The listener to remove
+   */
+  public void removeActionListener(ActionListener l)
+  {
+    listenerList.remove(ActionListener.class, l);
+  }
+
+  /**
+   * Returns all registered <code>ActionListener</code> objects.
+   *
+   * @return array of <code>ActionListener</code> objects
+   */
+  public ActionListener[] getActionListeners()
+  {
+    return (ActionListener[]) listenerList.getListeners(ActionListener.class);
+  }
+
+  /**
+   * Add an ItemListener to the model. Usually only called to subscribe an
+   * AbstractButton's listener to the model.
+   *
+   * @param l The listener to add
+   */
+  public void addItemListener(ItemListener l)
+  {
+    listenerList.add(ItemListener.class, l);
+  }
+
+  /**
+   * Remove an ItemListener to the model. Usually only called to unsubscribe
+   * an AbstractButton's listener to the model.
+   *
+   * @param l The listener to remove
+   */
+  public void removeItemListener(ItemListener l)
+  {
+    listenerList.remove(ItemListener.class, l);
+  }
+
+  /**
+   * Returns all registered <code>ItemListener</code> objects.
+   *
+   * @return array of <code>ItemListener</code> objects
+   */
+  public ItemListener[] getItemListeners()
+  {
+    return (ItemListener[]) listenerList.getListeners(ItemListener.class);
+  }
+
+  /**
+   * Add a ChangeListener to the model. Usually only called to subscribe an
+   * AbstractButton's listener to the model.
+   *
+   * @param l The listener to add
+   */
+  public void addChangeListener(ChangeListener l)
+  {
+    listenerList.add(ChangeListener.class, l);
+  }
+
+  /**
+   * Remove a ChangeListener to the model. Usually only called to unsubscribe
+   * an AbstractButton's listener to the model.
+   *
+   * @param l The listener to remove
+   */
+  public void removeChangeListener(ChangeListener l)
+  {
+    listenerList.remove(ChangeListener.class, l);
+  }
+
+  /**
+   * Returns all registered <code>ChangeListener</code> objects.
+   *
+   * @return array of <code>ChangeListener</code> objects
+   */
+  public ChangeListener[] getChangeListeners()
+  {
+    return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
+  }
+
+  /**
+   * Inform each ItemListener in the {@link #listenerList} that an ItemEvent
+   * has occurred. This happens in response to any change to the {@link
+   * #stateMask} field.
+   *
+   * @param e The ItemEvent to fire
+   */
+  protected void fireItemStateChanged(ItemEvent e)
+  {
+    ItemListener[] ll = getItemListeners();
+
+    for (int i = 0; i < ll.length; i++)
+      ll[i].itemStateChanged(e);
+  }
+
+  /**
+   * Inform each ActionListener in the {@link #listenerList} that an
+   * ActionEvent has occurred. This happens in response to the any change to
+   * the {@link #stateMask} field which makes the enabled, armed and pressed
+   * properties all simultaneously <code>true</code>.
+   *
+   * @param e The ActionEvent to fire
+   */
+  protected void fireActionPerformed(ActionEvent e)
+  {
+    ActionListener[] ll = getActionListeners();
+
+    for (int i = 0; i < ll.length; i++)
+      ll[i].actionPerformed(e);
+  }
+
+  /**
+   * Inform each ChangeListener in the {@link #listenerList} that a ChangeEvent
+   * has occurred. This happens in response to the any change to a property
+   * of the model.
+   */
+  protected void fireStateChanged()
+  {
+    ChangeListener[] ll = getChangeListeners();
+
+    for (int i = 0; i < ll.length; i++)
+      ll[i].stateChanged(changeEvent);
+  }
+
+  /**
+   * Get the value of the model's "armed" property.
+   *
+   * @return The current "armed" property
+   */
+  public boolean isArmed()
+  {
+    return (stateMask & ARMED) == ARMED;
+  }
+
+  /**
+   * Set the value of the model's "armed" property.
+   *
+   * @param a The new "armed" property
+   */
+  public void setArmed(boolean a)
+  {
+    // if this call does not represent a CHANGE in state, then return
+    if ((a && isArmed()) || (!a && !isArmed()))
+      return;
+    
+    // cannot change ARMED state unless button is enabled
+    if (!isEnabled())
+      return;
+
+    // make the change
+    if (a)
+      stateMask = stateMask | ARMED;
+    else
+      stateMask = stateMask & (~ARMED);
+
+    // notify interested ChangeListeners
+    fireStateChanged();
+  }
+
+  /**
+   * Get the value of the model's "enabled" property.
+   *
+   * @return The current "enabled" property.
+   */
+  public boolean isEnabled()
+  {
+    return (stateMask & ENABLED) == ENABLED;
+  }
+
+  /**
+   * Set the value of the model's "enabled" property.
+   *
+   * @param e The new "enabled" property
+   */
+  public void setEnabled(boolean e)
+  {
+    // if this call does not represent a CHANGE in state, then return
+    if ((e && isEnabled()) || (!e && !isEnabled()))
+      return;
+
+    // make the change
+    if (e)
+      stateMask = stateMask | ENABLED;
+    else
+      stateMask = stateMask & (~ENABLED) & (~ARMED) & (~PRESSED);
+
+    // notify interested ChangeListeners
+    fireStateChanged();
+  }
+
+  /**
+   * Set the value of the model's "pressed" property.
+   *
+   * @param p The new "pressed" property
+   */
+  public void setPressed(boolean p)
+  {
+    // if this call does not represent a CHANGE in state, then return
+    if ((p && isPressed()) || (!p && !isPressed()))
+      return;
+
+    // cannot changed PRESSED state unless button is enabled
+    if (!isEnabled())
+      return;
+
+    // make the change
+    if (p)
+      stateMask = stateMask | PRESSED;
+    else
+      stateMask = stateMask & (~PRESSED);
+
+    // if button is armed and was released, fire action event
+    if (!p && isArmed())
+      fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
+                                          actionCommand));
+
+    // notify interested ChangeListeners
+    fireStateChanged();
+  }
+
+  /**
+   * Get the value of the model's "pressed" property.
+   *
+   * @return The current "pressed" property
+   */
+  public boolean isPressed()
+  {
+    return (stateMask & PRESSED) == PRESSED;
+  }
+
+  /**
+   * Set the value of the model's "rollover" property.
+   *
+   * @param r The new "rollover" property
+   */
+  public void setRollover(boolean r)
+  {
+    // if this call does not represent a CHANGE in state, then return
+    if ((r && isRollover()) || (!r && !isRollover()))
+      return;
+    
+    // cannot set ROLLOVER property unless button is enabled
+    if (!isEnabled())
+      return;
+
+    // make the change
+    if (r)
+      stateMask = stateMask | ROLLOVER;
+    else
+      stateMask = stateMask & (~ROLLOVER);
+
+    // notify interested ChangeListeners
+    fireStateChanged();
+  }
+
+  /**
+   * Set the value of the model's "selected" property.
+   *
+   * @param s The new "selected" property
+   */
+  public void setSelected(boolean s)
+  {
+    // if this call does not represent a CHANGE in state, then return
+    if ((s && isSelected()) || (!s && !isSelected()))
+      return;
+    
+    // make the change
+    if (s)
+      stateMask = stateMask | SELECTED;
+    else
+      stateMask = stateMask & (~SELECTED);
+
+    // notify interested ChangeListeners
+    fireStateChanged();
+
+    // fire ItemStateChanged events
+    if (s)
+      {
+        fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+                                           this, ItemEvent.SELECTED));
+        if (group != null)
+          group.setSelected(this, true);
+      }
+    else
+      {
+        fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+                                           this, ItemEvent.DESELECTED));
+        if (group != null)
+          group.setSelected(this, false);
+      }
+  }
+
+  /**
+   * Get the value of the model's "selected" property.
+   *
+   * @return The current "selected" property
+   */
+  public boolean isSelected()
+  {
+    return (stateMask & SELECTED) == SELECTED;
+  }
+
+  /**
+   * Get the value of the model's "rollover" property.
+   *
+   * @return The current "rollover" property
+   */
+  public boolean isRollover()
+  {
+    return (stateMask & ROLLOVER) == ROLLOVER;
+  }
+
+  /**
+   * Get the value of the model's "mnemonic" property.
+   *
+   * @return The current "mnemonic" property
+   */
+  public int getMnemonic()
+  {
+    return mnemonic;
+  }
+
+  /**
+   * Set the value of the model's "mnemonic" property.
+   *
+   * @param key The new "mnemonic" property
+   */
+  public void setMnemonic(int key)
+  {
+    if (mnemonic != key)
+      {
+        mnemonic = key;
+        fireStateChanged();
+      }
+  }
+
+  /**
+   * Set the value of the model's "actionCommand" property. This property is
+   * used as the "command" property of the {@link ActionEvent} fired from the
+   * model.
+   *
+   * @param s The new "actionCommand" property.
+   */
+  public void setActionCommand(String s)
+  {
+    if (actionCommand != s)
+      {
+        actionCommand = s;
+        fireStateChanged();
+      }
+  }
+
+  /**
+   * Returns the current value of the model's "actionCommand" property.
+   *
+   * @return The current "actionCommand" property
+   */
+  public String getActionCommand()
+  {
+    return actionCommand;
+  }
+
+  /**
+   * Set the value of the model's "group" property. The model is said to be a
+   * member of the {@link ButtonGroup} held in its "group" property, and only
+   * one model in a given group can have their "selected" property be
+   * <code>true</code> at a time.
+   *
+   * @param g The new "group" property (<code>null</code> permitted).
+   * 
+   * @see #getGroup()
+   */
+  public void setGroup(ButtonGroup g)
+  {
+    group = g;
+  }
+
+  /**
+   * Returns the current value of the model's "group" property.
+   *
+   * @return The value of the "group" property
+   * 
+   * @see #setGroup(ButtonGroup)
+   */
+  public ButtonGroup getGroup()
+  {
+    return group;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultCellEditor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultCellEditor.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultCellEditor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultCellEditor.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,570 @@
+/* DefaultCellEditor.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.MouseEvent;
+import java.io.Serializable;
+import java.util.EventObject;
+
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.event.CellEditorListener;
+import javax.swing.table.TableCellEditor;
+import javax.swing.tree.TreeCellEditor;
+
+/**
+ * The default implementation of {@link TableCellEditor} and
+ * {@link TreeCellEditor}. It provides editor components for
+ * some standard object types.
+ * 
+ * @author Andrew Selkirk
+ * @author Audrius Meskauskas
+ */
+public class DefaultCellEditor
+  extends AbstractCellEditor
+  implements TableCellEditor, TreeCellEditor
+{
+  private static final long serialVersionUID = 3564035141373880027L;
+
+  /**
+   * This changeable module access the editor component in the component
+   * specific way. For instance, to set the value for JTextField, we need to 
+   * call setText(String), and for JCheckBox we need to call 
+   * setSelected(boolean). Each default editor has the component specific
+   * derivative of this class. These derivatives are private inner classes of
+   * the DefaultCellEditor.
+   * 
+   * The editor delegate is also set for the editor component as the action
+   * listener. It listens for the events that indicate that editing has stopped.
+   */
+  protected class EditorDelegate
+    implements ActionListener, ItemListener, Serializable
+  {
+    /**
+     * Use the serial version UID for interoperability.
+     */
+    private static final long serialVersionUID = -1420007406015481933L;
+
+    /**
+     * The object value (updated when getting and setting the value).
+     */
+    protected Object value;
+
+    /**
+     * Constructor EditorDelegate
+     */
+    protected EditorDelegate()
+    {
+      // Nothing to do here.
+    }
+    
+    /**
+     * Set the value for the editor component. This method is normally
+     * overridden to set the value in the way, specific for the text
+     * component, check box or combo box.
+     *
+     * @param aValue the value to set (String, Boolean or Number).
+     */
+    public void setValue(Object aValue)
+    {
+      value = aValue;
+    }
+
+    /**
+     * Get the value for the editor component. This method is normally
+     * overridden to obtain the value in the way, specific for the text
+     * component, check box or combo box.
+     *
+     * @return value the value of the component (String, Boolean or Number).
+     */
+    public Object getCellEditorValue()
+    {
+      return value;
+    } 
+
+    /**
+     * The default method returns true for the {@link MouseEvent} and false 
+     * for any other events.
+     * 
+     * @param event the event to check
+     *
+     * @return true if the passed event is the mouse event and false otherwise.
+     */
+    public boolean isCellEditable(EventObject event)
+    {
+      if (event == null || !(event instanceof MouseEvent) ||
+          (((MouseEvent) event).getClickCount() >= getClickCountToStart()))
+        return true;
+      return false;
+    } // isCellEditable()
+
+    /**
+     * Returns true to indicate that the editing cell can be selected.
+     * 
+     * The default method returns true without action but may be overridden
+     * in derived classes for more specific behavior.
+     * 
+     * @param event unused in default method
+     *
+     * @return true always
+     */
+    public boolean shouldSelectCell(EventObject event)
+    {
+      // return true to indicate that the editing cell may be selected
+      return true;
+    }
+
+    /**
+     * Finish the cell editing session. This method notifies the registered
+     * cell editor listeners (including the table) that the editing has been
+     * stopped. 
+     * 
+     * @return boolean
+     */
+    public boolean stopCellEditing()
+    {
+      fireEditingStopped();
+      return true;
+    } // stopCellEditing()
+
+    /**
+     * Cancel the cell editing session. This method notifies the registered
+     * cell editor listeners (including the table) that the editing has been
+     * canceled.
+     */
+    public void cancelCellEditing()
+    {
+      fireEditingCanceled();
+    } // cancelCellEditing()
+
+    /**
+     * Start editing session and returns true to indicate the editing has begun.
+     * The default method returns true without action but may be overridden
+     * in derived classes for more specific behavior.
+     * 
+     * @param event  the event.
+     * 
+     * @return true, always
+     */
+    public boolean startCellEditing(EventObject event)
+    {
+      // return true to indicate that editing has begun
+      return true;
+    } // startCellEditing()
+
+    /**
+     * This event is fired by the editor component (for instance, by pressing
+     * ENTER in the {@link JTextField}. The default method delegates call to
+     * the {@link #stopCellEditing}, finishing the editing session. 
+     * 
+     * @param event unused in default method
+     */
+    public void actionPerformed(ActionEvent event)
+    {
+      stopCellEditing();
+    } // actionPerformed()
+
+    /**
+     * This event is fired by the editor component.The default method delegates
+     * call to the {@link #stopCellEditing}, finishing the editing session. 
+     * 
+     * @param event unused in default method
+     */
+    public void itemStateChanged(ItemEvent event)
+    {
+      stopCellEditing();
+    } // itemStateChanged()
+
+    /**
+     * Notify the registered listeners (including the table) that the editing
+     * has been completed.
+     */
+    void fireEditingStopped()
+    {
+      CellEditorListener[] listeners = getCellEditorListeners();
+      for (int index = 0; index < listeners.length; index++)
+        listeners[index].editingStopped(changeEvent);
+      
+    }
+    
+    /**
+     * Notify the registered listeners (including the table) that the editing
+     * has been canceled.
+     */
+    void fireEditingCanceled()
+    {
+      CellEditorListener[] listeners = getCellEditorListeners();
+      for (int index = 0; index < listeners.length; index++)
+        listeners[index].editingCanceled(changeEvent);
+    }
+  } // EditorDelegate
+  
+  /**
+   * Provides getter and setter methods to work with the text component.
+   * 
+   * @author Audrius Meskauskas (audriusa at Bioinformatics.org)
+   */
+  private class JTextFieldDelegate extends EditorDelegate
+  {
+    /**
+     * Use the serial version UID for interoperability.
+     */
+    private static final long serialVersionUID = 1;
+    
+    /**
+     * Set the value for the editor component.
+     *
+     * @param aValue the value to set (toString() will be called).
+     */
+    public void setValue(Object aValue)
+    {
+      value = aValue;
+      JTextField f = (JTextField) editorComponent;
+      if (value == null)
+        f.setText("");
+      else
+        f.setText(value.toString());
+    }
+
+    /**
+     * Get the value for the editor component. 
+     *
+     * @return value the value of the component (String)
+     */
+    public Object getCellEditorValue()
+    {
+      JTextField f = (JTextField) editorComponent;
+      return value = f.getText();      
+    }     
+  }
+
+  /**
+   * Provides getter and setter methods to work with the combo box.
+   * 
+   * @author Audrius Meskauskas (audriusa at Bioinformatics.org) 
+   */
+  private class JComboBoxDelegate extends EditorDelegate
+  {
+    /**
+     * Use the serial version UID for interoperability.
+     */
+    private static final long serialVersionUID = 1;
+    
+    /**
+     * Set the value for the editor component.
+     *
+     * @param aValue the value to set.
+     */
+    public void setValue(Object aValue)
+    {
+      value = aValue;      
+      JComboBox c = (JComboBox) editorComponent;
+      if (value != null)
+        c.setSelectedItem(value);
+    }
+
+    /**
+     * Get the value for the editor component. 
+     *
+     * @return value the value of the component (as String)
+     */
+    public Object getCellEditorValue()
+    {
+      JComboBox c = (JComboBox) editorComponent;
+      return value = c.getSelectedItem();
+    } 
+    
+    /**
+     * Returns true to indicate that the editing cell can be selected. If the
+     * check box is not editable, expands it. If it is editable, brings
+     * focus to the editor field.
+     * 
+     * @param event unused in default method
+     *
+     * @return true always
+     */
+    public boolean shouldSelectCell(EventObject event)
+    {
+      JComboBox c = (JComboBox) editorComponent;
+      if (!c.isEditable)
+        c.showPopup();
+      return true;
+    }    
+  }
+
+  /**
+   * Provides getter and setter methods to work with the check box.
+   * 
+   * @author Audrius Meskauskas (audriusa at Bioinformatics.org) 
+   */
+  private class JCheckBoxDelegate extends EditorDelegate
+  {
+    /**
+     * Use the serial version UID for interoperability.
+     */
+    private static final long serialVersionUID = 1;
+    
+    /**
+     * Set the value for the editor component.
+     *
+     * @param value the value to set (must be Boolean).
+     */
+    public void setValue(Object value)
+    {
+      JCheckBox c = (JCheckBox) editorComponent;
+      
+      if (value == null)
+        c.setSelected(false);
+      else
+        c.setSelected( ((Boolean) value).booleanValue());
+    }
+
+    /**
+     * Get the value for the editor component. 
+     *
+     * @return value the value of the component (must be CharSequence)
+     */
+    public Object getCellEditorValue()
+    {
+      JCheckBox c = (JCheckBox) editorComponent;
+      value = c.isSelected() ? Boolean.TRUE : Boolean.FALSE;
+      return value;
+    }     
+  }
+  
+  /**
+   * The Swing JComponent, performing the editing session.
+   */
+  protected JComponent editorComponent;
+
+  /**
+   * The editor delegate, responsible for listening the {@link #editorComponent}
+   * events and getting/setting its value.
+   */
+  protected EditorDelegate delegate;
+
+  /**
+   * The number of the mouse clicks, required to start the editing session.
+   */
+  protected int clickCountToStart;
+
+  /**
+   * Create the DefaultCellEditor that uses the text field as its editor
+   * component (appropriate for the text content)
+   * 
+   * @param textfield the text field as will be used as the editor component
+   */
+  public DefaultCellEditor(JTextField textfield)
+  {
+    editorComponent = textfield;
+    clickCountToStart = 2;
+    delegate = new JTextFieldDelegate();
+    textfield.addActionListener(delegate);
+  } // DefaultCellEditor()
+
+  /**
+   * Constructor DefaultCellEditor that uses the checkbox (appropriate
+   * for boolean values)
+   * 
+   * @param checkbox the checkbox that will be used with this editor.
+   */
+  public DefaultCellEditor(JCheckBox checkbox)
+  {
+    editorComponent = checkbox;
+    clickCountToStart = 1;
+    delegate = new JCheckBoxDelegate();
+    checkbox.addActionListener(delegate);
+  } // DefaultCellEditor()
+
+  /**
+   * Constructor DefaultCellEditor that uses the combo box.
+   * 
+   * @param combobox the combo box that will be used with this editor.
+   */
+  public DefaultCellEditor(JComboBox combobox)
+  {
+    editorComponent = combobox;
+    clickCountToStart = 1;
+    delegate = new JComboBoxDelegate();
+    combobox.addActionListener(delegate);
+  } // DefaultCellEditor()
+
+  /**
+   * Get the component that performs the editing sessions. It is the same 
+   * component that was passed in constructor.
+   * 
+   * @return the component, performing the editing sessions. 
+   */
+  public Component getComponent()
+  {
+    return editorComponent; 
+  } // getComponent()
+
+  /**
+   * Get the number of mouse clicks, required to start the editing session.
+   * 
+   * @return int the number of mouse clicks, required to start the session
+   */
+  public int getClickCountToStart()
+  {
+    return clickCountToStart;
+  } // getClickCountToStart()
+
+  /**
+   * Set the number of mouse clicks, required to start the editing session.
+   * 
+   * @param count the number of clicks, required to start the session
+   */
+  public void setClickCountToStart(int count)
+  {
+    clickCountToStart = count;
+  } // setClickCountToStart()
+
+  /**
+   * Get the value, currently being displayed by the editor component. The 
+   * call is forwarded to the {@link #delegate}.
+   * 
+   * @return Object the value (class depends on the editor component)
+   */
+  public Object getCellEditorValue()
+  {
+    return delegate.getCellEditorValue();
+  } // getCellEditorValue()
+
+  /**
+   * Forwards call to the {@link #delegate}.
+   * 
+   * @param event forwarded to the delegate.
+   *
+   * @return boolean returned by delegate
+   */
+  public boolean isCellEditable(EventObject event)
+  {
+    return delegate.isCellEditable(event);
+  } // isCellEditable()
+
+  /**
+   * Forwards call to the {@link #delegate}.
+   * 
+   * @param event forwarded to the delegate.
+   *
+   * @return boolean returned by delegate
+   */
+  public boolean shouldSelectCell(EventObject event)
+  {
+    return delegate.shouldSelectCell(event);
+  } // shouldSelectCell()
+
+  /**
+   * Forwards call to the {@link #delegate}.
+   * 
+   * @return boolean returned by delegate
+   */
+  public boolean stopCellEditing()
+  {
+    return delegate.stopCellEditing();
+  } // stopCellEditing()
+
+  /**
+   * Forwards call to the {@link #delegate}.
+   */
+  public void cancelCellEditing()
+  {
+    delegate.cancelCellEditing();
+  } // cancelCellEditing()
+
+  /**
+   * Sets an initial value for the editor. 
+   * This will cause the editor to stopEditing and lose any partially 
+   * edited value if the editor is editing when this method is called.
+   * Returns the component that should be added to the client's Component 
+   * hierarchy. Once installed in the client's hierarchy this component will 
+   * then be able to draw and receive user input. 
+   * 
+   * @param tree - the JTree that is asking the editor to edit; this 
+   * parameter can be null
+   * @param value - the value of the cell to be edited
+   * @param isSelected - true is the cell is to be renderer with selection
+   * highlighting
+   * @param expanded - true if the node is expanded
+   * @param leaf - true if the node is a leaf node
+   * @param row - the row index of the node being edited
+   *
+   * @return Component the component for editing
+   */
+  public Component getTreeCellEditorComponent(JTree tree, Object value,
+                                              boolean isSelected,
+                                              boolean expanded, boolean leaf,
+                                              int row)
+  {
+    delegate.setValue(value);
+    return editorComponent;
+  } // getTreeCellEditorComponent()
+
+  /**
+   * Get the cell editor component that will perform the editing session. If
+   * returned once, the same component is also returned on the repetetive calls
+   * again (reused).
+   * 
+   * @param table the table where the editing is performed
+   * @param value the current value of the table. It is set as the initial 
+   *        component value.
+   * @param isSelected if true, the cell is currently selected
+   * @param row the row of the cell being edited
+   * @param column the column of the cell being edited
+   * 
+   * @return Component the component that will perform the editing session
+   */
+  public Component getTableCellEditorComponent(JTable table, Object value,
+                                               boolean isSelected, int row,
+                                               int column)
+  {
+    // NOTE: as specified by Sun, we don't call new() everytime, we return 
+    // editorComponent on each call to getTableCellEditorComponent or
+    // getTreeCellEditorComponent.
+    delegate.setValue(value);
+    return editorComponent;
+  } // getTableCellEditorComponent()
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultComboBoxModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultComboBoxModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultComboBoxModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultComboBoxModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,278 @@
+/* DefaultComboBoxModel.java --
+   Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.Vector;
+
+import javax.swing.event.ListDataEvent;
+
+
+/**
+ * A model that stores a list of elements and a selected item (which may be
+ * <code>null</code>).  Changes to the model are signalled to listeners using
+ * {@link ListDataEvent}.  This model is designed for use by the
+ * {@link JComboBox} component.
+ *
+ * @author Andrew Selkirk
+ * @author Olga Rodimina
+ * @author Robert Schuster
+ */
+public class DefaultComboBoxModel extends AbstractListModel
+  implements MutableComboBoxModel, Serializable
+{
+  private static final long serialVersionUID = 6698657703676921904L;
+
+  /**
+   * Storage for the elements in the model's list.
+   */
+  private Vector list;
+
+  /**
+   * The selected item (<code>null</code> indicates no selection).
+   */
+  private Object selectedItem = null;
+
+  /**
+   * Creates a new model, initially empty.
+   */
+  public DefaultComboBoxModel()
+  {
+    list = new Vector();
+  }
+
+  /**
+   * Creates a new model and initializes its item list to the values in the 
+   * given array.  The selected item is set to the first item in the array, or 
+   * <code>null</code> if the array length is zero.
+   *
+   * @param items  an array containing items for the model (<code>null</code>
+   *               not permitted).
+   * 
+   * @throws NullPointerException if <code>items</code> is <code>null</code>.
+   */
+  public DefaultComboBoxModel(Object[] items)
+  {
+    list = new Vector(Arrays.asList(items));
+    if (list.size() > 0)
+      selectedItem = list.get(0);
+  }
+
+  /**
+   * Creates a new model and initializes its item list to the values in the 
+   * given vector.  The selected item is set to the first item in the vector, 
+   * or <code>null</code> if the vector length is zero.
+   *
+   * @param vector  a vector containing items for the model (<code>null</code>
+   *                not permitted).
+   * 
+   * @throws NullPointerException if <code>vector</code> is <code>null</code>.
+   */
+  public DefaultComboBoxModel(Vector vector)
+  {
+    this.list = vector;
+    if (getSize() > 0)
+      selectedItem = vector.get(0);
+  }
+
+  /**
+   * Adds an element to the model's item list and sends a {@link ListDataEvent}
+   * to all registered listeners.  If the new element is the first item added
+   * to the list, and the selected item is <code>null</code>, the new element 
+   * is set as the selected item.
+   *
+   * @param object item to add to the model's item list.
+   */
+  public void addElement(Object object)
+  {
+    list.addElement(object);
+    int index = list.size() - 1;
+    fireIntervalAdded(this, index, index);
+    if (list.size() == 1 && selectedItem == null)
+      setSelectedItem(object);
+  }
+
+  /**
+   * Removes the element at the specified index from the model's item list
+   * and sends a {@link ListDataEvent} to all registered listeners.  If the
+   * element removed was the selected item, then the preceding element becomes 
+   * the new selected item (or the next element, if there is no preceding 
+   * element).
+   *
+   * @param index  the index of the item to remove.
+   * 
+   * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of
+   *         bounds.
+   */
+  public void removeElementAt(int index)
+  {
+    int selected = getIndexOf(selectedItem);
+    if (selected == index) // choose a new selected item
+      {
+        if (selected > 0)
+          setSelectedItem(getElementAt(selected - 1));
+        else 
+          setSelectedItem(getElementAt(selected + 1));
+      }
+    list.removeElementAt(index);
+    fireIntervalRemoved(this, index, index);
+  }
+
+  /**
+   * Adds an element at the specified index in the model's item list
+   * and sends a {@link ListDataEvent} to all registered listeners.
+   *
+   * @param object element to insert
+   * @param index index specifing position in the list where given element
+   *        should be inserted.
+   * 
+   * @throws ArrayIndexOutOfBoundsException if <code>index</code> is out of 
+   *         bounds.
+   * 
+   * @see #addElement(Object)
+   */
+  public void insertElementAt(Object object, int index)
+  {
+    list.insertElementAt(object, index);
+    fireIntervalAdded(this, index, index);
+  }
+
+  /**
+   * Removes an element from the model's item list and sends a 
+   * {@link ListDataEvent} to all registered listeners.  If the item to be
+   * removed is the current selected item, a new selected item will be set.
+   * If the element is not found in the model's item list, this method does
+   * nothing.
+   *
+   * @param object  the element to remove.
+   */
+  public void removeElement(Object object)
+  {
+    int index = getIndexOf(object);
+    if (index != -1)
+      removeElementAt(index);
+  }
+
+  /**
+   * Removes all the items from the model's item list, resets and selected item
+   * to <code>null</code>, and sends a {@link ListDataEvent} to all registered 
+   * listeners.
+   */
+  public void removeAllElements()
+  {
+    selectedItem = null;
+    int size = getSize();
+    if (size > 0)
+      {
+        list.clear();
+        fireIntervalRemoved(this, 0, size - 1);
+      }
+  }
+
+  /**
+   * Returns the number of items in the model's item list.
+   *
+   * @return The number of items in the model's item list.
+   */
+  public int getSize()
+  {
+    return list.size();
+  }
+
+  /**
+   * Sets the selected item for the model and sends a {@link ListDataEvent} to
+   * all registered listeners.  The start and end index of the event is set to 
+   * -1 to indicate the model's selection has changed, and not its contents.
+   *
+   * @param object  the new selected item (<code>null</code> permitted).
+   */
+  public void setSelectedItem(Object object)
+  {
+    if (selectedItem == null)
+      {
+        if (object == null)
+          return;
+      }
+    else
+      {
+        if (selectedItem.equals(object))
+          return;
+      }
+    selectedItem = object;
+    fireContentsChanged(this, -1, -1);    
+  }
+
+  /**
+   * Returns the selected item.
+   *
+   * @return The selected item (possibly <code>null</code>).
+   */
+  public Object getSelectedItem()
+  {
+    return selectedItem;
+  }
+
+  /**
+   * Returns the element at the specified index in the model's item list.
+   *
+   * @param index  the element index.
+   *
+   * @return The element at the specified index in the model's item list, or
+   *         <code>null</code> if the <code>index</code> is outside the bounds
+   *         of the list.
+   */
+  public Object getElementAt(int index)
+  {
+    if (index < 0 || index >= list.size())
+      return null;
+    return list.elementAt(index);
+  }
+
+  /**
+   * Returns the index of the specified element in the model's item list.
+   *
+   * @param object  the element.
+   *
+   * @return The index of the specified element in the model's item list.
+   */
+  public int getIndexOf(Object object)
+  {
+    return list.indexOf(object);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultDesktopManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultDesktopManager.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultDesktopManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultDesktopManager.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,630 @@
+/* DefaultDesktopManager.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.Rectangle;
+import java.beans.PropertyVetoException;
+import java.io.Serializable;
+
+import javax.swing.JInternalFrame.JDesktopIcon;
+
+/**
+ * The default implementation of DesktopManager for
+ * Swing. It implements the basic beaviours for JInternalFrames in arbitrary
+ * parents. The methods provided by the class are not meant to be called by
+ * the user, instead, the JInternalFrame methods will call these methods.
+ */
+public class DefaultDesktopManager implements DesktopManager, Serializable
+{
+  /** DOCUMENT ME! */
+  private static final long serialVersionUID = 4657624909838017887L;
+
+  /** The property change event fired when the wasIcon property changes. */
+  static final String WAS_ICON_ONCE_PROPERTY = "wasIconOnce";
+
+  /**
+   * The method of dragging used by the JDesktopPane that parents the
+   * JInternalFrame that is being dragged.
+   */
+  private int currentDragMode = 0;
+
+  /**
+   * The cache of the bounds used to draw the outline rectangle when
+   * OUTLINE_DRAG_MODE is used.
+   */
+  private transient Rectangle dragCache = new Rectangle();
+
+  /**
+   * A cached JDesktopPane that is stored when the JInternalFrame is initially
+   * dragged.
+   */
+  private transient Container pane;
+
+  /**
+   * An array of Rectangles that holds the bounds of the JDesktopIcons in the
+   * JDesktopPane when looking for where to place a new icon.
+   */
+  private transient Rectangle[] iconRects;
+
+  /**
+   * This creates a new DefaultDesktopManager object.
+   */
+  public DefaultDesktopManager()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * This method is not normally called since the user will typically add the
+   * JInternalFrame to a Container. If this is called, it will try to
+   * determine the parent of the JInternalFrame and remove any icon that
+   * represents this JInternalFrame and add this JInternalFrame.
+   *
+   * @param frame The JInternalFrame to open.
+   */
+  public void openFrame(JInternalFrame frame)
+  {
+    Container c = frame.getParent();
+    if (c == null)
+      c = frame.getDesktopIcon().getParent();
+    if (c == null)
+      return;
+
+    c.remove(frame.getDesktopIcon());
+    c.add(frame);
+    frame.setVisible(true);
+  }
+
+  /**
+   * This method removes the JInternalFrame and JDesktopIcon (if one is
+   * present) from their parents.
+   *
+   * @param frame The JInternalFrame to close.
+   */
+  public void closeFrame(JInternalFrame frame)
+  {
+    Container c = frame.getParent();
+    if (c != null)
+      {
+	if (frame.isIcon())
+	  c.remove(frame.getDesktopIcon());
+	else
+	  c.remove(frame);
+	c.repaint();
+      }
+  }
+
+  /**
+   * This method resizes the JInternalFrame to match its parent's bounds.
+   *
+   * @param frame The JInternalFrame to maximize.
+   */
+  public void maximizeFrame(JInternalFrame frame)
+  {
+    // Can't maximize from iconified state.
+    // It can only return to maximized state, but that would fall under
+    // deiconify.
+    if (frame.isIcon())
+      return;
+    frame.setNormalBounds(frame.getBounds());
+
+    Container p = frame.getParent();
+    if (p != null)
+      {
+	Rectangle pBounds = p.getBounds();
+	Insets insets = p.getInsets();
+	pBounds.width -= insets.left + insets.right;
+	pBounds.height -= insets.top + insets.bottom;
+
+	setBoundsForFrame(frame, 0, 0, pBounds.width, pBounds.height);
+      }
+    if (p instanceof JDesktopPane)
+      ((JDesktopPane) p).setSelectedFrame(frame);
+    else
+      {
+	try
+	  {
+	    frame.setSelected(true);
+	  }
+	catch (PropertyVetoException e)
+	  {
+	    // Do nothing.
+	  }
+      }
+  }
+
+  /**
+   * This method restores the JInternalFrame's bounds to what they were
+   * previous to the setMaximize call.
+   *
+   * @param frame The JInternalFrame to minimize.
+   */
+  public void minimizeFrame(JInternalFrame frame)
+  {
+    Rectangle normalBounds = frame.getNormalBounds();
+
+    JDesktopPane p = frame.getDesktopPane();
+    if (p != null)
+      p.setSelectedFrame(frame);
+    else
+      {
+        try
+          {
+            frame.setSelected(true);
+          }
+        catch (PropertyVetoException e)
+          {
+            // Do nothing.
+          }
+      }
+
+    setBoundsForFrame(frame, normalBounds.x, normalBounds.y,
+                      normalBounds.width, normalBounds.height);
+  }
+
+  /**
+   * This method removes the JInternalFrame from its parent and adds its
+   * JDesktopIcon representation.
+   *
+   * @param frame The JInternalFrame to iconify.
+   */
+  public void iconifyFrame(JInternalFrame frame)
+  {
+    JDesktopPane p = frame.getDesktopPane();
+    JDesktopIcon icon = frame.getDesktopIcon();
+    if (p != null && p.getSelectedFrame() == frame)
+      p.setSelectedFrame(null);
+    else
+      {
+        try
+          {
+            frame.setSelected(false);
+          }
+        catch (PropertyVetoException e)
+          {
+            // Do nothing if attempt is vetoed.
+          }
+      }
+
+    Container c = frame.getParent();
+
+    if (!wasIcon(frame))
+      {
+        Rectangle r = getBoundsForIconOf(frame);
+        icon.setBounds(r);
+        setWasIcon(frame, Boolean.TRUE);
+      }
+
+    if (c != null)
+      {
+        if (icon != null)
+          {
+            c.add(icon);
+            icon.setVisible(true);
+          }
+        Rectangle b = frame.getBounds();
+        c.remove(frame);
+        c.repaint(b.x, b.y, b.width, b.height);
+      }
+  }
+
+  /**
+   * This method removes the JInternalFrame's JDesktopIcon representation and
+   * adds the JInternalFrame back to its parent.
+   *
+   * @param frame The JInternalFrame to deiconify.
+   */
+  public void deiconifyFrame(JInternalFrame frame)
+  {
+    JDesktopIcon icon = frame.getDesktopIcon();
+    Container c = icon.getParent();
+
+    removeIconFor(frame);
+    c.add(frame);
+    frame.setVisible(true);
+
+    if (!frame.isSelected())
+      {
+        JDesktopPane p = frame.getDesktopPane();
+        if (p != null)
+          p.setSelectedFrame(frame);
+        else
+          {
+            try
+              {
+                frame.setSelected(true);
+              }
+            catch (PropertyVetoException e)
+              {
+                // Do nothing.
+              }
+          }
+      }
+
+    c.invalidate();
+  }
+
+  /**
+   * This method activates the JInternalFrame by moving it to the front and
+   * selecting it.
+   *
+   * @param frame The JInternalFrame to activate.
+   */
+  public void activateFrame(JInternalFrame frame)
+  {
+    JDesktopPane p = frame.getDesktopPane();
+
+    if (p != null)
+      p.setSelectedFrame(frame);
+    else
+      {
+        try
+          {
+            frame.setSelected(true);
+          }
+        catch (PropertyVetoException e)
+          {
+            // Do nothing if attempt is vetoed.
+          }
+      }
+
+    frame.toFront();
+  }
+
+  /**
+   * This method is called when the JInternalFrame loses focus.
+   *
+   * @param frame The JInternalFram to deactivate.
+   */
+  public void deactivateFrame(JInternalFrame frame)
+  {
+    JDesktopPane p = frame.getDesktopPane();
+    if (p != null)
+      {
+        if (p.getSelectedFrame() == frame)
+          p.setSelectedFrame(null);
+      }
+    else
+      {
+        try
+          {
+            frame.setSelected(false);
+          }
+        catch (PropertyVetoException e)
+          {
+            // Do nothing if attempt is vetoed.
+          }
+      }
+  }
+
+  /**
+   * This method is called to indicate that the DesktopManager should prepare
+   * to drag the JInternalFrame. Any state information needed to drag the
+   * frame will be prepared now.
+   *
+   * @param component The JComponent to drag, usually a JInternalFrame.
+   */
+  public void beginDraggingFrame(JComponent component)
+  {
+    if (component instanceof JDesktopIcon)
+      pane = ((JDesktopIcon) component).getInternalFrame().getDesktopPane();
+    else
+      pane = ((JInternalFrame) component).getDesktopPane();
+    if (pane == null)
+      return;
+
+    dragCache = component.getBounds();
+
+    if (! (pane instanceof JDesktopPane))
+      currentDragMode = JDesktopPane.LIVE_DRAG_MODE;
+    else
+      currentDragMode = ((JDesktopPane) pane).getDragMode();
+  }
+
+  /**
+   * This method is called to drag the JInternalFrame to a new location.
+   *
+   * @param component The JComponent to drag, usually a JInternalFrame.
+   *
+   * @param newX The new x coordinate.
+   * @param newY The new y coordinate.
+   */
+  public void dragFrame(JComponent component, int newX, int newY)
+  {
+    if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
+      {
+        // FIXME: Do outline drag mode painting.
+      }
+    else
+      {
+        Rectangle b = component.getBounds();
+        if (component instanceof JDesktopIcon)
+          component.setBounds(newX, newY, b.width, b.height);
+        else
+          setBoundsForFrame((JInternalFrame) component, newX, newY, b.width,
+                            b.height);
+      }
+  }
+
+  /**
+   * This method indicates that the dragging is done. Any state information
+   * stored by the DesktopManager can be cleared.
+   *
+   * @param component The JComponent that has finished dragging.
+   */
+  public void endDraggingFrame(JComponent component)
+  {
+    if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
+      {
+        setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y,
+                          dragCache.width, dragCache.height);
+        pane = null;
+        dragCache = null;
+        component.repaint();        
+      }
+  }
+
+  /**
+   * This method is called to indicate that the given JComponent will be
+   * resized. Any state information necessary to resize the JComponent will
+   * be prepared now.
+   *
+   * @param component The JComponent to resize, usually a JInternalFrame.
+   * @param direction The direction to drag in (a SwingConstant).
+   */
+  public void beginResizingFrame(JComponent component, int direction)
+  {
+    pane = ((JInternalFrame) component).getDesktopPane();
+    if (pane == null)
+      return;
+
+    dragCache = component.getBounds();
+    if (! (pane instanceof JDesktopPane))
+      currentDragMode = JDesktopPane.LIVE_DRAG_MODE;
+    else
+      currentDragMode = ((JDesktopPane) pane).getDragMode();
+  }
+
+  /**
+   * This method resizes the give JComponent.
+   *
+   * @param component The JComponent to resize.
+   * @param newX The new x coordinate.
+   * @param newY The new y coordinate.
+   * @param newWidth The new width.
+   * @param newHeight The new height.
+   */
+  public void resizeFrame(JComponent component, int newX, int newY,
+                          int newWidth, int newHeight)
+  {
+    dragCache.setBounds(newX, newY, newWidth, newHeight);
+
+    if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
+      {
+        // FIXME: Do outline drag painting.
+      }
+    else
+      setBoundsForFrame(component, dragCache.x, dragCache.y, dragCache.width,
+                        dragCache.height);
+  }
+
+  /**
+   * This method is called to indicate that the given JComponent has finished
+   * dragging. Any state information stored by the DesktopManager can be
+   * cleared.
+   *
+   * @param component The JComponent that finished resizing.
+   */
+  public void endResizingFrame(JComponent component)
+  {
+    if (currentDragMode == JDesktopPane.OUTLINE_DRAG_MODE)
+      {
+        setBoundsForFrame((JInternalFrame) component, dragCache.x, dragCache.y,
+                          dragCache.width, dragCache.height);
+        pane = null;
+        dragCache = null;
+        component.repaint();        
+      }
+  }
+
+  /**
+   * This method calls setBounds with the given parameters and repaints the
+   * JComponent.
+   *
+   * @param component The JComponent to set bounds for.
+   * @param newX The new x coordinate.
+   * @param newY The new y coordinate.
+   * @param newWidth The new width.
+   * @param newHeight The new height.
+   */
+  public void setBoundsForFrame(JComponent component, int newX, int newY,
+                                int newWidth, int newHeight)
+  {
+    component.setBounds(newX, newY, newWidth, newHeight);
+  }
+
+  /**
+   * This is a helper method that removes the JDesktopIcon of the given
+   * JInternalFrame from the parent.
+   *
+   * @param frame The JInternalFrame to remove an icon for.
+   */
+  protected void removeIconFor(JInternalFrame frame)
+  {
+    JDesktopIcon icon = frame.getDesktopIcon();
+    Container c = icon.getParent();
+    if (c != null && icon != null)
+      {
+        Rectangle b = icon.getBounds();
+        c.remove(icon);
+        c.repaint(b.x, b.y, b.width, b.height);
+      }
+  }
+
+  /**
+   * This method is called by iconifyFrame to determine the bounds of the
+   * JDesktopIcon for the given JInternalFrame.
+   *
+   * @param frame The JInternalFrame to find the bounds of its JDesktopIcon
+   *        for.
+   *
+   * @return The bounds of the JDesktopIcon.
+   */
+  protected Rectangle getBoundsForIconOf(JInternalFrame frame)
+  {
+    // IconRects has no order to it.
+    // The icon _must_ be placed in the first free slot (working from 
+    // the bottom left corner)
+    // The icon also must not be placed where another icon is placed 
+    // (regardless whether that frame is an icon currently or not)
+    JDesktopPane desktopPane = frame.getDesktopPane();
+
+    if (desktopPane == null)
+      return frame.getDesktopIcon().getBounds();
+
+    Rectangle paneBounds = desktopPane.getBounds();
+    Insets insets = desktopPane.getInsets();
+    Dimension pref = frame.getDesktopIcon().getPreferredSize();
+
+    Component[] frames = desktopPane.getComponents();
+
+    int count = 0;
+    for (int i = 0, j = 0; i < frames.length; i++)
+      if (frames[i] instanceof JDesktopIcon
+          || frames[i] instanceof JInternalFrame
+          && ((JInternalFrame) frames[i]).getWasIcon() && frames[i] != frame)
+	count++;
+    iconRects = new Rectangle[count];
+    for (int i = 0, j = 0; i < frames.length; i++)
+      if (frames[i] instanceof JDesktopIcon)
+        iconRects[--count] = frames[i].getBounds();
+      else if (frames[i] instanceof JInternalFrame
+               && ((JInternalFrame) frames[i]).getWasIcon()
+               && frames[i] != frame)
+        iconRects[--count] = ((JInternalFrame) frames[i])
+                                                 .getDesktopIcon().getBounds();
+
+    int startingX = insets.left;
+    int startingY = paneBounds.height - insets.bottom - pref.height;
+    Rectangle ideal = new Rectangle(startingX, startingY, pref.width,
+                                    pref.height);
+    boolean clear = true;
+
+    while (iconRects.length > 0)
+      {
+        clear = true;
+        for (int i = 0; i < iconRects.length; i++)
+          {
+            if (iconRects[i] != null && iconRects[i].intersects(ideal))
+              {
+                clear = false;
+                break;
+              }
+          }
+        if (clear)
+          return ideal;
+
+        startingX += pref.width;
+        if (startingX + pref.width > paneBounds.width - insets.right)
+          {
+            startingX = insets.left;
+            startingY -= pref.height;
+          }
+        ideal.setBounds(startingX, startingY, pref.width, pref.height);
+      }
+
+    return ideal;
+  }
+
+  /**
+   * This method sets the bounds of the JInternalFrame right before the
+   * maximizeFrame call.
+   *
+   * @param frame The JInternalFrame being maximized.
+   * @param rect The normal bounds.
+   */
+  protected void setPreviousBounds(JInternalFrame frame, Rectangle rect)
+  {
+    frame.setNormalBounds(rect);
+  }
+
+  /**
+   * This method returns the normal bounds of the JInternalFrame from before
+   * the maximize call.
+   *
+   * @param frame The JInternalFrame that is being restored.
+   *
+   * @return The previous bounds of the JInternalFrame.
+   */
+  protected Rectangle getPreviousBounds(JInternalFrame frame)
+  {
+    return frame.getNormalBounds();
+  }
+
+  /**
+   * This method sets the value to true if the given JInternalFrame has been
+   * iconized and the bounds of its DesktopIcon are valid.
+   *
+   * @param frame The JInternalFrame for the JDesktopIcon.
+   * @param value True if the JInternalFrame has been iconized and the bounds
+   *        of the JDesktopIcon are valid.
+   */
+  protected void setWasIcon(JInternalFrame frame, Boolean value)
+  {
+    frame.setWasIcon(value.booleanValue(), WAS_ICON_ONCE_PROPERTY);
+  }
+
+  /**
+   * This method returns true if the given JInternalFrame has been iconized
+   * and the bounds of its DesktopIcon are valid.
+   *
+   * @param frame The JInternalFrame for the JDesktopIcon.
+   *
+   * @return True if the given JInternalFrame has been iconized and the bounds
+   *         of its DesktopIcon are valid.
+   */
+  protected boolean wasIcon(JInternalFrame frame)
+  {
+    return frame.getWasIcon();
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultFocusManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultFocusManager.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultFocusManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultFocusManager.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,169 @@
+/* DefaultFocusManager.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.event.KeyEvent;
+import java.util.Stack;
+
+/**
+ * This class has been obsoleted by the new
+ * {@link java.awt.KeyboardFocusManager} and
+ * {@link java.awt.DefaultKeyboardFocusManager} API.
+ *
+ * @author Andrew Selkirk
+ */
+public class DefaultFocusManager extends FocusManager 
+{
+
+  /**
+   * historyStack
+   */
+  private Stack historyStack;
+
+  /**
+   * Constructor DefaultFocusManager
+   */
+  public DefaultFocusManager()
+  {
+    // TODO
+  } // DefaultFocusManager()
+
+	/**
+   * processKeyEvent
+   * 
+   * @param component
+   *          TODO
+   * @param event
+   *          TODO
+   */
+  public void processKeyEvent(Component component, KeyEvent event)
+  {
+    // TODO
+  } // processKeyEvent()
+
+  /**
+   * focusNextComponent
+   * 
+   * @param component
+   *          TODO
+   */
+  public void focusNextComponent(Component component)
+  {
+    // TODO
+  } // focusNextComponent()
+
+  /**
+   * focusPreviousComponent
+   * 
+   * @param component
+   *          TODO
+   */
+  public void focusPreviousComponent(Component component)
+  {
+    // TODO
+  } // focusPreviousComponent()
+
+  /**
+   * getFirstComponent
+   * 
+   * @param container
+   *          TODO
+   * @return Component
+   */
+  public Component getFirstComponent(Container container)
+  {
+    return null; // TODO
+  } // getFirstComponent()
+
+  /**
+   * getLastComponent
+   * 
+   * @param container
+   *          TODO
+   * @return Component
+   */
+  public Component getLastComponent(Container container)
+  {
+    return null; // TODO
+  } // getLastComponent()
+
+  /**
+   * getComponentBefore
+   * 
+   * @param container
+   *          TODO
+   * @param component
+   *          TODO
+   * @return Component
+   */
+  public Component getComponentBefore(Container container, Component component)
+  {
+    return null; // TODO
+  } // getComponentBefore()
+
+  /**
+   * getComponentAfter
+   * 
+   * @param container
+   *          TODO
+   * @param component
+   *          TODO
+   * @return Component
+   */
+  public Component getComponentAfter(Container container, Component component)
+  {
+    return null; // TODO
+  } // getComponentAfter()
+
+  /**
+   * compareTabOrder
+   * 
+   * @param component1
+   *          TODO
+   * @param component2
+   *          TODO
+   * @return boolean
+   */
+  public boolean compareTabOrder(Component component1, Component component2)
+  {
+    return false; // TODO
+  } // compareTabOrder()
+
+} // DefaultFocusManager

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListCellRenderer.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListCellRenderer.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListCellRenderer.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListCellRenderer.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,199 @@
+/* DefaultListCellRenderer.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Rectangle;
+import java.io.Serializable;
+
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+
+/**
+ * The default implementation {@link ListCellRenderer}. It provides a standard
+ * renderer for data objects of all types via {@link Object#toString()}.
+ *
+ * @author Andrew Selkirk
+ */
+public class DefaultListCellRenderer extends JLabel
+  implements ListCellRenderer, Serializable
+{
+  private static final long serialVersionUID = 7708947179685189462L;
+
+  /**
+   * Subclasses <code>DefaultListCellRenderers</code> and implements
+   * {@link javax.swing.plaf.UIResource}. This is used by
+   * {@link javax.swing.plaf.ListUI} subclasses to provide a default for
+   * the <code>List.cellRenderer</code> property. If you want to override
+   * this property, use <code>DefaultListCellRenderer</code> or a subclass.
+   */
+  public static class UIResource extends DefaultListCellRenderer
+    implements javax.swing.plaf.UIResource
+  {
+    public UIResource()
+    {
+      super();
+    }
+  }
+
+  /**
+   * This border is used whenever renderer doesn't have a focus.
+   */
+  protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
+
+  /**
+   * getListCellRendererComponent
+   *
+   * @param list JList list for the 'value'
+   * @param value object that should be rendered in the cell
+   * @param index index of the cell
+   * @param isSelected draw cell highlighted if isSelected is true
+   * @param cellHasFocus draw focus rectangle around cell if the cell has
+   *        focus
+   *
+   * @return Component that will be painted to the desired cell.
+   */
+  public Component getListCellRendererComponent(JList list, Object value,
+                                                int index, boolean isSelected,
+                                                boolean cellHasFocus)
+  {
+    String s = value != null ? value.toString() : "";
+    setText(s);
+    setOpaque(true);
+    setHorizontalAlignment(LEFT);
+
+    if (isSelected)
+      {
+        setBackground(list.getSelectionBackground());
+        setForeground(list.getSelectionForeground());
+      }
+    else
+      {
+        setBackground(list.getBackground());
+        setForeground(list.getForeground());
+      }
+
+    setEnabled(list.isEnabled());
+    setFont(list.getFont());
+
+    // Use focusCellHighlightBorder when renderer has focus and
+    // noFocusBorder otherwise
+
+    if (cellHasFocus)
+      setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
+    else
+      setBorder(noFocusBorder);
+
+    return this;
+  }
+
+  public void validate()
+  {
+    // Overridden to do nothing.
+  }
+
+  public void revalidate()
+  {
+    // Overridden to do nothing.
+  }
+
+  public void repaint(long tm, int x, int y, int w, int h)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void repaint(Rectangle rect)
+  {
+    // Overridden to do nothing.
+  }
+
+  protected void firePropertyChange(String propertyName, Object oldValue,
+                                    Object newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, byte oldValue,
+                                 byte newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, char oldValue,
+                                 char newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, short oldValue,
+                                 short newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, int oldValue,
+                                 int newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, long oldValue,
+                                 long newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, float oldValue,
+                                 float newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, double oldValue,
+                                 double newValue)
+  {
+    // Overridden to do nothing.
+  }
+
+  public void firePropertyChange(String propertyName, boolean oldValue,
+                                 boolean newValue)
+  {
+    // Overridden to do nothing.
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,521 @@
+/* DefaultListModel.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ * The default implementation of {@link AbstractListModel}, used by
+ * {@link javax.swing.JList} and similar objects as the model of a list of
+ * values. The implementation is based on an underlying {@link
+ * java.util.Vector}.
+ *
+ * @author Andrew Selkirk
+ * @author Graydon Hoare (graydon at redhat.com)
+ */
+
+public class DefaultListModel extends AbstractListModel
+{
+  private static final long serialVersionUID = 2315945659722172272L;
+
+  /**
+   * The vector of elements in this list model.
+   */
+  private Vector elements = new Vector();
+
+  /**
+   * Gets an element of the list at the provided index.
+   *
+   * @param index The index of the element to get
+   *
+   * @return The object at the given index
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds of the list <code>[0, size())</code>
+   */
+  public Object elementAt(int index)
+  {
+    return elements.elementAt(index);
+  }
+
+  /**
+   * Convert the list to a string representation.
+   *
+   * @return A string representation of the list
+   */
+  public String toString()
+  {
+    return elements.toString();
+  }
+
+  /**
+   * Gets the first index of a particular element in the list.
+   *
+   * @param element The element to search for
+   *
+   * @return The first index in the list at which an object
+   *     <code>obj</code> exists such that <code>obj.equals(element)</code> is
+   *     <code>true</code>; if no such object exists, the method returns
+   *     <code>-1</code>
+   */
+  public int indexOf(Object element)
+  {
+    return elements.indexOf(element);
+  }
+
+  /**
+   * Gets the first index of a particular element in a list which occurs
+   * <em>at or after</em> a particular index.
+   *
+   * @param element The element to search for
+   * @param startIndex The index to begin searching at
+   *
+   * @return The first index in the list, greater than or equal to
+   *     <code>startIndex</code>, at which an object <code>obj</code> exists
+   *     such that <code>obj.equals(element)</code> is <code>true</code>; if no
+   *     such object exists, the method returns <code>-1</code>
+   */
+  public int indexOf(Object element, int startIndex)
+  {
+    return elements.indexOf(element, startIndex);
+  }
+
+  /**
+   * Gets the last index of a particular element in the list.
+   *
+   * @param element The element to search for
+   *
+   * @return The last index in the list at which an object
+   *     <code>obj</code> exists such that <code>obj.equals(element)</code> is
+   *     <code>true</code>; if no such object exists, the method returns
+   *     <code>-1</code>
+   */
+  public int lastIndexOf(Object element)
+  {
+    return elements.lastIndexOf(element);
+  }
+
+  /**
+   * Gets the last index of a particular element in a list which occurs
+   * <em>at or before</em> a particular index.
+   *
+   * @param element The element to search for
+   * @param endIndex The index to finish searching at
+   *
+   * @return The last index in the list, less than to or equal to
+   *     <code>endIndexIndex</code>, at which an object <code>obj</code> exists
+   *     such that <code>obj.equals(element)</code> is <code>true</code>; if no
+   *     such object exists, the method returns <code>-1</code>
+   */
+  public int lastIndexOf(Object element, int endIndex)
+  {
+    return elements.lastIndexOf(element, endIndex);
+  }
+
+  /**
+   * Gets the list element at a particular index.
+   *
+   * @param index The index to get the list value at
+   *
+   * @return The list value at the provided index
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds of the list <code>[0, size())</code>
+   */
+  public Object get(int index)
+  {
+    return elements.get(index);
+  }
+
+  /**
+   * Sets the list element at a particular index.
+   *
+   * @param index The list index at which to set a value 
+   * @param element The value to set at the specified index
+   *
+   * @return The value previously held at the specified index
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds of the list <code>[0, size())</code>
+   */
+  public Object set(int index, Object element)
+  {
+    Object result;
+    result = elements.set(index, element);
+    fireContentsChanged(this, index, index);
+    return result;
+  }
+
+  /**
+   * Inserts an element at a particular index in the list. Each element at
+   * index <code>i >= index</code> is shifted to position <code>i + 1</code>.
+   * If <code>index</code> is equal to <code>size()</code>, this is
+   * equivalent to appending an element to the array. Any
+   * <code>index</code> greater than <code>size()</code> is illegal.
+   *
+   * @param index The index to insert the element at
+   * @param element The element to insert at the index
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds <code>[0, size()]</code>
+   */
+  public void add(int index, Object element)
+  {
+    elements.add(index, element);
+    fireIntervalAdded(this, index, index);
+  }
+
+  /**
+   * Inserts an element at the end of the list. This is equivalent to
+   * calling <code>list.add(list.size(), element)</code>.
+   *
+   * @param element The element to add to the list
+   */
+  public void addElement(Object element)
+  {
+    int s = elements.size();
+    elements.add(element);
+    fireIntervalAdded(this, s, s);
+  }
+
+  /**
+   * Gets the number of elements in the list.
+   *
+   * @return The number of elements in the list
+   */
+  public int size()
+  {
+    return elements.size();
+  }
+
+  /**
+   * Gets an array containing the elements of the list.
+   *
+   * @return An array of the objects in the list, in the order they occur
+   *     in the list
+   */
+  public Object[] toArray()
+  {
+    return elements.toArray();
+  }
+
+  /**
+   * Determines whether a particular element is a member of the list.
+   *
+   * @param element The element to search for
+   *
+   * @return <code>true</code> if <code>element</code> is a member of the
+   *     list, otherwise <code>false</code>
+   */
+  public boolean contains(Object element)
+  {
+    return elements.contains(element);
+  }
+
+  /**
+   * Copies the list into a provided array. The provided array must be at
+   * least as large as the list.
+   *
+   * @param array The array to copy the list into
+   * 
+   * @throws IndexOutOfBoundsException if the array is too small to hold the
+   *     elements of the list
+   */
+  public void copyInto(Object[] array)
+  {
+    elements.copyInto(array);
+  }
+
+  /**
+   * Erases all the elements of the list, setting the list's size to 0.
+   */
+  public void clear()
+  {
+    int s = elements.size();
+    if (s > 0)
+    {
+      elements.clear();
+      fireIntervalRemoved(this, 0, s - 1);
+    }
+  }
+
+  /**
+   * Removes the element at a particular index from the list.
+   *
+   * @param index The index of the element to remove
+   *
+   * @return The value at the index, which has been removed from the list
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds of the list <code>[0, size())</code>
+   */
+  public Object remove(int index)
+  {
+    Object result;
+    result = elements.remove(index);
+    fireIntervalRemoved(this, index, index);
+    return result;
+  }
+
+  /**
+   * Determines whether the list is empty.
+   *
+   * @return <code>true</code> if the list is empty, otherwise
+   *     <code>false</code>
+   */
+  public boolean isEmpty()
+  {
+    return elements.isEmpty();
+  }
+
+  /**
+   * Returns an {@link java.util.Enumeration} over the elements of the list.
+   *
+   * @return A new enumeration which iterates over the list
+   */
+  public Enumeration elements()
+  {
+    return elements.elements();
+  }
+
+  /**
+   * Sets the capacity of the list to be equal to its size. The list's capacity
+   * is the number of elements it can hold before it needs to be reallocated.
+   * The list's size is the number of elements it currently holds. 
+   */
+  public void trimToSize()
+  {
+    elements.trimToSize();
+  }
+
+  /**
+   * Ensures that the list's capacity is at least equal to
+   * <code>size</code>. The list's capacity is the number of elements it
+   * can hold before it needs to be reallocated.
+   *
+   * @param size The capacity to ensure the list can hold
+   */
+  public void ensureCapacity(int size)
+  {
+    elements.ensureCapacity(size);
+  }
+
+  /**
+   * Sets the size of the list to a particular value. If the specified size
+   * is greater than the current size, the values at the excess list
+   * indices are set to <code>null</code>.  If the specified size is less
+   * than the current size, the excess elements are removed from the list.
+   *
+   * @param size The new size to set the list to
+   */
+  public void setSize(int size)
+  {
+    int oldSize = elements.size();
+    elements.setSize(size);
+    if (oldSize < size)
+      {
+        fireIntervalAdded(this, oldSize, size - 1);
+      }
+    else if (oldSize > size)
+      {
+        this.fireIntervalRemoved(this, size, oldSize - 1);
+      }
+  }
+
+  /**
+   * Gets the capacity of the list. The list's capacity is the number of
+   * elements it can hold before it needs to be reallocated. 
+   *
+   * @return The capacity of the list
+   */
+  public int capacity()
+  {
+    return elements.capacity();
+  }
+
+  /**
+   * Gets the first element in the list.
+   *
+   * @return The first element in the list
+   */
+  public Object firstElement()
+  {
+    return elements.firstElement();
+  }
+
+  /**
+   * Gets the last element in the list.
+   *
+   * @return The last element in the list
+   */
+  public Object lastElement()
+  {
+    return elements.lastElement();
+  }
+
+  /**
+   * Sets the list element at a particular index.
+   *
+   * @param element The value to set at the specified index
+   * @param index The list index at which to set a value 
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds of the list <code>[0, size())</code>
+   */
+  public void setElementAt(Object element, int index)
+  {
+    elements.setElementAt(element, index);
+    fireContentsChanged(this, index, index);
+  }
+
+  /**
+   * Removes the element at a particular index from the list.
+   *
+   * @param index The index of the element to remove
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds of the list <code>[0, size())</code>
+   */
+  public void removeElementAt(int index)
+  {
+    elements.remove(index);
+    fireIntervalRemoved(this, index, index);
+  }
+
+  /**
+   * Inserts an element at a particular index in the list. Each element at
+   * index <code>i >= index</code> is shifted to position <code>i + 1</code>.
+   * If <code>index</code> is equal to <code>size()</code>, this is
+   * equivalent to appending an element to the array. Any
+   * <code>index</code> greater than <code>size()</code> is illegal.
+   *
+   * @param element The element to insert at the index
+   * @param index The index to insert the element at
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds <code>[0, size()]</code>
+   */
+  public void insertElementAt(Object element, int index)
+  {
+    elements.insertElementAt(element, index);
+    fireIntervalAdded(this, index, index);
+  }
+
+  /**
+   * Removes the first occurrence of a particular element in the list. If the
+   * element does not exist in the list, nothing happens.
+   *
+   * @param element The element to remove
+   *
+   * @return <code>true</code> if the element existed in the list (and was
+   *     removed), <code>false</code> otherwise
+   */
+  public boolean removeElement(Object element)
+  {
+    int index;
+    index = elements.indexOf(element);
+    if (index != -1)
+      {
+        elements.remove(index);
+        fireIntervalRemoved(this, index, index);
+        return true;
+      }
+    return false;
+  }
+
+  /**
+   * Remove all elements in the list.
+   */
+  public void removeAllElements()
+  {
+    int size;
+    size = size();
+    if (size > 0)
+      {
+        elements.clear();
+        fireIntervalRemoved(this, 0, size - 1);
+      }
+  }
+
+  /**
+   * Remove all elements between <code>startIndex</code> and
+   * <code>endIndex</code> inclusive.
+   *
+   * @param startIndex The first index in the range to remove
+   * @param endIndex The last index in the range to remove
+   *
+   * @throws ArrayIndexOutOfBoundsException if either index is outside the
+   *     valid range of indices for this list <code>[0, size())</code>
+   * @throws IllegalArgumentException if <code>startIndex > endIndex</code>
+   */
+  public void removeRange(int startIndex, int endIndex)
+  {
+    int index;
+    if (startIndex > endIndex)
+      throw new IllegalArgumentException();
+    for (index = endIndex; index >= startIndex; index--)
+      elements.remove(index);
+    fireIntervalRemoved(this, startIndex, endIndex);
+  }
+
+  /**
+   * Gets the size of the list.
+   *
+   * @return The number of elements currently in the list
+   */
+  public int getSize()
+  {
+    return elements.size();
+  }
+
+  /**
+   * Gets the list element at a particular index.
+   *
+   * @param index The index to get the list value at
+   *
+   * @return The list value at the provided index
+   *
+   * @throws ArrayIndexOutOfBoundsException If the provided index is
+   *     outside the bounds of the list <code>[0, size())</code>
+   */
+  public Object getElementAt(int index)
+  {
+    return elements.get(index);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListSelectionModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListSelectionModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListSelectionModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultListSelectionModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,855 @@
+/* DefaultListSelectionModel.java --
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.BitSet;
+import java.util.EventListener;
+
+import javax.swing.event.EventListenerList;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+/**
+ * The default implementation of {@link ListSelectionModel},
+ * which is used by {@link javax.swing.JList} and
+ * similar classes to manage the selection status of a number of data
+ * elements.
+ *
+ * <p>The class is organized <em>abstractly</em> as a set of intervals of
+ * integers. Each interval indicates an inclusive range of indices in a
+ * list -- held by some other object and unknown to this class -- which is
+ * considered "selected". There are various accessors for querying and
+ * modifying the set of intervals, with simplified forms accepting a single
+ * index, representing an interval with only one element. </p>
+ */
+public class DefaultListSelectionModel implements Cloneable,
+                                                  ListSelectionModel,
+                                                  Serializable
+{
+  private static final long serialVersionUID = -5718799865110415860L;
+
+  /** The list of ListSelectionListeners subscribed to this selection model. */
+  protected EventListenerList listenerList = new EventListenerList();
+
+
+  /** 
+   * The current list selection mode. Must be one of the numeric constants
+   * <code>SINGLE_SELECTION</code>, <code>SINGLE_INTERVAL_SELECTION</code>
+   * or <code>MULTIPLE_INTERVAL_SELECTION</code> from {@link
+   * ListSelectionModel}. The default value is
+   * <code>MULTIPLE_INTERVAL_SELECTION</code>.
+   */
+  int selectionMode = MULTIPLE_INTERVAL_SELECTION;
+
+  /**
+   * The index of the "lead" of the most recent selection. The lead is the
+   * second argument in any call to {@link #setSelectionInterval}, {@link
+   * #addSelectionInterval} or {@link #removeSelectionInterval}. Generally
+   * the lead refers to the most recent position a user dragged their mouse
+   * over.
+   */
+  int leadSelectionIndex = -1;
+
+  /**
+   * The index of the "anchor" of the most recent selection. The anchor is
+   * the first argument in any call to {@link #setSelectionInterval},
+   * {@link #addSelectionInterval} or {@link
+   * #removeSelectionInterval}. Generally the anchor refers to the first
+   * recent position a user clicks when they begin to drag their mouse over
+   * a list.
+   *
+   * @see #getAnchorSelectionIndex
+   * @see #setAnchorSelectionIndex
+   */
+  int anchorSelectionIndex = -1;
+
+  /**
+   * controls the range of indices provided in any {@link
+   * ListSelectionEvent} fired by the selectionModel. Let
+   * <code>[A,L]</code> be the range of indices between {@link
+   * #anchorSelectionIndex} and {@link #leadSelectionIndex} inclusive, and
+   * let <code>[i0,i1]</code> be the range of indices changed in a given
+   * call which generates a {@link ListSelectionEvent}. Then when this
+   * property is <code>true</code>, the {@link ListSelectionEvent} contains
+   * the range <code>[A,L] union [i0,i1]</code>; when <code>false</code> it
+   * will contain only <code>[i0,i1]</code>. The default is
+   * <code>true</code>.
+   *
+   * @see #isLeadAnchorNotificationEnabled
+   * @see #setLeadAnchorNotificationEnabled
+   */
+  protected boolean leadAnchorNotificationEnabled = true;
+
+  /**
+   * Whether the selection is currently "adjusting". Any {@link
+   * ListSelectionEvent} events constructed in response to changes in this
+   * list selection model will have their {@link
+   * ListSelectionEvent#isAdjusting} field set to this value.
+   *
+   * @see #getValueIsAdjusting
+   * @see #setValueIsAdjusting
+   */
+  boolean valueIsAdjusting = false;
+
+
+  /** 
+   * The current set of "intervals", represented simply by a {@link
+   * java.util.BitSet}. A set bit indicates a selected index, whereas a
+   * cleared bit indicates a non-selected index.
+   */
+  BitSet sel = new BitSet();
+
+  /**
+   * A variable to store the previous value of sel.
+   * Used to make sure we only fireValueChanged when the BitSet
+   * actually does change.
+   */
+  Object oldSel;
+
+  /**
+   * Whether this call of setLeadSelectionInterval was called locally
+   * from addSelectionInterval
+   */
+  boolean setLeadCalledFromAdd = false;
+
+  /**
+   * Returns the selection mode, which is one of {@link #SINGLE_SELECTION}, 
+   * {@link #SINGLE_INTERVAL_SELECTION} and 
+   * {@link #MULTIPLE_INTERVAL_SELECTION}.  The default value is
+   * {@link #MULTIPLE_INTERVAL_SELECTION}.
+   * 
+   * @return The selection mode.
+   * 
+   * @see #setSelectionMode(int)
+   */
+  public int getSelectionMode()
+  {
+    return selectionMode;
+  }
+
+  /**
+   * Sets the value of the {@link #selectionMode} property.
+   *
+   * @param mode The new value of the property
+   */
+  public void setSelectionMode(int mode)
+  {
+    if (mode < ListSelectionModel.SINGLE_SELECTION 
+        || mode > ListSelectionModel.MULTIPLE_INTERVAL_SELECTION)
+      throw new IllegalArgumentException("Unrecognised mode: " + mode);
+    selectionMode = mode;
+  }
+
+  /**
+   * Gets the value of the {@link #anchorSelectionIndex} property.
+   * 
+   * @return The current property value
+   *
+   * @see #setAnchorSelectionIndex
+   */
+  public int getAnchorSelectionIndex()
+  {
+    return anchorSelectionIndex;
+  }
+
+  /**
+   * Sets the value of the {@link #anchorSelectionIndex} property.
+   * 
+   * @param index The new property value
+   *
+   * @see #getAnchorSelectionIndex
+   */
+  public void setAnchorSelectionIndex(int index)
+  {
+    if (anchorSelectionIndex != index)
+      {
+        int old = anchorSelectionIndex;
+        anchorSelectionIndex = index;
+        if (leadAnchorNotificationEnabled)
+          fireValueChanged(index, old);
+      }
+  }
+  
+  /**
+   * Gets the value of the {@link #leadSelectionIndex} property.
+   * 
+   * @return The current property value
+   *
+   * @see #setLeadSelectionIndex
+   */
+  public int getLeadSelectionIndex()
+  {
+    return leadSelectionIndex;
+  }
+
+  /**
+   * <p>Sets the value of the {@link #anchorSelectionIndex} property. As a
+   * side effect, alters the selection status of two ranges of indices. Let
+   * <code>OL</code> be the old lead selection index, <code>NL</code> be
+   * the new lead selection index, and <code>A</code> be the anchor
+   * selection index. Then if <code>A</code> is a valid selection index,
+   * one of two things happens depending on the seleciton status of
+   * <code>A</code>:</p>
+   *
+   * <ul>
+   *
+   * <li><code>isSelectedIndex(A) == true</code>: set <code>[A,OL]</code>
+   * to <em>deselected</em>, then set <code>[A,NL]</code> to
+   * <em>selected</em>.</li>
+   *
+   * <li><code>isSelectedIndex(A) == false</code>: set <code>[A,OL]</code>
+   * to <em>selected</em>, then set <code>[A,NL]</code> to
+   * <em>deselected</em>.</li>
+   *
+   * </ul>
+   *
+   * <p>This method generates at most a single {@link ListSelectionEvent}
+   * despite changing multiple ranges. The range of values provided to the
+   * {@link ListSelectionEvent} includes only the minimum range of values
+   * which changed selection status between the beginning and end of the
+   * method.</p>
+   * 
+   * @param leadIndex The new property value
+   *
+   * @see #getAnchorSelectionIndex
+   */
+  public void setLeadSelectionIndex(int leadIndex)
+  {
+    // Only set the lead selection index to < 0 if anchorSelectionIndex < 0.
+    if (leadIndex < 0)
+      {
+        if (anchorSelectionIndex < 0)
+          leadSelectionIndex = -1;
+        else
+          return;
+      }
+
+    // Only touch the lead selection index if the anchor is >= 0.
+    if (anchorSelectionIndex < 0)
+      return;
+
+    if (selectionMode == SINGLE_SELECTION)
+      setSelectionInterval (leadIndex, leadIndex);
+    
+    int oldLeadIndex = leadSelectionIndex;
+    if (oldLeadIndex == -1)
+      oldLeadIndex = leadIndex;
+    if (setLeadCalledFromAdd == false)
+      oldSel = sel.clone();
+    leadSelectionIndex = leadIndex;
+
+    if (anchorSelectionIndex == -1)
+      return;    
+    
+    int R1 = Math.min(anchorSelectionIndex, oldLeadIndex);
+    int R2 = Math.max(anchorSelectionIndex, oldLeadIndex);
+    int S1 = Math.min(anchorSelectionIndex, leadIndex);
+    int S2 = Math.max(anchorSelectionIndex, leadIndex);
+
+    int lo = Math.min(R1, S1);
+    int hi = Math.max(R2, S2);
+
+    if (isSelectedIndex(anchorSelectionIndex))
+      {
+        sel.clear(R1, R2+1);
+        sel.set(S1, S2+1);
+      }
+    else
+      {
+        sel.set(R1, R2+1);
+        sel.clear(S1, S2+1);
+      }    
+
+    int beg = sel.nextSetBit(0), end = -1;
+    for(int i=beg; i >= 0; i=sel.nextSetBit(i+1)) 
+      end = i;
+    
+    BitSet old = (BitSet) oldSel;
+    
+    // The new and previous lead location requires repainting.
+    old.set(oldLeadIndex, !sel.get(oldLeadIndex));
+    old.set(leadSelectionIndex, !sel.get(leadSelectionIndex));
+    
+    fireDifference(sel, old);
+  }
+
+  /**
+   * Moves the lead selection index to <code>leadIndex</code> without 
+   * changing the selection values.
+   * 
+   * If leadAnchorNotificationEnabled is true, send a notification covering the
+   * old and new lead cells.
+   * 
+   * @param leadIndex the new lead selection index
+   * @since 1.5
+   */
+  public void moveLeadSelectionIndex (int leadIndex)
+  {
+    if (leadSelectionIndex == leadIndex)
+      return;
+    
+    leadSelectionIndex = leadIndex;
+    if (isLeadAnchorNotificationEnabled())
+      fireValueChanged(Math.min(leadSelectionIndex, leadIndex),
+                       Math.max(leadSelectionIndex, leadIndex));
+  }
+  
+  /**
+   * Gets the value of the {@link #leadAnchorNotificationEnabled} property.
+   * 
+   * @return The current property value
+   *
+   * @see #setLeadAnchorNotificationEnabled
+   */
+  public boolean isLeadAnchorNotificationEnabled()
+  {
+    return leadAnchorNotificationEnabled;
+  }
+
+  /**
+   * Sets the value of the {@link #leadAnchorNotificationEnabled} property.
+   * 
+   * @param l The new property value
+   *
+   * @see #isLeadAnchorNotificationEnabled
+   */
+  public void setLeadAnchorNotificationEnabled(boolean l)
+  {
+    leadAnchorNotificationEnabled = l;
+  }
+
+  /**
+   * Gets the value of the {@link #valueIsAdjusting} property.
+   *
+   * @return The current property value
+   *
+   * @see #setValueIsAdjusting
+   */
+  public boolean getValueIsAdjusting()
+  {
+    return valueIsAdjusting;
+  }
+
+  /**
+   * Sets the value of the {@link #valueIsAdjusting} property.
+   *
+   * @param v The new property value
+   *
+   * @see #getValueIsAdjusting
+   */
+  public void setValueIsAdjusting(boolean v)
+  {
+    valueIsAdjusting = v;
+  }
+
+  /**
+   * Determines whether the selection is empty.
+   *
+   * @return <code>true</code> if the selection is empty, otherwise
+   * <code>false</code>
+   */
+  public boolean isSelectionEmpty()
+  {
+    return sel.isEmpty();
+  }
+
+  /**
+   * Gets the smallest index which is currently a member of a selection
+   * interval.
+   *
+   * @return The least integer <code>i</code> such that <code>i >=
+   *     0</code> and <code>i</code> is a member of a selected interval, or
+   *     <code>-1</code> if there are no selected intervals
+   *
+   * @see #getMaxSelectionIndex
+   */
+  public int getMinSelectionIndex()
+  {
+    if (isSelectionEmpty())
+      return -1;
+    
+    return sel.nextSetBit(0);
+  }
+
+  /**
+   * Gets the largest index which is currently a member of a selection
+   * interval.
+   *
+   * @return The greatest integer <code>i</code> such that <code>i >=
+   *     0</code> and <code>i</code> is a member of a selected interval, or
+   *     <code>-1</code> if there are no selected intervals
+   *
+   * @see #getMinSelectionIndex
+   */
+  public int getMaxSelectionIndex()
+  {
+    if (isSelectionEmpty())
+      return -1;
+
+    int mx = -1;
+    for(int i=sel.nextSetBit(0); i >= 0; i=sel.nextSetBit(i+1)) 
+      { 
+        mx = i;
+      }
+    return mx;
+  }
+
+  /**
+   * Determines whether a particular index is a member of a selection
+   * interval.
+   *
+   * @param a The index to search for
+   *
+   * @return <code>true</code> if the index is a member of a selection interval,
+   *     otherwise <code>false</code>
+   */
+  public boolean isSelectedIndex(int a)
+  {
+    // TODO: Probably throw an exception here?
+    if (a >= sel.length() || a < 0)
+      return false;
+    return sel.get(a);
+  }
+
+  /**
+   * If the {@link #selectionMode} property is equal to
+   * <code>SINGLE_SELECTION</code> equivalent to calling
+   * <code>setSelectionInterval(index1, index2)</code>; 
+   * If the {@link #selectionMode} property is equal to 
+   * <code>SINGLE_INTERVAL_SELECTION</code> and the interval being
+   * added is not adjacent to an already selected interval,
+   * equivalent to <code>setSelectionInterval(index1, index2)</code>.
+   * Otherwise adds the range <code>[index0, index1]</code> 
+   * to the selection interval set.
+   *
+   * @param index0 The beginning of the range of indices to select
+   * @param index1 The end of the range of indices to select
+   *
+   * @see #setSelectionInterval
+   * @see #removeSelectionInterval
+   */
+  public void addSelectionInterval(int index0, int index1) 
+  {
+    if (index0 == -1 || index1 == -1)
+      return;
+    
+    if (selectionMode == SINGLE_SELECTION)
+      setSelectionInterval(index0, index1);
+    else
+    {
+    int lo = Math.min(index0, index1);
+    int hi = Math.max(index0, index1);
+    oldSel = sel.clone();
+
+
+    // COMPAT: Like Sun (but not like IBM), we allow calls to 
+    // addSelectionInterval when selectionMode is
+    // SINGLE_SELECTION_INTERVAL iff the interval being added
+    // is adjacent to an already selected interval
+    if (selectionMode == SINGLE_INTERVAL_SELECTION)
+      if (!(isSelectedIndex(index0) || 
+            isSelectedIndex(index1) || 
+            isSelectedIndex(Math.max(lo-1,0)) || 
+            isSelectedIndex(Math.min(hi+1,sel.size()))))
+        sel.clear();    
+
+    // We have to update the anchorSelectionIndex and leadSelectionIndex
+    // variables
+    
+    // The next if statements breaks down to "if this selection is adjacent
+    // to the previous selection and going in the same direction"
+    if ((isSelectedIndex(leadSelectionIndex)) 
+        && ((index0 - 1 == leadSelectionIndex 
+             && (index1 >= index0) 
+             && (leadSelectionIndex >= anchorSelectionIndex))
+            || (index0 + 1 == leadSelectionIndex && (index1 <= index0) 
+                && (leadSelectionIndex <= anchorSelectionIndex)))
+        && (anchorSelectionIndex != -1 || leadSelectionIndex != -1))
+      {
+        // setting setLeadCalledFromAdd to true tells setLeadSelectionIndex
+        //   not to update oldSel
+        setLeadCalledFromAdd = true;
+        setLeadSelectionIndex(index1);
+        setLeadCalledFromAdd = false;
+      }
+    else
+      {
+        leadSelectionIndex = index1;
+        anchorSelectionIndex = index0;
+        sel.set(lo, hi+1);
+        fireDifference(sel, (BitSet) oldSel);
+      }
+    }
+  }
+
+
+  /**
+   * Deselects all indices in the inclusive range
+   * <code>[index0,index1]</code>.
+   *
+   * @param index0 The beginning of the range of indices to deselect
+   * @param index1 The end of the range of indices to deselect
+   *
+   * @see #addSelectionInterval
+   * @see #setSelectionInterval
+   */
+  public void removeSelectionInterval(int index0,
+                                      int index1)
+  {
+    if (index0 == -1 || index1 == -1)
+      return;
+    
+    oldSel = sel.clone();
+    int lo = Math.min(index0, index1);
+    int hi = Math.max(index0, index1);
+    
+    // if selectionMode is SINGLE_INTERVAL_SELECTION and removing the interval
+    //   (index0,index1) would leave two disjoint selection intervals, remove all
+    //   selected indices from lo to the last selected index
+    if (getMinSelectionIndex() > 0 && getMinSelectionIndex() < lo && 
+        selectionMode == SINGLE_INTERVAL_SELECTION)
+      hi = sel.size() - 1;
+
+    sel.clear(lo, hi+1); 
+    //update anchorSelectionIndex and leadSelectionIndex variables
+    //TODO: will probably need MouseDragged to test properly and know if this works
+    setAnchorSelectionIndex(index0);
+    leadSelectionIndex = index1;
+    
+    fireDifference(sel, (BitSet) oldSel);
+  }
+
+  /**
+   * Removes all intervals in the selection set.
+   */
+  public void clearSelection()
+  {
+    // Find the selected interval.
+    int from = sel.nextSetBit(0);
+    if (from < 0)
+      return; // Empty selection - nothing to do.
+    int to = from;
+    
+    int i;
+
+    for (i = from; i>=0; i=sel.nextSetBit(i+1))
+      to = i;
+    
+    sel.clear();
+    fireValueChanged(from, to, valueIsAdjusting);
+  }
+  
+  /**
+   * Fire the change event, covering the difference between the two sets.
+   * 
+   * @param current the current set
+   * @param x the previous set, the object will be reused.
+   */
+  private void fireDifference(BitSet current, BitSet x)
+  {
+    x.xor(current);
+    int from = x.nextSetBit(0);
+    if (from < 0)
+      return; // No difference.
+    int to = from;
+    int i;
+
+    for (i = from; i >= 0; i = x.nextSetBit(i+1))
+      to = i;
+
+    fireValueChanged(from, to, valueIsAdjusting);
+  }
+  
+  /**
+   * Clears the current selection and marks a given interval as "selected". If
+   * the current selection mode is <code>SINGLE_SELECTION</code> only the
+   * index <code>index2</code> is selected.
+   * 
+   * @param anchor  the anchor selection index.
+   * @param lead  the lead selection index.
+   */
+  public void setSelectionInterval(int anchor, int lead)
+  {
+    if (anchor == -1 || lead == -1)
+      return;
+    if (selectionMode == SINGLE_SELECTION)
+      {
+        int lo = lead;
+        int hi = lead;
+        int selected = sel.nextSetBit(0);
+        if (selected == lead)
+          return;  // the selection is not changing
+        if (selected >= 0)
+          {
+            lo = Math.min(lo, selected);
+            hi = Math.max(hi, selected);
+          }
+        if (anchorSelectionIndex >= 0)
+          {
+            lo = Math.min(lo, anchorSelectionIndex);
+            hi = Math.max(hi, anchorSelectionIndex);
+          }
+        sel.clear();
+        sel.set(lead);
+        leadSelectionIndex = lead;
+        anchorSelectionIndex = lead;
+        fireValueChanged(lo, hi);
+      }
+    else if (selectionMode == SINGLE_INTERVAL_SELECTION)
+      {
+        // determine the current interval
+        int first = sel.nextSetBit(0);
+        int last = first;
+        if (first >= 0)
+          last += (sel.cardinality() - 1);
+        
+        // update the selection
+        int lo = Math.min(anchor, lead);
+        int hi = Math.max(anchor, lead);
+        if (lo == first && hi == last)
+          return;  // selected interval is not being changed
+        sel.clear();
+        sel.set(lo, hi + 1);
+        
+        // include the old selection in the event range
+        if (first >= 0)
+          lo = Math.min(lo, first);
+        if (last >= 0)
+          hi = Math.max(hi, last);
+        if (anchorSelectionIndex >= 0)
+          {
+            lo = Math.min(lo, anchorSelectionIndex);
+            hi = Math.max(hi, anchorSelectionIndex);
+          }
+        anchorSelectionIndex = anchor;
+        leadSelectionIndex = lead;
+        fireValueChanged(lo, hi);
+      }    
+    else
+    {
+      BitSet oldSel = (BitSet) sel.clone();
+      sel.clear();
+      if (selectionMode == SINGLE_SELECTION)
+        anchor = lead;
+
+      int lo = Math.min(anchor, lead);
+      int hi = Math.max(anchor, lead);
+      sel.set(lo, hi+1);
+      // update the anchorSelectionIndex and leadSelectionIndex variables
+      setAnchorSelectionIndex(anchor);
+      leadSelectionIndex = lead;
+    
+      fireDifference(sel, oldSel);
+    }
+  }
+
+  /**
+   * Inserts a number of indices either before or after a particular
+   * position in the set of indices. Renumbers all indices after the
+   * inserted range. The new indices in the inserted range are not
+   * selected. This method is typically called to synchronize the selection
+   * model with an inserted range of elements in a {@link ListModel}.
+   *
+   * @param index The position to insert indices at
+   * @param length The number of indices to insert
+   * @param before Indicates whether to insert the indices before the index
+   *     or after it
+   */
+  public void insertIndexInterval(int index,
+                                  int length,
+                                  boolean before)
+  {
+    if (!before)
+      {        
+        index++;
+        length--;
+      }
+    BitSet tmp = sel.get(index, sel.size());
+    sel.clear(index, sel.size());
+    int n = tmp.size();
+    for (int i = 0; i < n; ++i)
+      sel.set(index + length + i, tmp.get(i));
+  }
+
+  /**
+   * Removes a range from the set of indices. Renumbers all indices after
+   * the removed range. This method is typically called to synchronize the
+   * selection model with a deleted range of elements in a {@link
+   * ListModel}.
+   *
+   * @param index0 The first index to remove (inclusive)
+   * @param index1 The last index to remove (inclusive)
+   */
+  public void removeIndexInterval(int index0,
+                                  int index1)
+  {
+    int lo = Math.min(index0, index1);
+    int hi = Math.max(index0, index1);
+
+    BitSet tmp = sel.get(hi, sel.size());
+    sel.clear(lo, sel.size());
+    int n = tmp.size();
+    for (int i = 0; i < n; ++i)
+      sel.set(lo + i, tmp.get(i));
+  }
+
+  /**
+   * Fires a {@link ListSelectionEvent} to all the listeners of type {@link
+   * ListSelectionListener} registered with this selection model to
+   * indicate that a series of adjustment has just ended.
+   *
+   * The values of {@link #getMinSelectionIndex} and
+   * {@link #getMaxSelectionIndex} are used in the {@link ListSelectionEvent}
+   * that gets fired.
+   *
+   * @param isAdjusting <code>true</code> if this is the final change
+   *     in a series of adjustments, <code>false/code> otherwise
+   */
+  protected void fireValueChanged(boolean isAdjusting)
+  {
+    fireValueChanged(getMinSelectionIndex(), getMaxSelectionIndex(),
+                     isAdjusting);
+  }
+
+  /**
+   * Fires a {@link ListSelectionEvent} to all the listeners of type {@link
+   * ListSelectionListener} registered with this selection model.
+   *
+   * @param firstIndex The low index of the changed range
+   * @param lastIndex The high index of the changed range
+   */
+  protected void fireValueChanged(int firstIndex, int lastIndex)
+  {
+    fireValueChanged(firstIndex, lastIndex, getValueIsAdjusting());
+  }
+  
+  /**
+   * Fires a {@link ListSelectionEvent} to all the listeners of type {@link
+   * ListSelectionListener} registered with this selection model.
+   *
+   * @param firstIndex The low index of the changed range
+   * @param lastIndex The high index of the changed range
+   * @param isAdjusting Whether this change is part of a seqence of adjustments
+   *     made to the selection, such as during interactive scrolling
+   */
+  protected void fireValueChanged(int firstIndex, int lastIndex,
+				  boolean isAdjusting)
+  {
+    ListSelectionEvent evt = new ListSelectionEvent(this, firstIndex,
+                                                    lastIndex, isAdjusting);
+    ListSelectionListener[] listeners = getListSelectionListeners();
+    for (int i = 0; i < listeners.length; ++i)
+      listeners[i].valueChanged(evt);
+  }
+
+  /**
+   * Adds a listener.
+   *
+   * @param listener The listener to add
+   *
+   * @see #removeListSelectionListener
+   * @see #getListSelectionListeners
+   */
+  public void addListSelectionListener(ListSelectionListener listener)
+  {
+    listenerList.add(ListSelectionListener.class, listener);
+  }
+
+  /**
+   * Removes a registered listener.
+   *
+   * @param listener The listener to remove
+   *
+   * @see #addListSelectionListener
+   * @see #getListSelectionListeners
+   */
+  public void removeListSelectionListener(ListSelectionListener listener)
+  {
+    listenerList.remove(ListSelectionListener.class, listener);
+  }
+
+  /**
+   * Returns an array of all registerers listeners.
+   *
+   * @param listenerType The type of listener to retrieve
+   *
+   * @return The array
+   *
+   * @see #getListSelectionListeners
+   * @since 1.3
+   */
+  public EventListener[] getListeners(Class listenerType)
+  {
+    return listenerList.getListeners(listenerType);
+  }
+
+  /**
+   * Returns an array of all registerd list selection listeners.
+   *
+   * @return the array
+   *
+   * @see #addListSelectionListener
+   * @see #removeListSelectionListener
+   * @see #getListeners
+   * @since 1.4
+   */
+  public ListSelectionListener[] getListSelectionListeners()
+  {
+    return (ListSelectionListener[]) getListeners(ListSelectionListener.class);
+  }
+
+  /**
+   * Returns a clone of this object.
+   * <code>listenerList</code> don't gets duplicated.
+   *
+   * @return the cloned object
+   *
+   * @throws CloneNotSupportedException if an error occurs
+   */
+  public Object clone()
+    throws CloneNotSupportedException
+  {
+    DefaultListSelectionModel model =
+      (DefaultListSelectionModel) super.clone();
+    model.sel = (BitSet) sel.clone();
+    model.listenerList = new EventListenerList();
+    return model;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DefaultSingleSelectionModel.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,191 @@
+/* DefaultSingleSelectionModel.java --
+   Copyright (C) 2002, 2004, 2006,  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.EventListener;
+
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+
+/**
+ * The default implementation of {@link SingleSelectionModel}, used in
+ * {@link JTabbedPane}, {@link JMenuBar} and {@link JPopupMenu}.
+ *
+ * @author Andrew Selkirk
+ */
+public class DefaultSingleSelectionModel
+  implements SingleSelectionModel, Serializable
+{
+  private static final long serialVersionUID = 3676229404753786004L;
+
+  /**
+   * changeEvent
+   */
+  protected transient ChangeEvent changeEvent;
+
+  /**
+   * listenerList
+   */
+  protected EventListenerList listenerList = new EventListenerList();
+
+  /**
+   * The selected index (or -1 for no selection).
+   */
+  private int index = -1;
+
+  /**
+   * Creates a new <code>DefaultSingleSelectionModel</code> with no current
+   * selection.
+   */
+  public DefaultSingleSelectionModel()
+  {
+    // Do nothing.
+  }
+
+  /**
+   * Returns the selected index or <code>-1</code> if there is no selection.
+   * 
+   * @return The selected index.
+   * 
+   * @see #setSelectedIndex(int)
+   */
+  public int getSelectedIndex()
+  {
+    return index;
+  }
+
+  /**
+   * Sets the selected index and, if this is different to the previous 
+   * selection, sends a {@link ChangeEvent} to all registered listeners.
+   * 
+   * @param index  the index (use <code>-1</code> to represent no selection).
+   * 
+   * @see #getSelectedIndex()
+   * @see #clearSelection
+   */
+  public void setSelectedIndex(int index)
+  {
+    if (this.index != index)
+      {
+        this.index = index;
+        fireStateChanged();
+      }
+  }
+
+  /**
+   * Clears the selection by setting the selected index to <code>-1</code> and
+   * sends a {@link ChangeEvent} to all registered listeners.  If the selected
+   * index is already <code>-1</code>, this method does nothing.  
+   */
+  public void clearSelection()
+  {
+    setSelectedIndex(-1);
+  }
+
+  /**
+   * Returns <code>true</code> if there is a selection, and <code>false</code>
+   * otherwise.  
+   * 
+   * @return A boolean.
+   */
+  public boolean isSelected()
+  {
+    return index != -1;
+  }
+
+  /**
+   * Registers a listener to receive {@link ChangeEvent} notifications from
+   * this model whenever the selected index changes.
+   *
+   * @param listener the listener to add.
+   */
+  public void addChangeListener(ChangeListener listener)
+  {
+    listenerList.add(ChangeListener.class, listener);
+  }
+
+  /**
+   * Deregisters a listener so that it no longer receives {@link ChangeEvent}
+   * notifications from this model.
+   *
+   * @param listener the listener to remove.
+   */
+  public void removeChangeListener(ChangeListener listener)
+  {
+    listenerList.remove(ChangeListener.class, listener);
+  }
+
+  /**
+   * fireStateChanged
+   */
+  protected void fireStateChanged()
+  {
+    if (changeEvent == null)
+      changeEvent = new ChangeEvent(this);
+    ChangeListener[] listeners = getChangeListeners();
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].stateChanged(changeEvent);
+  }
+
+  /**
+   * getListeners
+   *
+   * @param listenerClass the type fo listener
+   *
+   * @return an array of listeners
+   *
+   * @since 1.3
+   */
+  public EventListener[] getListeners(Class listenerClass)
+  {
+    return listenerList.getListeners(listenerClass);
+  }
+
+  /**
+   * getChangeListeners
+   *
+   * @since 1.4
+   */
+  public ChangeListener[] getChangeListeners()
+  {
+    return (ChangeListener[]) getListeners(ChangeListener.class);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DesktopManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DesktopManager.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DesktopManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/DesktopManager.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,177 @@
+/* DesktopManager.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+/**
+ * DesktopManagers are responsible for implementing the behaviours for the
+ * JInternalFrames that belong to JDesktopPanes. Actions such as maximizing,
+ * minimizing, iconifying, etc will be delegated to the DesktopManager.
+ */
+public interface DesktopManager
+{
+  /**
+   * This method will cause the JInternalFrame to be displayed in the set
+   * location. This usually is not needed since the user will add the
+   * JInternalFrame to a Container separately.
+   *
+   * @param frame The JInternalFrame to open.
+   */
+  void openFrame(JInternalFrame frame);
+
+  /**
+   * This method should remove the JInternalFrame from its parent.
+   *
+   * @param frame The JInternalFrame to close.
+   */
+  void closeFrame(JInternalFrame frame);
+
+  /**
+   * This method should maximize the JInternalFrame to match its parent's
+   * bounds.
+   *
+   * @param frame The JInternalFrame to maximize.
+   */
+  void maximizeFrame(JInternalFrame frame);
+
+  /**
+   * This method should restore the JInternalFrame to its normal bounds.
+   *
+   * @param frame The JInternalFrame to minimize.
+   */
+  void minimizeFrame(JInternalFrame frame);
+
+  /**
+   * This method should remove the JInternalFrame from its parent and replace
+   * it with a JDesktopIcon.
+   *
+   * @param frame The JInternalFrame to iconify.
+   */
+  void iconifyFrame(JInternalFrame frame);
+
+  /**
+   * This method should remove the JDesktopIcon from its parent and replace it
+   * with the JInternalFrame that the JDesktopIcon represents.
+   *
+   * @param frame The JInternalFrame to deiconify.
+   */
+  void deiconifyFrame(JInternalFrame frame);
+
+  /**
+   * This method should give focus to the JInternalFrame and its default focus
+   * owner.
+   *
+   * @param vframe The JInternalFrame to activate.
+   */
+  void activateFrame(JInternalFrame vframe);
+
+  /**
+   * This method should be called when the JInternalFrame gets deselected and
+   * subsequently loses focus.
+   *
+   * @param frame The JInternalFrame to deactivate.
+   */
+  void deactivateFrame(JInternalFrame frame);
+
+  /**
+   * This method should be called in preparation for dragging. This needs to
+   * be called prior to dragFrame calls so that the DesktopManager can
+   * prepare any state information.
+   *
+   * @param frame The JInternalFrame to prepare for dragging.
+   */
+  void beginDraggingFrame(JComponent frame);
+
+  /**
+   * This method drags the given JInternalFrame to the given x and y
+   * coordinates.
+   *
+   * @param frame The JInternalFrame to drag.
+   * @param x The new x coordinate.
+   * @param y The new y coordinate.
+   */
+  void dragFrame(JComponent frame, int x, int y);
+
+  /**
+   * This method should be called after dragFrame calls. Any information used
+   * by the DesktopManager for dragging the JInternalFrame can be cleared.
+   *
+   * @param frame The JInternalFrame that finished dragging.
+   */
+  void endDraggingFrame(JComponent frame);
+
+  /**
+   * This method should be called prior to any resizeFrame calls. Any state
+   * information needed by the DesktopManager to resize the JInternalFrame
+   * will be prepared here.
+   *
+   * @param frame The JInternalFrame to resize.
+   * @param direction One of eight directions specified by SwingConstants.
+   */
+  void beginResizingFrame(JComponent frame, int direction);
+
+  /**
+   * This method is called to resize the given JInternalFrame to the given
+   * bounds.
+   *
+   * @param frame The JInternalFrame to resize.
+   * @param x The new x coordinate.
+   * @param y The new y coordinate.
+   * @param width The new width.
+   * @param height The new height.
+   */
+  void resizeFrame(JComponent frame, int x, int y, int width, int height);
+
+  /**
+   * This method is called to signify that the resize is finished. Any
+   * information used to resize the JInternalFrame can now be cleared.
+   *
+   * @param frame The JInternalFrame that just finished dragging.
+   */
+  void endResizingFrame(JComponent frame);
+
+  /**
+   * This method does the actual work for reshaping the JInternalFrame.
+   *
+   * @param frame The JInternalFrame to resize.
+   * @param x The new x coordinate.
+   * @param y The new y coordinate.
+   * @param width The new width.
+   * @param height The new height.
+   */
+  void setBoundsForFrame(JComponent frame, int x, int y, int width, int height);
+} // DesktopManager

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/FocusManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/FocusManager.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/FocusManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/FocusManager.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,524 @@
+/* FocusManager.java --
+   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.AWTEvent;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.DefaultKeyboardFocusManager;
+import java.awt.FocusTraversalPolicy;
+import java.awt.KeyEventDispatcher;
+import java.awt.KeyEventPostProcessor;
+import java.awt.KeyboardFocusManager;
+import java.awt.Window;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.VetoableChangeListener;
+import java.util.Set;
+
+/**
+ * This class has been obsoleted by the new
+ * {@link java.awt.KeyboardFocusManager} and
+ * {@link java.awt.DefaultKeyboardFocusManager} API.
+ *
+ * @author Andrew Selkirk
+ */
+public abstract class FocusManager
+  extends DefaultKeyboardFocusManager
+{
+  /**
+   * A FocusManager that wraps an AWT KeyboardFocusManager and forwards all
+   * method calls to it. This is used for compatibility with the new focus
+   * system.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  private static class WrappingFocusManager
+    extends FocusManager
+  {
+    /**
+     * The wrapped KeyboardFocusManager.
+     */
+    private KeyboardFocusManager wrapped;
+
+    /**
+     * Creates a new instance of WrappedFocusManager.
+     *
+     * @param fm the focus manager to wrap
+     */
+    WrappingFocusManager(KeyboardFocusManager fm)
+    {
+      wrapped = fm;
+    }
+
+    /**
+     * Wraps {@link DefaultKeyboardFocusManager#dispatchEvent(AWTEvent)}.
+     *
+     * @param ev the event to dispatch
+     *
+     * @return <code>true</code> if the event has been dispatched,
+     *         <code>false</code> otherwise
+     */
+    public boolean dispatchEvent(AWTEvent ev)
+    {
+      return wrapped.dispatchEvent(ev);
+    }
+
+    /**
+     * Wraps {@link DefaultKeyboardFocusManager#dispatchKeyEvent(KeyEvent)}.
+     *
+     * @param ev the event to dispatch
+     *
+     * @return <code>true</code> if the event has been dispatched,
+     *         <code>false</code> otherwise
+     */
+    public boolean dispatchKeyEvent(KeyEvent ev)
+    {
+      return wrapped.dispatchKeyEvent(ev);
+    }
+
+    /**
+     * Wraps {@link DefaultKeyboardFocusManager#downFocusCycle(Container)}.
+     *
+     * @param c the container
+     */
+    public void downFocusCycle(Container c)
+    {
+      wrapped.downFocusCycle(c);
+    }
+
+    /**
+     * Wraps {@link DefaultKeyboardFocusManager#upFocusCycle(Container)}.
+     *
+     * @param c the container
+     */
+    public void upFocusCycle(Container c)
+    {
+      wrapped.upFocusCycle(c);
+    }
+
+    /**
+     * Wraps {@link DefaultKeyboardFocusManager#focusNextComponent(Component)}.
+     *
+     * @param c the component
+     */
+    public void focusNextComponent(Component c)
+    {
+      wrapped.focusNextComponent(c);
+    }
+
+    /**
+     * Wraps
+     * {@link DefaultKeyboardFocusManager#focusPreviousComponent(Component)}.
+     *
+     * @param c the component
+     */
+    public void focusPreviousComponent(Component c)
+    {
+      wrapped.focusPreviousComponent(c);
+    }
+
+    /**
+     * Wraps {@link DefaultKeyboardFocusManager#postProcessKeyEvent(KeyEvent)}.
+     *
+     * @param e the key event
+     *
+     * @return a boolead
+     */
+    public boolean postProcessKeyEvent(KeyEvent e)
+    {
+      return wrapped.postProcessKeyEvent(e);
+    }
+
+    /**
+     * Wraps
+     * {@link DefaultKeyboardFocusManager#processKeyEvent(Component, KeyEvent)}.
+     *
+     * @param c the component
+     * @param e the key event
+     */
+    public void processKeyEvent(Component c, KeyEvent e)
+    {
+      wrapped.processKeyEvent(c, e);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)}.
+     *
+     * @param d the dispatcher
+     */
+    public void addKeyEventDispatcher(KeyEventDispatcher d)
+    {
+      wrapped.addKeyEventDispatcher(d);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
+     *
+     * @param p the post processor
+     */
+    public void addKeyEventPostProcessor(KeyEventPostProcessor p)
+    {
+      wrapped.addKeyEventPostProcessor(p);
+    }
+ 
+    /**
+     * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(PropertyChangeListener)}.
+     *
+     * @param l the property change listener
+     */
+    public void addPropertyChangeListener(PropertyChangeListener l)
+    {
+      wrapped.addPropertyChangeListener(l);
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(String, PropertyChangeListener)}.
+     *
+     * @param p the property name
+     * @param l the property change listener
+     */
+    public void addPropertyChangeListener(String p, PropertyChangeListener l)
+    {
+      wrapped.addPropertyChangeListener(p, l);
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(String, VetoableChangeListener)}.
+     *
+     * @param p the property name
+     * @param l the vetoable change listener
+     */
+    public void addVetoableChangeListener(String p, VetoableChangeListener l)
+    {
+      wrapped.addVetoableChangeListener(p, l);
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(VetoableChangeListener)}.
+     *
+     * @param l the vetoable change listener
+     */
+    public void addVetoableChangeListener(VetoableChangeListener l)
+    {
+      wrapped.addVetoableChangeListener(l);
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#clearGlobalFocusOwner()}.
+     */
+    public void clearGlobalFocusOwner()
+    {
+      wrapped.clearGlobalFocusOwner();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getActiveWindow()}.
+     *
+     * @return the active window
+     */
+    public Window getActiveWindow()
+    {
+      return wrapped.getActiveWindow();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getCurrentFocusCycleRoot()}.
+     *
+     * @return the focus cycle root
+     */
+    public Container getCurrentFocusCycleRoot()
+    {
+      return wrapped.getCurrentFocusCycleRoot();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalKeys(int)}.
+     *
+     * @param i the ID
+     *
+     * @return the focus traversal keys
+     */
+    public Set getDefaultFocusTraversalKeys(int i)
+    {
+      return wrapped.getDefaultFocusTraversalKeys(i);
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalPolicy()}.
+     *
+     * @return the focus traversal policy
+     */
+    public FocusTraversalPolicy getDefaultFocusTraversalPolicy()
+    {
+      return wrapped.getDefaultFocusTraversalPolicy();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getFocusedWindow()}.
+     *
+     * @return the focused window
+     */
+    public Window getFocusedWindow()
+    {
+      return wrapped.getFocusedWindow();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getFocusOwner()}.
+     *
+     * @return the focus owner
+     */
+    public Component getFocusOwner()
+    {
+      return wrapped.getFocusOwner();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getPermanentFocusOwner()}.
+     *
+     * @return the focus owner
+     */
+    public Component getPermanentFocusOwner()
+    {
+      return wrapped.getPermanentFocusOwner();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners()}.
+     *
+     * @return the property change listeners
+     */
+    public PropertyChangeListener[] getPropertyChangeListeners()
+    {
+      return wrapped.getPropertyChangeListeners();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners(String)}.
+     *
+     * @param n the property name
+     *
+     * @return the property change listeners
+     */
+    public PropertyChangeListener[] getPropertyChangeListeners(String n)
+    {
+      return wrapped.getPropertyChangeListeners(n);
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners()}.
+     *
+     * @return the vetoable change listeners
+     */
+    public VetoableChangeListener[] getVetoableChangeListeners()
+    {
+      return wrapped.getVetoableChangeListeners();
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners(String)}.
+     *
+     * @param n the property name
+     *
+     * @return the vetoable change listeners
+     */
+    public VetoableChangeListener[] getVetoableChangeListeners(String n)
+    {
+      return wrapped.getVetoableChangeListeners(n);
+    }
+
+    
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)}.
+     *
+     * @param d the key event dispatcher to remove
+     */
+    public void removeKeyEventDispatcher(KeyEventDispatcher d)
+    {
+      wrapped.removeKeyEventDispatcher(d);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
+     *
+     * @param p the post processor
+     */
+    public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
+    {
+      wrapped.removeKeyEventPostProcessor(p);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#removePropertyChangeListener(PropertyChangeListener)}.
+     *
+     * @param l the listener
+     */
+    public void removePropertyChangeListener(PropertyChangeListener l)
+    {
+      wrapped.removePropertyChangeListener(l);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#removePropertyChangeListener(String, PropertyChangeListener)}.
+     *
+     * @param n the property name
+     * @param l the listener
+     */
+    public void removePropertyChangeListener(String n, PropertyChangeListener l)
+    {
+      wrapped.removePropertyChangeListener(n, l);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#removeVetoableChangeListener(VetoableChangeListener)}.
+     *
+     * @param l the listener
+     */
+    public void removeVetoableChangeListener(VetoableChangeListener l)
+    {
+      wrapped.removeVetoableChangeListener(l);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#removeVetoableChangeListener(String, VetoableChangeListener)}.
+     *
+     * @param n the property name
+     * @param l the listener
+     */
+    public void removeVetoableChangeListener(String n, VetoableChangeListener l)
+    {
+      wrapped.removeVetoableChangeListener(n, l);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#setDefaultFocusTraversalKeys(int, Set)}.
+     *
+     * @param id the ID
+     * @param k the keystrokes
+     */
+    public void setDefaultFocusTraversalKeys(int id, Set k)
+    {
+      wrapped.setDefaultFocusTraversalKeys(id, k);
+    }
+
+    /**
+     * Wraps {@link KeyboardFocusManager#setDefaultFocusTraversalPolicy(FocusTraversalPolicy)}.
+     *
+     * @param p the focus traversal policy
+     */
+    public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy p)
+    {
+      wrapped.setDefaultFocusTraversalPolicy(p);
+    }
+
+    /**
+     * Wraps
+     * {@link KeyboardFocusManager#setGlobalCurrentFocusCycleRoot(Container)}.
+     *
+     * @param r the focus cycle root
+     */
+    public void setGlobalCurrentFocusCycleRoot(Container r)
+    {
+      wrapped.setGlobalCurrentFocusCycleRoot(r);
+    }
+  }
+
+  /**
+   * FOCUS_MANAGER_CLASS_PROPERTY
+   */
+  public static final String FOCUS_MANAGER_CLASS_PROPERTY =
+    "FocusManagerClassName";
+
+  /**
+   * Constructor FocusManager
+   */
+  public FocusManager()
+  {
+    super();
+  }
+
+  /**
+   * getCurrentManager
+   * @return FocusManager
+   */
+  public static FocusManager getCurrentManager()
+  {
+    KeyboardFocusManager m =
+      KeyboardFocusManager.getCurrentKeyboardFocusManager(); 
+    return new WrappingFocusManager(m);
+  }
+
+  /**
+   * setCurrentManager
+   * @param manager TODO
+   */
+  public static void setCurrentManager(FocusManager manager)
+  {
+    KeyboardFocusManager.setCurrentKeyboardFocusManager(manager);
+  }
+
+  /**
+   * disableSwingFocusManager
+   * @deprecated 1.4
+   */
+  public static void disableSwingFocusManager()
+  {
+    // TODO
+  }
+
+  /**
+   * isFocusManagerEnabled
+   * @return boolean
+   * @deprecated 1.4
+   */
+  public static boolean isFocusManagerEnabled()
+  {
+    return false; // TODO
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/GrayFilter.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/GrayFilter.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/GrayFilter.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/GrayFilter.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,97 @@
+/* GrayFilter.java -- Java class for filtering Pixels to produce Gray Pictures
+   Copyright (C) 1999, 2004  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+ 
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.image.FilteredImageSource;
+import java.awt.image.RGBImageFilter;
+
+/**
+ * Produces grayscale images out of colored images. This is used to provide
+ * default disabled icons for buttons.
+ *
+ * @author original author unknown
+ */
+public class GrayFilter extends RGBImageFilter
+{
+  private boolean b;
+  private double p;
+
+  /**
+   * Create a GrayFilter. If b is true then brighten. Also, indicate how much
+   * gray.
+   *    
+   * @param b if brighten
+   * @param p percent of gray, 0 - 100
+   */
+  public GrayFilter(boolean b, int p)
+  {
+    this.b = b; //FIXME - HANDLE THIS
+    this.p = (1. - (p / 100.)) / 3.;
+  }
+
+  /**
+   * Create grayed image
+   *
+   * @param src image to gray
+   *
+   * @return a grayed image
+   */
+  public static Image createDisabledImage(Image src)
+  {
+    return (Toolkit.getDefaultToolkit().createImage(new FilteredImageSource(
+        src.getSource(), new GrayFilter(true, 0))));
+  }
+  
+  /**
+   * Filter RGB to gray
+   */
+  public int filterRGB(int x, int y, int rgb)
+  {
+    int alpha = 0xff000000 & rgb;
+    int red = (0xff0000 & rgb) >> 16;
+    int green = (0xff00 & rgb) >> 8;
+    int blue = (0xff & rgb);
+    int gray = (int) ((0.299 * red + 0.587 * green + 0.114 * blue) * p);
+    if (b)
+      gray = Math.min(gray + 128, 255);
+    return gray | gray << 8 | gray << 16 | alpha ;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Icon.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Icon.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Icon.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/Icon.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,73 @@
+/* Icon.java -- 
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Graphics;
+
+/**
+ * Defines the methods that an object must implement if it should be used
+ * as an icon in Swing.
+ */
+public interface Icon
+{
+  /**
+   * Returns the height of the icon.
+   * 
+   * @return The height of the icon.
+   */
+  int getIconHeight();
+  
+  /**
+   * Returns the width of the icon.
+   * 
+   * @return The width of the icon.
+   */
+  int getIconWidth();
+  
+  /**
+   * Draws the icon at the location (x, y) on the specified graphics device.
+   * 
+   * @param c  a component related to the icon in some way (can be ignored by
+               some implementing classes).
+   * @param g  the graphics device.
+   * @param x  the x-coordinate.
+   * @param y  the y-coordinate.
+   */
+  void paintIcon(Component c, Graphics g, int x, int y);
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ImageIcon.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ImageIcon.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ImageIcon.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/ImageIcon.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,471 @@
+/* ImageIcon.java --
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Graphics;
+import java.awt.IllegalComponentStateException;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.Toolkit;
+import java.awt.image.ImageObserver;
+import java.io.Serializable;
+import java.net.URL;
+import java.util.Locale;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleIcon;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleStateSet;
+
+/**
+ * An {@link Icon} implementation that is backed by an {@link Image}.
+ */
+public class ImageIcon
+  implements Icon, Serializable, Accessible
+{
+  /**
+   * Provides the accessibility features for the <code>ImageIcon</code>
+   * class.
+   */
+  protected class AccessibleImageIcon
+    extends AccessibleContext
+    implements AccessibleIcon, Serializable
+  {
+    private static final long serialVersionUID = 2113430526551336564L;
+
+    /**
+     * Creates a new instance of <code>AccessibleImageIcon</code>.
+     */
+    protected AccessibleImageIcon()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * Returns the accessible role for the <code>ImageIcon</code>.
+     *
+     * @return {@link AccessibleRole#ICON}.
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.ICON;
+    }
+
+    /**
+     * Returns the accessible state for the <code>ImageIcon</code>.  To
+     * match the reference implementation, this method always returns 
+     * <code>null</code>.
+     *
+     * @return <code>null</code>.
+     */
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      // refer to Sun's bug report 4269253
+      return null;
+    }
+
+    /**
+     * Returns the accessible parent of this object.  To match the reference
+     * implementation, this method always returns <code>null</code>.
+     *
+     * @return <code>null</code>.
+     */
+    public Accessible getAccessibleParent()
+    {
+      // refer to Sun's bug report 4269253
+      return null;
+    }
+
+    /**
+     * Returns the index of this object in its accessible parent.  To match
+     * the reference implementation, this method always returns <code>-1</code>.
+     *
+     * @return <code>-1</code>.
+     */
+    public int getAccessibleIndexInParent()
+    {
+      // refer to Sun's bug report 4269253
+      return -1;
+    }
+
+    /**
+     * Returns the number of accessible children of this component,
+     * which is 0, because an {@link ImageIcon} has no children.
+     *
+     * @return <code>0</code>.
+     */
+    public int getAccessibleChildrenCount()
+    {
+      return 0;
+    }
+
+    /**
+     * Returns the accessible child at index <code>i</code>, which is
+     * <code>null</code> in this case because an {@link ImageIcon} has no 
+     * children.
+     *
+     * @param i the index of the child to be fetched
+     *
+     * @return <code>null</code>.
+     */
+    public Accessible getAccessibleChild(int i)
+    {
+      return null;
+    }
+
+    /**
+     * Returns the locale of this object.  To match the reference 
+     * implementation, this method always returns <code>null</code>.
+     *
+     * @return <code>null</code>.
+     */
+    public Locale getLocale() 
+      throws IllegalComponentStateException
+    {
+      // refer to Sun's bug report 4269253
+      return null;
+    }
+
+    /**
+     * Returns the accessible icon description.  This returns the
+     * <code>description</code> property of the underlying {@link ImageIcon}.
+     *
+     * @return The description (possibly <code>null</code>).
+     * 
+     * @see #setAccessibleIconDescription(String)
+     */
+    public String getAccessibleIconDescription()
+    {
+      return getDescription();
+    }
+
+    /**
+     * Sets the accessible icon description.  This sets the 
+     * <code>description</code> property of the underlying {@link ImageIcon}.
+     *
+     * @param newDescr the description (<code>null</code> permitted).
+     * 
+     * @see #getAccessibleIconDescription()
+     */
+    public void setAccessibleIconDescription(String newDescr)
+    {
+      setDescription(newDescr);
+    }
+
+    /**
+     * Returns the icon height. This returns the <code>iconHeight</code> 
+     * property of the underlying {@link ImageIcon}.
+     *
+     * @return The icon height.
+     */
+    public int getAccessibleIconHeight()
+    {
+      return getIconHeight();
+    }
+    
+    /**
+     * Returns the icon width. This returns the <code>iconWidth</code> property 
+     * of the underlying {@link ImageIcon}.
+     *
+     * @return The icon width.
+     */
+    public int getAccessibleIconWidth()
+    {
+      return getIconWidth();
+    }
+  } // AccessibleIcon
+
+  private static final long serialVersionUID = 532615968316031794L;
+
+  /** A dummy Component that is used in the MediaTracker. */
+  protected static final Component component = new Component()
+  {
+    // No need to implement this. 
+  };
+
+  /** The MediaTracker used to monitor the loading of images. */
+  protected static final MediaTracker tracker = new MediaTracker(component);
+
+  /** The ID that is used in the tracker. */
+  private static int id;
+
+  Image image;
+  String description;
+  ImageObserver observer;
+
+  /** The image loading status. */
+  private int loadStatus;
+
+  /** The AccessibleContext of this ImageIcon. */
+  private AccessibleContext accessibleContext;
+
+  /**
+   * Creates an ImageIcon without any properties set.
+   */
+  public ImageIcon()
+  {
+    // Nothing to do here.
+  }
+ 
+  /**
+   * Constructs an ImageIcon given a filename.  The icon's description
+   * is initially set to the filename itself.  A filename of "" means
+   * create a blank icon.
+   *
+   * @param filename name of file to load or "" for a blank icon
+   */
+  public ImageIcon(String filename)
+  {
+    this(filename, filename);
+  }
+
+  /**
+   * Constructs an ImageIcon from the given filename, setting its
+   * description to the given description.  A filename of "" means
+   * create a blank icon.
+   *
+   * @param filename name of file to load or "" for a blank icon
+   * @param description human-readable description of this icon
+   */
+  public ImageIcon(String filename, String description)
+  {
+    this(Toolkit.getDefaultToolkit().getImage(filename), description);
+  }
+
+  /**
+   * Creates an ImageIcon from the given byte array without any
+   * description set.
+   */
+  public ImageIcon(byte[] imageData)
+  {
+    this(imageData, null);
+  }
+  
+  /**
+   * Creates an ImageIcon from the given byte array and sets the given
+   * description.
+   */
+  public ImageIcon(byte[] imageData, String description)
+  {
+    this(Toolkit.getDefaultToolkit().createImage(imageData), description);
+  }
+
+  /**
+   * Creates an ImageIcon from the given URL and sets the description
+   * to the URL String representation.
+   */
+  public ImageIcon(URL url)
+  {
+    this(url, url.toString());
+  }
+
+  /**
+   * Creates an ImageIcon from the given URL and sets the given
+   * description.
+   */
+  public ImageIcon(URL url, String description)
+  {
+    this(Toolkit.getDefaultToolkit().getImage(url), description);
+  }
+
+  /**
+   * Creates an ImageIcon from the given Image without any description
+   * set.
+   */
+  public ImageIcon(Image image)
+  {
+    this(image, null);
+  }
+
+  /**
+   * Creates an ImageIcon from the given Image and sets the given
+   * description.
+   */
+  public ImageIcon(Image image, String description)
+  {
+    setImage(image);
+    setDescription(description);
+  }
+
+  /**
+   * Returns the ImageObserver that is used for all Image
+   * operations. Defaults to null when not explicitly set.
+   */
+  public ImageObserver getImageObserver()
+  {
+    return observer;
+  }
+  
+  /**
+   * Sets the ImageObserver that will be used for all Image
+   * operations. Can be set to null (the default) when no observer is
+   * needed.
+   */
+  public void setImageObserver(ImageObserver newObserver)
+  {
+    observer = newObserver;
+  }
+
+  /**
+   * Returns the backing Image for this ImageIcon. Might be set to
+   * null in which case no image is shown.
+   */
+  public Image getImage()
+  {
+    return image;
+  }
+
+  /**
+   * Explicitly sets the backing Image for this ImageIcon. Will call
+   * loadImage() to make sure that the Image is completely loaded
+   * before returning.
+   */
+  public void setImage(Image image)
+  {
+    loadImage(image);
+    this.image = image;
+  }
+
+  /**
+   * Returns a human readable description for this ImageIcon or null
+   * when no description is set or available.
+   */
+  public String getDescription()
+  {
+    return description;
+  }
+
+  /**
+   * Sets a human readable description for this ImageIcon. Can be set
+   * to null when no description is available.
+   */
+  public void setDescription(String description)
+  {
+    this.description = description;
+  }
+
+  /**
+   * Returns the the height of the backing Image, or -1 if the backing
+   * Image is null. The getHeight() method of the Image will be called
+   * with the set observer of this ImageIcon.
+   */
+  public int getIconHeight()
+  {
+    if (image == null)
+      return -1;
+
+    return image.getHeight(observer);
+  }
+
+  /**
+   * Returns the the width of the backing Image, or -1 if the backing
+   * Image is null. The getWidth() method of the Image will be called
+   * with the set observer of this ImageIcon.
+   */
+  public int getIconWidth()
+  {
+    if (image == null)
+      return -1;
+
+    return image.getWidth(observer);
+  }
+
+  /**
+   * Calls <code>g.drawImage()</code> on the backing Image using the
+   * set observer of this ImageIcon. If the set observer is null, the
+   * given Component is used as observer.
+   */
+  public void paintIcon(Component c, Graphics g, int x, int y)
+  {
+    g.drawImage(image, x, y, observer != null ? observer : c);
+  }
+
+  /**
+   * Loads the image and blocks until the loading operation is finished.
+   *
+   * @param image the image to be loaded
+   */
+  protected void loadImage(Image image)
+  {
+    try
+      {
+        tracker.addImage(image, id);
+        id++;
+        tracker.waitForID(id - 1);
+      }
+    catch (InterruptedException ex)
+      {
+        // Ignore this for now.
+      }
+    finally
+      {
+        loadStatus = tracker.statusID(id - 1, false);
+        tracker.removeImage(image, id - 1);
+      }
+  }
+
+  /**
+   * Returns the load status of the icon image.
+   *
+   * @return the load status of the icon image
+   *
+   * @see MediaTracker#COMPLETE
+   * @see MediaTracker#ABORTED
+   * @see MediaTracker#ERRORED
+   */
+  public int getImageLoadStatus()
+  {
+    return loadStatus;
+  }
+
+  /**
+   * Returns the object that provides accessibility features for this
+   * <code>ImageIcon</code> instance.
+   *
+   * @return The accessible context (an instance of 
+   *     {@link AccessibleImageIcon}).
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleImageIcon();
+    return accessibleContext;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputMap.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputMap.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputMap.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputMap.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,235 @@
+/* InputMap.java --
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Maps {@link KeyStroke}s to arbitrary objects, usually Strings. This
+ * is used in combination with {@link ActionMap}s.
+ *
+ * If a component receives an input event, this is looked up in
+ * the component's <code>InputMap</code>. The result is an object which
+ * serves as a key to the component's <code>ActionMap</code>. Finally
+ * the <code>Action</code> that is stored is executed.
+ *
+ * @author Andrew Selkirk
+ * @author Michael Koch
+ *
+ * @since 1.3
+ */
+public class InputMap
+  implements Serializable
+{
+  private static final long serialVersionUID = -5429059542008604257L;
+
+  /**
+   * Storage for the KeyStroke --> Object mappings.
+   */
+  private Map inputMap;
+
+  /**
+   * An optional parent map.
+   */
+  private InputMap parent;
+
+  /**
+   * Creates a new <code>InputMap</code> instance.  This default instance
+   * contains no mappings and has no parent.
+   */
+  public InputMap()
+  {
+    // nothing to do
+  }
+
+  /**
+   * Returns the binding for the specified keystroke, if there is one.
+   *
+   * @param keystroke the key of the entry (<code>null</code> is ignored).
+   *
+   * @return The binding associated with the specified keystroke (or 
+   *     <code>null</code>).
+   */
+  public Object get(KeyStroke keystroke)
+  {
+    Object result = null;
+    if (inputMap != null)
+      result = inputMap.get(keystroke);
+
+    if (result == null && parent != null)
+      result = parent.get(keystroke);
+    return result;
+  }
+
+  /**
+   * Puts a new entry into the <code>InputMap</code>.  If 
+   * <code>actionMapKey</code> is <code>null</code> any existing entry will be 
+   * removed.
+   *
+   * @param keystroke the keystroke for the entry (<code>null</code> is 
+   *     ignored).
+   * @param actionMapKey the action (<code>null</code> permitted).
+   */
+  public void put(KeyStroke keystroke, Object actionMapKey)
+  {
+    if (keystroke == null)
+      return;
+    if (inputMap == null)
+      inputMap = new HashMap();
+    if (actionMapKey == null)
+      inputMap.remove(keystroke);
+    else
+      inputMap.put(keystroke, actionMapKey);
+  }
+
+  /**
+   * Removes an entry from this <code>InputMap</code>.  Note that this will
+   * not remove any entry from the parent map, if there is one.
+   *
+   * @param keystroke the key of the entry to remove (<code>null</code> is 
+   *     ignored).
+   */
+  public void remove(KeyStroke keystroke)
+  {
+    if (inputMap != null)
+      inputMap.remove(keystroke);
+  }
+
+  /**
+   * Returns the parent of this <code>InputMap</code>.  The default value
+   * is <code>null</code>.
+   *
+   * @return The parent map (possibly <code>null</code>).
+   * 
+   * @see #setParent(InputMap)
+   */
+  public InputMap getParent()
+  {
+    return parent;
+  }
+
+  /**
+   * Sets a parent for this <code>InputMap</code>.  If a parent is specified,
+   * the {@link #get(KeyStroke)} method will look in the parent if it cannot
+   * find an entry in this map.
+   *
+   * @param parentMap the new parent (<code>null</code> permitted).
+   * 
+   * @see #getParent()
+   */
+  public void setParent(InputMap parentMap)
+  {
+    parent = parentMap;
+  }
+
+  /**
+   * Returns the number of entries in this <code>InputMap</code>.  This count 
+   * does not include any entries from the parent map, if there is one.
+   *
+   * @return The number of entries.
+   */
+  public int size()
+  {
+    int result = 0;
+    if (inputMap != null)
+      result = inputMap.size();
+    return result;
+  }
+
+  /**
+   * Clears the entries from this <code>InputMap</code>.  The parent map, if
+   * there is one, is not cleared.
+   */
+  public void clear()
+  {
+    if (inputMap != null)
+      inputMap.clear();
+  }
+
+  /**
+   * Returns all keys of entries in this <code>InputMap</code>.  This does not
+   * include keys defined in the parent, if there is one (use the 
+   * {@link #allKeys()} method for that case).
+   * <br><br>
+   * Following the behaviour of the reference implementation, this method will
+   * return <code>null</code> when no entries have been added to the map, 
+   * and a zero length array if entries have been added but subsequently 
+   * removed (or cleared) from the map.
+   *
+   * @return An array of keys (may be <code>null</code> or have zero length).
+   */
+  public KeyStroke[] keys()
+  {
+    if (inputMap != null)
+      {
+        KeyStroke[] array = new KeyStroke[size()];
+        return (KeyStroke[]) inputMap.keySet().toArray(array);
+      }
+    return null;
+  }
+
+  /**
+   * Returns all keys of entries in this <code>InputMap</code> and all its 
+   * parents.
+   *
+   * @return An array of keys (may be <code>null</code> or have zero length).
+   */
+  public KeyStroke[] allKeys()
+  {
+    Set set = new HashSet();
+
+    if (parent != null)
+      {
+        Object[] parentKeys = parent.allKeys();
+        if (parentKeys != null)
+          set.addAll(Arrays.asList(parentKeys));
+      }
+    if (inputMap != null)
+      set.addAll(inputMap.keySet());
+    if (set.size() == 0)
+      return null;    
+    KeyStroke[] array = new KeyStroke[set.size()];
+    return (KeyStroke[]) set.toArray(array);
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputVerifier.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputVerifier.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputVerifier.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InputVerifier.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* InputVerifier.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+
+/**
+ * Verifies the user input on a component before the focus is shifted.
+ * It is sometimes necessary that input components have a valid state before
+ * they loose focus. Such components can have a <code>InputVerifier</code>
+ * subclass registered, that permits or vetos a focus change request.
+ *
+ * @author Andrew Selkirk
+ */
+public abstract class InputVerifier
+{
+  /**
+   * Creates a <code>InputVerifier</code>
+   */
+  public InputVerifier()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * verify
+   *
+   * @param component the component to verify
+   *
+   * @return <code>true</code> if valid, <code>false</code> otherwise.
+   */
+  public abstract boolean verify(JComponent component);
+
+  /**
+   * shouldYieldFocus
+   *
+   * @param component the component to verify
+   *
+   * @return <code>true</code> if valid, <code>false</code> otherwise.
+   */
+  public boolean shouldYieldFocus(JComponent component)
+  {
+    return verify(component);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/InternalFrameFocusTraversalPolicy.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* InternalFrameFocusTraversalPolicy.java --
+   Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.FocusTraversalPolicy;
+
+/**
+ * A {@link FocusTraversalPolicy} that provides the additional capability
+ * to determine a {@link JInternalFrame}'s initially focused component
+ * when it is selected.
+ *
+ * @author Michael Koch
+ * 
+ * @since 1.4
+ */
+public abstract class InternalFrameFocusTraversalPolicy
+  extends FocusTraversalPolicy
+{
+  public Component getInitialComponent(JInternalFrame frame)
+  {
+    return getDefaultComponent(frame);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JApplet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JApplet.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JApplet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JApplet.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,224 @@
+/* JApplet.java --
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.applet.Applet;
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.LayoutManager;
+import java.awt.event.KeyEvent;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+
+/**
+ * A top-level container that is usually used in web browsers.
+ *
+ * @author original author unknown
+ */
+public class JApplet extends Applet
+  implements RootPaneContainer, Accessible
+{
+  /**
+   * Provides accessibility support for <code>JApplet</code>.
+   */
+  protected class AccessibleJApplet extends Applet.AccessibleApplet
+  {
+    /**
+     * Creates a new instance of <code>AccessibleJApplet</code>.
+     */
+    protected AccessibleJApplet()
+    {
+      super();
+      // Nothing to do here.
+    }
+  }
+
+  /**
+   * The accessible context for this <code>JApplet</code>.
+   */
+  protected AccessibleContext accessibleContext;
+
+  private static final long serialVersionUID = 7269359214497372587L;
+  
+  protected JRootPane rootPane;
+
+  /**
+   * @specnote rootPaneCheckingEnabled is false to comply with J2SE 5.0
+   */
+  protected boolean rootPaneCheckingEnabled = false;
+
+  public JApplet()
+  {
+    super.setLayout(new BorderLayout(1, 1));
+    getRootPane(); // Will do set/create.
+    setRootPaneCheckingEnabled(true); // Init stage is now over.
+  }
+
+  public Dimension getPreferredSize()
+  {
+    return super.getPreferredSize();
+  }
+
+  public void setLayout(LayoutManager manager)
+  {
+    // Check if we're in initialization stage.  If so, call super.setLayout
+    // otherwise, valid calls go to the content pane
+    if (isRootPaneCheckingEnabled())
+      getContentPane().setLayout(manager);
+    else
+      super.setLayout(manager);
+  }
+
+  public void setLayeredPane(JLayeredPane layeredPane)
+  {
+    getRootPane().setLayeredPane(layeredPane);
+  }
+
+  public JLayeredPane getLayeredPane()
+  {
+    return getRootPane().getLayeredPane();
+  }
+
+  public JRootPane getRootPane()
+  {
+    if (rootPane == null)
+      setRootPane(createRootPane());
+    return rootPane;
+  }
+
+  protected void setRootPane(JRootPane root)
+  {
+    if (rootPane != null)
+      remove(rootPane);
+
+    rootPane = root;
+    add(rootPane, BorderLayout.CENTER);
+  }
+
+  protected JRootPane createRootPane()
+  {
+    return new JRootPane();
+  }
+
+  public Container getContentPane()
+  {
+    return getRootPane().getContentPane();
+  }
+
+  public void setContentPane(Container contentPane)
+  {
+    getRootPane().setContentPane(contentPane);
+  }
+
+  public Component getGlassPane()
+  {
+    return getRootPane().getGlassPane();
+  }
+
+  public void setGlassPane(Component glassPane)
+  {
+    getRootPane().setGlassPane(glassPane);
+  }
+
+  protected void addImpl(Component comp, Object constraints, int index)
+  {
+    // If we're adding in the initialization stage use super.add.
+    // Otherwise pass the add onto the content pane.
+    if (isRootPaneCheckingEnabled())
+      getContentPane().add(comp, constraints, index);
+    else
+      super.addImpl(comp, constraints, index);
+  }
+
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJApplet();
+    return accessibleContext;
+  }
+
+  public JMenuBar getJMenuBar()
+  {
+    return getRootPane().getJMenuBar();
+  }
+
+  public void setJMenuBar(JMenuBar menubar)
+  {
+    getRootPane().setJMenuBar(menubar);
+  }
+
+  protected String paramString()
+  {
+    return super.paramString();
+  }
+
+  protected void processKeyEvent(KeyEvent e)
+  {
+    super.processKeyEvent(e);
+  }
+  
+  public void remove(Component comp)
+  {
+    // If we're removing the root pane, use super.remove. Otherwise
+    // pass it on to the content pane instead
+    if (comp == rootPane)
+      super.remove(rootPane);
+    else
+      getContentPane().remove(comp);
+  }
+
+  protected boolean isRootPaneCheckingEnabled()
+  {
+    return rootPaneCheckingEnabled;
+  }
+
+  protected void setRootPaneCheckingEnabled(boolean enabled)
+  {
+    rootPaneCheckingEnabled = enabled;
+  }
+
+  public void update(Graphics g)
+  {
+    paint(g);
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JButton.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JButton.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JButton.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JButton.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,274 @@
+/* JButton.java --
+   Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.plaf.ButtonUI;
+
+
+/**
+ * A general purpose push button. <code>JButton</code>s can display a label,
+ * an {@link Icon} or both.
+ *
+ * @author Ronald Veldema (rveldema at cs.vu.nl)
+ */
+public class JButton extends AbstractButton
+  implements Accessible
+{
+
+  /**
+   * Accessibility support for JButtons.
+   */
+  protected class AccessibleJButton
+    extends AbstractButton.AccessibleAbstractButton
+  {
+    /**
+     * Returns the accessible role that this component represents.
+     * This is {@link AccessibleRole#PUSH_BUTTON} for <code>JButton</code>s.
+     *
+     * @return the accessible role that this component represents
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.PUSH_BUTTON;
+    }
+  }
+
+  private static final long serialVersionUID = -1907255238954382202L;
+
+  /**
+   * Indicates if this button is capable to become the default button.
+   */
+  private boolean defaultCapable;
+
+  /**
+   * Creates a new button with an empty string for the button text and no
+   * icon.
+   */
+  public JButton()
+  {
+    this(null, null);
+  }
+
+  /**
+   * Creates a new button from the specified action.
+   * 
+   * @param a  the action (<code>null</code> permitted).
+   * 
+   * @see AbstractButton#setAction(Action)
+   */
+  public JButton(Action a)
+  {
+    this();
+    setAction(a);
+  }
+
+  /**
+   * Creates a new button with the specified icon (and an empty string for
+   * the button text).
+   * 
+   * @param icon  the icon (<code>null</code> permitted).
+   */
+  public JButton(Icon icon)
+  {
+    this(null, icon);
+  }
+
+  /**
+   * Creates a new button with the specified text and no icon.
+   * 
+   * @param text  the button text (<code>null</code> permitted, will be
+   *     substituted by an empty string).
+   */
+  public JButton(String text)
+  {
+    this(text, null);
+  }
+
+  /**
+   * Creates a new button with the specified text and icon.
+   * 
+   * @param text  the button text (<code>null</code> permitted, will be
+   *     substituted by an empty string).
+   * @param icon  the icon (<code>null</code> permitted).
+   */
+  public JButton(String text, Icon icon)
+  {
+    super();
+    init(text, icon);
+    setModel(new DefaultButtonModel());
+    defaultCapable = true;
+  }
+
+  protected void configurePropertiesFromAction(Action a)
+  { 
+    super.configurePropertiesFromAction(a);
+  }
+
+  /**
+   * Returns the object that provides accessibility features for this
+   * <code>JButton</code> component.
+   *
+   * @return The accessible context (an instance of {@link AccessibleJButton}).
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJButton();
+    return accessibleContext;
+  }
+
+  /**
+   * Returns the suffix (<code>"ButtonUI"</code> in this case) used to 
+   * determine the class name for a UI delegate that can provide the look and 
+   * feel for a <code>JButton</code>.
+   *
+   * @return <code>"ButtonUI"</code>.
+   */
+  public String getUIClassID()
+  {
+    // Returns a string that specifies the name of the L&F class that renders
+    // this component.  
+    return "ButtonUI";
+  }
+
+  /**
+   * Returns <code>true</code> if this button is the default button in
+   * its <code>JRootPane</code>. The default button gets automatically
+   * activated when the user presses <code>ENTER</code> (or whatever
+   * key this is bound to in the current Look and Feel).
+   *
+   * @return <code>true</code> if this button is the default button in
+   *         its <code>JRootPane</code>
+   *
+   * @see #isDefaultCapable()
+   * @see #setDefaultCapable(boolean)
+   * @see JRootPane#getDefaultButton()
+   * @see JRootPane#setDefaultButton(JButton)
+   */
+  public boolean isDefaultButton()
+  {
+    // The default button is managed by the JRootPane, so the safest way
+    // to determine this property is to ask the root pane of this button,
+    // if it exists.
+    JRootPane rp = SwingUtilities.getRootPane(this);
+    boolean isDefault = false;
+    if (rp != null)
+      isDefault = rp.getDefaultButton() == this;
+    return isDefault;
+  }
+
+  /**
+   * Returns <code>true</code> if this button can act as the default button.
+   * This is <code>true</code> by default.
+   *
+   * @return <code>true</code> if this button can act as the default button
+   *
+   * @see #setDefaultCapable(boolean)
+   * @see #isDefaultButton()
+   * @see JRootPane#getDefaultButton()
+   * @see JRootPane#setDefaultButton(JButton)
+   */
+  public boolean isDefaultCapable()
+  {
+    // Returns whether or not this button is capable of being the default
+    // button on the RootPane. 
+    return defaultCapable;
+  }
+
+  /**
+   * Returns an implementation-dependent string describing the attributes of
+   * this <code>JButton</code>.
+   *
+   * @return A string describing the attributes of this <code>JButton</code>
+   *         (never <code>null</code>).
+   */
+  protected String paramString()
+  {
+    String superParam = super.paramString();
+
+    // 41 is the maximum number of chars which may be needed.
+    StringBuffer sb = new StringBuffer(41);
+    sb.append(",defaultButton=").append(isDefaultButton());
+    sb.append(",defaultCapable=").append(defaultCapable);
+
+    return superParam + sb.toString();
+  }
+
+  /**
+   * Overrides JComponent.removeNotify to check if this button is currently
+   * set as the default button on the RootPane, and if so, sets the RootPane's
+   * default button to null to ensure the RootPane doesn't hold onto an invalid
+   * button reference.
+   */
+  public void removeNotify()
+  {
+    JRootPane root = SwingUtilities.getRootPane(this);
+    if (root != null && root.getDefaultButton() == this)
+      root.setDefaultButton(null);
+    super.removeNotify();
+  }
+
+  /**
+   * Sets the <code>defaultCapable</code> property which indicates if
+   * this button may become the default button in its <code>JRootPane</code>.
+   *
+   * @param defaultCapable <code>true</code> if this button can become the
+   *        default button in its JRootPane, <code>false</code> otherwise
+   *
+   * @see #setDefaultCapable(boolean)
+   * @see #isDefaultButton()
+   * @see JRootPane#getDefaultButton()
+   * @see JRootPane#setDefaultButton(JButton)
+   */
+  public void setDefaultCapable(boolean defaultCapable)
+  {
+    this.defaultCapable = defaultCapable;
+  }
+
+  /**
+   * Sets this button's UI delegate to the default (obtained from the
+   * {@link UIManager}) for the current look and feel.
+   */
+  public void updateUI()
+  {
+    setUI((ButtonUI) UIManager.getUI(this));
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBox.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBox.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBox.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBox.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,176 @@
+/* JCheckBox.java -- 
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
+/**
+ * A small box that displays a check or not, depending on it's
+ * <code>selected</code> state. This works very similar to
+ * {@link JToggleButton} and {@link JRadioButton}, but in UI design it
+ * has different semantics. <code>JCheckBox</code>es are usually
+ * used in multiple-choice scenarios, where a user can select 0..n
+ * of n different options. (This is in contrast to the general RadioButton
+ * semantics where the user can select exactly one of n options).
+ *
+ * Note however that this semantics is in no way enforced by the
+ * <code>JCheckBox</code>.
+ *
+ * @author Ronald Veldema (rveldema at cs.vu.nl)
+ */
+public class JCheckBox extends JToggleButton implements Accessible
+{
+
+  /**
+   * Provides accessibility support for <code>JCheckBox</code>.
+   */
+  protected class AccessibleJCheckBox extends AccessibleJToggleButton
+  {
+    /**
+     * Creates a new instance of <code>AccessibleJCheckBox</code>.
+     */
+    protected AccessibleJCheckBox()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * Returns the accessble role of <code>JCheckBox</code>,
+     * {@link AccessibleRole#CHECK_BOX}. 
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.CHECK_BOX;
+    }
+  }
+
+  private static final long serialVersionUID = -5246739313864538930L;
+
+  public static final String BORDER_PAINTED_FLAT_CHANGED_PROPERTY =
+    "borderPaintedFlat";
+  
+  private boolean borderPaintedFlat;
+
+  private void init()
+  {
+    borderPainted = false;
+    contentAreaFilled = false;
+  }
+  
+  public JCheckBox()
+  {
+    this(null, null, false);
+  }
+
+  public JCheckBox(Action action)
+  {
+    super(action);
+  }
+
+  public JCheckBox(Icon icon)
+  { 
+    this(null, icon, false);
+  }    
+  
+  public JCheckBox(Icon icon, boolean selected)
+  { 
+    this(null, icon, selected);
+  }    
+  
+  public JCheckBox(String text)
+  {
+    this(text, null, false);
+  }
+      
+  public JCheckBox(String text, boolean selected)
+  {
+    this(text, null, selected);
+  }
+      
+  public JCheckBox(String text, Icon icon)
+  {
+    this(text, icon, false);
+  }
+
+  public JCheckBox(String text, Icon icon, boolean selected)
+  {
+    super(text, icon, selected);
+    setHorizontalAlignment(LEADING);
+    setBorderPainted(false);
+  }
+
+  /**
+   * Returns a string that specifies the name of the Look and Feel class
+   * that renders this component.
+   */
+  public String getUIClassID()
+  {
+    return "CheckBoxUI";
+  }
+  
+  protected  String paramString()
+  {
+    return super.paramString() + ",borderPaintedFlat=" + borderPaintedFlat;
+  }
+
+  public boolean isBorderPaintedFlat()
+  {
+    return borderPaintedFlat;
+  }
+
+  public void setBorderPaintedFlat(boolean newValue)
+  {
+    firePropertyChange("borderPaintedFlat", borderPaintedFlat, newValue);
+    borderPaintedFlat = newValue;
+  }
+
+  /**
+   * Returns the accessible context for this <code>JCheckBox</code>.
+   *
+   * @return the accessible context for this <code>JCheckBox</code>
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJCheckBox();
+    return accessibleContext;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBoxMenuItem.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBoxMenuItem.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBoxMenuItem.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JCheckBoxMenuItem.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,275 @@
+/* JCheckBoxMenuItem.java --
+ Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath 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 for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING.  If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library.  Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module.  An independent module is a module which is not derived from
+ or based on this library.  If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so.  If you do not wish to do so, delete this
+ exception statement from your version. */
+
+
+package javax.swing;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
+/**
+ * A menu item that displays a checkbox. Its behaviour is very similar to
+ * {@link JCheckBox}. Just like the <code>JCheckBox</code>, user can check
+ * and uncheck this menu item by clicking on it. Also
+ * {@link AbstractButton#setSelected} and {@link #setState} can be use used for
+ * the same purpose. <code>JCheckBoxMenuItem</code> uses
+ * <code>ToggleButtonModel</code> to keep track of its selection.
+ * 
+ * @author original author unknown
+ */
+public class JCheckBoxMenuItem
+    extends JMenuItem
+    implements SwingConstants, Accessible
+{
+  private static final long serialVersionUID = - 6676402307973384715L;
+
+  /** name for the UI delegate for this menuItem. */
+  private static final String uiClassID = "CheckBoxMenuItemUI";
+
+  /** Indicates whether this menu item is checked. */
+  private boolean state;
+
+  /**
+   * This array contains text of this menu item if this menu item is in checked
+   * state and null it is not.
+   */
+  private Object[] selectedObjects = new Object[1];
+
+  /**
+   * Creates a new JCheckBoxMenuItem object.
+   */
+  public JCheckBoxMenuItem()
+  {
+    this(null, null);
+  }
+
+  /**
+   * Creates a new JCheckBoxMenuItem with given icon
+   * 
+   * @param icon Icon for this menu item
+   */
+  public JCheckBoxMenuItem(Icon icon)
+  {
+    this(null, icon);
+  }
+
+  /**
+   * Creates a new JCheckBoxMenuItem with given label
+   * 
+   * @param text Label for this menu item
+   */
+  public JCheckBoxMenuItem(String text)
+  {
+    this(text, null);
+  }
+
+  /**
+   * Creates a new JCheckBoxMenuItem using given action
+   * 
+   * @param action Action for this menu item.
+   */
+  public JCheckBoxMenuItem(Action action)
+  {
+    this();
+    setAction(action);
+  }
+
+  /**
+   * Creates a new JCheckBoxMenuItem object with given label and icon
+   * 
+   * @param text Label for this menu item
+   * @param icon Icon for this menu item
+   */
+  public JCheckBoxMenuItem(String text, Icon icon)
+  {
+    this(text, icon, false);
+  }
+
+  /**
+   * Creates a new JCheckBoxMenuItem object using specified label and marked as
+   * checked if given 'state' is true.
+   * 
+   * @param text Label for this menu item
+   * @param state <code>true</code> if this item should be in checked state
+   *          and <code>false</code> otherwise
+   */
+  public JCheckBoxMenuItem(String text, boolean state)
+  {
+    this(text, null, state);
+  }
+
+  /**
+   * Creates a new JCheckBoxMenuItem object with given label, icon, and marked
+   * as checked if given 'state' is true.
+   * 
+   * @param text Label for this menu item
+   * @param icon icon for this menu item
+   * @param state <code>true</code> if this item should be in checked state
+   *          and false otherwise
+   */
+  public JCheckBoxMenuItem(String text, Icon icon, boolean state)
+  {
+    super(text, icon);
+    setModel(new JToggleButton.ToggleButtonModel());
+    this.state = state;
+    if (state == true)
+      this.setSelected(true);
+    setFocusable(false);
+  }
+
+  /**
+   * This method returns a name to identify which look and feel class will be
+   * the UI delegate for the menuItem.
+   * 
+   * @return The Look and Feel classID. "JCheckBoxMenuItemUI"
+   */
+  public String getUIClassID()
+  {
+    return uiClassID;
+  }
+
+  /**
+   * Returns checked state for this check box menu item.
+   * 
+   * @return Returns true if this menu item is in checked state and false
+   *         otherwise.
+   */
+  public boolean getState()
+  {
+    return state;
+  }
+
+  /**
+   * Sets state for this check box menu item. If given 'state' is true, then
+   * mark menu item as checked, and uncheck this menu item otherwise.
+   * 
+   * @param state new state for this menu item
+   */
+  public synchronized void setState(boolean state)
+  {
+    this.state = state;
+  }
+
+  /**
+   * This method returns array containing label of this menu item if it is
+   * selected and null otherwise.
+   * 
+   * @return Array containing label of this menu item if this menu item is
+   *         selected or null otherwise.
+   */
+  public Object[] getSelectedObjects()
+  {
+    if (state == true)
+      selectedObjects[0] = this.getText();
+    else
+      selectedObjects[0] = null;
+
+    return selectedObjects;
+  }
+
+  /**
+   * This method overrides JComponent.requestFocus with an empty implementation,
+   * since JCheckBoxMenuItems should not receive focus in general.
+   */
+  public void requestFocus()
+  {
+    // Should do nothing here
+  }
+
+  /**
+   * Returns a string describing the attributes for the
+   * <code>JCheckBoxMenuItem</code> component, for use in debugging. The
+   * return value is guaranteed to be non-<code>null</code>, but the format
+   * of the string may vary between implementations.
+   * 
+   * @return A string describing the attributes of the
+   *         <code>JCheckBoxMenuItem</code>.
+   */
+  protected String paramString()
+  {
+    // calling super seems to be sufficient to match the reference
+    // implementation here...
+    return super.paramString();
+  }
+
+  /**
+   * Returns the object that provides accessibility features for this
+   * <code>JCheckBoxMenuItem</code> component.
+   * 
+   * @return The accessible context (an instance of
+   *         {@link AccessibleJCheckBoxMenuItem}).
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJCheckBoxMenuItem();
+
+    return accessibleContext;
+  }
+
+  /**
+   * Provides the accessibility features for the <code>JCheckBoxMenuItem</code>
+   * component.
+   * 
+   * @see JCheckBoxMenuItem#getAccessibleContext()
+   */
+  protected class AccessibleJCheckBoxMenuItem
+      extends AccessibleJMenuItem
+  {
+    private static final long serialVersionUID = 1079958073579370777L;
+
+    /**
+     * Creates a new <code>AccessibleJCheckBoxMenuItem</code> instance.
+     */
+    protected AccessibleJCheckBoxMenuItem()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * Returns the accessible role for the <code>JCheckBoxMenuItem</code>
+     * component.
+     * 
+     * @return {@link AccessibleRole#CHECK_BOX}.
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.CHECK_BOX;
+    }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JColorChooser.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JColorChooser.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JColorChooser.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JColorChooser.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,644 @@
+/* JColorChooser.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.AWTError;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.colorchooser.AbstractColorChooserPanel;
+import javax.swing.colorchooser.ColorSelectionModel;
+import javax.swing.colorchooser.DefaultColorSelectionModel;
+import javax.swing.plaf.ColorChooserUI;
+
+
+/**
+ * A Swing widget that offers users different ways to
+ * select a color. By default, three different panels are presented to the
+ * user that are capable of changing the selected color. There are three ways
+ * to utilize JColorChooser. The first is to build a JColorChooser and add it
+ * to the content pane. The second is to use the createDialog method to
+ * create a JDialog that holds a JColorChooser. The third is to show a
+ * JColorChooser in a JDialog directly using the showDialog method.
+ *
+ * @author original author unknown
+ */
+public class JColorChooser extends JComponent implements Accessible
+{
+  /** DOCUMENT ME! */
+  private static final long serialVersionUID = 9168066781620640889L;
+
+  /**
+   * Accessibility support for <code>JColorChooser</code>.
+   */
+  protected class AccessibleJColorChooser
+    extends JComponent.AccessibleJComponent
+  {
+    /** DOCUMENT ME! */
+    private static final long serialVersionUID = -2038297864782299082L;
+
+    /**
+     * Constructor AccessibleJColorChooser
+     */
+    protected AccessibleJColorChooser()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * getAccessibleRole
+     *
+     * @return AccessibleRole
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.COLOR_CHOOSER;
+    } // getAccessibleRole()
+  } // AccessibleJColorChooser
+
+  /** The model used with the JColorChooser. */
+  private ColorSelectionModel selectionModel;
+
+  /** The preview panel associated with the JColorChooser. */
+  private JComponent previewPanel;
+
+  /**
+   * The set of AbstractColorChooserPanels associated with the JColorChooser.
+   */
+  private AbstractColorChooserPanel[] chooserPanels;
+
+  /** A Drag and Drop property. */
+  private boolean dragEnabled;
+
+  /**
+   * The property fired by the JColorChooser when the selectionModel property
+   * changes.
+   */
+  public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
+
+  /**
+   * The property fired by the JColorChooser when the previewPanel property
+   * changes.
+   */
+  public static final String PREVIEW_PANEL_PROPERTY = "previewPanel";
+
+  /**
+   * The property fired by the JColorChooser when the chooserPanels property
+   * changes.
+   */
+  public static final String CHOOSER_PANELS_PROPERTY = "chooserPanels";
+
+  /** accessibleContext */
+  protected AccessibleContext accessibleContext;
+
+  /**
+   * This method creates a new JColorChooser with the default initial color.
+   */
+  public JColorChooser()
+  {
+    this(new DefaultColorSelectionModel());
+  } // JColorChooser()
+
+  /**
+   * This method creates a new JColorChooser with the given initial color.
+   *
+   * @param initial The initial color.
+   */
+  public JColorChooser(Color initial)
+  {
+    this(new DefaultColorSelectionModel(initial));
+  } // JColorChooser()
+
+  /**
+   * This method creates a new JColorChooser with the given model. The model
+   * will dictate what the initial color for the JColorChooser is.
+   *
+   * @param model The Model to use with the JColorChooser.
+   */
+  public JColorChooser(ColorSelectionModel model)
+  {
+    if (model == null)
+      model = new DefaultColorSelectionModel();
+    selectionModel = model;
+    updateUI();
+  } // JColorChooser()
+
+  /**
+   * This method sets the current color for the JColorChooser.
+   *
+   * @param color The new color for the JColorChooser.
+   */
+  public void setColor(Color color)
+  {
+    if (color != null)
+      selectionModel.setSelectedColor(color);
+  } // setColor()
+
+  /**
+   * This method sets the current color for the JColorChooser using RGB
+   * values.
+   *
+   * @param r The red value.
+   * @param g The green value.
+   * @param b The blue value.
+   */
+  public void setColor(int r, int g, int b)
+  {
+    selectionModel.setSelectedColor(new Color(r, g, b));
+  } // setColor()
+
+  /**
+   * This method sets the current color for the JColorChooser using the
+   * integer value. Bits 0-7 represent the blue value. Bits 8-15 represent
+   * the green value. Bits 16-23 represent the red value.
+   *
+   * @param color The new current color of the JColorChooser.
+   */
+  public void setColor(int color)
+  {
+    setColor(new Color(color, false));
+  } // setColor()
+
+  /**
+   * This method shows a JColorChooser inside a JDialog. The JDialog will
+   * block until it is hidden. The JDialog comes with three buttons: OK,
+   * Cancel, and Reset. Pressing OK or Cancel hide the JDialog. Pressing
+   * Reset will reset the JColorChooser to its initial value.
+   *
+   * @param component The Component that parents the JDialog.
+   * @param title The title displayed in the JDialog.
+   * @param initial The initial color.
+   *
+   * @return The selected color.
+   */
+  public static Color showDialog(Component component, String title,
+                                 Color initial)
+  {
+    JColorChooser choose = new JColorChooser(initial);
+
+    JDialog dialog = createDialog(component, title, true, choose, null, null);
+
+    dialog.getContentPane().add(choose);
+    dialog.pack();
+    dialog.show();
+
+    return choose.getColor();
+  } // showDialog()
+
+  /**
+   * This is a helper method to make the given JDialog block until it is
+   * hidden.  This is package-private to avoid an accessor method.
+   *
+   * @param dialog The JDialog to block.
+   */
+  static void makeModal(JDialog dialog)
+  {
+    try
+      {
+        synchronized (dialog)
+          {
+            while (dialog.isVisible())
+              dialog.wait();
+          }
+      }
+    catch (InterruptedException e)
+      {
+        // TODO: Should this be handled?
+      }
+  }
+
+  /**
+   * This is a helper method to find the first Frame or Dialog ancestor of the
+   * given Component.
+   *
+   * @param c The Component to find ancestors for.
+   *
+   * @return A Frame or Dialog ancestor. Null if none are found.
+   */
+  private static Component findParent(Component c)
+  {
+    Component parent = SwingUtilities.getAncestorOfClass(Frame.class, c);
+    if (parent != null)
+      return parent;
+    parent = SwingUtilities.getAncestorOfClass(Dialog.class, c);
+    return parent;
+  }
+
+  /**
+   * This method will take the given JColorChooser and place it in a JDialog
+   * with the given modal property. Three buttons are displayed in the
+   * JDialog: OK, Cancel and Reset. If OK or Cancel are pressed, the JDialog
+   * is hidden. If Reset is pressed, then the JColorChooser will take on its
+   * default color value. The given okListener will be registered to the OK
+   * button and the cancelListener will be registered to the Cancel button.
+   * If the modal property is set, then the JDialog will block until it is
+   * hidden.
+   *
+   * @param component The Component that will parent the JDialog.
+   * @param title The title displayed in the JDialog.
+   * @param modal The modal property.
+   * @param chooserPane The JColorChooser to place in the JDialog.
+   * @param okListener The ActionListener to register to the OK button.
+   * @param cancelListener The ActionListener to register to the Cancel
+   *        button.
+   *
+   * @return A JDialog with the JColorChooser inside of it.
+   *
+   * @throws AWTError If the component is not a suitable parent.
+   */
+  public static JDialog createDialog(Component component, String title,
+                                     boolean modal, JColorChooser chooserPane,
+                                     ActionListener okListener,
+                                     ActionListener cancelListener)
+  {
+    Component parent = findParent(component);
+    if (parent == null)
+      throw new AWTError("No suitable parent found for Component.");
+    JDialog dialog;
+    if (parent instanceof Frame)
+      dialog = new JDialog((Frame) parent, title, true);
+    else
+      dialog = new JDialog((Dialog) parent, title, true);
+
+    dialog.getContentPane().setLayout(new BorderLayout());
+
+    JPanel panel = new JPanel();
+    panel.setLayout(new FlowLayout());
+
+    ActionListener al = new DefaultOKCancelListener(dialog);
+
+    JButton ok = new JButton("OK");
+    ok.addActionListener(okListener);
+    ok.addActionListener(al);
+
+    JButton cancel = new JButton("Cancel");
+    cancel.addActionListener(cancelListener);
+    cancel.addActionListener(al);
+
+    JButton reset = new JButton("Reset");
+    reset.addActionListener(new DefaultResetListener(chooserPane));
+
+    dialog.getContentPane().add(chooserPane, BorderLayout.NORTH);
+
+    panel.add(ok);
+    panel.add(cancel);
+    panel.add(reset);
+
+    dialog.getContentPane().add(panel, BorderLayout.SOUTH);
+
+    return dialog;
+  } // createDialog()
+
+  /**
+   * This method returns the UI Component used for this JColorChooser.
+   *
+   * @return The UI Component for this JColorChooser.
+   */
+  public ColorChooserUI getUI()
+  {
+    return (ColorChooserUI) ui;
+  } // getUI()
+
+  /**
+   * This method sets the UI Component used for this JColorChooser.
+   *
+   * @param ui The UI Component to use with this JColorChooser.
+   */
+  public void setUI(ColorChooserUI ui)
+  {
+    super.setUI(ui);
+  } // setUI()
+
+  /**
+   * This method resets the UI Component property to the Look and Feel
+   * default.
+   */
+  public void updateUI()
+  {
+    setUI((ColorChooserUI) UIManager.getUI(this));
+  }
+
+  /**
+   * This method returns a String identifier for the UI Class to be used with
+   * the JColorChooser.
+   *
+   * @return The String identifier for the UI Class.
+   */
+  public String getUIClassID()
+  {
+    return "ColorChooserUI";
+  } // getUIClassID()
+
+  /**
+   * This method returns the current color for the JColorChooser.
+   *
+   * @return The current color for the JColorChooser.
+   */
+  public Color getColor()
+  {
+    return selectionModel.getSelectedColor(); // TODO
+  } // getColor()
+
+  /**
+   * This method changes the previewPanel property for the JTabbedPane. The
+   * previewPanel is responsible for indicating the current color of the
+   * JColorChooser.
+   *
+   * @param component The Component that will act as the previewPanel.
+   */
+  public void setPreviewPanel(JComponent component)
+  {
+    if (component != previewPanel)
+      {
+        JComponent old = previewPanel;
+        previewPanel = component;
+        firePropertyChange(PREVIEW_PANEL_PROPERTY, old, previewPanel);
+      }
+  } // setPreviewPanel()
+
+  /**
+   * This method returns the current previewPanel used with this
+   * JColorChooser.
+   *
+   * @return The current previewPanel.
+   */
+  public JComponent getPreviewPanel()
+  {
+    return previewPanel; // TODO
+  } // getPreviewPanel()
+
+  /**
+   * This method adds the given AbstractColorChooserPanel to the list of the
+   * JColorChooser's chooserPanels.
+   *
+   * @param panel The AbstractColorChooserPanel to add.
+   */
+  public void addChooserPanel(AbstractColorChooserPanel panel)
+  {
+    if (panel == null)
+      return;
+    AbstractColorChooserPanel[] old = chooserPanels;
+    AbstractColorChooserPanel[] newPanels =
+      new AbstractColorChooserPanel[(old == null) ? 1 : old.length + 1];
+    if (old != null)
+      System.arraycopy(old, 0, newPanels, 0, old.length);
+    newPanels[newPanels.length - 1] = panel;
+    chooserPanels = newPanels;
+    panel.installChooserPanel(this);
+    firePropertyChange(CHOOSER_PANELS_PROPERTY, old, newPanels);
+  } // addChooserPanel()
+
+  /**
+   * This method removes the given AbstractColorChooserPanel from the
+   * JColorChooser's list of chooserPanels.
+   *
+   * @param panel The AbstractColorChooserPanel to remove.
+   *
+   * @return The AbstractColorChooserPanel that was removed.
+   */
+  public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel)
+  {
+    int index = -1;
+    for (int i = 0; i < chooserPanels.length; i++)
+      if (panel == chooserPanels[i])
+        {
+          index = i;
+          break;
+        }
+
+    if (index == -1)
+      return null;
+
+    AbstractColorChooserPanel[] old = chooserPanels;
+    if (chooserPanels.length == 1)
+      chooserPanels = null;
+    else
+      {
+        AbstractColorChooserPanel[] newPanels =
+          new AbstractColorChooserPanel[chooserPanels.length - 1];
+        System.arraycopy(chooserPanels, 0, newPanels, 0, index);
+        System.arraycopy(chooserPanels, index, newPanels, index - 1,
+                         chooserPanels.length - index);
+        chooserPanels = newPanels;
+      }
+    panel.uninstallChooserPanel(this);
+    firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
+    return panel;
+  }
+
+  /**
+   * This method sets the chooserPanels property for this JColorChooser.
+   *
+   * @param panels The new set of AbstractColorChooserPanels to use.
+   */
+  public void setChooserPanels(AbstractColorChooserPanel[] panels)
+  {
+    if (panels != chooserPanels)
+      {
+        if (chooserPanels != null)
+          for (int i = 0; i < chooserPanels.length; i++)
+            if (chooserPanels[i] != null)
+              chooserPanels[i].uninstallChooserPanel(this);
+
+        AbstractColorChooserPanel[] old = chooserPanels;
+        chooserPanels = panels;
+
+        if (panels != null)
+          for (int i = 0; i < panels.length; i++)
+            if (panels[i] != null)
+              panels[i].installChooserPanel(this);
+
+        firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
+      }
+  } // setChooserPanels()
+
+  /**
+   * This method returns the AbstractColorChooserPanels used with this
+   * JColorChooser.
+   *
+   * @return The AbstractColorChooserPanels used with this JColorChooser.
+   */
+  public AbstractColorChooserPanel[] getChooserPanels()
+  {
+    return chooserPanels;
+  } // getChooserPanels()
+
+  /**
+   * This method returns the ColorSelectionModel used with this JColorChooser.
+   *
+   * @return The ColorSelectionModel.
+   */
+  public ColorSelectionModel getSelectionModel()
+  {
+    return selectionModel;
+  } // getSelectionModel()
+
+  /**
+   * This method sets the ColorSelectionModel to be used with this
+   * JColorChooser.
+   *
+   * @param model The ColorSelectionModel to be used with this JColorChooser.
+   *
+   * @throws AWTError If the given model is null.
+   */
+  public void setSelectionModel(ColorSelectionModel model)
+  {
+    if (model == null)
+      throw new AWTError("ColorSelectionModel is not allowed to be null.");
+    selectionModel = model;
+  } // setSelectionModel()
+
+  /**
+   * DOCUMENT ME!
+   *
+   * @return DOCUMENT ME!
+   */
+  public boolean getDragEnabled()
+  {
+    return dragEnabled;
+  }
+
+  /**
+   * DOCUMENT ME!
+   *
+   * @param b DOCUMENT ME!
+   */
+  public void setDragEnabled(boolean b)
+  {
+    dragEnabled = b;
+  }
+
+  /**
+   * This method returns a String describing the JColorChooser.
+   *
+   * @return A String describing the JColorChooser.
+   */
+  protected String paramString()
+  {
+    return "JColorChooser";
+  } // paramString()
+
+  /**
+   * getAccessibleContext
+   *
+   * @return AccessibleContext
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJColorChooser();
+
+    return accessibleContext;
+  }
+
+  /**
+   * A helper class that hides a JDialog when the action is performed.
+   */
+  static class DefaultOKCancelListener implements ActionListener
+  {
+    /** The JDialog to hide. */
+    private JDialog dialog;
+
+    /**
+     * Creates a new DefaultOKCancelListener with the given JDialog to hide.
+     *
+     * @param dialog The JDialog to hide.
+     */
+    public DefaultOKCancelListener(JDialog dialog)
+    {
+      super();
+      this.dialog = dialog;
+    }
+
+    /**
+     * This method hides the JDialog when called.
+     *
+     * @param e The ActionEvent.
+     */
+    public void actionPerformed(ActionEvent e)
+    {
+      dialog.hide();
+    }
+  }
+
+  /**
+   * This method resets the JColorChooser color to the initial color when the
+   * action is performed.
+   */
+  static class DefaultResetListener implements ActionListener
+  {
+    /** The JColorChooser to reset. */
+    private JColorChooser chooser;
+
+    /** The initial color. */
+    private Color init;
+
+    /**
+     * Creates a new DefaultResetListener with the given JColorChooser.
+     *
+     * @param chooser The JColorChooser to reset.
+     */
+    public DefaultResetListener(JColorChooser chooser)
+    {
+      super();
+      this.chooser = chooser;
+      init = chooser.getColor();
+    }
+
+    /**
+     * This method resets the JColorChooser to its initial color.
+     *
+     * @param e The ActionEvent.
+     */
+    public void actionPerformed(ActionEvent e)
+    {
+      chooser.setColor(init);
+    }
+  }
+
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComboBox.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComboBox.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComboBox.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComboBox.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,1497 @@
+/* JComboBox.java --
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.ItemSelectable;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.plaf.ComboBoxUI;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.ComboPopup;
+
+/**
+ * A component that allows a user to select any item in its list and
+ * displays the selected item to the user. JComboBox also can show/hide a
+ * popup menu containing its list of item whenever the mouse is pressed
+ * over it.
+ *
+ * @author Andrew Selkirk
+ * @author Olga Rodimina
+ * @author Robert Schuster
+ */
+public class JComboBox extends JComponent implements ItemSelectable,
+                                                     ListDataListener,
+                                                     ActionListener,
+                                                     Accessible
+{
+
+  private static final long serialVersionUID = 5654585963292734470L;
+
+  /**
+   * Classes implementing this interface are
+   * responsible for matching key characters typed by the user with combo
+   * box's items.
+   */
+  public static interface KeySelectionManager
+  {
+    int selectionForKey(char aKey, ComboBoxModel aModel);
+  }
+
+  /**
+   * Maximum number of rows that should be visible by default  in the
+   * JComboBox's popup
+   */
+  private static final int DEFAULT_MAXIMUM_ROW_COUNT = 8;
+
+  /**
+   * Data model used by JComboBox to keep track of its list data and currently
+   * selected element in the list.
+   */
+  protected ComboBoxModel dataModel;
+
+  /**
+   * Renderer renders(paints) every object in the combo box list in its
+   * associated list cell. This ListCellRenderer is used only when  this
+   * JComboBox is uneditable.
+   */
+  protected ListCellRenderer renderer;
+
+  /**
+   * Editor that is responsible for editing an object in a combo box list.
+   */
+  protected ComboBoxEditor editor;
+
+  /**
+   * Number of rows that will be visible in the JComboBox's popup.
+   */
+  protected int maximumRowCount;
+
+  /**
+   * This field indicates if textfield of this JComboBox is editable or not.
+   */
+  protected boolean isEditable;
+
+  /**
+   * This field is reference to the current selection of the combo box.
+   */
+  protected Object selectedItemReminder;
+
+  /**
+   * keySelectionManager
+   */
+  protected KeySelectionManager keySelectionManager;
+
+  /**
+   * This actionCommand is used in ActionEvent that is fired to JComboBox's
+   * ActionListeneres.
+   */
+  protected String actionCommand;
+
+  /**
+   * This property indicates if heavyweight popup or lightweight popup will be
+   * used to diplay JComboBox's elements.
+   */
+  protected boolean lightWeightPopupEnabled;
+
+  /**
+   * The action taken when new item is selected in the JComboBox
+   */
+  private Action action;
+
+  /**
+   * since 1.4  If this field is set then comboBox's display area for the
+   * selected item  will be set by default to this value.
+   */
+  private Object prototypeDisplayValue;
+
+  /**
+   * Constructs JComboBox object with specified data model for it.
+   * <p>Note that the JComboBox will not change the value that
+   * is preselected by your ComboBoxModel implementation.</p>
+   *
+   * @param model Data model that will be used by this JComboBox to keep track
+   *        of its list of items.
+   */
+  public JComboBox(ComboBoxModel model)
+  {
+    setEditable(false);
+    setEnabled(true);
+    setMaximumRowCount(DEFAULT_MAXIMUM_ROW_COUNT);
+    setModel(model);
+    setActionCommand("comboBoxChanged");
+
+    lightWeightPopupEnabled = true;
+    isEditable = false;
+
+    updateUI();
+  }
+
+  /**
+   * Constructs JComboBox with specified list of items.
+   *
+   * @param itemArray array containing list of items for this JComboBox
+   */
+  public JComboBox(Object[] itemArray)
+  {
+    this(new DefaultComboBoxModel(itemArray));
+    
+    if (itemArray.length > 0) 
+      setSelectedIndex(0);
+  }
+
+  /**
+   * Constructs JComboBox object with specified list of items.
+   *
+   * @param itemVector vector containing list of items for this JComboBox.
+   */
+  public JComboBox(Vector itemVector)
+  {
+    this(new DefaultComboBoxModel(itemVector));
+
+    if (itemVector.size() > 0)
+      setSelectedIndex(0);
+  }
+
+  /**
+   * Constructor. Creates new empty JComboBox. ComboBox's data model is set to
+   * DefaultComboBoxModel.
+   */
+  public JComboBox()
+  {
+    this(new DefaultComboBoxModel());
+  }
+
+  /**
+   * This method returns true JComboBox is editable and false otherwise
+   *
+   * @return boolean true if JComboBox is editable and false otherwise
+   */
+  public boolean isEditable()
+  {
+    return isEditable;
+  }
+
+  /*
+   * This method adds ancestor listener to this JComboBox.
+   */
+  protected void installAncestorListener()
+  {
+    /* FIXME: Need to implement.
+     *
+     * Need to add ancestor listener to this JComboBox. This listener
+     * should close combo box's popup list of items whenever it
+     * receives an AncestorEvent.
+     */
+  }
+
+  /**
+   * Set the "UI" property of the combo box, which is a look and feel class
+   * responsible for handling comboBox's input events and painting it.
+   *
+   * @param ui The new "UI" property
+   */
+  public void setUI(ComboBoxUI ui)
+  {
+    super.setUI(ui);
+  }
+
+  /**
+   * This method sets this comboBox's UI to the UIManager's default for the
+   * current look and feel.
+   */
+  public void updateUI()
+  {
+    setUI((ComboBoxUI) UIManager.getUI(this));
+  }
+
+  /**
+   * This method returns the String identifier for the UI class to the used
+   * with the JComboBox.
+   *
+   * @return The String identifier for the UI class.
+   */
+  public String getUIClassID()
+  {
+    return "ComboBoxUI";
+  }
+
+  /**
+   * This method returns the UI used to display the JComboBox.
+   *
+   * @return The UI used to display the JComboBox.
+   */
+  public ComboBoxUI getUI()
+  {
+    return (ComboBoxUI) ui;
+  }
+
+  /**
+   * Set the data model for this JComboBox. This un-registers all  listeners
+   * associated with the current model, and re-registers them with the new
+   * model.
+   *
+   * @param newDataModel The new data model for this JComboBox
+   */
+  public void setModel(ComboBoxModel newDataModel)
+  {
+    // dataModel is null if it this method is called from inside the constructors.
+    if (dataModel != null)
+      {
+        // Prevents unneccessary updates.
+        if (dataModel == newDataModel)
+          return;
+
+        // Removes itself (as DataListener) from the to-be-replaced model.
+        dataModel.removeListDataListener(this);
+      }
+    
+    /* Adds itself as a DataListener to the new model.
+     * It is intentioned that this operation will fail with a NullPointerException if the
+     * caller delivered a null argument.
+     */
+    newDataModel.addListDataListener(this);
+
+    // Stores old data model for event notification.
+    ComboBoxModel oldDataModel = dataModel;
+    dataModel = newDataModel;
+    selectedItemReminder = newDataModel.getSelectedItem();
+    
+    // Notifies the listeners of the model change.
+    firePropertyChange("model", oldDataModel, dataModel);
+  }
+
+  /**
+   * This method returns data model for this comboBox.
+   *
+   * @return ComboBoxModel containing items for this combo box.
+   */
+  public ComboBoxModel getModel()
+  {
+    return dataModel;
+  }
+
+  /**
+   * This method sets JComboBox's popup to be either lightweight or
+   * heavyweight. If 'enabled' is true then lightweight popup is used and
+   * heavyweight otherwise. By default lightweight popup is used to display
+   * this JComboBox's elements.
+   *
+   * @param enabled indicates if lightweight popup or heavyweight popup should
+   *        be used to display JComboBox's elements.
+   */
+  public void setLightWeightPopupEnabled(boolean enabled)
+  {
+    lightWeightPopupEnabled = enabled;
+  }
+
+  /**
+   * This method returns whether popup menu that is used to display list of
+   * combo box's item is lightWeight or not.
+   *
+   * @return boolean true if popup menu is lightweight and false otherwise.
+   */
+  public boolean isLightWeightPopupEnabled()
+  {
+    return lightWeightPopupEnabled;
+  }
+
+  /**
+   * This method sets editability of the combo box. If combo box  is editable
+   * the user can choose component from the combo box list by typing
+   * component's name in the editor(JTextfield by default).  Otherwise if not
+   * editable, the user should use the list to choose   the component. This
+   * method fires PropertyChangeEvents to JComboBox's registered
+   * PropertyChangeListeners to indicate that 'editable' property of the
+   * JComboBox has changed.
+   *
+   * @param editable indicates if the JComboBox's textfield should be editable
+   *        or not.
+   */
+  public void setEditable(boolean editable)
+  {
+    if (isEditable != editable)
+      {
+        isEditable = editable;
+        firePropertyChange("editable", !isEditable, isEditable);
+      }
+  }
+
+  /**
+   * Sets number of rows that should be visible in this JComboBox's popup. If
+   * this JComboBox's popup has more elements that maximum number or rows
+   * then popup will have a scroll pane to allow users to view other
+   * elements.
+   *
+   * @param rowCount number of rows that will be visible in JComboBox's popup.
+   */
+  public void setMaximumRowCount(int rowCount)
+  {
+    if (maximumRowCount != rowCount)
+      {
+        int oldMaximumRowCount = maximumRowCount;
+        maximumRowCount = rowCount;
+        firePropertyChange("maximumRowCount", oldMaximumRowCount,
+                           maximumRowCount);
+      }
+  }
+
+  /**
+   * This method returns number of rows visible in the JComboBox's list of
+   * items.
+   *
+   * @return int maximun number of visible rows in the JComboBox's list.
+   */
+  public int getMaximumRowCount()
+  {
+    return maximumRowCount;
+  }
+
+  /**
+   * This method sets cell renderer for this JComboBox that will be used to
+   * paint combo box's items. The Renderer should only be used only when
+   * JComboBox is not editable.  In the case when JComboBox is editable  the
+   * editor must be used.  This method also fires PropertyChangeEvent when
+   * cellRendered for this JComboBox has changed.
+   *
+   * @param aRenderer cell renderer that will be used by this JComboBox to
+   *        paint its elements.
+   */
+  public void setRenderer(ListCellRenderer aRenderer)
+  {
+    if (renderer != aRenderer)
+      {
+        ListCellRenderer oldRenderer = renderer;
+        renderer = aRenderer;
+        firePropertyChange("renderer", oldRenderer, renderer);
+      }
+  }
+
+  /**
+   * This method returns renderer responsible for rendering selected item in
+   * the combo box
+   *
+   * @return ListCellRenderer
+   */
+  public ListCellRenderer getRenderer()
+  {
+    return renderer;
+  }
+
+  /**
+   * Sets editor for this JComboBox
+   *
+   * @param newEditor ComboBoxEditor for this JComboBox. This method fires
+   *        PropertyChangeEvent when 'editor' property is changed.
+   */
+  public void setEditor(ComboBoxEditor newEditor)
+  {
+    if (editor == newEditor)
+      return;
+
+    if (editor != null)
+      editor.removeActionListener(this);
+
+    ComboBoxEditor oldEditor = editor;
+    editor = newEditor;
+
+    if (editor != null)
+      editor.addActionListener(this);
+
+    firePropertyChange("editor", oldEditor, editor);
+  }
+
+  /**
+   * Returns editor component that is responsible for displaying/editing
+   * selected item in the combo box.
+   *
+   * @return ComboBoxEditor
+   */
+  public ComboBoxEditor getEditor()
+  {
+    return editor;
+  }
+
+  /**
+   * Forces combo box to select given item
+   *
+   * @param item element in the combo box to select.
+   */
+  public void setSelectedItem(Object item)
+  {
+    dataModel.setSelectedItem(item);
+    fireActionEvent();
+  }
+
+  /**
+   * Returns currently selected item in the combo box.
+   * The result may be <code>null</code> to indicate that nothing is
+   * currently selected.
+   *
+   * @return element that is currently selected in this combo box.
+   */
+  public Object getSelectedItem()
+  {
+    return dataModel.getSelectedItem();
+  }
+
+  /**
+   * Forces JComboBox to select component located in the given index in the
+   * combo box.
+   * <p>If the index is below -1 or exceeds the upper bound an
+   * <code>IllegalArgumentException</code> is thrown.<p/>
+   * <p>If the index is -1 then no item gets selected.</p>
+   *
+   * @param index index specifying location of the component that  should be
+   *        selected.
+   */
+  public void setSelectedIndex(int index)
+  {
+  	if (index < -1 || index >= dataModel.getSize())
+      // Fails because index is out of bounds.
+      throw new IllegalArgumentException("illegal index: " + index);
+    else
+       // Selects the item at the given index or clears the selection if the
+       // index value is -1.
+      setSelectedItem((index == -1) ? null : dataModel.getElementAt(index));
+  }
+
+  /**
+   * Returns index of the item that is currently selected in the combo box. If
+   * no item is currently selected, then -1 is returned.
+   * <p>
+   * Note: For performance reasons you should minimize invocation of this
+   * method. If the data model is not an instance of
+   * <code>DefaultComboBoxModel</code> the complexity is O(n) where n is the
+   * number of elements in the combo box.
+   * </p>
+   * 
+   * @return int Index specifying location of the currently selected item in the
+   *         combo box or -1 if nothing is selected in the combo box.
+   */
+  public int getSelectedIndex()
+  {
+    Object selectedItem = getSelectedItem();
+
+    if (selectedItem != null)
+      {
+        if (dataModel instanceof DefaultComboBoxModel)
+          // Uses special method of DefaultComboBoxModel to retrieve the index.
+          return ((DefaultComboBoxModel) dataModel).getIndexOf(selectedItem);
+        else
+          {
+            // Iterates over all items to retrieve the index.
+            int size = dataModel.getSize();
+
+            for (int i = 0; i < size; i++)
+              {
+                Object o = dataModel.getElementAt(i);
+
+                // XXX: Is special handling of ComparableS neccessary?
+                if ((selectedItem != null) ? selectedItem.equals(o) : o == null)
+                  return i;
+              }
+          }
+      }
+
+    // returns that no item is currently selected
+    return -1;
+  }
+
+  /**
+   * Returns an object that is used as the display value when calculating the 
+   * preferred size for the combo box.  This value is, of course, never 
+   * displayed anywhere.
+   * 
+   * @return The prototype display value (possibly <code>null</code>).
+   * 
+   * @since 1.4
+   * @see #setPrototypeDisplayValue(Object)
+   */
+  public Object getPrototypeDisplayValue()
+  {
+    return prototypeDisplayValue;
+  }
+
+  /**
+   * Sets the object that is assumed to be the displayed item when calculating
+   * the preferred size for the combo box.  A {@link PropertyChangeEvent} (with
+   * the name <code>prototypeDisplayValue</code>) is sent to all registered 
+   * listeners. 
+   * 
+   * @param value  the new value (<code>null</code> permitted).
+   * 
+   * @since 1.4
+   * @see #getPrototypeDisplayValue()
+   */
+  public void setPrototypeDisplayValue(Object value)
+  {
+    Object oldValue = prototypeDisplayValue;
+    prototypeDisplayValue = value;
+    firePropertyChange("prototypeDisplayValue", oldValue, value);
+  }
+
+  /**
+   * This method adds given element to this JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
+   *
+   * @param element element to add
+   */
+  public void addItem(Object element)
+  {
+  	if (dataModel instanceof MutableComboBoxModel)
+      ((MutableComboBoxModel) dataModel).addElement(element);
+    else
+      throw new RuntimeException("Unable to add the item because the data "
+                                 + "model it is not an instance of "
+                                 + "MutableComboBoxModel.");
+  }
+
+  /**
+   * Inserts given element at the specified index to this JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
+   *
+   * @param element element to insert
+   * @param index position where to insert the element
+   */
+  public void insertItemAt(Object element, int index)
+  {
+	if (dataModel instanceof MutableComboBoxModel)
+      ((MutableComboBoxModel) dataModel).insertElementAt(element, index);
+    else
+      throw new RuntimeException("Unable to insert the item because the data "
+                                 + "model it is not an instance of "
+                                 + "MutableComboBoxModel.");
+  }
+
+  /**
+   * This method removes given element from this JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
+   *
+   * @param element element to remove
+   */
+  public void removeItem(Object element)
+  {
+	if (dataModel instanceof MutableComboBoxModel)
+      ((MutableComboBoxModel) dataModel).removeElement(element);
+    else
+      throw new RuntimeException("Unable to remove the item because the data "
+                                 + "model it is not an instance of "
+                                 + "MutableComboBoxModel.");
+  }
+
+  /**
+   * This method remove element location in the specified index in the
+   * JComboBox.
+   * <p>A <code>RuntimeException</code> is thrown if the data model is not
+   * an instance of {@link MutableComboBoxModel}.</p>
+   *
+   * @param index index specifying position of the element to remove
+   */
+  public void removeItemAt(int index)
+  {
+    if (dataModel instanceof MutableComboBoxModel)
+      ((MutableComboBoxModel) dataModel).removeElementAt(index);
+    else
+      throw new RuntimeException("Unable to remove the item because the data "
+                                 + "model it is not an instance of "
+                                 + "MutableComboBoxModel.");
+  }
+
+  /**
+   * This method removes all elements from this JComboBox.
+   * <p>
+   * A <code>RuntimeException</code> is thrown if the data model is not an
+   * instance of {@link MutableComboBoxModel}.
+   * </p>
+   */
+  public void removeAllItems()
+  {
+    if (dataModel instanceof DefaultComboBoxModel)
+      // Uses special method if we have a DefaultComboBoxModel.
+      ((DefaultComboBoxModel) dataModel).removeAllElements();
+    else if (dataModel instanceof MutableComboBoxModel)
+      {
+        // Iterates over all items and removes each.
+        MutableComboBoxModel mcbm = (MutableComboBoxModel) dataModel;
+
+         // We intentionally remove the items backwards to support models which
+         // shift their content to the beginning (e.g. linked lists)
+        for (int i = mcbm.getSize() - 1; i >= 0; i--)
+          mcbm.removeElementAt(i);
+      }
+    else
+      throw new RuntimeException("Unable to remove the items because the data "
+                                 + "model it is not an instance of "
+                                 + "MutableComboBoxModel.");
+  }
+
+  /**
+   * This method displays popup with list of combo box's items on the screen
+   */
+  public void showPopup()
+  {
+    setPopupVisible(true);
+  }
+
+  /**
+   * This method hides popup containing list of combo box's items
+   */
+  public void hidePopup()
+  {
+    setPopupVisible(false);
+  }
+
+  /**
+   * This method either displayes or hides the popup containing  list of combo
+   * box's items.
+   *
+   * @param visible show popup if 'visible' is true and hide it otherwise
+   */
+  public void setPopupVisible(boolean visible)
+  {
+    getUI().setPopupVisible(this, visible);
+  }
+
+  /**
+   * Checks if popup is currently visible on the screen.
+   *
+   * @return boolean true if popup is visible and false otherwise
+   */
+  public boolean isPopupVisible()
+  {
+    return getUI().isPopupVisible(this);
+  }
+
+  /**
+   * This method sets actionCommand to the specified string. ActionEvent fired
+   * to this JComboBox  registered ActionListeners will contain this
+   * actionCommand.
+   *
+   * @param aCommand new action command for the JComboBox's ActionEvent
+   */
+  public void setActionCommand(String aCommand)
+  {
+    actionCommand = aCommand;
+  }
+
+  /**
+   * Returns actionCommand associated with the ActionEvent fired by the
+   * JComboBox to its registered ActionListeners.
+   *
+   * @return String actionCommand for the ActionEvent
+   */
+  public String getActionCommand()
+  {
+    return actionCommand;
+  }
+
+  /**
+   * setAction
+   *
+   * @param a action to set
+   */
+  public void setAction(Action a)
+  {
+    Action old = action;
+    action = a;
+    configurePropertiesFromAction(action);
+    if (action != null)
+      // FIXME: remove from old action and add to new action 
+      // PropertyChangeListener to listen to changes in the action
+      addActionListener(action);
+  }
+
+  /**
+   * This method returns Action that is invoked when selected item is changed
+   * in the JComboBox.
+   *
+   * @return Action
+   */
+  public Action getAction()
+  {
+    return action;
+  }
+
+  /**
+   * Configure properties of the JComboBox by reading properties of specified
+   * action. This method always sets the comboBox's "enabled" property to the
+   * value of the Action's "enabled" property.
+   *
+   * @param a An Action to configure the combo box from
+   */
+  protected void configurePropertiesFromAction(Action a)
+  {
+    if (a == null)
+      {
+        setEnabled(true);
+        setToolTipText(null);
+      }
+    else
+      {
+        setEnabled(a.isEnabled());
+        setToolTipText((String) (a.getValue(Action.SHORT_DESCRIPTION)));
+      }
+  }
+
+  /**
+   * Creates PropertyChangeListener to listen for the changes in comboBox's
+   * action properties.
+   *
+   * @param action action to listen to for property changes
+   *
+   * @return a PropertyChangeListener that listens to changes in
+   *         action properties.
+   */
+  protected PropertyChangeListener createActionPropertyChangeListener(Action action)
+  {
+    return new PropertyChangeListener()
+      {
+        public void propertyChange(PropertyChangeEvent e)
+        {
+          Action act = (Action) (e.getSource());
+          configurePropertiesFromAction(act);
+        }
+      };
+  }
+
+  /**
+   * This method fires ItemEvent to this JComboBox's registered ItemListeners.
+   * This method is invoked when currently selected item in this combo box
+   * has changed.
+   *
+   * @param e the ItemEvent describing the change in the combo box's
+   *        selection.
+   */
+  protected void fireItemStateChanged(ItemEvent e)
+  {
+    ItemListener[] ll = getItemListeners();
+
+    for (int i = 0; i < ll.length; i++)
+      ll[i].itemStateChanged(e);
+  }
+
+  /**
+   * This method fires ActionEvent to this JComboBox's registered
+   * ActionListeners. This method is invoked when user explicitly changes
+   * currently selected item.
+   */
+  protected void fireActionEvent()
+  {
+    ActionListener[] ll = getActionListeners();
+
+    for (int i = 0; i < ll.length; i++)
+      ll[i].actionPerformed(new ActionEvent(this,
+                                            ActionEvent.ACTION_PERFORMED,
+                                            actionCommand));
+  }
+
+  /**
+   * Fires a popupMenuCanceled() event to all <code>PopupMenuListeners</code>.
+   *
+   * Note: This method is intended for use by plaf classes only.
+   */
+  public void firePopupMenuCanceled()
+  {
+    PopupMenuListener[] listeners = getPopupMenuListeners();
+    PopupMenuEvent e = new PopupMenuEvent(this);
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].popupMenuCanceled(e);
+  }
+
+  /**
+   * Fires a popupMenuWillBecomeInvisible() event to all 
+   * <code>PopupMenuListeners</code>.
+   *
+   * Note: This method is intended for use by plaf classes only.
+   */
+  public void firePopupMenuWillBecomeInvisible()
+  {
+    PopupMenuListener[] listeners = getPopupMenuListeners();
+    PopupMenuEvent e = new PopupMenuEvent(this);
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].popupMenuWillBecomeInvisible(e);
+  }
+
+  /**
+   * Fires a popupMenuWillBecomeVisible() event to all 
+   * <code>PopupMenuListeners</code>.
+   *
+   * Note: This method is intended for use by plaf classes only.
+   */
+  public void firePopupMenuWillBecomeVisible()
+  {
+    PopupMenuListener[] listeners = getPopupMenuListeners();
+    PopupMenuEvent e = new PopupMenuEvent(this);
+    for (int i = 0; i < listeners.length; i++)
+      listeners[i].popupMenuWillBecomeVisible(e);
+  }
+
+  /**
+   * This method is invoked whenever selected item changes in the combo box's
+   * data model. It fires ItemEvent and ActionEvent to all registered
+   * ComboBox's ItemListeners and ActionListeners respectively, indicating
+   * the change.
+   */
+  protected void selectedItemChanged()
+  {
+    // Fire ItemEvent to indicated that previously selected item is now
+    // deselected        
+    if (selectedItemReminder != null)
+      fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+                                         selectedItemReminder,
+                                         ItemEvent.DESELECTED));
+
+    // Fire ItemEvent to indicate that new item is selected    
+    Object newSelection = getSelectedItem();
+    if (newSelection != null)
+      fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+                                         newSelection, ItemEvent.SELECTED));
+
+    // Fire Action Event to JComboBox's registered listeners					 				 
+    fireActionEvent();
+
+    selectedItemReminder = newSelection;
+  }
+
+  /**
+   * Returns Object array of size 1 containing currently selected element in
+   * the JComboBox.
+   *
+   * @return Object[] Object array of size 1 containing currently selected
+   *         element in the JComboBox.
+   */
+  public Object[] getSelectedObjects()
+  {
+    return new Object[] { getSelectedItem() };
+  }
+
+  /**
+   * This method handles actionEvents fired by the ComboBoxEditor. It changes
+   * this JComboBox's selection to the new value currently in the editor and
+   * hides list of combo box items.
+   *
+   * @param e the ActionEvent
+   */
+  public void actionPerformed(ActionEvent e)
+  {
+    setSelectedItem(getEditor().getItem());
+    setPopupVisible(false);
+  }
+
+  /**
+   * This method selects item in this combo box that matches specified
+   * specified keyChar and returns true if such item is found. Otherwise
+   * false is returned.
+   *
+   * @param keyChar character indicating which item in the combo box should be
+   *        selected.
+   *
+   * @return boolean true if item corresponding to the specified keyChar
+   *         exists in the combo box. Otherwise false is returned.
+   */
+  public boolean selectWithKeyChar(char keyChar)
+  {
+    if (keySelectionManager == null)
+      {
+        keySelectionManager = createDefaultKeySelectionManager();
+      }
+
+    int index = keySelectionManager.selectionForKey(keyChar, getModel());
+    boolean retVal = false;
+    if (index >= 0)
+      {
+        setSelectedIndex(index);
+        retVal = true;
+      }
+    return retVal;
+  }
+
+  /**
+   * The part of implementation of ListDataListener interface. This method is
+   * invoked when some items where added to the JComboBox's data model.
+   *
+   * @param event ListDataEvent describing the change
+   */
+  public void intervalAdded(ListDataEvent event)
+  {
+    // FIXME: Need to implement
+    repaint();
+  }
+
+  /**
+   * The part of implementation of ListDataListener interface. This method is
+   * invoked when some items where removed from the JComboBox's data model.
+   *
+   * @param event ListDataEvent describing the change.
+   */
+  public void intervalRemoved(ListDataEvent event)
+  {
+    // FIXME: Need to implement
+    repaint();
+  }
+
+  /**
+   * The part of implementation of ListDataListener interface. This method is
+   * invoked when contents of the JComboBox's  data model changed.
+   *
+   * @param event ListDataEvent describing the change
+   */
+  public void contentsChanged(ListDataEvent event)
+  {
+    // if first and last index of the given ListDataEvent are both -1,
+    // then it indicates that selected item in the combo box data model
+    // have changed. 
+    if (event.getIndex0() == -1 && event.getIndex1() == -1)
+      selectedItemChanged();
+  }
+
+  /**
+   * This method disables or enables JComboBox. If the JComboBox is enabled,
+   * then user is able to make item choice, otherwise if JComboBox is
+   * disabled then user is not able to make a selection.
+   *
+   * @param enabled if 'enabled' is true then enable JComboBox and disable it
+   */
+  public void setEnabled(boolean enabled)
+  {
+    boolean oldEnabled = super.isEnabled();
+    if (enabled != oldEnabled)
+      {
+        super.setEnabled(enabled);
+        firePropertyChange("enabled", oldEnabled, enabled);
+      }
+  }
+
+  /**
+   * This method initializes specified ComboBoxEditor to display given item.
+   *
+   * @param anEditor ComboBoxEditor to initialize
+   * @param anItem Item that should displayed in the specified editor
+   */
+  public void configureEditor(ComboBoxEditor anEditor, Object anItem)
+  {
+    anEditor.setItem(anItem);
+  }
+
+  /**
+   * This method is fired whenever a key is pressed with the combo box
+   * in focus
+   *
+   * @param e The KeyEvent indicating which key was pressed.
+   */
+  public void processKeyEvent(KeyEvent e)
+  {
+    if (e.getKeyCode() == KeyEvent.VK_TAB)
+      setPopupVisible(false);
+    else
+      super.processKeyEvent(e);
+  }
+
+  /**
+   * setKeySelectionManager
+   *
+   * @param aManager
+   */
+  public void setKeySelectionManager(KeySelectionManager aManager)
+  {
+    keySelectionManager = aManager;
+  }
+
+  /**
+   * getKeySelectionManager
+   *
+   * @return JComboBox.KeySelectionManager
+   */
+  public KeySelectionManager getKeySelectionManager()
+  {
+    return keySelectionManager;
+  }
+
+  /**
+   * This method returns number of elements in this JComboBox
+   *
+   * @return int number of elements in this JComboBox
+   */
+  public int getItemCount()
+  {
+    return dataModel.getSize();
+  }
+
+  /**
+   * Returns elements located in the combo box at the given index.
+   *
+   * @param index index specifying location of the component to  return.
+   *
+   * @return component in the combo box that is located in  the given index.
+   */
+  public Object getItemAt(int index)
+  {
+    return dataModel.getElementAt(index);
+  }
+
+  /**
+   * createDefaultKeySelectionManager
+   *
+   * @return KeySelectionManager
+   */
+  protected KeySelectionManager createDefaultKeySelectionManager()
+  {
+    return new DefaultKeySelectionManager();
+  }
+
+  /**
+   * Returns an implementation-dependent string describing the attributes of
+   * this <code>JComboBox</code>.
+   *
+   * @return A string describing the attributes of this <code>JComboBox</code>
+   *         (never <code>null</code>).
+   */
+  protected String paramString()
+  {
+    String superParamStr = super.paramString();
+    StringBuffer sb = new StringBuffer();
+    sb.append(",isEditable=").append(isEditable());
+    sb.append(",lightWeightPopupEnabled=").append(isLightWeightPopupEnabled());
+    sb.append(",maximumRowCount=").append(getMaximumRowCount());
+    
+    sb.append(",selectedItemReminder=");
+    if (selectedItemReminder != null)
+      sb.append(selectedItemReminder);
+    return superParamStr + sb.toString();
+  }
+
+  /**
+   * Returns the object that provides accessibility features for this
+   * <code>JComboBox</code> component.
+   *
+   * @return The accessible context (an instance of 
+   *         {@link AccessibleJComboBox}).
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJComboBox();
+
+    return accessibleContext;
+  }
+
+  /**
+   * This methods adds specified ActionListener to this JComboBox.
+   *
+   * @param listener to add
+   */
+  public void addActionListener(ActionListener listener)
+  {
+    listenerList.add(ActionListener.class, listener);
+  }
+
+  /**
+   * This method removes specified ActionListener from this JComboBox.
+   *
+   * @param listener ActionListener
+   */
+  public void removeActionListener(ActionListener listener)
+  {
+    listenerList.remove(ActionListener.class, listener);
+  }
+
+  /**
+   * This method returns array of ActionListeners that are registered with
+   * this JComboBox.
+   *
+   * @since 1.4
+   */
+  public ActionListener[] getActionListeners()
+  {
+    return (ActionListener[]) getListeners(ActionListener.class);
+  }
+
+  /**
+   * This method registers given ItemListener with this JComboBox
+   *
+   * @param listener to remove
+   */
+  public void addItemListener(ItemListener listener)
+  {
+    listenerList.add(ItemListener.class, listener);
+  }
+
+  /**
+   * This method unregisters given ItemListener from this JComboBox
+   *
+   * @param listener to remove
+   */
+  public void removeItemListener(ItemListener listener)
+  {
+    listenerList.remove(ItemListener.class, listener);
+  }
+
+  /**
+   * This method returns array of ItemListeners that are registered with this
+   * JComboBox.
+   *
+   * @since 1.4
+   */
+  public ItemListener[] getItemListeners()
+  {
+    return (ItemListener[]) getListeners(ItemListener.class);
+  }
+
+  /**
+   * Adds PopupMenuListener to combo box to listen to the events fired by the
+   * combo box's popup menu containing its list of items
+   *
+   * @param listener to add
+   */
+  public void addPopupMenuListener(PopupMenuListener listener)
+  {
+    listenerList.add(PopupMenuListener.class, listener);
+  }
+
+  /**
+   * Removes PopupMenuListener to combo box to listen to the events fired by
+   * the combo box's popup menu containing its list of items
+   *
+   * @param listener to add
+   */
+  public void removePopupMenuListener(PopupMenuListener listener)
+  {
+    listenerList.remove(PopupMenuListener.class, listener);
+  }
+
+  /**
+   * Returns array of PopupMenuListeners that are registered with  combo box.
+   */
+  public PopupMenuListener[] getPopupMenuListeners()
+  {
+    return (PopupMenuListener[]) getListeners(PopupMenuListener.class);
+  }
+
+  /**
+   * Accessibility support for <code>JComboBox</code>.
+   */
+  protected class AccessibleJComboBox extends AccessibleJComponent
+    implements AccessibleAction, AccessibleSelection
+  {
+    private static final long serialVersionUID = 8217828307256675666L;
+
+    /**
+     * @specnote This constructor was protected in 1.4, but made public
+     * in 1.5.
+     */
+    public AccessibleJComboBox()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * Returns the number of accessible children of this object. The
+     * implementation of AccessibleJComboBox delegates this call to the UI
+     * of the associated JComboBox.
+     *
+     * @return the number of accessible children of this object
+     *
+     * @see ComponentUI#getAccessibleChildrenCount(JComponent)
+     */
+    public int getAccessibleChildrenCount()
+    {
+      ComponentUI ui = getUI();
+      int count;
+      if (ui != null)
+        count = ui.getAccessibleChildrenCount(JComboBox.this);
+      else
+        count = super.getAccessibleChildrenCount();
+      return count;
+    }
+
+    /**
+     * Returns the number of accessible children of this object. The
+     * implementation of AccessibleJComboBox delegates this call to the UI
+     * of the associated JComboBox.
+     *
+     * @param index the index of the accessible child to fetch
+     *
+     * @return the number of accessible children of this object
+     *
+     * @see ComponentUI#getAccessibleChild(JComponent, int)
+     */
+    public Accessible getAccessibleChild(int index)
+    {
+      ComponentUI ui = getUI();
+      Accessible child = null;
+      if (ui != null)
+        child = ui.getAccessibleChild(JComboBox.this, index);
+      else
+        child = super.getAccessibleChild(index);
+      return child;
+    }
+
+    /**
+     * Returns the AccessibleSelection object associated with this object.
+     * AccessibleJComboBoxes handle their selection themselves, so this
+     * always returns <code>this</code>.
+     *
+     * @return the AccessibleSelection object associated with this object
+     */
+    public AccessibleSelection getAccessibleSelection()
+    {
+      return this;
+    }
+
+    /**
+     * Returns the accessible selection from this AccssibleJComboBox.
+     *
+     * @param index the index of the selected child to fetch
+     *
+     * @return the accessible selection from this AccssibleJComboBox
+     */
+    public Accessible getAccessibleSelection(int index)
+    {
+      // Get hold of the actual popup.
+      Accessible popup = getUI().getAccessibleChild(JComboBox.this, 0);
+      Accessible selected = null;
+      if (popup != null && popup instanceof ComboPopup)
+        {
+          ComboPopup cPopup = (ComboPopup) popup;
+          // Query the list for the currently selected child.
+          JList l = cPopup.getList();
+          AccessibleContext listCtx = l.getAccessibleContext();
+          if (listCtx != null)
+            {
+              AccessibleSelection s = listCtx.getAccessibleSelection();
+              if (s != null)
+                {
+                  selected = s.getAccessibleSelection(index);
+                }
+            }
+        }
+      return selected;
+    }
+
+    /**
+     * Returns <code>true</code> if the accessible child with the specified
+     * <code>index</code> is selected, <code>false</code> otherwise.
+     *
+     * @param index the index of the accessible child
+     *
+     * @return <code>true</code> if the accessible child with the specified
+     *         <code>index</code> is selected, <code>false</code> otherwise
+     */
+    public boolean isAccessibleChildSelected(int index)
+    {
+      return getSelectedIndex() == index;
+    }
+
+    /**
+     * Returns the accessible role for the <code>JComboBox</code> component.
+     *
+     * @return {@link AccessibleRole#COMBO_BOX}.
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.COMBO_BOX;
+    }
+
+    /**
+     * Returns the accessible action associated to this accessible object.
+     * AccessibleJComboBox implements its own AccessibleAction, so this
+     * method returns <code>this</code>.
+     *
+     * @return the accessible action associated to this accessible object
+     */
+    public AccessibleAction getAccessibleAction()
+    {
+      return this;
+    }
+
+    /**
+     * Returns the description of the specified action. AccessibleJComboBox
+     * implements 1 action (toggle the popup menu) and thus returns
+     * <code>UIManager.getString("ComboBox.togglePopupText")</code>
+     *
+     * @param actionIndex the index of the action for which to return the
+     *        description
+     *
+     * @return the description of the specified action
+     */
+    public String getAccessibleActionDescription(int actionIndex)
+    {
+      return UIManager.getString("ComboBox.togglePopupText");
+    }
+
+    /**
+     * Returns the number of accessible actions that can be performed by
+     * this object. AccessibleJComboBox implement s one accessible action
+     * (toggle the popup menu), so this method always returns <code>1</code>.
+     *
+     * @return the number of accessible actions that can be performed by
+     *         this object
+     */
+    public int getAccessibleActionCount()
+    {
+      return 1;
+    }
+
+    /**
+     * Performs the accessible action with the specified index.
+     * AccessibleJComboBox has 1 accessible action
+     * (<code>actionIndex == 0</code>), which is to toggle the
+     * popup menu. All other action indices have no effect and return
+     * <code<>false</code>.
+     *
+     * @param actionIndex the index of the action to perform
+     *
+     * @return <code>true</code> if the action has been performed,
+     *         <code>false</code> otherwise
+     */
+    public boolean doAccessibleAction(int actionIndex)
+    {
+      boolean actionPerformed = false;
+      if (actionIndex == 0)
+        {
+          setPopupVisible(! isPopupVisible());
+          actionPerformed = true;
+        }
+      return actionPerformed;
+    }
+
+    /**
+     * Returns the number of selected accessible children of this object. This
+     * returns <code>1</code> if the combobox has a selected entry,
+     * <code>0</code> otherwise.
+     *
+     * @return the number of selected accessible children of this object
+     */
+    public int getAccessibleSelectionCount()
+    {
+      Object sel = getSelectedItem();
+      int count = 0;
+      if (sel != null)
+        count = 1;
+      return count;
+    }
+
+    /**
+     * Sets the current selection to the specified <code>index</code>.
+     *
+     * @param index the index to set as selection
+     */
+    public void addAccessibleSelection(int index)
+    {
+      setSelectedIndex(index);
+    }
+
+    /**
+     * Removes the specified index from the current selection.
+     *
+     * @param index the index to remove from the selection
+     */
+    public void removeAccessibleSelection(int index)
+    {
+      if (getSelectedIndex() == index)
+        clearAccessibleSelection();
+    }
+
+    /**
+     * Clears the current selection.
+     */
+    public void clearAccessibleSelection()
+    {
+      setSelectedIndex(-1);
+    }
+
+    /**
+     * Multiple selection is not supported by AccessibleJComboBox, so this
+     * does nothing.
+     */
+    public void selectAllAccessibleSelection()
+    {
+      // Nothing to do here.
+    }
+  }
+  
+  private class DefaultKeySelectionManager
+      implements KeySelectionManager
+  {
+
+    public int selectionForKey(char aKey, ComboBoxModel aModel)
+    {
+      int selectedIndex = getSelectedIndex();
+
+      // Start at currently selected item and iterate to end of list
+      for (int i = selectedIndex + 1; i < aModel.getSize(); i++)
+        {
+          String nextItem = aModel.getElementAt(i).toString();
+
+          if (nextItem.charAt(0) == aKey)
+            return i;
+        }
+
+      // Wrap to start of list if no match yet
+      for (int i = 0; i <= selectedIndex; i++)
+        {
+          String nextItem = aModel.getElementAt(i).toString();
+
+          if (nextItem.charAt(0) == aKey)
+            return i;
+        }
+
+      return - 1;
+    }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComponent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComponent.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComponent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JComponent.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,3769 @@
+/* JComponent.java -- Every component in swing inherits from this class.
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.applet.Applet;
+import java.awt.AWTEvent;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.FocusTraversalPolicy;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Window;
+import java.awt.dnd.DropTarget;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.peer.LightweightPeer;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyVetoException;
+import java.beans.VetoableChangeListener;
+import java.beans.VetoableChangeSupport;
+import java.io.Serializable;
+import java.util.EventListener;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.Set;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleExtendedComponent;
+import javax.accessibility.AccessibleKeyBinding;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.swing.border.Border;
+import javax.swing.border.CompoundBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.event.AncestorEvent;
+import javax.swing.event.AncestorListener;
+import javax.swing.event.EventListenerList;
+import javax.swing.plaf.ComponentUI;
+
+/**
+ * The base class of all Swing components.
+ * It contains generic methods to manage events, properties and sizes. Actual
+ * drawing of the component is channeled to a look-and-feel class that is
+ * implemented elsewhere.
+ *
+ * @author Ronald Veldema (rveldema&064;cs.vu.nl)
+ * @author Graydon Hoare (graydon&064;redhat.com)
+ */
+public abstract class JComponent extends Container implements Serializable
+{
+  private static final long serialVersionUID = -7908749299918704233L;
+
+  /** 
+   * The accessible context of this <code>JComponent</code>.
+   */
+  protected AccessibleContext accessibleContext;
+
+  /**
+   * Basic accessibility support for <code>JComponent</code> derived
+   * widgets.
+   */
+  public abstract class AccessibleJComponent 
+    extends AccessibleAWTContainer
+    implements AccessibleExtendedComponent
+  {
+    /**
+     * Receives notification if the focus on the JComponent changes and
+     * fires appropriate PropertyChangeEvents to listeners registered with
+     * the AccessibleJComponent.
+     */
+    protected class AccessibleFocusHandler 
+      implements FocusListener
+    {
+      /**
+       * Creates a new AccessibleFocusHandler.
+       */
+      protected AccessibleFocusHandler()
+      {
+        // Nothing to do here.
+      }
+
+      /**
+       * Receives notification when the JComponent gained focus and fires
+       * a PropertyChangeEvent to listeners registered on the
+       * AccessibleJComponent with a property name of
+       * {@link AccessibleContext#ACCESSIBLE_STATE_PROPERTY} and a new value
+       * of {@link AccessibleState#FOCUSED}.
+       */
+      public void focusGained(FocusEvent event)
+      {
+        AccessibleJComponent.this.firePropertyChange
+          (AccessibleContext.ACCESSIBLE_STATE_PROPERTY, null,
+           AccessibleState.FOCUSED);
+      }
+
+      /**
+       * Receives notification when the JComponent lost focus and fires
+       * a PropertyChangeEvent to listeners registered on the
+       * AccessibleJComponent with a property name of
+       * {@link AccessibleContext#ACCESSIBLE_STATE_PROPERTY} and an old value
+       * of {@link AccessibleState#FOCUSED}.
+       */
+      public void focusLost(FocusEvent valevent)
+      {
+        AccessibleJComponent.this.firePropertyChange
+          (AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+           AccessibleState.FOCUSED, null);
+      }
+    }
+
+    /**
+     * Receives notification if there are child components are added or removed
+     * from the JComponent and fires appropriate PropertyChangeEvents to
+     * interested listeners on the AccessibleJComponent.
+     */
+    protected class AccessibleContainerHandler 
+      implements ContainerListener
+    {
+      /**
+       * Creates a new AccessibleContainerHandler.
+       */
+      protected AccessibleContainerHandler()
+      {
+        // Nothing to do here.
+      }
+
+      /**
+       * Receives notification when a child component is added to the
+       * JComponent and fires a PropertyChangeEvent on listeners registered
+       * with the AccessibleJComponent with a property name of
+       * {@link AccessibleContext#ACCESSIBLE_CHILD_PROPERTY}.
+       *
+       * @param event the container event
+       */
+      public void componentAdded(ContainerEvent event)
+      {
+        Component c = event.getChild();
+        if (c != null && c instanceof Accessible)
+          {
+            AccessibleContext childCtx = c.getAccessibleContext();
+            AccessibleJComponent.this.firePropertyChange
+              (AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, null, childCtx);
+          }
+      }
+
+      /**
+       * Receives notification when a child component is removed from the
+       * JComponent and fires a PropertyChangeEvent on listeners registered
+       * with the AccessibleJComponent with a property name of
+       * {@link AccessibleContext#ACCESSIBLE_CHILD_PROPERTY}.
+       *
+       * @param event the container event
+       */
+      public void componentRemoved(ContainerEvent event)
+      {
+        Component c = event.getChild();
+        if (c != null && c instanceof Accessible)
+          {
+            AccessibleContext childCtx = c.getAccessibleContext();
+            AccessibleJComponent.this.firePropertyChange
+              (AccessibleContext.ACCESSIBLE_CHILD_PROPERTY, childCtx, null);
+          }
+      }
+    }
+
+    private static final long serialVersionUID = -7047089700479897799L;
+
+    /**
+     * Receives notification when a child component is added to the
+     * JComponent and fires a PropertyChangeEvent on listeners registered
+     * with the AccessibleJComponent.
+     *
+     * @specnote AccessibleAWTContainer has a protected field with the same
+     *           name. Looks like a bug or nasty misdesign to me.
+     */
+    protected ContainerListener accessibleContainerHandler;
+
+    /**
+     * Receives notification if the focus on the JComponent changes and
+     * fires appropriate PropertyChangeEvents to listeners registered with
+     * the AccessibleJComponent.
+     *
+     * @specnote AccessibleAWTComponent has a protected field
+     *           accessibleAWTFocusHandler. Looks like a bug or nasty misdesign
+     *           to me.
+     */
+    protected FocusListener accessibleFocusHandler;
+
+    /**
+     * Creates a new AccessibleJComponent.
+     */
+    protected AccessibleJComponent()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * Adds a property change listener to the list of registered listeners.
+     *
+     * This sets up the {@link #accessibleContainerHandler} and
+     * {@link #accessibleFocusHandler} fields and calls
+     * <code>super.addPropertyChangeListener(listener)</code>.
+     *
+     * @param listener the listener to add
+     */
+    public void addPropertyChangeListener(PropertyChangeListener listener)
+    {
+      // Tests seem to indicate that this method also sets up the other two
+      // handlers.
+      if (accessibleContainerHandler == null)
+        {
+          accessibleContainerHandler = new AccessibleContainerHandler();
+          addContainerListener(accessibleContainerHandler);
+        }
+      if (accessibleFocusHandler == null)
+        {
+          accessibleFocusHandler = new AccessibleFocusHandler();
+          addFocusListener(accessibleFocusHandler);
+        }
+      super.addPropertyChangeListener(listener);
+    }
+
+    /**
+     * Removes a property change listener from the list of registered listeners.
+     *
+     * This uninstalls the {@link #accessibleContainerHandler} and
+     * {@link #accessibleFocusHandler} fields and calls
+     * <code>super.removePropertyChangeListener(listener)</code>.
+     *
+     * @param listener the listener to remove
+     */
+    public void removePropertyChangeListener(PropertyChangeListener listener)
+    {
+      // Tests seem to indicate that this method also resets the other two
+      // handlers.
+      if (accessibleContainerHandler != null)
+        {
+          removeContainerListener(accessibleContainerHandler);
+          accessibleContainerHandler = null;
+        }
+      if (accessibleFocusHandler != null)
+        {
+          removeFocusListener(accessibleFocusHandler);
+          accessibleFocusHandler = null;
+        }
+      super.removePropertyChangeListener(listener);
+    }
+
+    /**
+     * Returns the number of accessible children of this object.
+     *
+     * @return  the number of accessible children of this object
+     */
+    public int getAccessibleChildrenCount()
+    {
+      // TODO: The functionality should be performed in the superclass.
+      // Find out why this is overridden. However, it is very well possible
+      // that this is left over from times when there was no such superclass
+      // method.
+      return super.getAccessibleChildrenCount();
+    }
+
+    /**
+     * Returns the accessible child component at index <code>i</code>.
+     *
+     * @param i the index of the accessible child to return
+     *
+     * @return the accessible child component at index <code>i</code>
+     */
+    public Accessible getAccessibleChild(int i)
+    {
+      // TODO: The functionality should be performed in the superclass.
+      // Find out why this is overridden. However, it is very well possible
+      // that this is left over from times when there was no such superclass
+      // method.
+      return super.getAccessibleChild(i);
+    }
+
+    /**
+     * Returns the accessible state set of this component.
+     *
+     * @return the accessible state set of this component
+     */
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      // Note: While the java.awt.Component has an 'opaque' property, it
+      // seems that it is not added to the accessible state set there, even
+      // if this property is true. However, it is handled for JComponent, so
+      // we add it here.
+      AccessibleStateSet state = super.getAccessibleStateSet();
+      if (isOpaque())
+        state.add(AccessibleState.OPAQUE);
+      return state;
+    }
+
+    /**
+     * Returns the localized name for this object. Generally this should
+     * almost never return {@link Component#getName()} since that is not
+     * a localized name. If the object is some kind of text component (like
+     * a menu item), then the value of the object may be returned. Also, if
+     * the object has a tooltip, the value of the tooltip may also be
+     * appropriate.
+     *
+     * @return the localized name for this object or <code>null</code> if this
+     *         object has no name
+     */
+    public String getAccessibleName()
+    {
+      String name = super.getAccessibleName();
+
+      // There are two fallbacks provided by the JComponent in the case the
+      // superclass returns null:
+      // - If the component is inside a titled border, then it inherits the
+      //   name from the border title.
+      // - If the component is not inside a titled border but has a label
+      //   (via JLabel.setLabelFor()), then it gets the name from the label's
+      //   accessible context.
+
+      if (name == null)
+        {
+          name = getTitledBorderText();
+        }
+
+      if (name == null)
+        {
+          Object l = getClientProperty(JLabel.LABEL_PROPERTY);
+          if (l instanceof Accessible)
+            {
+              AccessibleContext labelCtx =
+                ((Accessible) l).getAccessibleContext();
+              name = labelCtx.getAccessibleName();
+            }
+        }
+
+      return name;
+    }
+
+    /**
+     * Returns the localized description of this object.
+     *
+     * @return the localized description of this object or <code>null</code>
+     *         if this object has no description
+     */
+    public String getAccessibleDescription()
+    {
+      // There are two fallbacks provided by the JComponent in the case the
+      // superclass returns null:
+      // - If the component has a tooltip, then inherit the description from
+      //   the tooltip.
+      // - If the component is not inside a titled border but has a label
+      //   (via JLabel.setLabelFor()), then it gets the name from the label's
+      //   accessible context.
+      String descr = super.getAccessibleDescription();
+
+      if (descr == null)
+        {
+          descr = getToolTipText();
+        }
+
+      if (descr == null)
+        {
+          Object l = getClientProperty(JLabel.LABEL_PROPERTY);
+          if (l instanceof Accessible)
+            {
+              AccessibleContext labelCtx =
+                ((Accessible) l).getAccessibleContext();
+              descr = labelCtx.getAccessibleName();
+            }
+        }
+
+      return descr;
+    }
+
+    /**
+     * Returns the accessible role of this component.
+     *
+     * @return the accessible role of this component
+     *
+     * @see AccessibleRole
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.SWING_COMPONENT;
+    }
+
+    /**
+     * Recursivly searches a border hierarchy (starting at <code>border) for
+     * a titled border and returns the title if one is found, <code>null</code>
+     * otherwise.
+     *
+     * @param border the border to start search from
+     *
+     * @return the border title of a possibly found titled border
+     */
+    protected String getBorderTitle(Border border)
+    {
+      String title = null;
+      if (border instanceof CompoundBorder)
+        {
+          CompoundBorder compound = (CompoundBorder) border;
+          Border inner = compound.getInsideBorder();
+          title = getBorderTitle(inner);
+          if (title == null)
+            {
+              Border outer = compound.getOutsideBorder();
+              title = getBorderTitle(outer);
+            }
+        }
+      else if (border instanceof TitledBorder)
+        {
+          TitledBorder titled = (TitledBorder) border;
+          title = titled.getTitle(); 
+        }
+      return title;
+    }
+
+    /**
+     * Returns the tooltip text for this accessible component.
+     *
+     * @return the tooltip text for this accessible component
+     */
+    public String getToolTipText()
+    {
+      return JComponent.this.getToolTipText();
+    }
+
+    /**
+     * Returns the title of the border of this accessible component if
+     * this component has a titled border, otherwise returns <code>null</code>.
+     *
+     * @return the title of the border of this accessible component if
+     *         this component has a titled border, otherwise returns
+     *         <code>null</code>
+     */
+    public String getTitledBorderText()
+    {
+      return getBorderTitle(getBorder()); 
+    }
+
+    /**
+     * Returns the keybindings associated with this accessible component or
+     * <code>null</code> if the component does not support key bindings.
+     *
+     * @return the keybindings associated with this accessible component
+     */
+    public AccessibleKeyBinding getAccessibleKeyBinding()
+    {
+      // The reference implementation seems to always return null here,
+      // independent of the key bindings of the JComponent. So do we.
+      return null;
+    }
+  }
+
+  /** 
+   * An explicit value for the component's preferred size; if not set by a
+   * user, this is calculated on the fly by delegating to the {@link
+   * ComponentUI#getPreferredSize} method on the {@link #ui} property. 
+   */
+  Dimension preferredSize;
+
+  /** 
+   * An explicit value for the component's minimum size; if not set by a
+   * user, this is calculated on the fly by delegating to the {@link
+   * ComponentUI#getMinimumSize} method on the {@link #ui} property. 
+   */
+  Dimension minimumSize;
+
+  /** 
+   * An explicit value for the component's maximum size; if not set by a
+   * user, this is calculated on the fly by delegating to the {@link
+   * ComponentUI#getMaximumSize} method on the {@link #ui} property.
+   */
+  Dimension maximumSize;
+
+  /**
+   * A value between 0.0 and 1.0 indicating the preferred horizontal
+   * alignment of the component, relative to its siblings. The values
+   * {@link #LEFT_ALIGNMENT}, {@link #CENTER_ALIGNMENT}, and {@link
+   * #RIGHT_ALIGNMENT} can also be used, as synonyms for <code>0.0</code>,
+   * <code>0.5</code>, and <code>1.0</code>, respectively. Not all layout
+   * managers use this property.
+   *
+   * @see #getAlignmentX
+   * @see #setAlignmentX
+   * @see javax.swing.OverlayLayout
+   * @see javax.swing.BoxLayout
+   */
+  float alignmentX = -1.0F;
+
+  /**
+   * A value between 0.0 and 1.0 indicating the preferred vertical
+   * alignment of the component, relative to its siblings. The values
+   * {@link #TOP_ALIGNMENT}, {@link #CENTER_ALIGNMENT}, and {@link
+   * #BOTTOM_ALIGNMENT} can also be used, as synonyms for <code>0.0</code>,
+   * <code>0.5</code>, and <code>1.0</code>, respectively. Not all layout
+   * managers use this property.
+   *
+   * @see #getAlignmentY
+   * @see #setAlignmentY
+   * @see javax.swing.OverlayLayout
+   * @see javax.swing.BoxLayout
+   */
+  float alignmentY = -1.0F;
+
+  /** 
+   * The border painted around this component.
+   * 
+   * @see #paintBorder
+   */
+  Border border;
+
+  /** 
+   * The text to show in the tooltip associated with this component.
+   * 
+   * @see #setToolTipText
+   * @see #getToolTipText()
+   */
+   String toolTipText;
+
+  /**
+   * The popup menu for the component.
+   * 
+   * @see #getComponentPopupMenu()
+   * @see #setComponentPopupMenu(JPopupMenu)
+   */
+  JPopupMenu componentPopupMenu;
+   
+  /**
+   * A flag that controls whether the {@link #getComponentPopupMenu()} method
+   * looks to the component's parent when the <code>componentPopupMenu</code>
+   * field is <code>null</code>.
+   */
+  boolean inheritsPopupMenu;
+  
+  /** 
+   * <p>Whether to double buffer this component when painting. This flag
+   * should generally be <code>true</code>, to ensure good painting
+   * performance.</p>
+   *
+   * <p>All children of a double buffered component are painted into the
+   * double buffer automatically, so only the top widget in a window needs
+   * to be double buffered.</p>
+   *
+   * @see #setDoubleBuffered
+   * @see #isDoubleBuffered
+   * @see #paint
+   */
+  boolean doubleBuffered = true;
+
+  /**
+   * A set of flags indicating which debugging graphics facilities should
+   * be enabled on this component. The values should be a combination of
+   * {@link DebugGraphics#NONE_OPTION}, {@link DebugGraphics#LOG_OPTION},
+   * {@link DebugGraphics#FLASH_OPTION}, or {@link
+   * DebugGraphics#BUFFERED_OPTION}.
+   *
+   * @see #setDebugGraphicsOptions
+   * @see #getDebugGraphicsOptions
+   * @see DebugGraphics
+   * @see #getComponentGraphics
+   */
+  int debugGraphicsOptions;
+
+  /** 
+   * <p>This property controls two independent behaviors simultaneously.</p>
+   *
+   * <p>First, it controls whether to fill the background of this widget
+   * when painting its body. This affects calls to {@link
+   * JComponent#paintComponent}, which in turn calls {@link
+   * ComponentUI#update} on the component's {@link #ui} property. If the
+   * component is opaque during this call, the background will be filled
+   * before calling {@link ComponentUI#paint}. This happens merely as a
+   * convenience; you may fill the component's background yourself too,
+   * but there is no need to do so if you will be filling with the same
+   * color.</p>
+   *
+   * <p>Second, it the opaque property informs swing's repaint system
+   * whether it will be necessary to paint the components "underneath" this
+   * component, in Z-order. If the component is opaque, it is considered to
+   * completely occlude components "underneath" it, so they will not be
+   * repainted along with the opaque component.</p>
+   *
+   * <p>The default value for this property is <code>false</code>, but most
+   * components will want to set it to <code>true</code> when installing UI
+   * defaults in {@link ComponentUI#installUI}.</p>
+   *
+   * @see #setOpaque
+   * @see #isOpaque
+   * @see #paintComponent
+   */
+  boolean opaque = false;
+
+  /** 
+   * The user interface delegate for this component. Event delivery and
+   * repainting of the component are usually delegated to this object. 
+   *
+   * @see #setUI
+   * @see #getUIClassID
+   * @see #updateUI
+   */
+  protected ComponentUI ui;
+
+  /**
+   * A hint to the focus system that this component should or should not
+   * get focus. If this is <code>false</code>, swing will not try to
+   * request focus on this component; if <code>true</code>, swing might
+   * try to request focus, but the request might fail. Thus it is only 
+   * a hint guiding swing's behavior.
+   *
+   * @see #requestFocus()
+   * @see #isRequestFocusEnabled
+   * @see #setRequestFocusEnabled
+   */
+  boolean requestFocusEnabled;
+
+  /**
+   * Flag indicating behavior of this component when the mouse is dragged
+   * outside the component and the mouse <em>stops moving</em>. If
+   * <code>true</code>, synthetic mouse events will be delivered on regular
+   * timed intervals, continuing off in the direction the mouse exited the
+   * component, until the mouse is released or re-enters the component.
+   *
+   * @see #setAutoscrolls
+   * @see #getAutoscrolls
+   */
+  boolean autoscrolls = false;
+
+  /**
+   * Indicates whether the current paint call is already double buffered or
+   * not. 
+   */
+  static boolean paintingDoubleBuffered = false;
+
+  /**
+   * Indicates whether we are calling paintDoubleBuffered() from
+   * paintImmadiately (RepaintManager) or from paint() (AWT refresh).
+   */
+  static private boolean isRepainting = false;
+
+  /**
+   * Listeners for events other than {@link PropertyChangeEvent} are
+   * handled by this listener list. PropertyChangeEvents are handled in
+   * {@link #changeSupport}.
+   */
+  protected EventListenerList listenerList = new EventListenerList();
+
+  /**
+   * Handles VetoableChangeEvents.
+   */
+  private VetoableChangeSupport vetoableChangeSupport;
+
+  /** 
+   * Storage for "client properties", which are key/value pairs associated
+   * with this component by a "client", such as a user application or a
+   * layout manager. This is lazily constructed when the component gets its
+   * first client property.
+   */
+  private Hashtable clientProperties;
+  
+  private InputMap inputMap_whenFocused;
+  private InputMap inputMap_whenAncestorOfFocused;
+  private ComponentInputMap inputMap_whenInFocusedWindow;
+  private ActionMap actionMap;
+  /** @since 1.3 */
+  private boolean verifyInputWhenFocusTarget = true;
+  private InputVerifier inputVerifier;
+
+  private TransferHandler transferHandler;
+
+  /**
+   * Indicates if this component is currently painting a tile or not.
+   */
+  private boolean paintingTile;
+
+  /**
+   * A temporary buffer used for fast dragging of components.
+   */
+  private Image dragBuffer;
+
+  /**
+   * Indicates if the dragBuffer is already initialized.
+   */
+  private boolean dragBufferInitialized;
+
+  /**
+   * A cached Rectangle object to be reused. Be careful when you use that,
+   * so that it doesn't get modified in another context within the same
+   * method call chain.
+   */
+  private static transient Rectangle rectCache;
+
+  /**
+   * The default locale of the component.
+   * 
+   * @see #getDefaultLocale
+   * @see #setDefaultLocale
+   */
+  private static Locale defaultLocale;
+  
+  public static final String TOOL_TIP_TEXT_KEY = "ToolTipText";
+
+  /**
+   * Constant used to indicate that no condition has been assigned to a
+   * particular action.
+   *
+   * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
+   */
+  public static final int UNDEFINED_CONDITION = -1;
+
+  /**
+   * Constant used to indicate that an action should be performed only when 
+   * the component has focus.
+   *
+   * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
+   */
+  public static final int WHEN_FOCUSED = 0;
+
+  /**
+   * Constant used to indicate that an action should be performed only when 
+   * the component is an ancestor of the component which has focus.
+   *
+   * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
+   */
+  public static final int WHEN_ANCESTOR_OF_FOCUSED_COMPONENT = 1;
+
+  /**
+   * Constant used to indicate that an action should be performed only when 
+   * the component is in the window which has focus.
+   *
+   * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
+   */
+  public static final int WHEN_IN_FOCUSED_WINDOW = 2;
+
+  /**
+   * Indicates if the opaque property has been set by a client program or by
+   * the UI.
+   *
+   * @see #setUIProperty(String, Object)
+   * @see LookAndFeel#installProperty(JComponent, String, Object)
+   */
+  private boolean clientOpaqueSet = false;
+
+  /**
+   * Indicates if the autoscrolls property has been set by a client program or
+   * by the UI.
+   *
+   * @see #setUIProperty(String, Object)
+   * @see LookAndFeel#installProperty(JComponent, String, Object)
+   */
+  private boolean clientAutoscrollsSet = false;
+
+  /**
+   * Creates a new <code>JComponent</code> instance.
+   */
+  public JComponent()
+  {
+    super();
+    setDropTarget(new DropTarget());
+    setLocale(getDefaultLocale());
+    debugGraphicsOptions = DebugGraphics.NONE_OPTION;
+    setRequestFocusEnabled(true);
+  }
+
+  /**
+   * Helper to lazily construct and return the client properties table.
+   * 
+   * @return The current client properties table
+   *
+   * @see #clientProperties
+   * @see #getClientProperty
+   * @see #putClientProperty
+   */
+  private Hashtable getClientProperties()
+  {
+    if (clientProperties == null)
+      clientProperties = new Hashtable();
+    return clientProperties;
+  }
+
+  /**
+   * Get a client property associated with this component and a particular
+   * key.
+   *
+   * @param key The key with which to look up the client property
+   *
+   * @return A client property associated with this object and key
+   *
+   * @see #clientProperties
+   * @see #getClientProperties
+   * @see #putClientProperty
+   */
+  public final Object getClientProperty(Object key)
+  {
+    return getClientProperties().get(key);
+  }
+
+  /**
+   * Add a client property <code>value</code> to this component, associated
+   * with <code>key</code>. If there is an existing client property
+   * associated with <code>key</code>, it will be replaced.  A
+   * {@link PropertyChangeEvent} is sent to registered listeners (with the
+   * name of the property being <code>key.toString()</code>).
+   *
+   * @param key The key of the client property association to add
+   * @param value The value of the client property association to add
+   *
+   * @see #clientProperties
+   * @see #getClientProperties
+   * @see #getClientProperty
+   */
+  public final void putClientProperty(Object key, Object value)
+  {
+    Hashtable t = getClientProperties();
+    Object old = t.get(key);
+    if (value != null)
+      t.put(key, value);
+    else
+      t.remove(key);
+    firePropertyChange(key.toString(), old, value);
+  }
+
+  /**
+   * Unregister an <code>AncestorListener</code>.
+   *
+   * @param listener The listener to unregister
+   * 
+   * @see #addAncestorListener
+   */
+  public void removeAncestorListener(AncestorListener listener)
+  {
+    listenerList.remove(AncestorListener.class, listener);
+  }
+
+  /**
+   * Unregister a <code>VetoableChangeChangeListener</code>.
+   *
+   * @param listener The listener to unregister
+   *
+   * @see #addVetoableChangeListener
+   */
+  public void removeVetoableChangeListener(VetoableChangeListener listener)
+  {
+    if (vetoableChangeSupport != null)
+      vetoableChangeSupport.removeVetoableChangeListener(listener);
+  }
+
+  /**
+   * Register an <code>AncestorListener</code>.
+   *
+   * @param listener The listener to register
+   *
+   * @see #removeVetoableChangeListener
+   */
+  public void addAncestorListener(AncestorListener listener)
+  {
+    listenerList.add(AncestorListener.class, listener);
+  }
+
+  /**
+   * Register a <code>VetoableChangeListener</code>.
+   *
+   * @param listener The listener to register
+   *
+   * @see #removeVetoableChangeListener
+   * @see #listenerList
+   */
+  public void addVetoableChangeListener(VetoableChangeListener listener)
+  {
+    // Lazily instantiate this, it's rarely needed.
+    if (vetoableChangeSupport == null)
+      vetoableChangeSupport = new VetoableChangeSupport(this);
+    vetoableChangeSupport.addVetoableChangeListener(listener);
+  }
+
+  /**
+   * Returns all registered {@link EventListener}s of the given 
+   * <code>listenerType</code>.
+   *
+   * @param listenerType the class of listeners to filter (<code>null</code> 
+   *                     not permitted).
+   *                     
+   * @return An array of registered listeners.
+   * 
+   * @throws ClassCastException if <code>listenerType</code> does not implement
+   *                            the {@link EventListener} interface.
+   * @throws NullPointerException if <code>listenerType</code> is 
+   *                              <code>null</code>.
+   *                            
+   * @see #getAncestorListeners()
+   * @see #listenerList
+   * 
+   * @since 1.3
+   */
+  public EventListener[] getListeners(Class listenerType)
+  {
+    if (listenerType == PropertyChangeListener.class)
+      return getPropertyChangeListeners();
+    else if (listenerType == VetoableChangeListener.class)
+      return getVetoableChangeListeners();
+    else
+      return listenerList.getListeners(listenerType);
+  }
+
+  /**
+   * Return all registered <code>AncestorListener</code> objects.
+   *
+   * @return The set of <code>AncestorListener</code> objects in {@link
+   * #listenerList}
+   */
+  public AncestorListener[] getAncestorListeners()
+  {
+    return (AncestorListener[]) getListeners(AncestorListener.class);
+  }
+
+  /**
+   * Return all registered <code>VetoableChangeListener</code> objects.
+   *
+   * @return An array of the <code>VetoableChangeListener</code> objects 
+   *     registered with this component (possibly empty but never 
+   *     <code>null</code>).
+   * 
+   * @since 1.4
+   */
+  public VetoableChangeListener[] getVetoableChangeListeners()
+  {    
+    return vetoableChangeSupport == null ? new VetoableChangeListener[0]
+        : vetoableChangeSupport.getVetoableChangeListeners();
+  }
+
+  /**
+   * Call {@link VetoableChangeListener#vetoableChange} on all listeners
+   * registered to listen to a given property. Any method which changes
+   * the specified property of this component should call this method.
+   *
+   * @param propertyName The property which changed
+   * @param oldValue The old value of the property
+   * @param newValue The new value of the property
+   *
+   * @throws PropertyVetoException if the change was vetoed by a listener
+   *
+   * @see #addVetoableChangeListener
+   * @see #removeVetoableChangeListener
+   */
+  protected void fireVetoableChange(String propertyName, Object oldValue,
+                                    Object newValue)
+    throws PropertyVetoException
+  {
+    if (vetoableChangeSupport != null)
+      vetoableChangeSupport.fireVetoableChange(propertyName, oldValue, newValue);
+  }
+
+
+  /**
+   * Fires a property change for a primitive integer property.
+   *
+   * @param property the name of the property
+   * @param oldValue the old value of the property
+   * @param newValue the new value of the property
+   *
+   * @specnote This method is implemented in
+   *           {@link Component#firePropertyChange(String, int, int)}. It is
+   *           only here because it is specified to be public, whereas the
+   *           Component method is protected.
+   */
+  public void firePropertyChange(String property, int oldValue, int newValue)
+  {
+    super.firePropertyChange(property, oldValue, newValue);
+  }
+  
+  /**
+   * Fires a property change for a primitive boolean property.
+   *
+   * @param property the name of the property
+   * @param oldValue the old value of the property
+   * @param newValue the new value of the property
+   *
+   * @specnote This method is implemented in
+   *           {@link Component#firePropertyChange(String, boolean, boolean)}.
+   *           It is only here because it is specified to be public, whereas
+   *           the Component method is protected.
+   */
+  public void firePropertyChange(String property, boolean oldValue,
+                                 boolean newValue)
+  {
+    super.firePropertyChange(property, oldValue, newValue);
+  }
+
+  /**
+   * Fires a property change for a primitive character property.
+   *
+   * @param property the name of the property
+   * @param oldValue the old value of the property
+   * @param newValue the new value of the property
+   */
+  public void firePropertyChange(String property, char oldValue,
+                                 char newValue)
+  {
+    //  FIXME - This method is already public in awt Component, but
+    //  is included here to work around a compilation bug in gcj 4.1.
+    super.firePropertyChange(property, oldValue, newValue);
+  }
+
+  /**
+   * Get the value of the accessibleContext property for this component.
+   *
+   * @return the current value of the property
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    return null;
+  }
+
+  /**
+   * Get the value of the {@link #alignmentX} property.
+   *
+   * @return The current value of the property.
+   *
+   * @see #setAlignmentX
+   * @see #alignmentY
+   */
+  public float getAlignmentX()
+  {
+    float ret = alignmentX;
+    if (alignmentX < 0)
+      // alignment has not been set explicitly.
+      ret = super.getAlignmentX();
+
+    return ret;
+  }
+
+  /**
+   * Get the value of the {@link #alignmentY} property.
+   *
+   * @return The current value of the property.
+   *
+   * @see #setAlignmentY
+   * @see #alignmentX
+   */
+  public float getAlignmentY()
+  {
+    float ret = alignmentY;
+    if (alignmentY < 0)
+      // alignment has not been set explicitly.
+      ret = super.getAlignmentY();
+
+    return ret;
+  }
+
+  /**
+   * Get the current value of the {@link #autoscrolls} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean getAutoscrolls()
+  {
+    return autoscrolls;
+  }
+
+  /**
+   * Set the value of the {@link #border} property.
+   *   
+   * @param newBorder The new value of the property
+   *
+   * @see #getBorder
+   */
+  public void setBorder(Border newBorder)
+  {
+    Border oldBorder = getBorder();
+    if (oldBorder == newBorder)
+      return;
+
+    border = newBorder;
+    firePropertyChange("border", oldBorder, newBorder);
+    repaint();
+  }
+
+  /**
+   * Get the value of the {@link #border} property.
+   *
+   * @return The property's current value
+   *
+   * @see #setBorder
+   */
+  public Border getBorder()
+  {
+    return border;
+  }
+
+  /**
+   * Get the component's current bounding box. If a rectangle is provided,
+   * use this as the return value (adjusting its fields in place);
+   * otherwise (of <code>null</code> is provided) return a new {@link
+   * Rectangle}.
+   *
+   * @param rv Optional return value to use
+   *
+   * @return A rectangle bounding the component
+   */
+  public Rectangle getBounds(Rectangle rv)
+  {
+    if (rv == null)
+      return new Rectangle(getX(), getY(), getWidth(), getHeight());
+    else
+      {
+        rv.setBounds(getX(), getY(), getWidth(), getHeight());
+        return rv;
+      }
+  }
+
+  /**
+   * Prepares a graphics context for painting this object. If {@link
+   * #debugGraphicsOptions} is not equal to {@link
+   * DebugGraphics#NONE_OPTION}, produce a new {@link DebugGraphics} object
+   * wrapping the parameter. Otherwise configure the parameter with this
+   * component's foreground color and font.
+   *
+   * @param g The graphics context to wrap or configure
+   *
+   * @return A graphics context to paint this object with
+   *
+   * @see #debugGraphicsOptions
+   * @see #paint
+   */
+  protected Graphics getComponentGraphics(Graphics g)
+  {
+    Graphics g2 = g;
+    int options = getDebugGraphicsOptions();
+    if (options != DebugGraphics.NONE_OPTION)
+      {
+        if (!(g2 instanceof DebugGraphics))
+          g2 = new DebugGraphics(g);
+        DebugGraphics dg = (DebugGraphics) g2;
+        dg.setDebugOptions(dg.getDebugOptions() | options);
+      }
+    g2.setFont(this.getFont());
+    g2.setColor(this.getForeground());
+    return g2;
+  }
+
+  /**
+   * Get the value of the {@link #debugGraphicsOptions} property.
+   *
+   * @return The current value of the property.
+   *
+   * @see #setDebugGraphicsOptions
+   * @see #debugGraphicsOptions
+   */
+  public int getDebugGraphicsOptions()
+  {
+    String option = System.getProperty("gnu.javax.swing.DebugGraphics");
+    int options = debugGraphicsOptions;
+    if (option != null && option.length() != 0)
+      {
+        if (options < 0)
+          options = 0;
+
+        if (option.equals("LOG"))
+          options |= DebugGraphics.LOG_OPTION;
+        else if (option.equals("FLASH"))
+          options |= DebugGraphics.FLASH_OPTION;
+      }
+    return options;
+  }
+
+  /**
+   * Get the component's insets, which are calculated from
+   * the {@link #border} property. If the border is <code>null</code>,
+   * calls {@link Container#getInsets}.
+   *
+   * @return The component's current insets
+   */
+  public Insets getInsets()
+  {
+    if (border == null)
+      return super.getInsets();
+    return getBorder().getBorderInsets(this);
+  }
+
+  /**
+   * Get the component's insets, which are calculated from the {@link
+   * #border} property. If the border is <code>null</code>, calls {@link
+   * Container#getInsets}. The passed-in {@link Insets} value will be
+   * used as the return value, if possible.
+   *
+   * @param insets Return value object to reuse, if possible
+   *
+   * @return The component's current insets
+   */
+  public Insets getInsets(Insets insets)
+  {
+    Insets t = getInsets();
+
+    if (insets == null)
+      return t;
+
+    insets.left = t.left;
+    insets.right = t.right;
+    insets.top = t.top;
+    insets.bottom = t.bottom;
+    return insets;
+  }
+
+  /**
+   * Get the component's location. The passed-in {@link Point} value
+   * will be used as the return value, if possible.
+   *
+   * @param rv Return value object to reuse, if possible
+   *
+   * @return The component's current location
+   */
+  public Point getLocation(Point rv)
+  {
+    if (rv == null)
+      return new Point(getX(), getY());
+
+    rv.setLocation(getX(), getY());
+    return rv;
+  }
+
+  /**
+   * Get the component's maximum size. If the {@link #maximumSize} property
+   * has been explicitly set, it is returned. If the {@link #maximumSize}
+   * property has not been set but the {@link #ui} property has been, the
+   * result of {@link ComponentUI#getMaximumSize} is returned. If neither
+   * property has been set, the result of {@link Container#getMaximumSize}
+   * is returned.
+   *
+   * @return The maximum size of the component
+   *
+   * @see #maximumSize
+   * @see #setMaximumSize
+   */
+  public Dimension getMaximumSize()
+  {
+    if (maximumSize != null)
+      return maximumSize;
+
+    if (ui != null)
+      {
+        Dimension s = ui.getMaximumSize(this);
+        if (s != null)
+          return s;
+      }
+
+    Dimension p = super.getMaximumSize();
+    return p;
+  }
+
+  /**
+   * Get the component's minimum size. If the {@link #minimumSize} property
+   * has been explicitly set, it is returned. If the {@link #minimumSize}
+   * property has not been set but the {@link #ui} property has been, the
+   * result of {@link ComponentUI#getMinimumSize} is returned. If neither
+   * property has been set, the result of {@link Container#getMinimumSize}
+   * is returned.
+   *
+   * @return The minimum size of the component
+   *
+   * @see #minimumSize
+   * @see #setMinimumSize
+   */
+  public Dimension getMinimumSize()
+  {
+    if (minimumSize != null)
+      return minimumSize;
+
+    if (ui != null)
+      {
+        Dimension s = ui.getMinimumSize(this);
+        if (s != null)
+          return s;
+      }
+
+    Dimension p = super.getMinimumSize();
+    return p;
+  }
+
+  /**
+   * Get the component's preferred size. If the {@link #preferredSize}
+   * property has been explicitly set, it is returned. If the {@link
+   * #preferredSize} property has not been set but the {@link #ui} property
+   * has been, the result of {@link ComponentUI#getPreferredSize} is
+   * returned. If neither property has been set, the result of {@link
+   * Container#getPreferredSize} is returned.
+   *
+   * @return The preferred size of the component
+   *
+   * @see #preferredSize
+   * @see #setPreferredSize
+   */
+  public Dimension getPreferredSize()
+  {
+    Dimension prefSize = null;
+    if (preferredSize != null)
+      prefSize = new Dimension(preferredSize);
+
+    else if (ui != null)
+      {
+        Dimension s = ui.getPreferredSize(this);
+        if (s != null)
+          prefSize = s;
+      }
+
+    if (prefSize == null)
+      prefSize = super.getPreferredSize();
+
+    return prefSize;
+  }
+
+  /**
+   * Checks if a maximum size was explicitely set on the component.
+   *
+   * @return <code>true</code> if a maximum size was set,
+   * <code>false</code> otherwise
+   * 
+   * @since 1.3
+   */
+  public boolean isMaximumSizeSet()
+  {
+    return maximumSize != null;
+  }
+
+  /**
+   * Checks if a minimum size was explicitely set on the component.
+   *
+   * @return <code>true</code> if a minimum size was set,
+   * <code>false</code> otherwise
+   * 
+   * @since 1.3
+   */
+  public boolean isMinimumSizeSet()
+  {
+    return minimumSize != null;
+  }
+
+  /**
+   * Checks if a preferred size was explicitely set on the component.
+   *
+   * @return <code>true</code> if a preferred size was set,
+   * <code>false</code> otherwise
+   * 
+   * @since 1.3
+   */
+  public boolean isPreferredSizeSet()
+  {
+    return preferredSize != null;
+  }
+  
+  /**
+   * Return the value of the <code>nextFocusableComponent</code> property.
+   *
+   * @return The current value of the property, or <code>null</code>
+   * if none has been set.
+   * 
+   * @deprecated See {@link java.awt.FocusTraversalPolicy}
+   */
+  public Component getNextFocusableComponent()
+  {
+    Container focusRoot = this;
+    if (! this.isFocusCycleRoot())
+      focusRoot = getFocusCycleRootAncestor();
+
+    FocusTraversalPolicy policy  = focusRoot.getFocusTraversalPolicy();
+    return policy.getComponentAfter(focusRoot, this);
+  }
+
+  /**
+   * Return the set of {@link KeyStroke} objects which are registered
+   * to initiate actions on this component.
+   *
+   * @return An array of the registered keystrokes (possibly empty but never
+   *     <code>null</code>).
+   */
+  public KeyStroke[] getRegisteredKeyStrokes()
+  {
+    KeyStroke[] ks0;
+    KeyStroke[] ks1;
+    KeyStroke[] ks2;
+    if (inputMap_whenFocused != null)
+      ks0 = inputMap_whenFocused.keys();
+    else 
+      ks0 = new KeyStroke[0];
+    if (inputMap_whenAncestorOfFocused != null)
+      ks1 = inputMap_whenAncestorOfFocused.keys();
+    else 
+      ks1 = new KeyStroke[0];
+    if (inputMap_whenInFocusedWindow != null)
+      ks2 = inputMap_whenInFocusedWindow.keys();
+    else
+      ks2 = new KeyStroke[0];
+    int count = ks0.length + ks1.length + ks2.length;
+    KeyStroke[] result = new KeyStroke[count];
+    System.arraycopy(ks0, 0, result, 0, ks0.length);
+    System.arraycopy(ks1, 0, result, ks0.length, ks1.length);
+    System.arraycopy(ks2, 0, result, ks0.length + ks1.length, ks2.length);
+    return result;
+  }
+
+  /**
+   * Returns the first ancestor of this component which is a {@link JRootPane}.
+   * Equivalent to calling <code>SwingUtilities.getRootPane(this);</code>.
+   *
+   * @return An ancestral JRootPane, or <code>null</code> if none exists.
+   */
+  public JRootPane getRootPane()
+  {
+    JRootPane p = SwingUtilities.getRootPane(this);
+    return p;
+  }
+
+  /**
+   * Get the component's size. The passed-in {@link Dimension} value
+   * will be used as the return value, if possible.
+   *
+   * @param rv Return value object to reuse, if possible
+   *
+   * @return The component's current size
+   */
+  public Dimension getSize(Dimension rv)
+  {
+    if (rv == null)
+      return new Dimension(getWidth(), getHeight());
+    else
+      {
+        rv.setSize(getWidth(), getHeight());
+        return rv;
+      }
+  }
+
+  /**
+   * Return the <code>toolTip</code> property of this component, creating it and
+   * setting it if it is currently <code>null</code>. This method can be
+   * overridden in subclasses which wish to control the exact form of
+   * tooltip created.
+   *
+   * @return The current toolTip
+   */
+  public JToolTip createToolTip()
+  {
+    JToolTip toolTip = new JToolTip();
+    toolTip.setComponent(this);
+    toolTip.setTipText(toolTipText);
+
+    return toolTip;
+  }
+
+  /**
+   * Return the location at which the {@link #toolTipText} property should be
+   * displayed, when triggered by a particular mouse event. 
+   *
+   * @param event The event the tooltip is being presented in response to
+   *
+   * @return The point at which to display a tooltip, or <code>null</code>
+   *     if swing is to choose a default location.
+   */
+  public Point getToolTipLocation(MouseEvent event)
+  {
+    return null;
+  }
+
+  /**
+   * Set the value of the {@link #toolTipText} property.
+   *
+   * @param text The new property value
+   *
+   * @see #getToolTipText()
+   */
+  public void setToolTipText(String text)
+  {
+    if (text == null)
+    {
+      ToolTipManager.sharedInstance().unregisterComponent(this);
+      toolTipText = null;
+      return;
+    }
+
+    // XXX: The tip text doesn't get updated unless you set it to null
+    // and then to something not-null. This is consistent with the behaviour
+    // of Sun's ToolTipManager.
+
+    String oldText = toolTipText;
+    toolTipText = text;
+
+    if (oldText == null)
+      ToolTipManager.sharedInstance().registerComponent(this);
+  }
+
+  /**
+   * Get the value of the {@link #toolTipText} property.
+   *
+   * @return The current property value
+   *
+   * @see #setToolTipText
+   */
+  public String getToolTipText()
+  {
+    return toolTipText;
+  }
+
+  /**
+   * Get the value of the {@link #toolTipText} property, in response to a
+   * particular mouse event.
+   *
+   * @param event The mouse event which triggered the tooltip
+   *
+   * @return The current property value
+   *
+   * @see #setToolTipText
+   */
+  public String getToolTipText(MouseEvent event)
+  {
+    return getToolTipText();
+  }
+  
+  /**
+   * Returns the flag that controls whether or not the component inherits its
+   * parent's popup menu when no popup menu is specified for this component.
+   * 
+   * @return A boolean.
+   * 
+   * @since 1.5
+   * 
+   * @see #setInheritsPopupMenu(boolean)
+   */
+  public boolean getInheritsPopupMenu()
+  {
+    return inheritsPopupMenu; 
+  }
+  
+  /**
+   * Sets the flag that controls whether or not the component inherits its
+   * parent's popup menu when no popup menu is specified for this component.
+   * This is a bound property with the property name 'inheritsPopupMenu'.
+   * 
+   * @param inherit  the new flag value.
+   * 
+   * @since 1.5
+   * 
+   * @see #getInheritsPopupMenu()
+   */
+  public void setInheritsPopupMenu(boolean inherit)
+  {
+    if (inheritsPopupMenu != inherit)
+      {
+        inheritsPopupMenu = inherit;
+        this.firePropertyChange("inheritsPopupMenu", ! inherit, inherit);
+      }
+  }
+  
+  /**
+   * Returns the popup menu for this component.  If the popup menu is 
+   * <code>null</code> AND the {@link #getInheritsPopupMenu()} method returns
+   * <code>true</code>, this method will return the parent's popup menu (if it
+   * has one).
+   * 
+   * @return The popup menu (possibly <code>null</code>.
+   * 
+   * @since 1.5
+   * 
+   * @see #setComponentPopupMenu(JPopupMenu)
+   * @see #getInheritsPopupMenu()
+   */
+  public JPopupMenu getComponentPopupMenu()
+  {
+    if (componentPopupMenu == null && getInheritsPopupMenu())
+      {
+        Container parent = getParent(); 
+        if (parent instanceof JComponent)
+          return ((JComponent) parent).getComponentPopupMenu();
+        else
+          return null;
+      }
+    else
+      return componentPopupMenu;
+  }
+
+  /**
+   * Sets the popup menu for this component (this is a bound property with 
+   * the property name 'componentPopupMenu').
+   * 
+   * @param popup  the popup menu (<code>null</code> permitted).
+   *
+   * @since 1.5
+   * 
+   * @see #getComponentPopupMenu()
+   */
+  public void setComponentPopupMenu(JPopupMenu popup)
+  {
+    if (componentPopupMenu != popup)
+      {
+        JPopupMenu old = componentPopupMenu;
+        componentPopupMenu = popup;
+        firePropertyChange("componentPopupMenu", old, popup);
+      }
+  }
+  
+  /**
+   * Return the top level ancestral container (usually a {@link
+   * java.awt.Window} or {@link java.applet.Applet}) which this component is
+   * contained within, or <code>null</code> if no ancestors exist.
+   *
+   * @return The top level container, if it exists
+   */
+  public Container getTopLevelAncestor()
+  {
+    Container c = getParent();
+    for (Container peek = c; peek != null; peek = peek.getParent())
+      c = peek;
+    return c;
+  }
+
+  /**
+   * Compute the component's visible rectangle, which is defined
+   * recursively as either the component's bounds, if it has no parent, or
+   * the intersection of the component's bounds with the visible rectangle
+   * of its parent.
+   *
+   * @param rect The return value slot to place the visible rectangle in
+   */
+  public void computeVisibleRect(Rectangle rect)
+  {
+    Component c = getParent();
+    if (c != null && c instanceof JComponent)
+      {
+        ((JComponent) c).computeVisibleRect(rect);
+        rect.translate(-getX(), -getY());
+        rect = SwingUtilities.computeIntersection(0, 0, getWidth(),
+                                                  getHeight(), rect);
+      }
+    else
+      rect.setRect(0, 0, getWidth(), getHeight());
+  }
+
+  /**
+   * Return the component's visible rectangle in a new {@link Rectangle},
+   * rather than via a return slot.
+   *
+   * @return the component's visible rectangle
+   *
+   * @see #computeVisibleRect(Rectangle)
+   */
+  public Rectangle getVisibleRect()
+  {
+    Rectangle r = new Rectangle();
+    computeVisibleRect(r);
+    return r;
+  }
+
+  /**
+   * <p>Requests that this component receive input focus, giving window
+   * focus to the top level ancestor of this component. Only works on
+   * displayable, focusable, visible components.</p>
+   *
+   * <p>This method should not be called by clients; it is intended for
+   * focus implementations. Use {@link Component#requestFocus()} instead.</p>
+   *
+   * @see Component#requestFocus()
+   */
+  public void grabFocus()
+  {
+    requestFocus();
+  }
+
+  /**
+   * Get the value of the {@link #doubleBuffered} property.
+   *
+   * @return The property's current value
+   */
+  public boolean isDoubleBuffered()
+  {
+    return doubleBuffered;
+  }
+
+  /**
+   * Return <code>true</code> if the provided component has no native peer;
+   * in other words, if it is a "lightweight component".
+   *
+   * @param c The component to test for lightweight-ness
+   *
+   * @return Whether or not the component is lightweight
+   */
+  public static boolean isLightweightComponent(Component c)
+  {
+    return c.getPeer() instanceof LightweightPeer;
+  }
+
+  /**
+   * Return <code>true</code> if you wish this component to manage its own
+   * focus. In particular: if you want this component to be sent
+   * <code>TAB</code> and <code>SHIFT+TAB</code> key events, and to not
+   * have its children considered as focus transfer targets. If
+   * <code>true</code>, focus traversal around this component changes to
+   * <code>CTRL+TAB</code> and <code>CTRL+SHIFT+TAB</code>.
+   *
+   * @return <code>true</code> if you want this component to manage its own
+   *     focus, otherwise (by default) <code>false</code>
+   *
+   * @deprecated 1.4 Use {@link Component#setFocusTraversalKeys(int, Set)} and
+   *     {@link Container#setFocusCycleRoot(boolean)} instead
+   */
+  public boolean isManagingFocus()
+  {
+    return false;
+  }
+
+  /**
+   * Return the current value of the {@link #opaque} property. 
+   *
+   * @return The current property value
+   */
+  public boolean isOpaque()
+  {
+    return opaque;
+  }
+
+  /**
+   * Return <code>true</code> if the component can guarantee that none of its
+   * children will overlap in Z-order. This is a hint to the painting system.
+   * The default is to return <code>true</code>, but some components such as
+   * {@link JLayeredPane} should override this to return <code>false</code>.
+   *
+   * @return Whether the component tiles its children
+   */
+  public boolean isOptimizedDrawingEnabled()
+  {
+    return true;
+  }
+
+  /**
+   * Return <code>true</code> if this component is currently painting a tile,
+   * this means that paint() is called again on another child component. This
+   * method returns <code>false</code> if this component does not paint a tile
+   * or if the last tile is currently painted.
+   *
+   * @return whether the component is painting a tile
+   */
+  public boolean isPaintingTile()
+  {
+    return paintingTile;
+  }
+
+  /**
+   * Get the value of the {@link #requestFocusEnabled} property.
+   *
+   * @return The current value of the property
+   */
+  public boolean isRequestFocusEnabled()
+  {
+    return requestFocusEnabled;
+  }
+
+  /**
+   * Return <code>true</code> if this component is a validation root; this
+   * will cause calls to {@link #invalidate()} in this component's children
+   * to be "captured" at this component, and not propagate to its parents.
+   * For most components this should return <code>false</code>, but some
+   * components such as {@link JViewport} will want to return
+   * <code>true</code>.
+   *
+   * @return Whether this component is a validation root
+   */
+  public boolean isValidateRoot()
+  {
+    return false;
+  }
+
+  /**
+   * <p>Paint the component. This is a delicate process, and should only be
+   * called from the repaint thread, under control of the {@link
+   * RepaintManager}. Client code should usually call {@link #repaint()} to
+   * trigger painting.</p>
+   *
+   * <p>The body of the <code>paint</code> call involves calling {@link
+   * #paintComponent}, {@link #paintBorder}, and {@link #paintChildren} in
+   * order. If you want to customize painting behavior, you should override
+   * one of these methods rather than <code>paint</code>.</p>
+   *
+   * <p>For more details on the painting sequence, see <a
+   * href="http://java.sun.com/products/jfc/tsc/articles/painting/index.html">
+   * this article</a>.</p>
+   *
+   * @param g The graphics context to paint with
+   *
+   * @see #paintImmediately(Rectangle)
+   */
+  public void paint(Graphics g)
+  {
+    RepaintManager rm = RepaintManager.currentManager(this);
+    // We do a little stunt act here to switch on double buffering if it's
+    // not already on. If we are not already doublebuffered, then we jump
+    // into the method paintDoubleBuffered, which turns on the double buffer
+    // and then calls paint(g) again. In the second call we go into the else
+    // branch of this if statement and actually paint things to the double
+    // buffer. When this method completes, the call stack unwinds back to
+    // paintDoubleBuffered, where the buffer contents is finally drawn to the
+    // screen.
+    if (!paintingDoubleBuffered && isDoubleBuffered()
+        && rm.isDoubleBufferingEnabled())
+      {
+        Rectangle clip = g.getClipBounds();
+        paintDoubleBuffered(clip);
+      }
+    else
+      {
+        if (getClientProperty("bufferedDragging") != null
+            && dragBuffer == null)
+          {
+            initializeDragBuffer();
+          }
+        else if (getClientProperty("bufferedDragging") == null
+            && dragBuffer != null)
+          {
+            dragBuffer = null;
+          }
+
+        if (g.getClip() == null)
+          g.setClip(0, 0, getWidth(), getHeight());
+        if (dragBuffer != null && dragBufferInitialized)
+          {
+            g.drawImage(dragBuffer, 0, 0, this);
+          }
+        else
+          {
+            Graphics g2 = getComponentGraphics(g);
+            paintComponent(g2);
+            paintBorder(g2);
+            paintChildren(g2);
+          }
+      }
+  }
+
+  /**
+   * Initializes the drag buffer by creating a new image and painting this
+   * component into it.
+   */
+  private void initializeDragBuffer()
+  {
+    dragBufferInitialized = false;
+    // Allocate new dragBuffer if the current one is too small.
+    if (dragBuffer == null || dragBuffer.getWidth(this) < getWidth()
+        || dragBuffer.getHeight(this) < getHeight())
+      {
+        dragBuffer = createImage(getWidth(), getHeight());
+      }
+    Graphics g = dragBuffer.getGraphics();
+    paint(g);
+    g.dispose();
+    dragBufferInitialized = true;
+  }
+
+  /**
+   * Paint the component's border. This usually means calling {@link
+   * Border#paintBorder} on the {@link #border} property, if it is
+   * non-<code>null</code>. You may override this if you wish to customize
+   * border painting behavior. The border is painted after the component's
+   * body, but before the component's children.
+   *
+   * @param g The graphics context with which to paint the border
+   *
+   * @see #paint
+   * @see #paintChildren
+   * @see #paintComponent
+   */
+  protected void paintBorder(Graphics g)
+  {
+    if (getBorder() != null)
+      getBorder().paintBorder(this, g, 0, 0, getWidth(), getHeight());
+  }
+
+  /**
+   * Paint the component's children. This usually means calling {@link
+   * Container#paint}, which recursively calls {@link #paint} on any of the
+   * component's children, with appropriate changes to coordinate space and
+   * clipping region. You may override this if you wish to customize
+   * children painting behavior. The children are painted after the
+   * component's body and border.
+   *
+   * @param g The graphics context with which to paint the children
+   *
+   * @see #paint
+   * @see #paintBorder
+   * @see #paintComponent
+   */
+  protected void paintChildren(Graphics g)
+  {
+    if (getComponentCount() > 0)
+      {
+        // Need to lock the tree to avoid problems with AWT and concurrency.
+        synchronized (getTreeLock())
+          {
+            for (int i = getComponentCount() - 1; i >= 0; i--)
+              {
+                Component child = getComponent(i);
+                if (child != null && child.isLightweight()
+                    && child.isVisible())
+                  {
+                    int cx = child.getX();
+                    int cy = child.getY();
+                    int cw = child.getWidth();
+                    int ch = child.getHeight();
+                    if (g.hitClip(cx, cy, cw, ch))
+                      {
+                        if ((! isOptimizedDrawingEnabled()) && i > 0)
+                          {
+                            // Check if the child is completely obscured.
+                            Rectangle clip = g.getClipBounds(); // A copy.
+                            SwingUtilities.computeIntersection(cx, cy, cw, ch,
+                                                               clip);
+                            if (isCompletelyObscured(i, clip))
+                              continue; // Continues the for-loop.
+                          }
+                        Graphics cg = g.create(cx, cy, cw, ch);
+                        cg.setColor(child.getForeground());
+                        cg.setFont(child.getFont());
+                        try
+                          {
+                            child.paint(cg);
+                          }
+                        finally
+                          {
+                            cg.dispose();
+                          }
+                      }
+                  }
+              }
+          }
+      }
+  }
+
+  /**
+   * Determines if a region of a child component is completely obscured by one
+   * of its siblings.
+   *
+   * @param index the index of the child component
+   * @param rect the region to check
+   *
+   * @return <code>true</code> if the region is completely obscured by a
+   *         sibling, <code>false</code> otherwise
+   */
+  private boolean isCompletelyObscured(int index, Rectangle rect)
+  {
+    boolean obscured = false;
+    for (int i = index - 1; i >= 0 && obscured == false; i--)
+      {
+        Component sib = getComponent(i);
+        if (sib.isVisible())
+          {
+            Rectangle sibRect = sib.getBounds(rectCache);
+            if (sib.isOpaque() && rect.x >= sibRect.x
+                && (rect.x + rect.width) <= (sibRect.x + sibRect.width)
+                && rect.y >= sibRect.y
+                && (rect.y + rect.height) <= (sibRect.y + sibRect.height))
+              {
+                obscured = true;
+              }
+          }
+      }
+    return obscured;
+  }
+
+  /**
+   * Paint the component's body. This usually means calling {@link
+   * ComponentUI#update} on the {@link #ui} property of the component, if
+   * it is non-<code>null</code>. You may override this if you wish to
+   * customize the component's body-painting behavior. The component's body
+   * is painted first, before the border and children.
+   *
+   * @param g The graphics context with which to paint the body
+   *
+   * @see #paint
+   * @see #paintBorder
+   * @see #paintChildren
+   */
+  protected void paintComponent(Graphics g)
+  {
+    if (ui != null)
+      {
+        Graphics g2 = g.create();
+        try
+          {
+            ui.update(g2, this);
+          }
+        finally
+          {
+            g2.dispose();
+          }
+      }
+  }
+
+  /**
+   * A variant of {@link #paintImmediately(Rectangle)} which takes
+   * integer parameters.
+   *
+   * @param x The left x coordinate of the dirty region
+   * @param y The top y coordinate of the dirty region
+   * @param w The width of the dirty region
+   * @param h The height of the dirty region
+   */
+  public void paintImmediately(int x, int y, int w, int h)
+  {
+    paintImmediately(new Rectangle(x, y, w, h));
+  }
+
+  /**
+   * Transform the provided dirty rectangle for this component into the
+   * appropriate ancestral {@link JRootPane} and call {@link #paint} on
+   * that root pane. This method is called from the {@link RepaintManager}
+   * and should always be called within the painting thread.
+   *
+   * <p>This method will acquire a double buffer from the {@link
+   * RepaintManager} if the component's {@link #doubleBuffered} property is
+   * <code>true</code> and the <code>paint</code> call is the
+   * <em>first</em> recursive <code>paint</code> call inside swing.</p>
+   *
+   * <p>The method will also modify the provided {@link Graphics} context
+   * via the {@link #getComponentGraphics} method. If you want to customize
+   * the graphics object used for painting, you should override that method
+   * rather than <code>paint</code>.</p>
+   *
+   * @param r The dirty rectangle to paint
+   */
+  public void paintImmediately(Rectangle r)
+  {
+    // Try to find a root pane for this component.
+    //Component root = findPaintRoot(r);
+    Component root = findPaintRoot(r);
+    // If no paint root is found, then this component is completely overlapped
+    // by another component and we don't need repainting.
+    if (root == null|| !root.isShowing())
+      return;
+    SwingUtilities.convertRectangleToAncestor(this, r, root);
+    if (root instanceof JComponent)
+      ((JComponent) root).paintImmediately2(r);
+    else
+      root.repaint(r.x, r.y, r.width, r.height);
+  }
+
+  /**
+   * Performs the actual work of paintImmediatly on the repaint root.
+   *
+   * @param r the area to be repainted
+   */
+  void paintImmediately2(Rectangle r)
+  {
+    isRepainting = true;
+    RepaintManager rm = RepaintManager.currentManager(this);
+    if (rm.isDoubleBufferingEnabled() && isPaintingDoubleBuffered())
+      paintDoubleBuffered(r);
+    else
+      paintSimple(r);
+    isRepainting = false;
+  }
+
+  /**
+   * Returns true if we must paint double buffered, that is, when this
+   * component or any of it's ancestors are double buffered.
+   *
+   * @return true if we must paint double buffered, that is, when this
+   *         component or any of it's ancestors are double buffered
+   */
+  private boolean isPaintingDoubleBuffered()
+  {
+    boolean doubleBuffered = isDoubleBuffered();
+    Component parent = getParent();
+    while (! doubleBuffered && parent != null)
+      {
+        doubleBuffered = parent instanceof JComponent
+                         && ((JComponent) parent).isDoubleBuffered();
+        parent = parent.getParent();
+      }
+    return doubleBuffered;
+  }
+
+  /**
+   * Performs double buffered repainting.
+   */
+  private void paintDoubleBuffered(Rectangle r)
+  {
+    RepaintManager rm = RepaintManager.currentManager(this);
+
+    // Paint on the offscreen buffer.
+    Component root = SwingUtilities.getRoot(this);
+    Image buffer = rm.getVolatileOffscreenBuffer(this, root.getWidth(),
+                                                 root.getHeight());
+
+    // The volatile offscreen buffer may be null when that's not supported
+    // by the AWT backend. Fall back to normal backbuffer in this case.
+    if (buffer == null)
+      buffer = rm.getOffscreenBuffer(this, root.getWidth(), root.getHeight());
+
+    //Rectangle targetClip = SwingUtilities.convertRectangle(this, r, root);
+    Graphics g2 = buffer.getGraphics();
+    clipAndTranslateGraphics(root, this, g2);
+    g2.clipRect(r.x, r.y, r.width, r.height);
+    g2 = getComponentGraphics(g2);
+    paintingDoubleBuffered = true;
+    try
+      {
+        if (isRepainting) // Called from paintImmediately, go through paint().
+          paint(g2);
+        else // Called from paint() (AWT refresh), don't call it again.
+          {
+            paintComponent(g2);
+            paintBorder(g2);
+            paintChildren(g2);
+          }
+      }
+    finally
+      {
+        paintingDoubleBuffered = false;
+        g2.dispose();
+      }
+
+    // Paint the buffer contents on screen.
+    rm.commitBuffer(this, r);
+  }
+
+  /**
+   * Clips and translates the Graphics instance for painting on the double
+   * buffer. This has to be done, so that it reflects the component clip of the
+   * target component.
+   *
+   * @param root the root component (top-level container usually)
+   * @param target the component to be painted
+   * @param g the Graphics instance
+   */
+  private void clipAndTranslateGraphics(Component root, Component target,
+                                        Graphics g)
+  {
+    Component parent = target;
+    int deltaX = 0;
+    int deltaY = 0;
+    while (parent != root)
+      {
+        deltaX += parent.getX();
+        deltaY += parent.getY();
+        parent = parent.getParent();
+      }
+    g.translate(deltaX, deltaY);
+    g.clipRect(0, 0, target.getWidth(), target.getHeight());
+  }
+
+  /**
+   * Performs normal painting without double buffering.
+   *
+   * @param r the area that should be repainted
+   */
+  void paintSimple(Rectangle r)
+  {
+    Graphics g = getGraphics();
+    Graphics g2 = getComponentGraphics(g);
+    g2.setClip(r);
+    paint(g2);
+    g2.dispose();
+    if (g != g2)
+      g.dispose();
+  }
+
+  /**
+   * Return a string representation for this component, for use in
+   * debugging.
+   *
+   * @return A string describing this component.
+   */
+  protected String paramString()
+  {
+    StringBuffer sb = new StringBuffer();
+    sb.append(super.paramString());
+    sb.append(",alignmentX=").append(getAlignmentX());
+    sb.append(",alignmentY=").append(getAlignmentY());
+    sb.append(",border=");
+    if (getBorder() != null)
+      sb.append(getBorder());
+    sb.append(",maximumSize=");
+    if (getMaximumSize() != null)
+      sb.append(getMaximumSize());
+    sb.append(",minimumSize=");
+    if (getMinimumSize() != null)
+      sb.append(getMinimumSize());
+    sb.append(",preferredSize=");
+    if (getPreferredSize() != null)
+      sb.append(getPreferredSize());
+    return sb.toString();
+  }
+
+  /**
+   * A variant of {@link
+   * #registerKeyboardAction(ActionListener,String,KeyStroke,int)} which
+   * provides <code>null</code> for the command name.
+   * 
+   * @param act  the action listener to notify when the keystroke occurs.
+   * @param stroke  the key stroke.
+   * @param cond  the condition (one of {@link #WHEN_FOCUSED}, 
+   *     {@link #WHEN_IN_FOCUSED_WINDOW} and 
+   *     {@link #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}).
+   */
+  public void registerKeyboardAction(ActionListener act,
+                                     KeyStroke stroke, 
+                                     int cond)
+  {
+    registerKeyboardAction(act, null, stroke, cond);
+  }
+
+  /* 
+   * There is some charmingly undocumented behavior sun seems to be using
+   * to simulate the old register/unregister keyboard binding API. It's not
+   * clear to me why this matters, but we shall endeavour to follow suit.
+   *
+   * Two main thing seem to be happening when you do registerKeyboardAction():
+   * 
+   *  - no actionMap() entry gets created, just an entry in inputMap()
+   *
+   *  - the inputMap() entry is a proxy class which invokes the the
+   *  binding's actionListener as a target, and which clobbers the command
+   *  name sent in the ActionEvent, providing the binding command name
+   *  instead.
+   *
+   * This much you can work out just by asking the input and action maps
+   * what they contain after making bindings, and watching the event which
+   * gets delivered to the recipient. Beyond that, it seems to be a
+   * sun-private solution so I will only immitate it as much as it matters
+   * to external observers.
+   */
+  private static class ActionListenerProxy
+    extends AbstractAction
+  {
+    ActionListener target;
+    String bindingCommandName;
+
+    public ActionListenerProxy(ActionListener li, 
+                               String cmd)
+    {
+      target = li;
+      bindingCommandName = cmd;
+    }
+
+    public void actionPerformed(ActionEvent e)
+    {
+      ActionEvent derivedEvent = new ActionEvent(e.getSource(),
+                                                 e.getID(),
+                                                 bindingCommandName,
+                                                 e.getModifiers());
+      target.actionPerformed(derivedEvent);
+    }
+  }
+
+  
+  /**
+   * An obsolete method to register a keyboard action on this component.
+   * You should use <code>getInputMap</code> and <code>getActionMap</code>
+   * to fetch mapping tables from keystrokes to commands, and commands to
+   * actions, respectively, and modify those mappings directly.
+   *
+   * @param act The action to be registered
+   * @param cmd The command to deliver in the delivered {@link
+   *     java.awt.event.ActionEvent}
+   * @param stroke The keystroke to register on
+   * @param cond One of the values {@link #UNDEFINED_CONDITION},
+   *     {@link #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, {@link #WHEN_FOCUSED}, or
+   *     {@link #WHEN_IN_FOCUSED_WINDOW}, indicating the condition which must
+   *     be met for the action to be fired
+   *
+   * @see #unregisterKeyboardAction
+   * @see #getConditionForKeyStroke
+   * @see #resetKeyboardActions
+   */
+  public void registerKeyboardAction(ActionListener act, 
+                                     String cmd,
+                                     KeyStroke stroke, 
+                                     int cond)
+  {
+    ActionListenerProxy proxy = new ActionListenerProxy(act, cmd);
+    getInputMap(cond).put(stroke, proxy);
+    getActionMap().put(proxy, proxy);
+  }
+
+  /**
+   * Sets the input map for the given condition.
+   * 
+   * @param condition  the condition (one of {@link #WHEN_FOCUSED}, 
+   *     {@link #WHEN_IN_FOCUSED_WINDOW} and 
+   *     {@link #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}).
+   * @param map  the map.
+   * 
+   * @throws IllegalArgumentException if <code>condition</code> is not one of
+   *     the specified values.
+   */
+  public final void setInputMap(int condition, InputMap map)
+  {
+    enableEvents(AWTEvent.KEY_EVENT_MASK);
+    switch (condition)
+      {
+      case WHEN_FOCUSED:
+        inputMap_whenFocused = map;
+        break;
+
+      case WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
+        inputMap_whenAncestorOfFocused = map;
+        break;
+
+      case WHEN_IN_FOCUSED_WINDOW:
+        if (map != null && !(map instanceof ComponentInputMap))
+            throw new 
+              IllegalArgumentException("WHEN_IN_FOCUSED_WINDOW " + 
+                                       "InputMap must be a ComponentInputMap");
+        inputMap_whenInFocusedWindow = (ComponentInputMap)map;
+        break;
+        
+      case UNDEFINED_CONDITION:
+      default:
+        throw new IllegalArgumentException();
+      }
+  }
+
+  /**
+   * Returns the input map associated with this component for the given
+   * state/condition.
+   * 
+   * @param condition  the state (one of {@link #WHEN_FOCUSED}, 
+   *     {@link #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT} and 
+   *     {@link #WHEN_IN_FOCUSED_WINDOW}).
+   * 
+   * @return The input map.
+   * @throws IllegalArgumentException if <code>condition</code> is not one of 
+   *             the specified values.
+   * @since 1.3
+   */
+  public final InputMap getInputMap(int condition)
+  {
+    enableEvents(AWTEvent.KEY_EVENT_MASK);
+    switch (condition)
+      {
+      case WHEN_FOCUSED:
+        if (inputMap_whenFocused == null)
+          inputMap_whenFocused = new InputMap();
+        return inputMap_whenFocused;
+
+      case WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
+        if (inputMap_whenAncestorOfFocused == null)
+          inputMap_whenAncestorOfFocused = new InputMap();
+        return inputMap_whenAncestorOfFocused;
+
+      case WHEN_IN_FOCUSED_WINDOW:
+        if (inputMap_whenInFocusedWindow == null)
+          inputMap_whenInFocusedWindow = new ComponentInputMap(this);
+        return inputMap_whenInFocusedWindow;
+
+      case UNDEFINED_CONDITION:
+      default:
+        throw new IllegalArgumentException("Invalid 'condition' argument: " 
+                                           + condition);
+      }
+  }
+
+  /**
+   * Returns the input map associated with this component for the 
+   * {@link #WHEN_FOCUSED} state.
+   * 
+   * @return The input map.
+   * 
+   * @since 1.3
+   * @see #getInputMap(int)
+   */
+  public final InputMap getInputMap()
+  {
+    return getInputMap(WHEN_FOCUSED);
+  }
+
+  public final ActionMap getActionMap()
+  {
+    if (actionMap == null)
+      actionMap = new ActionMap();
+    return actionMap;
+  }
+
+  public final void setActionMap(ActionMap map)
+  {
+    actionMap = map;
+  }
+
+  /**
+   * Return the condition that determines whether a registered action
+   * occurs in response to the specified keystroke.
+   *
+   * As of 1.3 KeyStrokes can be registered with multiple simultaneous
+   * conditions.
+   *
+   * @param ks The keystroke to return the condition of
+   *
+   * @return One of the values {@link #UNDEFINED_CONDITION}, {@link
+   *     #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, {@link #WHEN_FOCUSED}, or {@link
+   *     #WHEN_IN_FOCUSED_WINDOW}
+   *
+   * @see #registerKeyboardAction(ActionListener, KeyStroke, int)   
+   * @see #unregisterKeyboardAction   
+   * @see #resetKeyboardActions
+   */
+  public int getConditionForKeyStroke(KeyStroke ks)
+  {
+    if (inputMap_whenFocused != null 
+        && inputMap_whenFocused.get(ks) != null)
+      return WHEN_FOCUSED;
+    else if (inputMap_whenAncestorOfFocused != null 
+             && inputMap_whenAncestorOfFocused.get(ks) != null)
+      return WHEN_ANCESTOR_OF_FOCUSED_COMPONENT;
+    else if (inputMap_whenInFocusedWindow != null 
+             && inputMap_whenInFocusedWindow.get(ks) != null)
+      return WHEN_IN_FOCUSED_WINDOW;
+    else
+      return UNDEFINED_CONDITION;
+  }
+
+  /**
+   * Get the ActionListener (typically an {@link Action} object) which is
+   * associated with a particular keystroke. 
+   *
+   * @param ks The keystroke to retrieve the action of
+   *
+   * @return The action associated with the specified keystroke
+   */
+  public ActionListener getActionForKeyStroke(KeyStroke ks)
+  {
+    Object key = getInputMap(JComponent.WHEN_FOCUSED).get(ks);
+    if (key == null)
+      key = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).get(ks);
+    if (key == null)
+      key = getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).get(ks);
+    if (key != null)
+      {
+        if (key instanceof ActionListenerProxy)
+          return ((ActionListenerProxy) key).target;
+        else
+          return getActionMap().get(key);
+      }
+    return null;
+  }
+
+  /**
+   * A hook for subclasses which want to customize event processing.
+   */
+  protected void processComponentKeyEvent(KeyEvent e)
+  {
+    // This method does nothing, it is meant to be overridden by subclasses.
+  }
+
+  /**
+   * Override the default key dispatch system from Component to hook into
+   * the swing {@link InputMap} / {@link ActionMap} system.
+   *
+   * See <a
+   * href="http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html">
+   * this report</a> for more details, it's somewhat complex.
+   */
+  protected void processKeyEvent(KeyEvent e)
+  {
+    // let the AWT event processing send KeyEvents to registered listeners
+    super.processKeyEvent(e);
+    processComponentKeyEvent(e);
+
+    if (e.isConsumed())
+      return;
+
+    // Input maps are checked in this order:
+    // 1. The focused component's WHEN_FOCUSED map is checked.
+    // 2. The focused component's WHEN_ANCESTOR_OF_FOCUSED_COMPONENT map.
+    // 3. The WHEN_ANCESTOR_OF_FOCUSED_COMPONENT maps of the focused
+    //    component's parent, then its parent's parent, and so on.
+    //    Note: Input maps for disabled components are skipped.
+    // 4. The WHEN_IN_FOCUSED_WINDOW maps of all the enabled components in
+    //    the focused window are searched.
+    
+    KeyStroke keyStroke = KeyStroke.getKeyStrokeForEvent(e);
+    boolean pressed = e.getID() == KeyEvent.KEY_PRESSED;
+    
+    if (processKeyBinding(keyStroke, e, WHEN_FOCUSED, pressed))
+      {
+        // This is step 1 from above comment.
+        e.consume();
+        return;
+      }
+    else if (processKeyBinding
+             (keyStroke, e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
+      {
+        // This is step 2 from above comment.
+        e.consume();
+        return;
+      }
+    
+    // This is step 3 from above comment.
+    Container current = getParent();    
+    while (current != null)
+      { 
+        // If current is a JComponent, see if it handles the event in its
+        // WHEN_ANCESTOR_OF_FOCUSED_COMPONENT maps.
+        if ((current instanceof JComponent) && 
+            ((JComponent)current).processKeyBinding 
+            (keyStroke, e,WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, pressed))
+          {
+            e.consume();
+            return;
+          }     
+        
+        // Stop when we've tried a top-level container and it didn't handle it
+        if (current instanceof Window || current instanceof Applet)
+          break;        
+        
+        // Move up the hierarchy
+        current = current.getParent();
+      }
+    
+    // Current being null means the JComponent does not currently have a
+    // top-level ancestor, in which case we don't need to check 
+    // WHEN_IN_FOCUSED_WINDOW bindings.
+    if (current == null || e.isConsumed())
+      return;
+    
+    // This is step 4 from above comment.  KeyboardManager maintains mappings
+    // related to WHEN_IN_FOCUSED_WINDOW bindings so that we don't have to 
+    // traverse the containment hierarchy each time.
+    if (KeyboardManager.getManager().processKeyStroke(current, keyStroke, e))
+      e.consume();
+  }
+
+  protected boolean processKeyBinding(KeyStroke ks,
+                                      KeyEvent e,
+                                      int condition,
+                                      boolean pressed)
+  { 
+    if (isEnabled())
+      {
+        Action act = null;
+        Object cmd = null;
+        InputMap map = getInputMap(condition);
+        if (map != null)
+          {
+            cmd = map.get(ks);
+            if (cmd != null)
+              {
+                if (cmd instanceof ActionListenerProxy)
+                  act = (Action) cmd;
+                else 
+                  act = (Action) getActionMap().get(cmd);
+              }
+          }
+        if (act != null && act.isEnabled())
+          {
+            // Need to synchronize here so we don't get in trouble with
+            // our __command__ hack.
+            synchronized (act)
+              {
+                // We add the command as value to the action, so that
+                // the action can later determine the command with which it
+                // was called. This is undocumented, but shouldn't affect
+                // compatibility. It allows us to use only one Action instance
+                // to do the work for all components of one type, instead of
+                // having loads of small Actions. This effectivly saves startup
+                // time of Swing.
+                act.putValue("__command__", cmd);
+                return SwingUtilities.notifyAction(act, ks, e, this,
+                                                   e.getModifiers());
+              }
+          }
+      }
+    return false;
+  }
+  
+  /**
+   * Remove a keyboard action registry.
+   *
+   * @param aKeyStroke The keystroke to unregister
+   *
+   * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
+   * @see #getConditionForKeyStroke
+   * @see #resetKeyboardActions
+   */
+  public void unregisterKeyboardAction(KeyStroke aKeyStroke)
+  {
+    ActionMap am = getActionMap();
+    // This loops through the conditions WHEN_FOCUSED,
+    // WHEN_ANCESTOR_OF_FOCUSED_COMPONENT and WHEN_IN_FOCUSED_WINDOW.
+    for (int cond = 0; cond < 3; cond++)
+      {
+        InputMap im = getInputMap(cond);
+        if (im != null)
+          {
+            Object action = im.get(aKeyStroke);
+            if (action != null && am != null)
+              am.remove(action);
+            im.remove(aKeyStroke);
+          }
+      }
+  }
+
+
+  /**
+   * Reset all keyboard action registries.
+   *
+   * @see #registerKeyboardAction(ActionListener, KeyStroke, int)
+   * @see #unregisterKeyboardAction
+   * @see #getConditionForKeyStroke
+   */
+  public void resetKeyboardActions()
+  {
+    if (inputMap_whenFocused != null)
+      inputMap_whenFocused.clear();
+    if (inputMap_whenAncestorOfFocused != null)
+      inputMap_whenAncestorOfFocused.clear();
+    if (inputMap_whenInFocusedWindow != null)
+      inputMap_whenInFocusedWindow.clear();
+    if (actionMap != null)
+      actionMap.clear();
+  }
+
+  /**
+   * Mark the described region of this component as dirty in the current
+   * {@link RepaintManager}. This will queue an asynchronous repaint using
+   * the system painting thread in the near future.
+   *
+   * @param tm ignored
+   * @param x coordinate of the region to mark as dirty
+   * @param y coordinate of the region to mark as dirty
+   * @param width dimension of the region to mark as dirty
+   * @param height dimension of the region to mark as dirty
+   */
+  public void repaint(long tm, int x, int y, int width, int height)
+  {
+     RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width,
+                                                        height);
+  }
+
+  /**
+   * Mark the described region of this component as dirty in the current
+   * {@link RepaintManager}. This will queue an asynchronous repaint using
+   * the system painting thread in the near future.
+   *
+   * @param r The rectangle to mark as dirty
+   */
+  public void repaint(Rectangle r)
+  {
+    RepaintManager.currentManager(this).addDirtyRegion(this, r.x, r.y, r.width,
+                                                       r.height);
+  }
+
+  /**
+   * Request focus on the default component of this component's {@link
+   * FocusTraversalPolicy}.
+   *
+   * @return The result of {@link #requestFocus()}
+   *
+   * @deprecated Use {@link #requestFocus()} on the default component provided
+   *     from the {@link FocusTraversalPolicy} instead.
+   */
+  public boolean requestDefaultFocus()
+  {
+    return false;
+  }
+
+  /**
+   * Queue a an invalidation and revalidation of this component, using 
+   * {@link RepaintManager#addInvalidComponent}.
+   */
+  public void revalidate()
+  {
+    // As long as we don't have a parent we don't need to do any layout, since
+    // this is done anyway as soon as we get connected to a parent.
+    if (getParent() == null)
+      return;
+
+    if (! EventQueue.isDispatchThread())
+      SwingUtilities.invokeLater(new Runnable()
+        {
+          public void run()
+          {
+            revalidate();
+          }
+        });
+    else
+      {
+        invalidate();
+        RepaintManager.currentManager(this).addInvalidComponent(this);
+      }
+  }
+
+  /**
+   * Calls <code>scrollRectToVisible</code> on the component's parent. 
+   * Components which can service this call should override.
+   *
+   * @param r The rectangle to make visible
+   */
+  public void scrollRectToVisible(Rectangle r)
+  {
+    Component p = getParent();
+    if (p instanceof JComponent)
+      ((JComponent) p).scrollRectToVisible(r);
+  }
+
+  /**
+   * Set the value of the {@link #alignmentX} property.
+   *
+   * @param a The new value of the property
+   */
+  public void setAlignmentX(float a)
+  {
+    if (a < 0.0F)
+      alignmentX = 0.0F;
+    else if (a > 1.0)
+      alignmentX = 1.0F;
+    else
+      alignmentX = a;
+  }
+
+  /**
+   * Set the value of the {@link #alignmentY} property.
+   *
+   * @param a The new value of the property
+   */
+  public void setAlignmentY(float a)
+  {
+    if (a < 0.0F)
+      alignmentY = 0.0F;
+    else if (a > 1.0)
+      alignmentY = 1.0F;
+    else
+      alignmentY = a;
+  }
+
+  /**
+   * Set the value of the {@link #autoscrolls} property.
+   *
+   * @param a The new value of the property
+   */
+  public void setAutoscrolls(boolean a)
+  {
+    autoscrolls = a;
+    clientAutoscrollsSet = true;
+  }
+
+  /**
+   * Set the value of the {@link #debugGraphicsOptions} property.
+   *
+   * @param debugOptions The new value of the property
+   */
+  public void setDebugGraphicsOptions(int debugOptions)
+  {
+    debugGraphicsOptions = debugOptions;
+  }
+
+  /**
+   * Set the value of the {@link #doubleBuffered} property.
+   *
+   * @param db The new value of the property
+   */
+  public void setDoubleBuffered(boolean db)
+  {
+    doubleBuffered = db;
+  }
+
+  /**
+   * Set the value of the <code>enabled</code> property.
+   *
+   * @param enable The new value of the property
+   */
+  public void setEnabled(boolean enable)
+  {
+    if (enable == isEnabled())
+      return;
+    super.setEnabled(enable);
+    firePropertyChange("enabled", !enable, enable);
+    repaint();
+  }
+
+  /**
+   * Set the value of the <code>font</code> property.
+   *
+   * @param f The new value of the property
+   */
+  public void setFont(Font f)
+  {
+    if (f == getFont())
+      return;
+    super.setFont(f);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * Set the value of the <code>background</code> property.
+   *
+   * @param bg The new value of the property
+   */
+  public void setBackground(Color bg)
+  {
+    if (bg == getBackground())
+      return;
+    super.setBackground(bg);
+    repaint();
+  }
+
+  /**
+   * Set the value of the <code>foreground</code> property.
+   *
+   * @param fg The new value of the property
+   */
+  public void setForeground(Color fg)
+  {
+    if (fg == getForeground())
+      return;
+    super.setForeground(fg);
+    repaint();
+  }
+
+  /**
+   * Set the value of the {@link #maximumSize} property. The passed value is
+   * copied, the later direct changes on the argument have no effect on the
+   * property value.
+   *
+   * @param max The new value of the property
+   */
+  public void setMaximumSize(Dimension max)
+  {
+    Dimension oldMaximumSize = maximumSize;
+    if (max != null) 
+      maximumSize = new Dimension(max);
+    else
+      maximumSize = null;
+    firePropertyChange("maximumSize", oldMaximumSize, maximumSize);
+  }
+
+  /**
+   * Set the value of the {@link #minimumSize} property. The passed value is
+   * copied, the later direct changes on the argument have no effect on the
+   * property value.
+   *
+   * @param min The new value of the property
+   */
+  public void setMinimumSize(Dimension min)
+  {
+    Dimension oldMinimumSize = minimumSize;
+    if (min != null)
+      minimumSize = new Dimension(min);
+    else
+      minimumSize = null;
+    firePropertyChange("minimumSize", oldMinimumSize, minimumSize);
+  }
+
+  /**
+   * Set the value of the {@link #preferredSize} property. The passed value is
+   * copied, the later direct changes on the argument have no effect on the
+   * property value.
+   *
+   * @param pref The new value of the property
+   */
+  public void setPreferredSize(Dimension pref)
+  {
+    Dimension oldPreferredSize = preferredSize;
+    if (pref != null)
+      preferredSize = new Dimension(pref);
+    else
+      preferredSize = null;
+    firePropertyChange("preferredSize", oldPreferredSize, preferredSize);
+  }
+
+  /**
+   * Set the specified component to be the next component in the 
+   * focus cycle, overriding the {@link FocusTraversalPolicy} for
+   * this component.
+   *
+   * @param aComponent The component to set as the next focusable
+   *
+   * @deprecated Use FocusTraversalPolicy instead
+   */
+  public void setNextFocusableComponent(Component aComponent)
+  {
+    Container focusRoot = this;
+    if (! this.isFocusCycleRoot())
+      focusRoot = getFocusCycleRootAncestor();
+
+    FocusTraversalPolicy policy  = focusRoot.getFocusTraversalPolicy();
+    if (policy instanceof CompatibilityFocusTraversalPolicy)
+      {
+        policy = new CompatibilityFocusTraversalPolicy(policy);
+        focusRoot.setFocusTraversalPolicy(policy);
+      }
+    CompatibilityFocusTraversalPolicy p =
+      (CompatibilityFocusTraversalPolicy) policy;
+
+    Component old = getNextFocusableComponent();
+    if (old != null)
+      {
+        p.removeNextFocusableComponent(this, old);
+      }
+
+    if (aComponent != null)
+      {
+        p.addNextFocusableComponent(this, aComponent);
+      }
+  }
+
+  /**
+   * Set the value of the {@link #requestFocusEnabled} property.
+   *
+   * @param e The new value of the property
+   */
+  public void setRequestFocusEnabled(boolean e)
+  {
+    requestFocusEnabled = e;
+  }
+
+  /**
+   * Get the value of the {@link #transferHandler} property.
+   *
+   * @return The current value of the property
+   *
+   * @see #setTransferHandler
+   */
+
+  public TransferHandler getTransferHandler()
+  {
+    return transferHandler;
+  }
+
+  /**
+   * Set the value of the {@link #transferHandler} property.
+   *
+   * @param newHandler The new value of the property
+   *
+   * @see #getTransferHandler
+   */
+
+  public void setTransferHandler(TransferHandler newHandler)
+  {
+    if (transferHandler == newHandler)
+      return;
+
+    TransferHandler oldHandler = transferHandler;
+    transferHandler = newHandler;
+    firePropertyChange("transferHandler", oldHandler, newHandler);
+  }
+
+  /**
+   * Set if the component should paint all pixels withing its bounds.
+   * If this property is set to false, the component expects the cleared
+   * background.
+   *
+   * @param isOpaque if true, paint all pixels. If false, expect the clean
+   * background. 
+   *
+   * @see ComponentUI#update
+   */
+  public void setOpaque(boolean isOpaque)
+  {
+    boolean oldOpaque = opaque;
+    opaque = isOpaque;
+    clientOpaqueSet = true;
+    firePropertyChange("opaque", oldOpaque, opaque);
+  }
+
+  /**
+   * Set the value of the visible property.
+   *
+   * If the value is changed, then the AncestorListeners of this component
+   * and all its children (recursivly) are notified.
+   *
+   * @param v The new value of the property
+   */
+  public void setVisible(boolean v)
+  {
+    // No need to do anything if the actual value doesn't change.
+    if (isVisible() == v)
+      return;
+
+    super.setVisible(v);
+
+    // Notify AncestorListeners.
+    if (v == true)
+      fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);
+    else
+      fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED);
+
+    Container parent = getParent();
+    if (parent != null)
+      parent.repaint(getX(), getY(), getWidth(), getHeight());
+    revalidate();
+  }
+
+  /**
+   * Call {@link #paint}. 
+   * 
+   * @param g The graphics context to paint into
+   */
+  public void update(Graphics g)
+  {
+    paint(g);
+  }
+
+  /**
+   * Get the value of the UIClassID property. This property should be a key
+   * in the {@link UIDefaults} table managed by {@link UIManager}, the
+   * value of which is the name of a class to load for the component's
+   * {@link #ui} property.
+   *
+   * @return A "symbolic" name which will map to a class to use for the
+   * component's UI, such as <code>"ComponentUI"</code>
+   *
+   * @see #setUI
+   * @see #updateUI
+   */
+  public String getUIClassID()
+  {
+    return "ComponentUI";
+  }
+
+  /**
+   * Install a new UI delegate as the component's {@link #ui} property. In
+   * the process, this will call {@link ComponentUI#uninstallUI} on any
+   * existing value for the {@link #ui} property, and {@link
+   * ComponentUI#installUI} on the new UI delegate.
+   *
+   * @param newUI The new UI delegate to install
+   *
+   * @see #updateUI
+   * @see #getUIClassID
+   */
+  protected void setUI(ComponentUI newUI)
+  {
+    if (ui != null)
+      ui.uninstallUI(this);
+
+    ComponentUI oldUI = ui;
+    ui = newUI;
+
+    if (ui != null)
+      ui.installUI(this);
+
+    firePropertyChange("UI", oldUI, newUI);
+    revalidate();
+    repaint();
+  }
+
+  /**
+   * This method should be overridden in subclasses. In JComponent, the
+   * method does nothing. In subclasses, it should a UI delegate
+   * (corresponding to the symbolic name returned from {@link
+   * #getUIClassID}) from the {@link UIManager}, and calls {@link #setUI}
+   * with the new delegate.
+   */
+  public void updateUI()
+  {
+    // Nothing to do here.
+  }
+
+  /**
+   * Returns the locale used as the default for all new components.  The 
+   * default value is {@link Locale#getDefault()} (that is, the platform
+   * default locale).
+   * 
+   * @return The locale (never <code>null</code>).
+   * 
+   * @see #setDefaultLocale(Locale)
+   */
+  public static Locale getDefaultLocale()
+  {
+    if (defaultLocale == null)
+      defaultLocale = Locale.getDefault();
+    return defaultLocale;
+  }
+  
+  /**
+   * Sets the locale to be used as the default for all new components.  If this
+   * is set to <code>null</code>, the {@link #getDefaultLocale()} method will
+   * return the platform default locale.
+   * 
+   * @param l  the locale (<code>null</code> permitted).
+   */
+  public static void setDefaultLocale(Locale l)
+  {
+    defaultLocale = l;
+  }
+  
+  /**
+   * Returns the currently set input verifier for this component.
+   *
+   * @return the input verifier, or <code>null</code> if none
+   */
+  public InputVerifier getInputVerifier()
+  {
+    return inputVerifier;
+  }
+
+  /**
+   * Sets the input verifier to use by this component.
+   *
+   * @param verifier the input verifier, or <code>null</code>
+   */
+  public void setInputVerifier(InputVerifier verifier)
+  {
+    InputVerifier oldVerifier = inputVerifier;
+    inputVerifier = verifier;
+    firePropertyChange("inputVerifier", oldVerifier, verifier);
+  }
+
+  /**
+   * @since 1.3
+   */
+  public boolean getVerifyInputWhenFocusTarget()
+  {
+    return verifyInputWhenFocusTarget;
+  }
+
+  /**
+   * @since 1.3
+   */
+  public void setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget)
+  {
+    if (this.verifyInputWhenFocusTarget == verifyInputWhenFocusTarget)
+      return;
+
+    this.verifyInputWhenFocusTarget = verifyInputWhenFocusTarget;
+    firePropertyChange("verifyInputWhenFocusTarget",
+                       ! verifyInputWhenFocusTarget,
+                       verifyInputWhenFocusTarget);
+  }
+
+  /**
+   * Requests that this component gets the input focus if the
+   * requestFocusEnabled property is set to <code>true</code>.
+   * This also means that this component's top-level window becomes
+   * the focused window, if that is not already the case.
+   *
+   * The preconditions that have to be met to become a focus owner is that
+   * the component must be displayable, visible and focusable.
+   *
+   * Note that this signals only a request for becoming focused. There are
+   * situations in which it is not possible to get the focus. So developers
+   * should not assume that the component has the focus until it receives
+   * a {@link java.awt.event.FocusEvent} with a value of
+   * {@link java.awt.event.FocusEvent#FOCUS_GAINED}.
+   *
+   * @see Component#requestFocus()
+   */
+  public void requestFocus()
+  {
+    if (isRequestFocusEnabled())
+      super.requestFocus();
+  }
+
+  /**
+   * This method is overridden to make it public so that it can be used
+   * by look and feel implementations.
+   *
+   * You should not use this method directly. Instead you are strongly
+   * encouraged to call {@link #requestFocus()} or 
+   * {@link #requestFocusInWindow()} instead.
+   *
+   * @param temporary if the focus change is temporary
+   *
+   * @return <code>false</code> if the focus change request will definitly
+   *     fail, <code>true</code> if it will likely succeed
+   *
+   * @see Component#requestFocus(boolean)
+   *
+   * @since 1.4
+   */
+  public boolean requestFocus(boolean temporary)
+  {
+    return super.requestFocus(temporary);
+  }
+
+  /**
+   * Requests that this component gets the input focus if the top level
+   * window that contains this component has the focus and the
+   * requestFocusEnabled property is set to <code>true</code>.
+   *
+   * The preconditions that have to be met to become a focus owner is that
+   * the component must be displayable, visible and focusable.
+   *
+   * Note that this signals only a request for becoming focused. There are
+   * situations in which it is not possible to get the focus. So developers
+   * should not assume that the component has the focus until it receives
+   * a {@link java.awt.event.FocusEvent} with a value of
+   * {@link java.awt.event.FocusEvent#FOCUS_GAINED}.
+   *
+   * @return <code>false</code> if the focus change request will definitly
+   *     fail, <code>true</code> if it will likely succeed
+   *
+   * @see Component#requestFocusInWindow()
+   */
+  public boolean requestFocusInWindow()
+  {
+    if (isRequestFocusEnabled())
+      return super.requestFocusInWindow();
+    else
+      return false;
+  }
+
+  /**
+   * This method is overridden to make it public so that it can be used
+   * by look and feel implementations.
+   *
+   * You should not use this method directly. Instead you are strongly
+   * encouraged to call {@link #requestFocus()} or 
+   * {@link #requestFocusInWindow()} instead.
+   *
+   * @param temporary if the focus change is temporary
+   *
+   * @return <code>false</code> if the focus change request will definitly
+   *     fail, <code>true</code> if it will likely succeed
+   *
+   * @see Component#requestFocus(boolean)
+   *
+   * @since 1.4
+   */
+  protected boolean requestFocusInWindow(boolean temporary)
+  {
+    return super.requestFocusInWindow(temporary);
+  }
+
+  /**
+   * Receives notification if this component is added to a parent component.
+   *
+   * Notification is sent to all registered AncestorListeners about the
+   * new parent.
+   *
+   * This method sets up ActionListeners for all registered KeyStrokes of
+   * this component in the chain of parent components.
+   *
+   * A PropertyChange event is fired to indicate that the ancestor property
+   * has changed.
+   *
+   * This method is used internally and should not be used in applications.
+   */
+  public void addNotify()
+  {
+    // Register the WHEN_IN_FOCUSED_WINDOW keyboard bindings
+    // Note that here we unregister all bindings associated with
+    // this component and then re-register them.  This may be more than
+    // necessary if the top-level ancestor hasn't changed.  Should
+    // maybe improve this.
+    KeyboardManager km = KeyboardManager.getManager();
+    km.clearBindingsForComp(this);
+    km.registerEntireMap((ComponentInputMap)
+                         this.getInputMap(WHEN_IN_FOCUSED_WINDOW));
+    super.addNotify();
+
+    // Notify AncestorListeners.
+    fireAncestorEvent(this, AncestorEvent.ANCESTOR_ADDED);
+
+    // fire property change event for 'ancestor'
+    firePropertyChange("ancestor", null, getParent());
+  }
+
+  /**
+   * Receives notification that this component no longer has a parent.
+   *
+   * This method sends an AncestorEvent to all registered AncestorListeners,
+   * notifying them that the parent is gone.
+   *
+   * The keybord actions of this component are removed from the parent and
+   * its ancestors.
+   *
+   * A PropertyChangeEvent is fired to indicate that the 'ancestor' property
+   * has changed.
+   *
+   * This method is called before the component is actually removed from
+   * its parent, so the parent is still visible through 
+   * {@link Component#getParent}.
+   */
+  public void removeNotify()
+  {
+    super.removeNotify();
+
+    KeyboardManager.getManager().clearBindingsForComp(this);
+    
+    // Notify ancestor listeners.
+    fireAncestorEvent(this, AncestorEvent.ANCESTOR_REMOVED);
+
+    // fire property change event for 'ancestor'
+    firePropertyChange("ancestor", getParent(), null);
+  }
+
+  /**
+   * Returns <code>true</code> if the coordinates (x, y) lie within
+   * the bounds of this component and <code>false</code> otherwise.
+   * x and y are relative to the coordinate space of the component.
+   *
+   * @param x the X coordinate of the point to check
+   * @param y the Y coordinate of the point to check
+   *
+   * @return <code>true</code> if the specified point lies within the bounds
+   *     of this component, <code>false</code> otherwise
+   */
+  public boolean contains(int x, int y)
+  {
+    if (ui == null)
+      return super.contains(x, y);
+    else
+      return ui.contains(this, x, y);
+  }
+
+  /**
+   * Disables this component.
+   *
+   * @deprecated replaced by {@link #setEnabled(boolean)}
+   */
+  public void disable()
+  {
+    super.disable();
+  }
+
+  /**
+   * Enables this component.
+   *
+   * @deprecated replaced by {@link #setEnabled(boolean)}
+   */
+  public void enable()
+  {
+    super.enable();
+  }
+
+  /**
+   * Returns the Graphics context for this component. This can be used
+   * to draw on a component.
+   *
+   * @return the Graphics context for this component
+   */
+  public Graphics getGraphics()
+  {
+    return super.getGraphics();
+  }
+
+  /**
+   * Returns the X coordinate of the upper left corner of this component.
+   * Prefer this method over {@link #getBounds} or {@link #getLocation}
+   * because it does not cause any heap allocation.
+   *
+   * @return the X coordinate of the upper left corner of the component
+   */
+  public int getX()
+  {
+    return super.getX();
+  }
+
+  /**
+   * Returns the Y coordinate of the upper left corner of this component.
+   * Prefer this method over {@link #getBounds} or {@link #getLocation}
+   * because it does not cause any heap allocation.
+   *
+   * @return the Y coordinate of the upper left corner of the component
+   */
+  public int getY()
+  {
+    return super.getY();
+  }
+
+  /**
+   * Returns the height of this component. Prefer this method over
+   * {@link #getBounds} or {@link #getSize} because it does not cause
+   * any heap allocation.
+   *
+   * @return the height of the component
+   */
+  public int getHeight()
+  {
+    return super.getHeight();
+  }
+
+  /**
+   * Returns the width of this component. Prefer this method over
+   * {@link #getBounds} or {@link #getSize} because it does not cause
+   * any heap allocation.
+   *
+   * @return the width of the component
+   */
+  public int getWidth()
+  {
+    return super.getWidth();
+  }
+
+  /**
+   * Prints this component to the given Graphics context. A call to this
+   * method results in calls to the methods {@link #printComponent},
+   * {@link #printBorder} and {@link #printChildren} in this order.
+   *
+   * Double buffering is temporarily turned off so the painting goes directly
+   * to the supplied Graphics context.
+   *
+   * @param g the Graphics context to print onto
+   */
+  public void print(Graphics g)
+  {
+    boolean doubleBufferState = isDoubleBuffered();
+    setDoubleBuffered(false);
+    printComponent(g);
+    printBorder(g);
+    printChildren(g);
+    setDoubleBuffered(doubleBufferState);
+  }
+
+  /**
+   * Prints this component to the given Graphics context. This invokes
+   * {@link #print}.
+   *
+   * @param g the Graphics context to print onto
+   */
+  public void printAll(Graphics g)
+  {
+    print(g);
+  }
+
+  /**
+   * Prints this component to the specified Graphics context. The default
+   * behaviour is to invoke {@link #paintComponent}. Override this
+   * if you want special behaviour for printing.
+   *
+   * @param g the Graphics context to print onto
+   *
+   * @since 1.3
+   */
+  protected void printComponent(Graphics g)
+  {
+    paintComponent(g);
+  }
+
+  /**
+   * Print this component's children to the specified Graphics context.
+   * The default behaviour is to invoke {@link #paintChildren}. Override this
+   * if you want special behaviour for printing.
+   *
+   * @param g the Graphics context to print onto
+   *
+   * @since 1.3
+   */
+  protected void printChildren(Graphics g)
+  {
+    paintChildren(g);
+  }
+
+  /**
+   * Print this component's border to the specified Graphics context.
+   * The default behaviour is to invoke {@link #paintBorder}. Override this
+   * if you want special behaviour for printing.
+   *
+   * @param g the Graphics context to print onto
+   *
+   * @since 1.3
+   */
+  protected void printBorder(Graphics g)
+  {
+    paintBorder(g);
+  }
+
+  /**
+   * Processes mouse motion event, like dragging and moving.
+   *
+   * @param ev the MouseEvent describing the mouse motion
+   */
+  protected void processMouseMotionEvent(MouseEvent ev)
+  {
+    super.processMouseMotionEvent(ev);
+  }
+
+  /**
+   * Moves and resizes the component.
+   *
+   * @param x the new horizontal location
+   * @param y the new vertial location
+   * @param w the new width
+   * @param h the new height
+   */
+  public void reshape(int x, int y, int w, int h)
+  {
+    int oldX = getX();
+    int oldY = getY();
+    super.reshape(x, y, w, h);
+    // Notify AncestorListeners.
+    if (oldX != getX() || oldY != getY())
+      fireAncestorEvent(this, AncestorEvent.ANCESTOR_MOVED);
+  }
+
+  /**
+   * Fires an AncestorEvent to this component's and all of its child
+   * component's AncestorListeners.
+   *
+   * @param ancestor the component that triggered the event
+   * @param id the kind of ancestor event that should be fired
+   */
+  void fireAncestorEvent(JComponent ancestor, int id)
+  {
+    // Fire event for registered ancestor listeners of this component.
+    AncestorListener[] listeners = getAncestorListeners();
+    if (listeners.length > 0)
+      {
+        AncestorEvent ev = new AncestorEvent(this, id,
+                                             ancestor, ancestor.getParent());
+        for (int i = 0; i < listeners.length; i++)
+          {
+            switch (id)
+              {
+              case AncestorEvent.ANCESTOR_MOVED:
+                listeners[i].ancestorMoved(ev);
+                break;
+              case AncestorEvent.ANCESTOR_ADDED:
+                listeners[i].ancestorAdded(ev);
+                break;
+              case AncestorEvent.ANCESTOR_REMOVED:
+                listeners[i].ancestorRemoved(ev);
+                break;
+              }
+          }
+      }
+    // Dispatch event to all children.
+    int numChildren = getComponentCount();
+    for (int i = 0; i < numChildren; i++)
+      {
+        Component child = getComponent(i);
+        if (! (child instanceof JComponent))
+          continue;
+        JComponent jc = (JComponent) child;
+        jc.fireAncestorEvent(ancestor, id);
+      }
+  }
+
+  /**
+   * Finds a suitable paint root for painting this component. This method first
+   * checks if this component is overlapped using
+   * {@link #findOverlapFreeParent(Rectangle)}. The returned paint root is then
+   * feeded to {@link #findOpaqueParent(Component)} to find the nearest opaque
+   * component for this paint root. If no paint is necessary, then we return
+   * <code>null</code>.
+   *
+   * @param c the clip of this component
+   *
+   * @return the paint root or <code>null</code> if no painting is necessary
+   */
+  private Component findPaintRoot(Rectangle c)
+  {
+    Component p = findOverlapFreeParent(c);
+    if (p == null)
+      return null;
+    Component root = findOpaqueParent(p);
+    return root;
+  }
+
+  /**
+   * Scans the containment hierarchy upwards for components that overlap the
+   * this component in the specified clip. This method returns
+   * <code>this</code>, if no component overlaps this component. It returns
+   * <code>null</code> if another component completely covers this component
+   * in the specified clip (no repaint necessary). If another component partly
+   * overlaps this component in the specified clip, then the parent of this
+   * component is returned (this is the component that must be used as repaint
+   * root). For efficient lookup, the method
+   * {@link #isOptimizedDrawingEnabled()} is used.
+   *
+   * @param clip the clip of this component
+   *
+   * @return the paint root, or <code>null</code> if no paint is necessary
+   */
+  private Component findOverlapFreeParent(Rectangle clip)
+  {
+    Rectangle currentClip = clip;
+    Component found = this;
+    Container parent = this; 
+
+    while (parent != null && !(parent instanceof Window))
+      {
+        Container newParent = parent.getParent();
+        if (newParent == null || newParent instanceof Window)
+          break;
+        // If the parent is optimizedDrawingEnabled, then its children are
+        // tiled and cannot have an overlapping child. Go directly to next
+        // parent.
+        if ((newParent instanceof JComponent
+            && ((JComponent) newParent).isOptimizedDrawingEnabled()))
+          
+          {
+            parent = newParent;
+            continue;
+          }
+
+        // If the parent is not optimizedDrawingEnabled, we must check if the
+        // parent or some neighbor overlaps the current clip.
+
+        // This is the current clip converted to the parent's coordinate
+        // system. TODO: We can do this more efficiently by succesively
+        // cumulating the parent-child translations.
+        Rectangle target = SwingUtilities.convertRectangle(found,
+                                                           currentClip,
+                                                           newParent);
+
+        // We have an overlap if either:
+        // - The new parent itself doesn't completely cover the clip
+        //   (this can be the case with viewports).
+        // - If some higher-level (than the current) children of the new parent
+        //   intersect the target rectangle.
+        Rectangle parentRect = SwingUtilities.getLocalBounds(newParent);
+        boolean haveOverlap =
+          ! SwingUtilities.isRectangleContainingRectangle(parentRect, target);
+        if (! haveOverlap)
+          {
+            Component child;
+            for (int i = 0; (child = newParent.getComponent(i)) != parent && !haveOverlap; i++)
+              {
+                Rectangle childRect = child.getBounds();
+                haveOverlap = target.intersects(childRect);
+              }
+          }
+        if (haveOverlap)
+          {
+            found = newParent;
+            currentClip = target;
+          }
+        parent = newParent;
+      }
+    //System.err.println("overlapfree parent: " + found);
+    return found;
+  }
+
+  /**
+   * Finds the nearest component to <code>c</code> (upwards in the containment
+   * hierarchy), that is opaque. If <code>c</code> itself is opaque,
+   * this returns <code>c</code> itself.
+   *
+   * @param c the start component for the search
+   * @return the nearest component to <code>c</code> (upwards in the containment
+   *         hierarchy), that is opaque; If <code>c</code> itself is opaque,
+   *         this returns <code>c</code> itself
+   */
+  private Component findOpaqueParent(Component c)
+  {
+    Component found = c;
+    while (true)
+      {
+        if ((found instanceof JComponent) && ((JComponent) found).isOpaque())
+          break;
+        else if (!(found instanceof JComponent) && !found.isLightweight())
+          break;
+        Container p = found.getParent();
+        if (p == null)
+          break;
+        else
+          found = p;
+      }
+    return found;
+  }
+  
+  /**
+   * This is the method that gets called when the WHEN_IN_FOCUSED_WINDOW map
+   * is changed.
+   *
+   * @param changed the JComponent associated with the WHEN_IN_FOCUSED_WINDOW
+   *        map
+   */
+  void updateComponentInputMap(ComponentInputMap changed)
+  {
+    // Since you can change a component's input map via
+    // setInputMap, we have to check if <code>changed</code>
+    // is still in our WHEN_IN_FOCUSED_WINDOW map hierarchy
+    InputMap curr = getInputMap(WHEN_IN_FOCUSED_WINDOW);
+    while (curr != null && curr != changed)
+      curr = curr.getParent();
+    
+    // If curr is null then changed is not in the hierarchy
+    if (curr == null)
+      return;
+    
+    // Now we have to update the keyboard manager's hashtable
+    KeyboardManager km = KeyboardManager.getManager();
+    
+    // This is a poor strategy, should be improved.  We currently 
+    // delete all the old bindings for the component and then register
+    // the current bindings.
+    km.clearBindingsForComp(changed.getComponent());
+    km.registerEntireMap((ComponentInputMap) 
+                         getInputMap(WHEN_IN_FOCUSED_WINDOW));
+  }
+
+  /**
+   * Helper method for
+   * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+   * 
+   * @param propertyName the name of the property
+   * @param value the value of the property
+   *
+   * @throws IllegalArgumentException if the specified property cannot be set
+   *         by this method
+   * @throws ClassCastException if the property value does not match the
+   *         property type
+   * @throws NullPointerException if <code>c</code> or
+   *         <code>propertyValue</code> is <code>null</code>
+   */
+  void setUIProperty(String propertyName, Object value)
+  {
+    if (propertyName.equals("opaque"))
+      {
+        if (! clientOpaqueSet)
+          {
+            setOpaque(((Boolean) value).booleanValue());
+            clientOpaqueSet = false;
+          }
+      }
+    else if (propertyName.equals("autoscrolls"))
+      {
+        if (! clientAutoscrollsSet)
+          {
+            setAutoscrolls(((Boolean) value).booleanValue());
+            clientAutoscrollsSet = false;
+          }
+      }
+    else
+      {
+        throw new IllegalArgumentException
+            ("Unsupported property for LookAndFeel.installProperty(): "
+             + propertyName);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDesktopPane.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDesktopPane.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDesktopPane.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDesktopPane.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,384 @@
+/* JDesktopPane.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.beans.PropertyVetoException;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.plaf.DesktopPaneUI;
+
+/**
+ * JDesktopPane is a container (usually for JInternalFrames) that simulates a
+ * desktop. Typically, the user will create JInternalFrames and place them in
+ * a JDesktopPane. The user can then interact with JInternalFrames like they
+ * usually would with JFrames. The actions (minimize, maximize, close, etc)
+ * are done by using a DesktopManager that is associated with the
+ * JDesktopPane.
+ */
+public class JDesktopPane extends JLayeredPane implements Accessible
+{
+  private static final long serialVersionUID = 766333777224038726L;
+
+  /**
+   * This specifies that when dragged, a JInternalFrame should be completely
+   * visible.
+   *
+   * @specnote final since 1.5.0.
+   */
+  public static final int LIVE_DRAG_MODE = 0;
+
+  /**
+   * This specifies that when dragged, a JInternalFrame should only be visible
+   * as an outline.
+   *
+   * @specnote final since 1.5.0.
+   */
+  public static final int OUTLINE_DRAG_MODE = 1;
+
+  /** The selected frame in the JDesktopPane. */
+  private transient JInternalFrame selectedFrame;
+
+  /** The JDesktopManager to use for acting on JInternalFrames. */
+  transient DesktopManager desktopManager;
+
+  /** The drag mode used by the JDesktopPane. */
+  private transient int dragMode = LIVE_DRAG_MODE;
+
+  /**
+   * Indicates if the dragMode property has been set by a client
+   * program or by the UI.
+   *
+   * @see #setUIProperty(String, Object)
+   * @see LookAndFeel#installProperty(JComponent, String, Object)
+   */
+  private boolean clientDragModeSet = false;
+
+  /**
+   * Provides the accessibility features for the <code>JDesktopPane</code>
+   * component.
+   */
+  protected class AccessibleJDesktopPane extends AccessibleJComponent
+  {
+    private static final long serialVersionUID = 6079388927946077570L;
+
+    /**
+     * Creates a new <code>AccessibleJDesktopPane</code> instance.
+     */
+    protected AccessibleJDesktopPane()
+    {
+      // Nothing to do here.
+    }
+
+    /**
+     * Returns the accessible role for the <code>JSlider</code> component.
+     *
+     * @return {@link AccessibleRole#DESKTOP_PANE}.
+     */
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.DESKTOP_PANE;
+    }
+  }
+
+  /**
+   * Creates a new JDesktopPane object.
+   */
+  public JDesktopPane()
+  {
+    setLayout(null);
+    updateUI();
+  }
+
+  /**
+   * This method returns the UI used with the JDesktopPane.
+   *
+   * @return The UI used with the JDesktopPane.
+   */
+  public DesktopPaneUI getUI()
+  {
+    return (DesktopPaneUI) ui;
+  }
+
+  /**
+   * This method sets the UI used with the JDesktopPane.
+   *
+   * @param ui The UI to use with the JDesktopPane.
+   */
+  public void setUI(DesktopPaneUI ui)
+  {
+    super.setUI(ui);
+  }
+
+  /**
+   * This method sets the drag mode to use with the JDesktopPane.
+   *
+   * @param mode The drag mode to use.
+   *
+   * @throws IllegalArgumentException If the drag mode given is not
+   *         LIVE_DRAG_MODE or OUTLINE_DRAG_MODE.
+   */
+  public void setDragMode(int mode)
+  {
+    if ((mode != LIVE_DRAG_MODE) && (mode != OUTLINE_DRAG_MODE))
+      throw new IllegalArgumentException("Drag mode not valid.");
+
+    clientDragModeSet = true;
+
+    // FIXME: Unsupported mode.
+    if (mode == OUTLINE_DRAG_MODE)
+      // throw new IllegalArgumentException("Outline drag modes are
+      // unsupported.");
+      mode = LIVE_DRAG_MODE;
+
+    dragMode = mode;
+  }
+
+  /**
+   * This method returns the drag mode used with the JDesktopPane.
+   *
+   * @return The drag mode used with the JDesktopPane.
+   */
+  public int getDragMode()
+  {
+    return dragMode;
+  }
+
+  /**
+   * This method returns the DesktopManager used with the JDesktopPane.
+   *
+   * @return The DesktopManager to use with the JDesktopPane.
+   */
+  public DesktopManager getDesktopManager()
+  {
+    return desktopManager;
+  }
+
+  /**
+   * This method sets the DesktopManager to use with the JDesktopPane.
+   *
+   * @param manager The DesktopManager to use with the JDesktopPane.
+   */
+  public void setDesktopManager(DesktopManager manager)
+  {
+    desktopManager = manager;
+  }
+
+  /**
+   * This method restores the UI used with the JDesktopPane to the default.
+   */
+  public void updateUI()
+  {
+    setUI((DesktopPaneUI) UIManager.getUI(this));
+  }
+
+  /**
+   * This method returns a String identifier that allows the UIManager to know
+   * which class will act as JDesktopPane's UI.
+   *
+   * @return A String identifier for the UI class to use.
+   */
+  public String getUIClassID()
+  {
+    return "DesktopPaneUI";
+  }
+
+  /**
+   * This method returns all JInternalFrames that are in the JDesktopPane.
+   *
+   * @return All JInternalFrames that are in the JDesktopPane.
+   */
+  public JInternalFrame[] getAllFrames()
+  {
+    return getFramesFromComponents(getComponents());
+  }
+
+  /**
+   * This method returns the currently selected frame in the JDesktopPane.
+   *
+   * @return The currently selected frame in the JDesktopPane.
+   */
+  public JInternalFrame getSelectedFrame()
+  {
+    return selectedFrame;
+  }
+
+  /**
+   * This method sets the selected frame in the JDesktopPane.
+   *
+   * @param frame The selected frame in the JDesktopPane.
+   */
+  public void setSelectedFrame(JInternalFrame frame)
+  {
+    if (selectedFrame != null)
+      {
+        try
+          {
+            selectedFrame.setSelected(false);
+          }
+        catch (PropertyVetoException e)
+          {
+            // We do nothing when the attempt is vetoed.
+          }
+      }
+    selectedFrame = null;
+
+    try
+      {
+        if (frame != null)
+          frame.setSelected(true);
+
+        selectedFrame = frame;
+      }
+    catch (PropertyVetoException e)
+      {
+        // We do nothing when the attempt is vetoed.
+      }
+  }
+
+  /**
+   * This method returns all the JInternalFrames in the given layer.
+   *
+   * @param layer The layer to grab frames in.
+   *
+   * @return All JInternalFrames in the given layer.
+   */
+  public JInternalFrame[] getAllFramesInLayer(int layer)
+  {
+    return getFramesFromComponents(getComponentsInLayer(layer));
+  }
+
+  /**
+   * This method always returns true to indicate that it is not transparent.
+   *
+   * @return true.
+   */
+  public boolean isOpaque()
+  {
+    return true;
+  }
+
+  /**
+   * Returns an implementation-dependent string describing the attributes of
+   * this <code>JDesktopPane</code>.
+   *
+   * @return A string describing the attributes of this <code>JDesktopPane</code>
+   *         (never <code>null</code>).
+   */
+  protected String paramString()
+  {
+    String superParamStr = super.paramString();
+    StringBuffer sb = new StringBuffer();
+    sb.append(",isOptimizedDrawingPossible=");
+    sb.append(isOptimizedDrawingEnabled());
+    sb.append(",desktopManager=");
+    if (desktopManager != null)
+      sb.append(desktopManager);
+    return superParamStr + sb.toString();
+  }
+
+  /**
+   * This method returns all the JInternalFrames in the given Component array.
+   *
+   * @param components An array to search for JInternalFrames in.
+   *
+   * @return An array of JInternalFrames found in the Component array.
+   */
+  private static JInternalFrame[] getFramesFromComponents(Component[] components)
+  {
+    int count = 0;
+
+    for (int i = 0; i < components.length; i++)
+	if (components[i] instanceof JInternalFrame)
+	  count++;
+	  
+    JInternalFrame[] value = new JInternalFrame[count];
+    for (int i = 0, j = 0; i < components.length && j != count; i++)
+      if (components[i] instanceof JInternalFrame)
+	value[j++] = (JInternalFrame) components[i];
+    return value;
+  }
+
+  /**
+   * Returns the object that provides accessibility features for this
+   * <code>JDesktopPane</code> component.
+   *
+   * @return The accessible context (an instance of 
+   *     {@link AccessibleJDesktopPane}).
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJDesktopPane();
+
+    return accessibleContext;
+  }
+
+  /**
+   * Helper method for
+   * {@link LookAndFeel#installProperty(JComponent, String, Object)}.
+   * 
+   * @param propertyName the name of the property
+   * @param value the value of the property
+   *
+   * @throws IllegalArgumentException if the specified property cannot be set
+   *         by this method
+   * @throws ClassCastException if the property value does not match the
+   *         property type
+   * @throws NullPointerException if <code>c</code> or
+   *         <code>propertyValue</code> is <code>null</code>
+   */
+  void setUIProperty(String propertyName, Object value)
+  {
+    if (propertyName.equals("dragMode"))
+      {
+        if (! clientDragModeSet)
+          {
+            setDragMode(((Integer) value).intValue());
+            clientDragModeSet = false;
+          }
+      }
+    else
+      {
+        super.setUIProperty(propertyName, value);
+      }
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDialog.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDialog.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDialog.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JDialog.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,592 @@
+/* JDialog.java --
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.IllegalComponentStateException;
+import java.awt.LayoutManager;
+import java.awt.event.WindowEvent;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+
+/**
+ * A dialog window. This is an extension of {@link java.awt.Dialog} that
+ * provides support for the Swing architecture. Most importantly it contains a
+ * {@link JRootPane} as it's only top-level child, that manages the content
+ * pane, the menu and a glass pane.
+ *
+ * Also, unlike <code>java.awt.Dialog</code>s, JDialogs support the
+ * Swing Pluggable Look & Feel architecture.
+ * 
+ * @author Ronald Veldema (rveldema at cs.vu.nl)
+ */
+public class JDialog extends Dialog implements Accessible, WindowConstants,
+                                               RootPaneContainer
+{
+  /**
+   * Provides accessibility support for <code>JDialog</code>s.
+   */
+  protected class AccessibleJDialog extends Dialog.AccessibleAWTDialog
+  {
+    /**
+     * Creates a new instance of <code>AccessibleJDialog</code>.
+     */
+    protected AccessibleJDialog()
+    {
+      super();
+      // Nothing to do here.
+    }
+  }
+
+  private static final long serialVersionUID = -864070866424508218L;
+
+  /** DOCUMENT ME! */
+  protected AccessibleContext accessibleContext;
+
+  /** The single RootPane in the Dialog. */
+  protected JRootPane rootPane;
+
+  /**
+   * Whether checking is enabled on the RootPane.
+   *
+   * @specnote Should be false to comply with J2SE 5.0
+   */ 
+  protected boolean rootPaneCheckingEnabled = false;
+
+  /** The default action taken when closed. */
+  private int close_action = HIDE_ON_CLOSE;
+  
+  /** Whether JDialogs are decorated by the Look and Feel. */
+  private static boolean decorated;
+
+  /* Creates a new non-modal JDialog with no title 
+   * using a shared Frame as the owner.
+   */
+  public JDialog()
+  {
+    this((Frame) SwingUtilities.getOwnerFrame(null), "", false, null);
+  }
+
+  /**
+   * Creates a new non-modal JDialog with no title
+   * using the given owner.
+   *
+   * @param owner The owner of the JDialog.
+   */
+  public JDialog(Dialog owner)
+  {
+    this(owner, "", false, null);
+  }
+
+  /**
+   * Creates a new JDialog with no title using the
+   * given modal setting and owner.
+   *
+   * @param owner The owner of the JDialog.
+   * @param modal Whether the JDialog is modal.
+   */
+  public JDialog(Dialog owner, boolean modal)
+  {
+    this(owner, "", modal, null);
+  }
+
+  /**
+   * Creates a new non-modal JDialog using the 
+   * given title and owner.
+   *
+   * @param owner The owner of the JDialog.
+   * @param title The title of the JDialog.
+   */
+  public JDialog(Dialog owner, String title)
+  {
+    this(owner, title, false, null);
+  }
+
+  /**
+   * Creates a new JDialog using the given modal 
+   * settings, title, and owner.
+   *
+   * @param owner The owner of the JDialog.
+   * @param title The title of the JDialog.
+   * @param modal Whether the JDialog is modal.
+   */
+  public JDialog(Dialog owner, String title, boolean modal)
+  {
+    this(owner, title, modal, null);
+  }
+
+  /**
+   * Creates a new JDialog using the given modal 
+   * settings, title, owner and graphics configuration.
+   *
+   * @param owner The owner of the JDialog.
+   * @param title The title of the JDialog.
+   * @param modal Whether the JDialog is modal.
+   * @param gc The Graphics Configuration to use.
+   */
+  public JDialog(Dialog owner, String title, boolean modal,
+                 GraphicsConfiguration gc)
+  {
+    super(owner, title, modal, gc);
+    dialogInit();
+  }
+
+  /**
+   * Creates a new non-modal JDialog with no title
+   * using the given owner.
+   *
+   * @param owner The owner of the JDialog.
+   */
+  public JDialog(Frame owner)
+  {
+    this(owner, "", false, null);
+  }
+
+  /**
+   * Creates a new JDialog with no title using the
+   * given modal setting and owner.
+   *
+   * @param owner The owner of the JDialog.
+   * @param modal Whether the JDialog is modal.
+   */
+  public JDialog(Frame owner, boolean modal)
+  {
+    this(owner, "", modal, null);
+  }
+
+  /**
+   * Creates a new non-modal JDialog using the 
+   * given title and owner.
+   *
+   * @param owner The owner of the JDialog.
+   * @param title The title of the JDialog.
+   */
+  public JDialog(Frame owner, String title)
+  {
+    this(owner, title, false, null);
+  }
+
+  /**
+   * Creates a new JDialog using the given modal 
+   * settings, title, and owner.
+   *
+   * @param owner The owner of the JDialog.
+   * @param title The title of the JDialog.
+   * @param modal Whether the JDialog is modal.
+   */
+  public JDialog(Frame owner, String title, boolean modal)
+  {
+    this(owner, title, modal, null);
+  }
+
+  /**
+   * Creates a new JDialog using the given modal 
+   * settings, title, owner and graphics configuration.
+   *
+   * @param owner The owner of the JDialog.
+   * @param title The title of the JDialog.
+   * @param modal Whether the JDialog is modal.
+   * @param gc The Graphics Configuration to use.
+   */
+  public JDialog(Frame owner, String title, boolean modal,
+                 GraphicsConfiguration gc)
+  {
+    super((Frame) SwingUtilities.getOwnerFrame(owner), title, modal, gc);
+    dialogInit();
+  }
+
+  /**
+   * This method is called to initialize the 
+   * JDialog. It sets the layout used, the locale, 
+   * and creates the RootPane.
+   */
+  protected void dialogInit()
+  {
+    // FIXME: Do a check on GraphicsEnvironment.isHeadless()
+    setLocale(JComponent.getDefaultLocale());
+    getRootPane(); // Will do set/create.
+    invalidate();
+    // Now that initStageDone is true, adds and layouts apply to contentPane,
+    // not top-level.
+    setRootPaneCheckingEnabled(true);
+  }
+
+  /**
+   * This method returns whether JDialogs will have their
+   * window decorations provided by the Look and Feel.
+   *
+   * @return Whether the window decorations are Look and Feel provided.
+   */
+  public static boolean isDefaultLookAndFeelDecorated()
+  {
+    return decorated;
+  }
+
+  /**
+   * This method sets whether JDialogs will have their
+   * window decorations provided by the Look and Feel.
+   *
+   * @param defaultLookAndFeelDecorated Whether the window
+   * decorations are Look and Feel provided.
+   */
+  public static void setDefaultLookAndFeelDecorated(boolean defaultLookAndFeelDecorated)
+  {
+    decorated = defaultLookAndFeelDecorated;
+  }
+
+  /**
+   * This method returns the preferred size of 
+   * the JDialog.
+   *
+   * @return The preferred size.
+   */
+  public Dimension getPreferredSize()
+  {
+    Dimension d = super.getPreferredSize();
+    return d;
+  }
+
+  /**
+   * This method returns the JMenuBar used
+   * in this JDialog.
+   *
+   * @return The JMenuBar in the JDialog.
+   */
+  public JMenuBar getJMenuBar()
+  {
+    return getRootPane().getJMenuBar();
+  }
+
+  /**
+   * This method sets the JMenuBar used 
+   * in this JDialog.
+   *
+   * @param menubar The JMenuBar to use.
+   */
+  public void setJMenuBar(JMenuBar menubar)
+  {
+    getRootPane().setJMenuBar(menubar);
+  }
+
+  /**
+   * This method sets the LayoutManager used in the JDialog.
+   * This method will throw an Error if rootPaneChecking is 
+   * enabled.
+   *
+   * @param manager The LayoutManager to use.
+   */
+  public void setLayout(LayoutManager manager)
+  {
+    // Check if we're in initialization stage. If so, call super.setLayout
+    // otherwise, valid calls go to the content pane.
+    if (isRootPaneCheckingEnabled())
+      getContentPane().setLayout(manager);
+    else
+      super.setLayout(manager);
+  }
+
+  /**
+   * This method sets the JLayeredPane used in the JDialog.
+   * If the given JLayeredPane is null, then this method
+   * will throw an Error.
+   *
+   * @param layeredPane The JLayeredPane to use.
+   */
+  public void setLayeredPane(JLayeredPane layeredPane)
+  {
+    if (layeredPane == null)
+      throw new IllegalComponentStateException("layeredPane cannot be null.");
+    getRootPane().setLayeredPane(layeredPane);
+  }
+
+  /**
+   * This method returns the JLayeredPane used with this JDialog.
+   *
+   * @return The JLayeredPane used with this JDialog.
+   */
+  public JLayeredPane getLayeredPane()
+  {
+    return getRootPane().getLayeredPane();
+  }
+
+  /**
+   * This method returns the JRootPane used with this JDialog.
+   *
+   * @return The JRootPane used with this JDialog.
+   */
+  public JRootPane getRootPane()
+  {
+    if (rootPane == null)
+      setRootPane(createRootPane());
+    return rootPane;
+  }
+
+  /**
+   * This method sets the JRootPane used with this JDialog.
+   *
+   * @param root The JRootPane to use.
+   */
+  protected void setRootPane(JRootPane root)
+  {
+    if (rootPane != null)
+      remove(rootPane);
+
+    rootPane = root;
+    rootPane.show();
+    add(rootPane);
+  }
+
+  /**
+   * This method creates a new JRootPane.
+   *
+   * @return A new JRootPane.
+   */
+  protected JRootPane createRootPane()
+  {
+    return new JRootPane();
+  }
+
+  /**
+   * This method returns the ContentPane
+   * in the JRootPane.
+   *
+   * @return The ContentPane in the JRootPane.
+   */
+  public Container getContentPane()
+  {
+    return getRootPane().getContentPane();
+  }
+
+  /**
+   * This method sets the ContentPane to use with this
+   * JDialog. If the ContentPane given is null, this method
+   * will throw an exception.
+   *
+   * @param contentPane The ContentPane to use with the JDialog.
+   */
+  public void setContentPane(Container contentPane)
+  {
+    if (contentPane == null)
+      throw new IllegalComponentStateException("contentPane cannot be null.");
+    getRootPane().setContentPane(contentPane);
+  }
+
+  /**
+   * This method returns the GlassPane for this JDialog.
+   *
+   * @return The GlassPane for this JDialog.
+   */
+  public Component getGlassPane()
+  {
+    return getRootPane().getGlassPane();
+  }
+
+  /**
+   * This method sets the GlassPane for this JDialog.
+   *
+   * @param glassPane The GlassPane for this JDialog.
+   */
+  public void setGlassPane(Component glassPane)
+  {
+    getRootPane().setGlassPane(glassPane);
+  }
+
+  /**
+   * This method is called when a component is added to the 
+   * the JDialog. Calling this method with rootPaneCheckingEnabled
+   * will cause an Error to be thrown.
+   *
+   * @param comp The component to add.
+   * @param constraints The constraints.
+   * @param index The position of the component.
+   */
+  protected void addImpl(Component comp, Object constraints, int index)
+  {
+    // If we're adding in the initialization stage use super.add.
+    // Otherwise pass the add onto the content pane.
+    if (isRootPaneCheckingEnabled())
+      getContentPane().add(comp, constraints, index);
+    else
+      super.addImpl(comp, constraints, index);
+  }
+
+  /**
+   * This method removes a component from the JDialog.
+   *
+   * @param comp The component to remove.
+   */
+  public void remove(Component comp)
+  {
+    // If we're removing the root pane, use super.remove. Otherwise
+    // pass it on to the content pane instead.
+    if (comp == rootPane)
+      super.remove(rootPane);
+    else 
+      getContentPane().remove(comp);
+  }
+
+  /**
+   * This method returns whether rootPane checking is enabled.
+   *
+   * @return Whether rootPane checking is enabled.
+   */
+  protected boolean isRootPaneCheckingEnabled()
+  {
+    return rootPaneCheckingEnabled;
+  }
+
+  /**
+   * This method sets whether rootPane checking is enabled.
+   *
+   * @param enabled Whether rootPane checking is enabled.
+   */
+  protected void setRootPaneCheckingEnabled(boolean enabled)
+  {
+    rootPaneCheckingEnabled = enabled;
+  }
+
+  /**
+   * This method simply calls paint and returns.
+   *
+   * @param g The Graphics object to paint with.
+   */
+  public void update(Graphics g)
+  {
+    paint(g);
+  }
+  
+  
+  /**
+   * This method handles window events. This allows the JDialog
+   * to honour its default close operation.
+   *
+   * @param e The WindowEvent.
+   */
+  protected void processWindowEvent(WindowEvent e)
+  {
+    //	System.out.println("PROCESS_WIN_EV-1: " + e);
+    super.processWindowEvent(e);
+    //	System.out.println("PROCESS_WIN_EV-2: " + e);
+    switch (e.getID())
+      {
+      case WindowEvent.WINDOW_CLOSING:
+        {
+	  switch (getDefaultCloseOperation())
+	    {
+	    case DISPOSE_ON_CLOSE:
+	      {
+		dispose();
+		break;
+	      }
+	    case HIDE_ON_CLOSE:
+	      {
+		setVisible(false);
+		break;
+	      }
+	    case DO_NOTHING_ON_CLOSE:
+	      break;
+	    }
+	  break;
+        }
+      case WindowEvent.WINDOW_CLOSED:
+      case WindowEvent.WINDOW_OPENED:
+      case WindowEvent.WINDOW_ICONIFIED:
+      case WindowEvent.WINDOW_DEICONIFIED:
+      case WindowEvent.WINDOW_ACTIVATED:
+      case WindowEvent.WINDOW_DEACTIVATED:
+	break;
+      }
+  }
+
+  /**
+   * This method sets the action to take
+   * when the JDialog is closed.
+   *
+   * @param operation The action to take.
+   */
+  public void setDefaultCloseOperation(int operation)
+  {
+    /* Reference implementation allows invalid operations
+       to be specified.  If so, getDefaultCloseOperation
+       must return the invalid code, and the behaviour
+       defaults to DO_NOTHING_ON_CLOSE.  processWindowEvent
+       above handles this */
+    close_action = operation;
+  }
+
+  /**
+   * This method returns the action taken when
+   * the JDialog is closed.
+   *
+   * @return The action to take.
+   */
+  public int getDefaultCloseOperation()
+  {
+    return close_action;
+  }
+
+  /**
+   * This method returns a String describing the JDialog.
+   *
+   * @return A String describing the JDialog.
+   */
+  protected String paramString()
+  {
+    return "JDialog";
+  }
+
+  /**
+   * DOCUMENT ME!
+   *
+   * @return DOCUMENT ME!
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      accessibleContext = new AccessibleJDialog();
+    return accessibleContext;
+  }
+}

Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JEditorPane.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JEditorPane.java?rev=43913&view=auto

==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JEditorPane.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/swing/JEditorPane.java Thu Nov  8 16:56:19 2007
@@ -0,0 +1,976 @@
+/* JEditorPane.java --
+   Copyright (C) 2002, 2004, 2005, 2006,  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing;
+
+import java.awt.Container;
+import java.awt.Dimension;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleHyperlink;
+import javax.accessibility.AccessibleHypertext;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleText;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.DefaultEditorKit;
+import javax.swing.text.Document;
+import javax.swing.text.EditorKit;
+import javax.swing.text.Element;
+import javax.swing.text.JTextComponent;
+import javax.swing.text.View;
+import javax.swing.text.ViewFactory;
+import javax.swing.text.WrappedPlainView;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+
+/**
+ * A powerful text editor component that can handle different types of
+ * content.
+ *
+ * The JEditorPane text component is driven by an instance of
+ * {@link EditorKit}. The editor kit is responsible for providing
+ * a default {@link Document} implementation, a mechanism for loading
+ * and saving documents of its supported content type and providing
+ * a set of {@link Action}s for manipulating the content.
+ *
+ * By default the following content types are supported:
+ * <ul>
+ * <li><code>text/plain</code>: Plain text, handled by
+ *   {@link javax.swing.text.DefaultEditorKit}.</li>
+ * <li><code>text/html</code>: HTML 4.0 styled text, handled by
+ *   {@link javax.swing.text.html.HTMLEditorKit}.</li>
+ * <li><code>text/rtf</code>: RTF text, handled by
+ *   {@link javax.swing.text.rtf.RTFEditorKit}.</li>
+ * </ul>
+ *
+ * @author original author unknown
+ * @author Roman Kennke (roman at kennke.org)
+ * @author Anthony Balkissoon abalkiss at redhat dot com
+ */
+public class JEditorPane extends JTextComponent
+{
+  /**
+   * Provides accessibility support for <code>JEditorPane</code>.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  protected class AccessibleJEditorPane extends AccessibleJTextComponent
+  {
+
+    /**
+     * Creates a new <code>AccessibleJEditorPane</code> object.
+     */
+    protected AccessibleJEditorPane()
+    {
+      super();
+    }
+
+    /**
+     * Returns a description of this <code>AccessibleJEditorPane</code>. If
+     * this property is not set, then this returns the content-type of the
+     * editor pane.
+     *
+     * @return a description of this AccessibleJEditorPane
+     */
+    public String getAccessibleDescription()
+    {
+      String descr = super.getAccessibleDescription(); 
+      if (descr == null)
+        return getContentType();
+      else
+        return descr;
+    }
+
+    /**
+     * Returns the accessible state of this <code>AccessibleJEditorPane</code>.
+     *
+     * @return  the accessible state of this <code>AccessibleJEditorPane</code>
+     */
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      AccessibleStateSet state = super.getAccessibleStateSet();
+      // TODO: Figure out what state must be added here to the super's state.
+      return state;
+    }
+  }
+
+  /**
+   * Provides accessibility support for <code>JEditorPane</code>s, when the
+   * editor kit is an instance of {@link HTMLEditorKit}.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  protected class AccessibleJEditorPaneHTML extends AccessibleJEditorPane
+  {
+    /**
+     * Returns the accessible text of the <code>JEditorPane</code>. This will
+     * be an instance of
+     * {@link JEditorPaneAccessibleHypertextSupport}.
+     *
+     * @return the accessible text of the <code>JEditorPane</code>
+     */
+    public AccessibleText getAccessibleText()
+    {
+      return new JEditorPaneAccessibleHypertextSupport();
+    }
+  }
+
+  /**
+   * This is the accessible text that is returned by
+   * {@link AccessibleJEditorPaneHTML#getAccessibleText()}.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  protected class JEditorPaneAccessibleHypertextSupport
+    extends AccessibleJEditorPane implements AccessibleHypertext
+  {
+
+    /**
+     * Creates a new JEditorPaneAccessibleHypertextSupport object.
+     */
+    public JEditorPaneAccessibleHypertextSupport()
+    {
+      super();
+    }
+    
+    /**
+     * The accessible representation of a HTML link. 
+     *
+     * @author Roman Kennke (kennke at aicas.com)
+     */
+    public class HTMLLink extends AccessibleHyperlink
+    {
+
+      /**
+       * The element in the document that represents the link.
+       */
+      Element element;
+
+      /**
+       * Creates a new <code>HTMLLink</code>.
+       *
+       * @param el the link element
+       */
+      public HTMLLink(Element el)
+      {
+        this.element = el;
+      }
+
+      /**
+       * Returns <code>true</code> if this <code>HTMLLink</code> is still
+       * valid. A <code>HTMLLink</code> can become invalid when the document
+       * changes.
+       *
+       * @return <code>true</code> if this <code>HTMLLink</code> is still
+       *         valid
+       */
+      public boolean isValid()
+      {
+        // I test here if the element at our element's start offset is the
+        // same as the element in the document at this offset. If this is true,
+        // I consider the link valid, if not, then this link no longer
+        // represented by this HTMLLink and therefor invalid.
+        HTMLDocument doc = (HTMLDocument) getDocument();
+        return doc.getCharacterElement(element.getStartOffset()) == element;
+      }
+
+      /**
+       * Returns the number of AccessibleActions in this link object. In
+       * general, link have 1 AccessibleAction associated with them. There are
+       * special cases where links can have multiple actions associated, like
+       * in image maps.
+       * 
+       * @return the number of AccessibleActions in this link object
+       */
+      public int getAccessibleActionCount()
+      {
+        // TODO: Implement the special cases.
+        return 1;
+      }
+
+      /**
+       * Performs the specified action on the link object. This ususally means
+       * activating the link.
+       *
+       * @return <code>true</code> if the action has been performed
+       *         successfully, <code>false</code> otherwise
+       */
+      public boolean doAccessibleAction(int i)
+      {
+        String href = (String) element.getAttributes().getAttribute("href");
+        HTMLDocument doc = (HTMLDocument) getDocument();
+        try
+          {
+            URL url = new URL(doc.getBase(), href);
+            setPage(url);
+            String desc = doc.getText(element.getStartOffset(),
+                            element.getEndOffset() - element.getStartOffset());
+            HyperlinkEvent ev =
+              new HyperlinkEvent(JEditorPane.this,
+                                 HyperlinkEvent.EventType.ACTIVATED, url, desc,
+                                 element);
+            fireHyperlinkUpdate(ev);
+            return true;
+          }
+        catch (Exception ex)
+          {
+            return false;
+          }
+      }
+
+      /**
+       * Returns the description of the action at action index <code>i</code>.
+       * This method returns the text within the element associated with this
+       * link.
+       *
+       * @param i the action index
+       *
+       * @return the description of the action at action index <code>i</code>
+       */
+      public String getAccessibleActionDescription(int i)
+      {
+        HTMLDocument doc = (HTMLDocument) getDocument();
+        try
+          {
+            return doc.getText(element.getStartOffset(),
+                            element.getEndOffset() - element.getStartOffset());
+          }
+        catch (BadLocationException ex)
+          {
+            throw (AssertionError)
+            new AssertionError("BadLocationException must not be thrown "
+                               + "here.")
+              .initCause(ex);
+          }
+      }
+
+      /**
+       * Returns an {@link URL} object, that represents the action at action
+       * index <code>i</code>.
+       *
+       * @param i the action index
+       *
+       * @return an {@link URL} object, that represents the action at action
+       *         index <code>i</code>
+       */
+      public Object getAccessibleActionObject(int i)
+      {
+        String href = (String) element.getAttributes().getAttribute("href");
+        HTMLDocument doc = (HTMLDocument) getDocument();
+        try
+          {
+            URL url = new URL(doc.getBase(), href);
+            return url;
+          }
+        catch (MalformedURLException ex)
+          {
+            return null;
+          }
+      }
+
+      /**
+       * Returns an object that represents the link anchor. For examples, if
+       * the link encloses a string, then a <code>String</code> object is
+       * returned, if the link encloses an <img> tag, then an
+       * <code>ImageIcon</code> object is returned.
+       *
+       * @return an object that represents the link anchor
+       */
+      public Object getAccessibleActionAnchor(int i)
+      {
+        // TODO: This is only the String case. Implement all cases.
+        return getAccessibleActionDescription(i);
+      }
+
+      /**
+       * Returns the start index of the hyperlink element.
+       *
+       * @return the start index of the hyperlink element
+       */
+      public int getStartIndex()
+      {
+        return element.getStartOffset();
+      }
+
+      /**
+       * Returns the end index of the hyperlink element.
+       *
+       * @return the end index of the hyperlink element
+       */
+      public int getEndIndex()
+      {
+        return element.getEndOffset();
+      }
+      
+    }
+
+    /**
+     * Returns the number of hyperlinks in the document.
+     *
+     * @return the number of hyperlinks in the document
+     */
+    public int getLinkCount()
+    {
+      HTMLDocument doc = (HTMLDocument) getDocument();
+      HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+      int count = 0;
+      while (linkIter.isValid())
+        {
+          count++;
+          linkIter.next();
+        }
+      return count;
+    }
+
+    /**
+     * Returns the <code>i</code>-th hyperlink in the document or
+     * <code>null</code> if there is no hyperlink with the specified index.
+     *
+     * @param i the index of the hyperlink to return
+     *
+     * @return the <code>i</code>-th hyperlink in the document or
+     *         <code>null</code> if there is no hyperlink with the specified
+     *         index
+     */
+    public AccessibleHyperlink getLink(int i)
+    {
+      HTMLDocument doc = (HTMLDocument) getDocument();
+      HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+      int count = 0;
+      while (linkIter.isValid())
+        {
+          count++;
+          if (count == i)
+            break;
+          linkIter.next();
+        }
+      if (linkIter.isValid())
+        {
+          int offset = linkIter.getStartOffset();
+          // TODO: I fetch the element for the link via getCharacterElement().
+          // I am not sure that this is correct, maybe we must use
+          // getParagraphElement()?
+          Element el = doc.getCharacterElement(offset);
+          HTMLLink link = new HTMLLink(el);
+          return link;
+        }
+      else
+        return null;
+    }
+
+    /**
+     * Returns the index of the link element at the character position
+     * <code>c</code> within the document, or <code>-1</code> if there is no
+     * link at the specified position.
+     *
+     * @param c the character index from which to fetch the link index
+     *
+     * @return the index of the link element at the character position
+     *         <code>c</code> within the document, or <code>-1</code> if there
+     *         is no link at the specified position
+     */
+    public int getLinkIndex(int c)
+    {
+      HTMLDocument doc = (HTMLDocument) getDocument();
+      HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+      int count = 0;
+      while (linkIter.isValid())
+        {
+          if (linkIter.getStartOffset() <= c && linkIter.getEndOffset() > c)
+            break;
+          count++;
+          linkIter.next();
+        }
+      if (linkIter.isValid())
+        return count;
+      else
+        return -1;
+    }
+
+    /**
+     * Returns the link text of the link at index <code>i</code>, or
+     * <code>null</code>, if there is no link at the specified position.
+     *
+     * @param i the index of the link
+     *
+     * @return  the link text of the link at index <code>i</code>, or
+     *          <code>null</code>, if there is no link at the specified
+     *          position
+     */
+    public String getLinkText(int i)
+    {
+      HTMLDocument doc = (HTMLDocument) getDocument();
+      HTMLDocument.Iterator linkIter = doc.getIterator(HTML.Tag.A);
+      int count = 0;
+      while (linkIter.isValid())
+        {
+          count++;
+          if (count == i)
+            break;
+          linkIter.next();
+        }
+      if (linkIter.isValid())
+        {
+          int offset = linkIter.getStartOffset();
+          // TODO: I fetch the element for the link via getCharacterElement().
+          // I am not sure that this is correct, maybe we must use
+          // getParagraphElement()?
+          Element el = doc.getCharacterElement(offset);
+          try
+            {
+              String text = doc.getText(el.getStartOffset(),
+                                      el.getEndOffset() - el.getStartOffset());
+              return text;
+            }
+          catch (BadLocationException ex)
+            {
+              throw (AssertionError)
+                new AssertionError("BadLocationException must not be thrown "
+                                   + "here.")
+                  .initCause(ex);
+            }
+        }
+      else
+        return null;
+    }
+  }
+
+  /**
+   * An EditorKit used for plain text. This is the default editor kit for
+   * JEditorPanes.
+   *
+   * @author Roman Kennke (kennke at aicas.com)
+   */
+  private static class PlainEditorKit extends DefaultEditorKit
+  {
+
+    /**
+     * Returns a ViewFactory that supplies WrappedPlainViews.
+     */
+    public ViewFactory getViewFactory()
+    {
+      return new ViewFactory()
+      {
+        public View create(Element el)
+        {
+          return new WrappedPlainView(el);
+        }
+      };
+    }
+  }
+
+  private static final long serialVersionUID = 3140472492599046285L;
+  
+  private URL page;
+  private EditorKit editorKit;
+  
+  boolean focus_root;
+  
+  // A mapping between content types and registered EditorKit types
+  static HashMap registerMap;
+  
+  // A mapping between content types and used EditorKits
+  HashMap editorMap;  
+
+  public JEditorPane()
+  {
+    init();
+    setEditorKit(createDefaultEditorKit());
+  }
+
+  public JEditorPane(String url) throws IOException
+  {
+    this(new URL(url));
+  }
+
+  public JEditorPane(String type, String text)
+  {
+    init();
+    setEditorKit(createEditorKitForContentType(type));
+    setText(text);
+  }
+
+  public JEditorPane(URL url) throws IOException
+  {
+    init();
+    setEditorKit(createEditorKitForContentType("text/html"));;
+    setPage(url);
+  }
+  
+  /**
+   * Called by the constructors to set up the default bindings for content 
+   * types and EditorKits.
+   */
+  void init()
+  {
+    editorMap = new HashMap();
+    registerMap = new HashMap();
+    registerEditorKitForContentType("application/rtf",
+                                    "javax.swing.text.rtf.RTFEditorKit");
+    registerEditorKitForContentType("text/plain",
+                                    "javax.swing.JEditorPane$PlainEditorKit");
+    registerEditorKitForContentType("text/html",
+                                    "javax.swing.text.html.HTMLEditorKit");
+    registerEditorKitForContentType("text/rtf",
+                                    "javax.swing.text.rtf.RTFEditorKit");
+  }
+
+  protected EditorKit createDefaultEditorKit()
+  {
+    return new PlainEditorKit();
+  }
+
+  /**
+   * Creates and returns an EditorKit that is appropriate for the given 
+   * content type.  This is created using the default recognized types
+   * plus any EditorKit types that have been registered.
+   * 
+   * @see #registerEditorKitForContentType(String, String)
+   * @see #registerEditorKitForContentType(String, String, ClassLoader)
+   * @param type the content type
+   * @return an EditorKit for use with the given content type
+   */
+  public static EditorKit createEditorKitForContentType(String type)
+  {
+    // TODO: Have to handle the case where a ClassLoader was specified
+    // when the EditorKit was registered
+    EditorKit e = null;
+    String className = (String) registerMap.get(type);
+    if (className != null)
+      {
+        try
+        {
+          e = (EditorKit) Class.forName(className).newInstance();
+        }
+        catch (Exception e2)
+        {    
+          // TODO: Not sure what to do here.
+        }
+      }
+    return e;
+  }
+
+  /**
+   * Sends a given <code>HyperlinkEvent</code> to all registered listeners.
+   *
+   * @param event the event to send
+   */
+  public void fireHyperlinkUpdate(HyperlinkEvent event)
+  {
+    HyperlinkListener[] listeners = getHyperlinkListeners();
+
+    for (int index = 0; index < listeners.length; ++index)
+       listeners[index].hyperlinkUpdate(event);
+  }
+
+  /**
+   * Returns the accessible context associated with this editor pane.
+   *
+   * @return the accessible context associated with this editor pane
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    if (accessibleContext == null)
+      {
+        if (getEditorKit() instanceof HTMLEditorKit)
+          accessibleContext = new AccessibleJEditorPaneHTML();
+        else
+          accessibleContext = new AccessibleJEditorPane();
+      }
+    return accessibleContext;
+  }
+
+  public final String getContentType()
+  {
+    return getEditorKit().getContentType();
+  }
+
+  /**
+   * Returns the EditorKit. If there is no EditorKit set this method
+   * calls createDefaultEditorKit() and setEditorKit() first.
+   */
+  public EditorKit getEditorKit()
+  {
+    if (editorKit == null)
+      setEditorKit(createDefaultEditorKit());
+    return editorKit;
+  }
+
+  /**
+   * Returns the class name of the EditorKit associated with the given
+   * content type.
+   * 
+   * @since 1.3
+   * @param type the content type
+   * @return the class name of the EditorKit associated with this content type
+   */
+  public static String getEditorKitClassNameForContentType(String type)
+  {
+    return (String) registerMap.get(type);
+  }
+
+  /**
+   * Returns the EditorKit to use for the given content type.  If an
+   * EditorKit has been explicitly set via 
+   * <code>setEditorKitForContentType</code>
+   * then it will be returned.  Otherwise an attempt will be made to create
+   * an EditorKit from the default recognzied content types or any
+   * EditorKits that have been registered.  If none can be created, a
+   * PlainEditorKit is created.
+   * 
+   * @see #registerEditorKitForContentType(String, String)
+   * @see #registerEditorKitForContentType(String, String, ClassLoader)
+   * @param type the content type
+   * @return an appropriate EditorKit for the given content type
+   */
+  public EditorKit getEditorKitForContentType(String type)
+  {
+    // First check if an EditorKit has been explicitly set.
+    EditorKit e = (EditorKit) editorMap.get(type);
+    // Then check to see if we can create one.
+    if (e == null)
+      e = createEditorKitForContentType(type);
+    // Otherwise default to PlainEditorKit.
+    if (e == null)
+      e = new PlainEditorKit();
+    return e;
+  }
+
+  /**
+   * Returns the preferred size for the JEditorPane. This is implemented to
+   * return the super's preferred size, unless one of
+   * {@link #getScrollableTracksViewportHeight()} or
+   * {@link #getScrollableTracksViewportWidth()} returns <code>true</code>,
+   * in which case the preferred width and/or height is replaced by the UI's
+   * minimum size.
+   *
+   * @return the preferred size for the JEditorPane
+   */
+  public Dimension getPreferredSize()
+  {
+    Dimension pref = super.getPreferredSize();
+    if (getScrollableTracksViewportWidth())
+      pref.width = getUI().getMinimumSize(this).width;
+    if (getScrollableTracksViewportHeight())
+      pref.height = getUI().getMinimumSize(this).height;
+    return pref;
+  }
+
+  /**
+   * Returns <code>true</code> when a Viewport should force the height of
+   * this component to match the viewport height. This is implemented to return
+   * <code>true</code> when  the parent is an instance of JViewport and
+   * the viewport height > the UI's minimum height.
+   *
+   * @return <code>true</code> when a Viewport should force the height of
+   *         this component to match the viewport height
+   */
+  public boolean getScrollableTracksViewportHeight()
+  {
+    // Tests show that this returns true when the parent is a JViewport
+    // and has a height > minimum UI height.
+    Container parent = getParent();
+    return parent instanceof JViewport
+           && parent.getHeight() > getUI().getMinimumSize(this).height;
+  }
+
+  /**
+   * Returns <code>true</code> when a Viewport should force the width of
+   * this component to match the viewport width. This is implemented to return
+   * <code>true</code> when  the parent is an instance of JViewport and
+   * the viewport width > the UI's minimum width.
+   *
+   * @return <code>true</code> when a Viewport should force the width of
+   *         this component to match the viewport width
+   */
+  public boolean getScrollableTracksViewportWidth()
+  {
+    // Tests show that this returns true when the parent is a JViewport
+    // and has a width > minimum UI width.
+    Container parent = getParent();
+    return parent != null && parent instanceof JViewport
+           && parent.getWidth() > getUI().getMinimumSize(this).width;
+  }
+
+  public URL getPage()
+  {
+    return page;
+  }
+
+  protected InputStream getStream(URL page)
+    throws IOException
+  {
+    return page.openStream();
+  }
+
+  public String getText()
+  {
+    return super.getText();
+  }
+
+  public String getUIClassID()
+  {
+    return "EditorPaneUI";
+  }
+
+  public boolean isFocusCycleRoot()
+  {
+    return focus_root;
+  }
+
+  protected String paramString()
+  {
+    return "JEditorPane";
+  }
+
+  /**
+   * This method initializes from a stream. 
+   */
+  public void read(InputStream in, Object desc) throws IOException
+  {
+    EditorKit kit = getEditorKit();
+    if (kit instanceof HTMLEditorKit && desc instanceof HTMLDocument)
+      {
+        Document doc = (Document) desc;
+        try
+          {
+            kit.read(in, doc, 0);
+          }
+        catch (BadLocationException ex)
+          {
+            assert false : "BadLocationException must not be thrown here.";
+          }
+      }
+    else
+      {
+        Reader inRead = new InputStreamReader(in);
+        super.read(inRead, desc);
+      }
+  }
+
+  /**
+   * Establishes a binding between type and classname.  This enables
+   * us to create an EditorKit later for the given content type.
+   * 
+   * @param type the content type
+   * @param classname the name of the class that is associated with this 
+   * content type
+   */
+  public static void registerEditorKitForContentType(String type,
+                                                     String classname)
+  {
+    registerMap.put(type, classname);
+  }
+
+  /**
+   * Establishes the default bindings of type to classname.
+   */
+  public static void registerEditorKitForContentType(String type,
+                                                     String classname,
+                                                     ClassLoader loader)
+  {
+    // TODO: Implement this properly.
+  }
+
+  /**
+   * Replaces the currently selected content with new content represented
+   * by the given string.
+   */
+  public void replaceSelection(String content)
+  {
+    // TODO: Implement this properly.
+    super.replaceSelection(content);
+  }
+
+  /**
+   * Scrolls the view to the given reference location (that is, the value
+   * returned by the UL.getRef method for the URL being displayed).
+   */
+  public void scrollToReference(String reference)
+  {
+    // TODO: Implement this properly.
+  }
+
+  public final void setContentType(String type)
+  {
+    if (editorKit != null
+	&& editorKit.getContentType().equals(type))
+      return;
+    	      
+    EditorKit kit = getEditorKitForContentType(type);
+	    	
+    if (kit != null)
+      setEditorKit(kit);
+  }
+
+  public void setEditorKit(EditorKit newValue)
+  {
+    if (editorKit == newValue)
+      return;
+    	
+    if (editorKit != null)
+      editorKit.deinstall(this);
+	    	    
+    EditorKit oldValue = editorKit;
+    editorKit = newValue;
+			    	
+    if (editorKit != null)
+      {
+	editorKit.install(this);
+	setDocument(editorKit.createDefaultDocument());
+      }
+				    	    
+    firePropertyChange("editorKit", oldValue, newValue);
+    invalidate();
+    repaint();
+    // Reset the accessibleContext since this depends on the editorKit.
+    accessibleContext = null;
+  }
+
+  /**
+   * Explicitly sets an EditorKit to be used for the given content type.
+   * @param type the content type
+   * @param k the EditorKit to use for the given content type
+   */
+  public void setEditorKitForContentType(String type, EditorKit k)
+  {
+    editorMap.put(type, k);
+  }
+
+  /**
+   * Sets the current URL being displayed.  
+   */
+  public void setPage(String url) throws IOException
+  {
+    setPage(new URL(url));
+  }
+
+  /**
+   * Sets the current URL being displayed.  
+   */
+  public void setPage(URL page) throws IOException
+  {
+    if (page == null)
+      throw new IOException("invalid url");
+
+    try
+      {
+	this.page = page;
+	getEditorKit().read(page.openStream(), getDocument(), 0);
+      }
+    catch (BadLocationException e)
+      {
+	// Ignored. '0' is always a valid offset.
+      }
+  }
+
+  /**
+   * Sets the text of the JEditorPane.  The argument <code>t</code>
+   * is expected to be in the format of the current EditorKit.  This removes
+   * the content of the current document and uses the EditorKit to read in the
+   * new text.  This allows the EditorKit to handle the String rather than just
+   * inserting in plain text.
+   * 
+   * @param t the text to display in this JEditorPane
+   */
+  public void setText(String t)
+  {
+    try
+    {
+      // Remove the current content.
+      Document doc = getDocument();
+      doc.remove(0, doc.getLength());
+      if (t == null || t.equals(""))
+        return;
+      
+      // Let the EditorKit read the text into the Document.
+      getEditorKit().read(new StringReader(t), doc, 0);
+    }
+    catch (BadLocationException ble)
+    {
+      // TODO: Don't know what to do here.
+    }
+    catch (IOException ioe)
+    {
+      // TODO: Don't know what to do here.
+    }
+  }
+
+  /**
+   * Add a <code>HyperlinkListener</code> object to this editor pane.
+   *
+   * @param listener the listener to add
+   */
+  public void addHyperlinkListener(HyperlinkListener listener)
+  {
+    listenerList.add(HyperlinkListener.class, listener);
+  }
+
+  /**
+   * Removes a <code>HyperlinkListener</code> object to this editor pane.
+   *
+   * @param listener the listener to remove
+   */
+  public void removeHyperlinkListener(HyperlinkListener listener)
+  {
+    listenerList.remove(HyperlinkListener.class, listener);
+  }
+
+  /**
+   * Returns all added <code>HyperlinkListener</code> objects.
+   *
+   * @return array of listeners
+   *
+   * @since 1.4
+   */
+  public HyperlinkListener[] getHyperlinkListeners()
+  {
+    return (HyperlinkListener[]) getListeners(HyperlinkListener.class);
+  }
+}





More information about the llvm-commits mailing list