135-138.html

来自「dshfghfhhgsfgfghfhfghgfhfghfgh fg hfg hh」· HTML 代码 · 共 166 行

HTML
166
字号
<HTML>
<HEAD>
<META name=vsisbn content="1558515682"><META name=vstitle content="Java Digital Signal Processing"><META name=vsauthor content="Douglas A. Lyon"><META name=vsimprint content="M&T Books"><META name=vspublisher content="IDG Books Worldwide, Inc."><META name=vspubdate content="11/01/97"><META name=vscategory content="Web and Software Development: Programming, Scripting, and Markup Languages: Java"><TITLE>Java Digital Signal Processing:The Graphical User Interface</TITLE>
<!-- HEADER --><STYLE type="text/css">  <!-- A:hover  { 	color : Red; } --></STYLE><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<!--ISBN=1558515682//-->
<!--TITLE=Java Digital Signal Processing//-->
<!--AUTHOR=Douglas A. Lyon//-->
<!--PUBLISHER=IDG Books Worldwide, Inc.//-->
<!--IMPRINT=M & T Books//-->
<!--CHAPTER=3//-->
<!--PAGES=135-138//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->

<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="131-135.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="138-142.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H3><A NAME="Heading25"></A><FONT COLOR="#000077">The Component Class</FONT></H3>
<P>The <I>Component</I> class is an abstract class. Subclasses of components are used to make instances that can be displayed on the screen. Examples of such component subclasses include <I>Button</I>, <I>Canvas</I>, <I>Checkbox</I>, <I>Choice</I>, <I>Container</I>, <I>Label</I>, <I>List</I>, <I>Scrollbar</I>, and <I>TextComponent</I>. Figure 3.7 shows the <I>Component</I> hierarchy</P>
<P><A NAME="Fig7"></A><A HREF="javascript:displayWindow('images/03-07.jpg',497,213 )"><IMG SRC="images/03-07t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/03-07.jpg',497,213)"><FONT COLOR="#000077"><B>Figure 3.7</B></FONT></A>&nbsp;&nbsp;Component hierarchy.</P>
<P>The <I>Component</I> class resides in the <I>java.awt</I> package and implements the <I>ImageObserver</I> interface. A <I>Component</I> instance supports services that include drawing, event handling, font control, color control, image handling, and size and position control. These services are provided by a series of methods and instance variables.</P>
<P>A suite of methods is available that supports event handling: <I>handleEvent, mouseEnter, mouseExit, mouseMove, mouseDown, mouseDrag, mouseUp, keyDown,</I> and <I>action</I>. The <I>Component</I> class provides a mechanism for invoking the specialized event handlers. This mechanism is based on a <I>switch</I> statement that calls methods that are to be implemented by subclasses. The methods are implemented in the <I>Component.java</I> class by returning false, signaling that the event was not processed.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR>Some components are used for input, others for output, and still others for both input and output. In a later section we will see an example of a button component that is used only as an input. We will also see an example of a label component, that serves only as an output and a scrollbar component that can serve as both an input and an outputcComponent.<HR></FONT>
</BLOCKQUOTE>
<H4 ALIGN="LEFT"><A NAME="Heading26"></A><FONT COLOR="#000077">Class Summary</FONT></H4>
<!-- CODE //-->
<PRE>
public abstract class Component implements ImageObserver &#123;
public Container getParent()
public ComponentPeer getPeer()
public Toolkit getToolkit()
public boolean isValid()
public boolean isVisible()
public boolean isShowing()
public boolean isEnabled()
public Point location()
public Dimension size()
public Rectangle bounds()
public synchronized void enable()
public void enable(boolean cond)
public synchronized void disable()
public synchronized void show()
public void show(boolean cond)
public synchronized void hide()
public Color getForeground()
public synchronized void setForeground(Color c)
public Color getBackground()
public synchronized void setBackground(Color c)
public Font getFont()
public synchronized void setFont(Font f)
public synchronized ColorModel getColorModel()
public void move(int x, int y)
public void resize(int width, int height)
public void resize(Dimension d)
public synchronized void reshape(int x, int y, int width, int height)
public Dimension preferredSize()
public Dimension minimumSize()
public void layout()
public void validate()
public void invalidate()
public Graphics getGraphics()
public FontMetrics getFontMetrics(Font font)
public void paint(Graphics g)
public void update(Graphics g)
public void paintAll(Graphics g)
public void repaint()
public void repaint(long tm)
public void repaint(int x, int y, int width, int height)
public void repaint(long tm, int x, int y, int width, int height)
public void print(Graphics g)
public void printAll(Graphics g)
public boolean imageUpdate(Image img, int flags,int x,int y,int w, int h)
public Image createImage(ImageProducer producer)
public Image createImage(int width, int height)
public boolean prepareImage(Image image, ImageObserver observer)
public boolean prepareImage(Image image, int width, int height,
 ImageObserver observer)
public int checkImage(Image image, ImageObserver observer)
public int checkImage(Image image, int width, int height, ImageObserver
 observer)
public synchronized boolean inside(int x, int y)
public Component locate(int x, int y)
public void deliverEvent(Event e)
public boolean postEvent(Event e)
public boolean handleEvent(Event evt)
public boolean mouseDown(Event evt, int x, int y)
public boolean mouseDrag(Event evt, int x, int y)
public boolean mouseUp(Event evt, int x, int y)
public boolean mouseMove(Event evt, int x, int y)
public boolean mouseEnter(Event evt, int x, int y)
public boolean mouseExit(Event evt, int x, int y)
public boolean keyDown(Event evt, int key)
public boolean keyUp(Event evt, int key)
public boolean action(Event evt, Object what)
public void addNotify()
public synchronized void removeNotify()
public boolean gotFocus(Event evt, Object what)
public boolean lostFocus(Event evt, Object what)
public void requestFocus()
public void nextFocus()
public String toString()
public void list()
public void list(PrintStream out)
public void list(PrintStream out, int indent)
&#125;
</PRE>
<!-- END CODE //-->
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="131-135.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="138-142.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>

<hr width="90%" size="1" noshade><div align="center"><font face="Verdana,sans-serif" size="1">Copyright &copy; <a href="/reference/idgbooks00001.html">IDG Books Worldwide, Inc.</a></font></div>
<!-- all of the reference materials (books) have the footer and subfoot reveresed --><!-- reference_subfoot = footer --><!-- reference_footer = subfoot --></BODY></HTML><!-- END FOOTER -->

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?