java.awt.Component (JDK 1.0)
Component is the superclass of all GUI components (except menu components) in the java.awt package. You may not instantiate a Component directly; you must use a subclass.
Component defines many methods. Some of these are intended to be implemented by subclasses. Some are used internally by the AWT. Some are to be implemented to handle events. And many are useful utility methods for working with GUI components. getParent() returns the Container that a Component is contained in. setBackground(), setForeground(), and setFont() set the specified display attributes of a component. hide(), show(), enable(), and disable() perform the specified actions for a component. createImage() creates an Image object from a specified ImageProducer, or creates an offscreen image that can be draw into and used for double-buffering during animation. Component also has quite a few deprecated methods as a result of the Java 1.1 event model and the introduction of the JavaBeans method naming conventions. The class defines quite a few methods for handling many types of events using the 1.0 model and the 1.1 model in both its high-level and low-level forms.
public abstract classComponentextends Object implements ImageObserver, MenuContainer, Serializable { //Protected Constructor1.1 protectedComponent(); //Constants1.1 public static final floatBOTTOM_ALIGNMENT; 1.1 public static final floatCENTER_ALIGNMENT; 1.1 public static final floatLEFT_ALIGNMENT; 1.1 public static final floatRIGHT_ALIGNMENT; 1.1 public static final floatTOP_ALIGNMENT; //Public Instance Methods# public booleanaction(Eventevt, Objectwhat); 1.1 public synchronized voidadd(PopupMenupopup); 1.1 public synchronized voidaddComponentListener(ComponentListenerl); 1.1 public synchronized voidaddFocusListener(FocusListenerl); 1.1 public synchronized voidaddKeyListener(KeyListenerl); 1.1 public synchronized voidaddMouseListener(MouseListenerl); 1.1 public synchronized voidaddMouseMotionListener(MouseMotionListenerl); public voidaddNotify(); # public Rectanglebounds(); public intcheckImage(Imageimage, ImageObserverobserver); public intcheckImage(Imageimage, intwidth, intheight, ImageObserverobserver); 1.1 public booleancontains(intx, inty); 1.1 public booleancontains(Pointp); public ImagecreateImage(ImageProducerproducer); public ImagecreateImage(intwidth, intheight); # public voiddeliverEvent(Evente); # public voiddisable(); 1.1 public final voiddispatchEvent(AWTEvente); 1.1 public voiddoLayout(); # public voidenable(); # public voidenable(booleanb); 1.1 public floatgetAlignmentX(); 1.1 public floatgetAlignmentY(); public ColorgetBackground(); 1.1 public RectanglegetBounds(); public ColorModelgetColorModel(); 1.1 public ComponentgetComponentAt(intx, inty); 1.1 public ComponentgetComponentAt(Pointp); 1.1 public CursorgetCursor(); public FontgetFont(); //From MenuContainerpublic FontMetricsgetFontMetrics(Fontfont); public ColorgetForeground(); public GraphicsgetGraphics(); 1.1 public LocalegetLocale(); 1.1 public PointgetLocation(); 1.1 public PointgetLocationOnScreen(); 1.1 public DimensiongetMaximumSize(); 1.1 public DimensiongetMinimumSize(); 1.1 public StringgetName(); public ContainergetParent(); # public ComponentPeergetPeer(); 1.1 public DimensiongetPreferredSize(); 1.1 public DimensiongetSize(); public ToolkitgetToolkit(); 1.1 public final ObjectgetTreeLock(); # public booleangotFocus(Eventevt, Objectwhat); # public booleanhandleEvent(Eventevt); # public voidhide(); public booleanimageUpdate(Imageimg, intflags, intx, inty, intw, inth); //From ImageObserver# public booleaninside(intx, inty); public voidinvalidate(); public booleanisEnabled(); 1.1 public booleanisFocusTraversable(); public booleanisShowing(); public booleanisValid(); public booleanisVisible(); # public booleankeyDown(Eventevt, intkey); # public booleankeyUp(Eventevt, intkey); # public voidlayout(); public voidlist(); public voidlist(PrintStreamout); public voidlist(PrintStreamout, intindent); 1.1 public voidlist(PrintWriterout); 1.1 public voidlist(PrintWriterout, intindent); # public Componentlocate(intx, inty); # public Pointlocation(); # public booleanlostFocus(Eventevt, Objectwhat); # public DimensionminimumSize(); # public booleanmouseDown(Eventevt, intx, inty); # public booleanmouseDrag(Eventevt, intx, inty); # public booleanmouseEnter(Eventevt, intx, inty); # public booleanmouseExit(Eventevt, intx, inty); # public booleanmouseMove(Eventevt, intx, inty); # public booleanmouseUp(Eventevt, intx, inty); # public voidmove(intx, inty); # public voidnextFocus(); public voidpaint(Graphicsg); public voidpaintAll(Graphicsg); # public booleanpostEvent(Evente); //From MenuContainer# public DimensionpreferredSize(); public booleanprepareImage(Imageimage, ImageObserverobserver); public booleanprepareImage(Imageimage, intwidth, intheight, ImageObserverobserver); public voidg); public voidprintAll(Graphicsg); 1.1 public synchronized voidremove(MenuComponentpopup); //From MenuContainer1.1 public synchronized voidremoveComponentListener(ComponentListenerl); 1.1 public synchronized voidremoveFocusListener(FocusListenerl); 1.1 public synchronized voidremoveKeyListener(KeyListenerl); 1.1 public synchronized voidremoveMouseListener(MouseListenerl); 1.1 public synchronized voidremoveMouseMotionListener(MouseMotionListenerl); public voidremoveNotify(); public voidrepaint(); public voidrepaint(longtm); public voidrepaint(intx, inty, intwidth, intheight); public voidrepaint(longtm, intx, inty, intwidth, intheight); public voidrequestFocus(); # public voidreshape(intx, inty, intwidth, intheight); # public voidresize(intwidth, intheight); # public voidresize(Dimensiond); public voidsetBackground(Colorc); 1.1 public voidsetBounds(intx, inty, intwidth, intheight); 1.1 public voidsetBounds(Rectangler); 1.1 public synchronized voidsetCursor(Cursorcursor); 1.1 public voidsetEnabled(booleanb); public synchronized voidsetFont(Fontf); public voidsetForeground(Colorc); 1.1 public voidsetLocale(Localel); 1.1 public voidsetLocation(intx, inty); 1.1 public voidsetLocation(Pointp); 1.1 public voidsetName(Stringname); 1.1 public voidsetSize(intwidth, intheight); 1.1 public voidsetSize(Dimensiond); 1.1 public voidsetVisible(booleanb); # public voidshow(); # public voidshow(booleanb); # public Dimensionsize(); public StringtoString(); //Overrides Object1.1 public voidtransferFocus(); public voidupdate(Graphicsg); public voidvalidate(); //Protected Instance Methods1.1 protected final voiddisableEvents(longeventsToDisable); 1.1 protected final voidenableEvents(longeventsToEnable); protected StringparamString(); 1.1 protected voidprocessComponentEvent(ComponentEvente); 1.1 protected voidprocessEvent(AWTEvente); 1.1 protected voidprocessFocusEvent(FocusEvente); 1.1 protected voidprocessKeyEvent(KeyEvente); 1.1 protected voidprocessMouseEvent(MouseEvente); 1.1 protected voidprocessMouseMotionEvent(MouseEvente); }
Extended By:
Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, TextComponent
Passed To:
BorderLayout.addLayoutComponent(), BorderLayout.removeLayoutComponent(), CardLayout.addLayoutComponent(), CardLayout.removeLayoutComponent(), ComponentEvent(), Container.add(), Container.addImpl(), Container.isAncestorOf(), Container.remove(), ContainerEvent(), FlowLayout.addLayoutComponent(), FlowLayout.removeLayoutComponent(), FocusEvent(), GridBagLayout.addLayoutComponent(), GridBagLayout.getConstraints(), GridBagLayout.lookupConstraints(), GridBagLayout.removeLayoutComponent(), GridBagLayout.setConstraints(), GridLayout.addLayoutComponent(), GridLayout.removeLayoutComponent(), KeyEvent(), LayoutManager.addLayoutComponent(), LayoutManager.removeLayoutComponent(), LayoutManager2.addLayoutComponent(), MediaTracker(), MouseEvent(), PaintEvent(), PopupMenu.show(), ScrollPane.addImpl(), Toolkit.createComponent(), Toolkit.getNativeContainer()
Returned By:
Component.getComponentAt(), Component.locate(), ComponentEvent.getComponent(), Container.add(), Container.getComponent(), Container.getComponentAt(), Container.getComponents(), Container.locate(), ContainerEvent.getChild(), PropertyEditor.getCustomEditor(), PropertyEditorSupport.getCustomEditor(), Window.getFocusOwner()