/*
* @(#)Component.java 1.389 05/01/04
*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package java.awt;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Vector;
import java.util.Locale;
import java.util.EventListener;
import java.util.Iterator;
import java.util.HashSet;
import java.util.Set;
import java.util.Collections;
import java.awt.peer.ComponentPeer;
import java.awt.peer.ContainerPeer;
import java.awt.peer.LightweightPeer;
import java.awt.image.BufferStrategy;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.ColorModel;
import java.awt.image.VolatileImage;
import java.awt.event.*;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DragSource;
import java.awt.dnd.DragSourceContext;
import java.awt.dnd.DragSourceListener;
import java.awt.dnd.InvalidDnDOperationException;
import java.io.Serializable;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.IOException;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.awt.event.InputMethodListener;
import java.awt.event.InputMethodEvent;
import java.awt.im.InputContext;
import java.awt.im.InputMethodRequests;
import java.awt.dnd.DropTarget;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.accessibility.*;
import java.awt.GraphicsConfiguration;
import java.security.AccessController;
import java.security.PrivilegedAction;
import javax.accessibility.*;
import java.util.logging.*;
import sun.security.action.GetPropertyAction;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.ConstrainableGraphics;
import sun.awt.DebugHelper;
import sun.awt.WindowClosingListener;
import sun.awt.WindowClosingSupport;
import sun.awt.GlobalCursorManager;
import sun.awt.dnd.SunDropTargetEvent;
import sun.awt.im.CompositionArea;
/**
* A <em>component</em> is an object having a graphical representation
* that can be displayed on the screen and that can interact with the
* user. Examples of components are the buttons, checkboxes, and scrollbars
* of a typical graphical user interface. <p>
* The <code>Component</code> class is the abstract superclass of
* the nonmenu-related Abstract Window Toolkit components. Class
* <code>Component</code> can also be extended directly to create a
* lightweight component. A lightweight component is a component that is
* not associated with a native opaque window.
* <p>
* <h3>Serialization</h3>
* It is important to note that only AWT listeners which conform
* to the <code>Serializable</code> protocol will be saved when
* the object is stored. If an AWT object has listeners that
* aren't marked serializable, they will be dropped at
* <code>writeObject</code> time. Developers will need, as always,
* to consider the implications of making an object serializable.
* One situation to watch out for is this:
* <pre>
* import java.awt.*;
* import java.awt.event.*;
* import java.io.Serializable;
*
* class MyApp implements ActionListener, Serializable
* {
* BigObjectThatShouldNotBeSerializedWithAButton bigOne;
* Button aButton = new Button();
*
* MyApp()
* {
* // Oops, now aButton has a listener with a reference
* // to bigOne!
* aButton.addActionListener(this);
* }
*
* public void actionPerformed(ActionEvent e)
* {
* System.out.println("Hello There");
* }
* }
* </pre>
* In this example, serializing <code>aButton</code> by itself
* will cause <code>MyApp</code> and everything it refers to
* to be serialized as well. The problem is that the listener
* is serializable by coincidence, not by design. To separate
* the decisions about <code>MyApp</code> and the
* <code>ActionListener</code> being serializable one can use a
* nested class, as in the following example:
* <pre>
* import java.awt.*;
* import java.awt.event.*;
* import java.io.Serializable;
*
* class MyApp java.io.Serializable
* {
* BigObjectThatShouldNotBeSerializedWithAButton bigOne;
* Button aButton = new Button();
*
* class MyActionListener implements ActionListener
* {
* public void actionPerformed(ActionEvent e)
* {
* System.out.println("Hello There");
* }
* }
*
* MyApp()
* {
* aButton.addActionListener(new MyActionListener());
* }
* }
* </pre>
* <p>
* <b>Note</b>: For more information on the paint mechanisms utilitized
* by AWT and Swing, including information on how to write the most
* efficient painting code, see
* <a href="http://java.sun.com/products/jfc/tsc/articles/painting/index.html">Painting in AWT and Swing</a>.
* <p>
* For details on the focus subsystem, see
* <a href="http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html">
* How to Use the Focus Subsystem</a>,
* a section in <em>The Java Tutorial</em>, and the
* <a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
* for more information.
*
* @version 1.389, 01/04/05
* @author Arthur van Hoff
* @author Sami Shaio
*/
public abstract class Component implements ImageObserver, MenuContainer,
Serializable
{
private static final Logger focusLog = Logger.getLogger("java.awt.focus.Component");
private static final Logger log = Logger.getLogger("java.awt.Component");
/**
* The peer of the component. The peer implements the component's
* behavior. The peer is set when the <code>Component</code> is
* added to a container that also is a peer.
* @see #addNotify
* @see #removeNotify
*/
transient ComponentPeer peer;
/**
* The parent of the object. It may be <code>null</code>
* for top-level components.
* @see #getParent
*/
transient Container parent;
/**
* The <code>AppContext</code> of the component. Applets/Plugin may
* change the AppContext.
*/
transient AppContext appContext;
/**
* The x position of the component in the parent's coordinate system.
*
* @serial
* @see #getLocation
*/
int x;
/**
* The y position of the component in the parent's coordinate system.
*
* @serial
* @see #getLocation
*/
int y;
/**
* The width of the component.
*
* @serial
* @see #getSize
*/
int width;
/**
* The height of the component.
*
* @serial
* @see #getSize
*/
int height;
/**
* The foreground color for this component.
* <code>foreground</code> can be <code>null</code>.
*
* @serial
* @see #getForeground
* @see #setForeground
*/
Color foreground;
/**
* The background color for this component.
* <code>background</code> can be <code>null</code>.
*
* @serial
* @see #getBackground
* @see #setBackground
*/
Color background;
/**
* The font used by this component.
* The <code>font</code> can be <code>null</code>.
*
* @serial
* @see #getFont
* @see #setFont
*/
Font font;
/**
* The font which the peer is currently using.
* (<code>null</code> if no peer exists.)
*/
Font peerFont;
/**
* The cursor displayed when pointer is over this component.
* This value can be <code>null</code>.
*
* @serial
* @see #getCursor
* @see #setCursor
*/
Cursor cursor;
/**
* The locale for the component.
*
* @serial
* @see #getLocale
* @see #setLocale
*/
没有合适的资源?快使用搜索试试~ 我知道了~
JAVA API的源代码
共2000个文件
class:2110个
java:1359个
project:1个
4星 · 超过85%的资源 需积分: 16 22 下载量 61 浏览量
2009-09-23
09:02:59
上传
评论
收藏 6.8MB RAR 举报
温馨提示
做为JAVA的开发人员,在熟练使用后,就需要再深入了解。相信这份文档对你的能力提升能起到一定作用。
资源推荐
资源详情
资源评论
收起资源包目录
JAVA API的源代码 (2000个子文件)
Component.class 74KB
Container.class 42KB
BigInteger.class 38KB
X509CertSelector.class 33KB
Pattern.class 33KB
DecimalFormat.class 32KB
KeyboardFocusManager.class 31KB
TextLayout.class 30KB
Class.class 30KB
ObjectStreamClass.class 30KB
Arrays.class 29KB
ComponentColorModel.class 28KB
Formatter$FormatSpecifier.class 28KB
BigDecimal.class 28KB
AffineTransform.class 27KB
CharacterData00.class 27KB
GregorianCalendar.class 27KB
URI.class 26KB
Scanner.class 26KB
Window.class 26KB
Font.class 25KB
Collections.class 24KB
ObjectInputStream.class 23KB
ClassLoader.class 22KB
TextLine.class 22KB
Introspector.class 21KB
SimpleDateFormat.class 21KB
Character.class 20KB
KeyEvent.class 20KB
String.class 20KB
Character$UnicodeBlock.class 19KB
ICC_Profile.class 19KB
BufferedImage.class 19KB
BeanContextSupport.class 18KB
Toolkit.class 18KB
Calendar.class 18KB
TreeMap.class 18KB
SocksSocketImpl.class 17KB
MutableBigInteger.class 17KB
DefaultKeyboardFocusManager.class 17KB
Raster.class 16KB
ObjectOutputStream.class 16KB
SystemFlavorMap.class 16KB
WindowsPreferences.class 16KB
ColorConvertOp.class 16KB
Security.class 16KB
MessageFormat.class 16KB
AbstractPreferences.class 16KB
Bits.class 16KB
ColorModel.class 15KB
URLConnection.class 15KB
DataFlavor.class 15KB
DirectByteBuffer.class 15KB
Logger.class 15KB
IndexColorModel.class 14KB
SimpleTimeZone.class 14KB
Locale.class 14KB
ThreadPoolExecutor.class 14KB
AWTEventMulticaster.class 14KB
Date.class 14KB
LogManager.class 14KB
Provider.class 14KB
BeanContextServicesSupport.class 14KB
Socket.class 14KB
DirectColorModel.class 14KB
NumericShaper.class 14KB
GridBagLayout.class 14KB
Thread.class 13KB
CopyOnWriteArrayList.class 13KB
AbstractQueuedSynchronizer.class 13KB
File.class 13KB
ComponentSampleModel.class 13KB
AbstractStringBuilder.class 13KB
ObjectInputStream$BlockDataInputStream.class 13KB
List.class 13KB
StringBuffer.class 13KB
InetAddress.class 13KB
HashMap.class 13KB
URL.class 12KB
Hashtable.class 12KB
Signature.class 12KB
CubicCurve2D.class 12KB
AttributedString.class 12KB
TextMeasurer.class 12KB
BitSet.class 12KB
DatagramSocket.class 12KB
LinkedBlockingQueue.class 11KB
Frame.class 11KB
EventQueue.class 11KB
Color.class 11KB
IdentityHashMap.class 11KB
Method.class 11KB
DragSource.class 11KB
SampleModel.class 11KB
SecurityManager.class 11KB
Constructor.class 11KB
ResourceBundle.class 11KB
PageAttributes$MediaType.class 11KB
Provider$Service.class 11KB
Vector.class 11KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- 斯嘉静2013-01-03非常实用的资源,学习java必备呀
- wmdtksmld2013-10-11java学习必须的
moneyclearqq
- 粉丝: 2
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功