aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-03-17 15:20:10 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-03-17 15:20:10 +0000
commit2ff04cc63aa8b683dd17f029e7579280ecd8f9c8 (patch)
treec6337dc64052b39b5098596e7d1904d54ccdddd7 /libjava
parent94833648ca3360caeee3cce775ff410468d43559 (diff)
downloadgcc-2ff04cc63aa8b683dd17f029e7579280ecd8f9c8.zip
gcc-2ff04cc63aa8b683dd17f029e7579280ecd8f9c8.tar.gz
gcc-2ff04cc63aa8b683dd17f029e7579280ecd8f9c8.tar.bz2
2003-03-17 Michael Koch <konqueror@gmx.de>
* java/awt/Dialog.java (Dialog): New constructor, changed implementations, added documentation. * java/awt/ScrollPaneAdjustable.java (ScrollPaneAdjustable): Extends Object, implements Adjustable and Serializable. (serialVersionUID): New member variable. (sp): New member variable. (orientation): New member variable. (value): New member variable. (minimum): New member variable. (maximum): New member variable. (visibleAmount): New member variable. (unitIncrement): New member variable. (blockIncrement): New member variable. (AdjustmentListener): New member variable. (ScrollPaneAdjustable): New implementation. (addAdjustmentListener): New method. (removeAdjustmentListener): New method. (getAdjustmentListeners): New method. (getBlockIncrement): New method. (getMaximum): New method. (getMinimum): New method. (getOrientation): New method. (getUnitIncrement): New method. (getValue): New method. (getVisibleAmount): New method. (setBlockIncrement): New method. (setMaximum): Implemented. (setMinimum): Implemented. (setUnitIncrement): New method. (setValue): New method. (setVisibleAmount): Implemented. (paramString): New stubbed method. * java/awt/Window.java (show): Call setVisible(). (hide): Call setVisible(). (processEvent): Add cases for WINDOW_GAINED_FOCUS, WINDOW_LOST_FOCUS and WINDOW_STATE_CHANGED. (processWindowFocusEvent): New method. (processWindowStateEvent): New method. (postEvent): Deprecated. (applyResourceBundle): Deprecated. * java/awt/datatransfer/DataFlavor.java (DataFlavor): Doesn't thow ClassNotFoundException. From-SVN: r64485
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog48
-rw-r--r--libjava/java/awt/Dialog.java63
-rw-r--r--libjava/java/awt/ScrollPaneAdjustable.java112
-rw-r--r--libjava/java/awt/Window.java55
-rw-r--r--libjava/java/awt/datatransfer/DataFlavor.java4
5 files changed, 269 insertions, 13 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 69deac8..f08f4f8 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,51 @@
+2003-03-17 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/Dialog.java
+ (Dialog): New constructor, changed implementations, added
+ documentation.
+ * java/awt/ScrollPaneAdjustable.java
+ (ScrollPaneAdjustable): Extends Object, implements Adjustable and
+ Serializable.
+ (serialVersionUID): New member variable.
+ (sp): New member variable.
+ (orientation): New member variable.
+ (value): New member variable.
+ (minimum): New member variable.
+ (maximum): New member variable.
+ (visibleAmount): New member variable.
+ (unitIncrement): New member variable.
+ (blockIncrement): New member variable.
+ (AdjustmentListener): New member variable.
+ (ScrollPaneAdjustable): New implementation.
+ (addAdjustmentListener): New method.
+ (removeAdjustmentListener): New method.
+ (getAdjustmentListeners): New method.
+ (getBlockIncrement): New method.
+ (getMaximum): New method.
+ (getMinimum): New method.
+ (getOrientation): New method.
+ (getUnitIncrement): New method.
+ (getValue): New method.
+ (getVisibleAmount): New method.
+ (setBlockIncrement): New method.
+ (setMaximum): Implemented.
+ (setMinimum): Implemented.
+ (setUnitIncrement): New method.
+ (setValue): New method.
+ (setVisibleAmount): Implemented.
+ (paramString): New stubbed method.
+ * java/awt/Window.java
+ (show): Call setVisible().
+ (hide): Call setVisible().
+ (processEvent): Add cases for WINDOW_GAINED_FOCUS, WINDOW_LOST_FOCUS
+ and WINDOW_STATE_CHANGED.
+ (processWindowFocusEvent): New method.
+ (processWindowStateEvent): New method.
+ (postEvent): Deprecated.
+ (applyResourceBundle): Deprecated.
+ * java/awt/datatransfer/DataFlavor.java
+ (DataFlavor): Doesn't thow ClassNotFoundException.
+
2003-03-17 Michael Koch
* javax/print/attribute/Attribute.java,
diff --git a/libjava/java/awt/Dialog.java b/libjava/java/awt/Dialog.java
index 9aa2ea6..e7c40b1 100644
--- a/libjava/java/awt/Dialog.java
+++ b/libjava/java/awt/Dialog.java
@@ -153,11 +153,37 @@ Dialog(Frame parent, String title)
* @param title The title string for this dialog box.
* @param modal <true> if this dialog box is modal, <code>false</code>
* otherwise.
+ *
+ * @exception IllegalArgumentException If owner is null or
+ * GraphicsEnvironment.isHeadless() returns true.
*/
public
Dialog(Frame parent, String title, boolean modal)
{
- super(parent);
+ this (parent, title, modal, parent.getGraphicsConfiguration ());
+}
+
+/**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, title, modality and <code>GraphicsConfiguration</code>,
+ * that is not resizable.
+ *
+ * @param parent The parent frame of this dialog box.
+ * @param title The title string for this dialog box.
+ * @param modal <true> if this dialog box is modal, <code>false</code>
+ * otherwise.
+ * @param gc The <code>GraphicsConfiguration</code> object to use.
+ *
+ * @exception IllegalArgumentException If owner is null, the
+ * GraphicsConfiguration is not a screen device or
+ * GraphicsEnvironment.isHeadless() returns true.
+ *
+ * @since 1.4
+ */
+public
+Dialog (Frame parent, String title, boolean modal, GraphicsConfiguration gc)
+{
+ super (parent, gc);
this.title = title;
this.modal = modal;
@@ -166,10 +192,19 @@ Dialog(Frame parent, String title, boolean modal)
setLayout(new BorderLayout());
}
+/**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, that is not resizable.
+ *
+ * @exception IllegalArgumentException If parent is null. This exception is
+ * always thrown when GraphicsEnvironment.isHeadless() returns true.
+ *
+ * @since 1.2
+ */
public
Dialog (Dialog owner)
{
- this (owner, "", false);
+ this (owner, "", false, owner.getGraphicsConfiguration ());
}
/**
@@ -184,7 +219,7 @@ Dialog (Dialog owner)
public
Dialog (Dialog owner, String title)
{
- this (owner, title, false);
+ this (owner, title, false, owner.getGraphicsConfiguration ());
}
/**
@@ -199,9 +234,29 @@ Dialog (Dialog owner, String title)
public
Dialog (Dialog owner, String title, boolean modal)
{
- super (owner);
+ this (owner, title, modal, owner.getGraphicsConfiguration ());
+}
+
+/**
+ * Initializes a new instance of <code>Dialog</code> with the specified,
+ * parent, title, modality and <code>GraphicsConfiguration</code>,
+ * that is not resizable.
+ *
+ * @exception IllegalArgumentException If parent is null, the
+ * GraphicsConfiguration is not a screen device or
+ * GraphicsEnvironment.isHeadless() returns true.
+ *
+ * @since 1.4
+ */
+public
+Dialog (Dialog parent, String title, boolean modal, GraphicsConfiguration gc)
+{
+ super (parent, parent.getGraphicsConfiguration ());
+
this.modal = modal;
this.title = title;
+ resizable = false;
+
setLayout (new BorderLayout ());
}
diff --git a/libjava/java/awt/ScrollPaneAdjustable.java b/libjava/java/awt/ScrollPaneAdjustable.java
index 152f4d6..18b7748 100644
--- a/libjava/java/awt/ScrollPaneAdjustable.java
+++ b/libjava/java/awt/ScrollPaneAdjustable.java
@@ -38,29 +38,135 @@ exception statement from your version. */
package java.awt;
+import java.awt.event.AdjustmentListener;
+import java.io.Serializable;
+
/**
* Need this class since the serialization spec for ScrollPane
* uses it.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
+ * @since 1.4
*/
-class ScrollPaneAdjustable extends Scrollbar
+public class ScrollPaneAdjustable
+ implements Adjustable, Serializable
{
- public ScrollPaneAdjustable (int orientation)
+ private static final long serialVersionUID = -3359745691033257079L;
+
+ ScrollPane sp;
+ int orientation;
+ int value;
+ int minimum;
+ int maximum;
+ int visibleAmount;
+ int unitIncrement;
+ int blockIncrement;
+ AdjustmentListener adjustmentListener;
+
+ ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum,
+ int maximum, in visibleAmount, int unitIncrement,
+ int blockIncrement)
+ {
+ this.sp = sp;
+ this.orientation = orientation;
+ this.value = value;
+ this.minimum = minimum;
+ this.maximum = maximum;
+ this.visibleAmount = visibleAmount;
+ this.unitIncrement = Increment;
+ this.blockIncrement = Increment;
+ }
+
+ public void addAdjustmentListener (AdjustmentListener listener)
+ {
+ AWTEventMulticaster.add (adjustmentListener, listener);
+ }
+
+ public void removeAdjustmentListener (AdjustmentListener listener)
+ {
+ AWTEventMulticaster.remove (adjustmentListener, listener);
+ }
+
+ public AdjustmentListener[] getAdjustmentListeners ()
+ {
+ return (AdjustmentListener) AWTEventMulticaster.getListeners (AdjustmentListener.class);
+ }
+
+ public int getBlockIncrement ()
+ {
+ return blockIncrement;
+ }
+
+ public int getMaximum ()
+ {
+ return maximum;
+ }
+
+ public int getMinimum ()
+ {
+ return minimum;
+ }
+
+ public int getOrientation ()
+ {
+ return orientation;
+ }
+
+ public int getUnitIncrement ()
+ {
+ return unitIncrement;
+ }
+
+ public int getValue ()
+ {
+ return value;
+ }
+
+ public int getVisibleAmount ()
{
- super (orientation);
+ return visibleAmount;
}
+ public void setBlockIncrement (int blockIncrement)
+ {
+ this.blockIncrement = blockIncrement;
+ }
+
public void setMaximum (int maximum)
{
+ this.maximum = maximum;
}
public void setMinimum (int minimum)
{
+ this.minimum = minimum;
+ }
+
+ public void setUnitIncrement (int unitIncrement)
+ {
+ this.unitIncrement = unitIncrement;
}
+ public void setValue (int value)
+ {
+ this.value = value;
+
+ if (value < minimum)
+ minimum = value;
+
+ if (value > maximum)
+ maximum = value;
+ }
+
public void setVisibleAmount (int visibleAmount)
{
+ this.visibleAmount = visibleAmount;
}
+
+ public String paramString ()
+ {
+ throw new Error ("not implemented");
+ }
+
} // class ScrollPaneAdjustable
diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java
index e98c5ed..80c4759 100644
--- a/libjava/java/awt/Window.java
+++ b/libjava/java/awt/Window.java
@@ -213,14 +213,14 @@ public class Window extends Container
addNotify();
validate();
- super.show();
+ setVisible (true);
toFront();
}
public void hide()
{
// FIXME: call hide() on any "owned" children here.
- super.hide();
+ setVisible (false);
}
public boolean isDisplayable()
@@ -526,6 +526,13 @@ public class Window extends Container
case WindowEvent.WINDOW_OPENED:
windowListener.windowOpened(evt);
break;
+ case WindowEvent.WINDOW_GAINED_FOCUS:
+ case WindowEvent.WINDOW_LOST_FOCUS:
+ processWindowFocusEvent (evt);
+ break;
+ case WindowEvent.WINDOW_STATE_CHANGED:
+ processWindowStateEvent (evt);
+ break;
}
}
}
@@ -548,6 +555,8 @@ public class Window extends Container
* Post a Java 1.0 event to the event queue.
*
* @param event The event to post.
+ *
+ * @deprecated
*/
public boolean postEvent(Event e)
{
@@ -566,13 +575,21 @@ public class Window extends Container
return super.isShowing();
}
- /** @since 1.2 */
+ /**
+ * @since 1.2
+ *
+ * @deprecated
+ */
public void applyResourceBundle(ResourceBundle rb)
{
// FIXME
}
- /** @since 1.2 */
+ /**
+ * @since 1.2
+ *
+ * @deprecated
+ */
public void applyResourceBundle(String rbName)
{
ResourceBundle rb = ResourceBundle.getBundle(rbName);
@@ -598,4 +615,34 @@ public class Window extends Container
if (peer != null) return peer.getGraphicsConfiguration();
return null;
}
+
+ protected void processWindowFocusEvent(WindowEvent event)
+ {
+ if (windowFocusListener != null)
+ {
+ switch (event.getID ())
+ {
+ case WindowEvent.WINDOW_GAINED_FOCUS:
+ windowFocusListener.windowGainedFocus (event);
+ break;
+
+ case WindowEvent.WINDOW_LOST_FOCUS:
+ windowFocusListener.windowLostFocus (event);
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+ /**
+ * @since 1.4
+ */
+ protected void processWindowStateEvent(WindowEvent event)
+ {
+ if (windowStateListener != null
+ && event.getID () == WindowEvent.WINDOW_STATE_CHANGED)
+ windowStateListener.windowStateChanged (event);
+ }
}
diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java
index 51b610b..2603b6e 100644
--- a/libjava/java/awt/datatransfer/DataFlavor.java
+++ b/libjava/java/awt/datatransfer/DataFlavor.java
@@ -49,6 +49,7 @@ import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
+import java.nio.charset.Charset;
/**
* This class represents a particular data format used for transferring
@@ -335,9 +336,8 @@ getRepresentationClassFromMime(String mimeString, ClassLoader classLoader)
*/
public
DataFlavor(String mimeType, String humanPresentableName)
- throws ClassNotFoundException
{
- this(mimeType, humanPresentableName, null);
+ this (getRepresentationClassFromMime (mimeType, null), humanPresentableName);
}
/*************************************************************************/