mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-24 13:39:38 +08:00
e0a339f785
* java/awt/BorderLayout.java (BorderLayout()): New constructor. * java/awt/Frame.java (Frame): Pass `null' to Window constructor. * java/awt/Window.java (addNotify): Wrote. (addWindowListener): Wrote. (getLocale): Wrote. (getWarningString): Wrote. (processEvent): Wrote. (processWindowEvent): Wrote. (removeWindowListener): Wrote. (show): Call validate(), setVisible(). (toBack): Wrote. (toFront): Wrote. * java/awt/Toolkit.java (createWindow): Declare. * java/awt/Frame.java (addNotify): Use getToolkit to find toolkit. * java/awt/Component.java (invalidate): Wrote. (isValid): Wrote. (getToolkit): Wrote. * java/awt/Container.java (addContainerListener): Removed unnecessary cast. (removeContainerListener): Likewise. (addImpl): Wrote. (add(Component)): Use it. (add(String,Component)): Likewise. (add(Component,int)): Likewise. (add(Component,Object)): Likewise. (add(Component,Object,int)): Likewise. (doLayout): Wrote. (getAlignmentX): Wrote. (getAlignmentY): Wrote. (getComponentAt): Wrote. (getMaximumSize): Wrote. (invalidate): Wrote. (list(PrintStream,int)): Wrote. (list(PrintWriter,int)): Wrote. (getMinimumSize): Wrote. (getPreferredSize): Wrote. (printComponents): Wrote. (processContainerEvent): Look at containerListener, not componentListener. (remove): Added event processing and peer destruction. (removeAll): Use remove. (removeNotify): Wrote. (validate): Wrote. (validateTree): Wrote. * java/awt/Scrollbar.java (addNotify): Do nothing if peer exists. * java/awt/Label.java (addNotify): Do nothing if peer exists. * java/awt/Container.java (addNotify): Don't create Container peer. * java/awt/Button.java (addNotify): Do nothing if peer exists. From-SVN: r35361
88 lines
1.7 KiB
Java
88 lines
1.7 KiB
Java
/* Copyright (C) 2000 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.peer.ComponentPeer;
|
|
import java.awt.peer.LabelPeer;
|
|
|
|
/**
|
|
* @author Tom Tromey <tromey@cygnus.com>
|
|
* @date April 12, 2000
|
|
*/
|
|
|
|
public class Label extends Component
|
|
{
|
|
public static final int CENTER = 1;
|
|
public static final int LEFT = 0;
|
|
public static final int RIGHT = 2;
|
|
|
|
public Label ()
|
|
{
|
|
this ("", LEFT);
|
|
}
|
|
|
|
public Label (String text)
|
|
{
|
|
this (text, LEFT);
|
|
}
|
|
|
|
public Label (String text, int alignment)
|
|
{
|
|
if (alignment != CENTER && alignment != LEFT && alignment != RIGHT)
|
|
throw new IllegalArgumentException ();
|
|
this.text = text;
|
|
this.alignment = alignment;
|
|
}
|
|
|
|
public void addNotify ()
|
|
{
|
|
if (peer == null)
|
|
peer = (ComponentPeer) getToolkit ().createLabel (this);
|
|
}
|
|
|
|
public int getAlignment ()
|
|
{
|
|
return alignment;
|
|
}
|
|
|
|
public String getText ()
|
|
{
|
|
return text;
|
|
}
|
|
|
|
protected String paramString ()
|
|
{
|
|
return "Label[" + alignment + "," + text + "]";
|
|
}
|
|
|
|
public void setAlignment (int alignment)
|
|
{
|
|
if (alignment != CENTER && alignment != LEFT && alignment != RIGHT)
|
|
throw new IllegalArgumentException ();
|
|
this.alignment = alignment;
|
|
if (peer != null)
|
|
{
|
|
LabelPeer lp = (LabelPeer) peer;
|
|
lp.setAlignment (alignment);
|
|
}
|
|
}
|
|
|
|
public void setText (String text)
|
|
{
|
|
this.text = text;
|
|
if (peer != null)
|
|
{
|
|
LabelPeer lp = (LabelPeer) peer;
|
|
lp.setText (text);
|
|
}
|
|
}
|
|
|
|
private String text;
|
|
private int alignment;
|
|
}
|