mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-22 11:49:40 +08:00
760903c056
* Makefile.in: Rebuilt. * Makefile.am (awt_java_source_files): Added Line2D.java. * java/awt/geom/Line2D.java: Wrote. * java/awt/Menu.java (addNotify): Wrote. * java/awt/PopupMenu.java (addNotify): Implemented. (show): Likewise. * java/awt/Scrollbar.java (addNotify): Call super.addNotify. * java/awt/List.java (addNotify): Call super.addNotify. * java/awt/Label.java (addNotify): Call super.addNotify. * java/awt/FileDialog.java (addNotify): Call super.addNotify. * java/awt/Dialog.java (addNotify): Call super.addNotify. * java/awt/Choice.java (addNotify): Call super.addNotify. * java/awt/CheckboxMenuItem.java (addNotify): Call super.addNotify. * java/awt/Checkbox.java (addNotify): Call super.addNotify. * java/awt/List.java (replaceItem): Notify peer. * java/awt/geom/Rectangle2D.java (Float.setRect(float,float,float,float)): New method. * java/awt/event/ContainerEvent.java (getContainer): Now returns Container. * java/awt/RenderingHints.java (Key): Class now public. * java/awt/Rectangle.java (Rectangle): Now implements Serializable. (getPathIterator): Removed. * java/awt/GraphicsConfiguration.java (GraphicsConfiguration): New constructor. * java/awt/FileDialog.java: Wrote. * java/awt/EventQueue.java (isDispatchThread): Now public. (invokeLater): Likewise. * java/awt/Component.java (setCursor): Update peer. (getFontMetrics): Use peer. * java/awt/ComponentOrientation.java (ComponentOrientation): Class now final. From-SVN: r41489
236 lines
4.4 KiB
Java
236 lines
4.4 KiB
Java
/* Copyright (C) 2000, 2001 Free Software Foundation
|
|
|
|
This file is part of libjava.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
|
details. */
|
|
|
|
package java.awt;
|
|
import java.awt.event.*;
|
|
import java.awt.peer.ScrollbarPeer;
|
|
import java.awt.peer.ComponentPeer;
|
|
|
|
/**
|
|
* @author Tom Tromey <tromey@cygnus.com>
|
|
* @date April 12, 2000
|
|
*/
|
|
|
|
public class Scrollbar extends Component implements Adjustable
|
|
{
|
|
public Scrollbar ()
|
|
{
|
|
this (VERTICAL, 0, 10, 0, 100);
|
|
}
|
|
|
|
public Scrollbar (int orientation)
|
|
{
|
|
this (orientation, 0, 10, 0, 100);
|
|
}
|
|
|
|
public Scrollbar (int orientation, int value, int visible,
|
|
int minimum, int maximum)
|
|
{
|
|
if (orientation != HORIZONTAL && orientation != VERTICAL)
|
|
throw new IllegalArgumentException ();
|
|
|
|
if (maximum < minimum)
|
|
maximum = minimum;
|
|
if (value < minimum)
|
|
value = minimum;
|
|
if (value > maximum)
|
|
value = maximum;
|
|
|
|
this.orientation = orientation;
|
|
this.value = value;
|
|
this.visible = visible;
|
|
this.minimum = minimum;
|
|
this.maximum = maximum;
|
|
this.unit = 1;
|
|
|
|
this.block = 0; // FIXME
|
|
}
|
|
|
|
public void addNotify ()
|
|
{
|
|
if (peer == null)
|
|
peer = getToolkit ().createScrollbar (this);
|
|
super.addNotify ();
|
|
}
|
|
|
|
public int getOrientation ()
|
|
{
|
|
return orientation;
|
|
}
|
|
|
|
public void setOrientation (int orientation)
|
|
{
|
|
if (orientation != HORIZONTAL && orientation != VERTICAL)
|
|
throw new IllegalArgumentException ();
|
|
this.orientation = orientation;
|
|
}
|
|
|
|
public int getValue ()
|
|
{
|
|
return value;
|
|
}
|
|
|
|
public void setValue (int value)
|
|
{
|
|
setValues (value, visible, minimum, maximum);
|
|
}
|
|
|
|
public int getMinimum ()
|
|
{
|
|
return minimum;
|
|
}
|
|
|
|
public void setMinimum (int minimum)
|
|
{
|
|
setValues (value, visible, minimum, maximum);
|
|
}
|
|
|
|
public int getMaximum ()
|
|
{
|
|
return maximum;
|
|
}
|
|
|
|
public void setMaximum (int maximum)
|
|
{
|
|
setValues (value, visible, minimum, maximum);
|
|
}
|
|
|
|
public int getVisibleAmount ()
|
|
{
|
|
return visible;
|
|
}
|
|
|
|
public int getVisible ()
|
|
{
|
|
return visible;
|
|
}
|
|
|
|
public void setVisibleAmount (int visible)
|
|
{
|
|
setValues (value, visible, minimum, maximum);
|
|
}
|
|
|
|
public void setUnitIncrement (int v)
|
|
{
|
|
unit = v;
|
|
if (peer != null)
|
|
{
|
|
ScrollbarPeer sp = (ScrollbarPeer) peer;
|
|
sp.setLineIncrement (v);
|
|
}
|
|
}
|
|
|
|
/** @deprecated */
|
|
public void setLineIncrement (int v)
|
|
{
|
|
setUnitIncrement (v);
|
|
}
|
|
|
|
public int getUnitIncrement ()
|
|
{
|
|
return unit;
|
|
}
|
|
|
|
public int getLineIncrement ()
|
|
{
|
|
return unit;
|
|
}
|
|
|
|
public void setBlockIncrement (int v)
|
|
{
|
|
block = v;
|
|
if (peer != null)
|
|
{
|
|
ScrollbarPeer sp = (ScrollbarPeer) peer;
|
|
sp.setPageIncrement (v);
|
|
}
|
|
}
|
|
|
|
public void setPageIncrement (int v)
|
|
{
|
|
setBlockIncrement (v);
|
|
}
|
|
|
|
public int getBlockIncrement ()
|
|
{
|
|
return block;
|
|
}
|
|
|
|
public int getPageIncrement ()
|
|
{
|
|
return block;
|
|
}
|
|
|
|
public synchronized void setValues (int value, int visible,
|
|
int minimum, int maximum)
|
|
{
|
|
if (maximum < minimum)
|
|
maximum = minimum;
|
|
if (value < minimum)
|
|
value = minimum;
|
|
if (value > maximum)
|
|
value = maximum;
|
|
|
|
this.value = value;
|
|
this.visible = visible;
|
|
this.minimum = minimum;
|
|
this.maximum = maximum;
|
|
|
|
if (peer != null)
|
|
{
|
|
ScrollbarPeer sp = (ScrollbarPeer) peer;
|
|
sp.setValues (value, visible, minimum, maximum);
|
|
}
|
|
}
|
|
|
|
public void addAdjustmentListener (AdjustmentListener l)
|
|
{
|
|
listeners = AWTEventMulticaster.add (listeners, l);
|
|
}
|
|
|
|
public void removeAdjustmentListener (AdjustmentListener l)
|
|
{
|
|
listeners = AWTEventMulticaster.remove (listeners, l);
|
|
}
|
|
|
|
protected void processEvent (AWTEvent e)
|
|
{
|
|
if (e instanceof AdjustmentEvent)
|
|
processAdjustmentEvent ((AdjustmentEvent) e);
|
|
else
|
|
super.processEvent (e);
|
|
}
|
|
|
|
protected void processAdjustmentEvent (AdjustmentEvent e)
|
|
{
|
|
if (listeners != null)
|
|
listeners.adjustmentValueChanged (e);
|
|
}
|
|
|
|
protected String paramString ()
|
|
{
|
|
return ("Scrollbar["
|
|
+ ((orientation == VERTICAL) ? "VERTICAL" : "HORIZONTAL") + ","
|
|
+ value + ","
|
|
+ visible + ","
|
|
+ minimum + ","
|
|
+ maximum + ","
|
|
+ unit + ","
|
|
+ block + "]");
|
|
}
|
|
|
|
private AdjustmentListener listeners;
|
|
private int orientation;
|
|
private int value;
|
|
private int visible;
|
|
private int minimum;
|
|
private int maximum;
|
|
private int unit;
|
|
private int block;
|
|
}
|