/*
* @(#)Component.java 1.357 03/04/14
*
* Copyright 2003 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.awt.event.InputMethodListener;
import java.awt.event.InputMethodEvent;
import java.awt.im.InputContext;
import java.awt.im.InputMethodRequests;
import java.awt.dnd.DropTarget;
import javax.accessibility.*;
import java.awt.GraphicsConfiguration;
import javax.accessibility.*;
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>.
*
* @version 1.357, 04/14/03
* @author Arthur van Hoff
* @author Sami Shaio
*/
public abstract class Component implements ImageObserver, MenuContainer,
Serializable
{
/**
* 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. This is set in
* the constructor and never changes.
*/
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
*/
Locale locale;
/**
* A reference to a <code>GraphicsConfiguration</code> object
* used to describe the characteristics of a graphics
* destination.
* This value can be <code>null</code>.
*
* @since 1.3
* @serial
* @see GraphicsConfiguration
* @see #getGraphicsConfiguration
*/
transient GraphicsConfiguration graphicsConfig = null;
/**
* A reference to a <code>BufferStrategy</code> object
* used to manipulate the buffers on this component.
*
* @since 1.4
* @see java.awt.image.BufferStrategy
* @see #getBufferStrategy()
*/
transient BufferStrategy bufferStrategy = null;
/**
* True when the object should ignore all repaint events.
*
* @since 1.4
没有合适的资源?快使用搜索试试~ 我知道了~
jdk1.4.2源代码
共4137个文件
java:4133个
h:2个
c:2个
5星 · 超过95%的资源 需积分: 28 197 下载量 115 浏览量
2009-03-18
16:03:25
上传
评论
收藏 11.3MB ZIP 举报
温馨提示
jdk1.4.2源代码............
资源推荐
资源详情
资源评论
收起资源包目录
jdk1.4.2源代码 (4137个子文件)
java.c 35KB
java_md.c 9KB
java.h 2KB
java_md.h 853B
Component.java 266KB
JTable.java 217KB
JComponent.java 178KB
Pattern.java 175KB
JTree.java 169KB
ComponentColorModel.java 131KB
DatabaseMetaData.java 126KB
Container.java 124KB
JTextComponent.java 124KB
RuleBasedBreakIterator.java 124KB
Parser2.java 123KB
HTMLDocument.java 120KB
BasicTabbedPaneUI.java 114KB
ImageReader.java 114KB
URI.java 114KB
XSLTErrorResources_ko.java 114KB
DecimalFormat.java 113KB
SynthTreeUI.java 112KB
BasicTreeUI.java 111KB
KeyboardFocusManager.java 110KB
XSLTErrorResources_ja.java 110KB
JList.java 109KB
SynthTabbedPaneUI.java 106KB
BigInteger.java 105KB
ObjectInputStream.java 104KB
ResultSet.java 100KB
TransformerImpl.java 99KB
TextLayout.java 99KB
AffineTransform.java 98KB
StyleSheet.java 98KB
AbstractDocument.java 98KB
JOptionPane.java 97KB
XSLTErrorResources.java 97KB
JPEGMetadata.java 96KB
DTMDocumentImpl.java 95KB
AbstractButton.java 93KB
CSS.java 93KB
X509CertSelector.java 91KB
GregorianCalendar.java 90KB
Collections.java 90KB
ORB.java 90KB
AccessibleHTML.java 89KB
Toolkit.java 89KB
String.java 88KB
ColorModel.java 88KB
SynthTextUI.java 88KB
Class.java 87KB
TypeCodeImpl.java 86KB
SynthSplitPaneUI.java 85KB
Arrays.java 85KB
BasicTextUI.java 83KB
PNGMetadata.java 82KB
GTKStyle.java 81KB
JInternalFrame.java 81KB
XSLTErrorResources_zh_CN.java 80KB
XSLTErrorResources_zh_TW.java 79KB
ImageWriter.java 78KB
IIOPInputStream.java 77KB
SynthListUI.java 76KB
Raster.java 76KB
XSLTErrorResources_fr.java 76KB
DefaultStyledDocument.java 75KB
Window.java 75KB
Character.java 75KB
CDRInputStream_1_0.java 75KB
BasicListUI.java 75KB
JEditorPane.java 74KB
XSLTErrorResources_es.java 74KB
XSLTErrorResources_de.java 73KB
XSLTErrorResources_it.java 73KB
Font.java 73KB
XSLTErrorResources_sv.java 73KB
SAX2DTM.java 73KB
JComboBox.java 72KB
WindowsLookAndFeel.java 72KB
SimpleDateFormat.java 72KB
SimpleTimeZone.java 71KB
DefaultEditorKit.java 71KB
BasicLookAndFeel.java 71KB
HTMLEditorKit.java 70KB
ElemNumber.java 70KB
AbstractPreferences.java 68KB
ObjectOutputStream.java 68KB
BasicSplitPaneUI.java 68KB
DTMDefaultBase.java 68KB
JTabbedPane.java 68KB
SecurityManager.java 68KB
SerializerToXML.java 67KB
MetalIconFactory.java 66KB
WindowsFileChooserUI.java 66KB
SwingUtilities.java 65KB
MetalLookAndFeel.java 64KB
Class.java 64KB
Calendar.java 63KB
FloatingDecimal.java 63KB
ObjectStreamClass.java 63KB
共 4137 条
- 1
- 2
- 3
- 4
- 5
- 6
- 42
anyway1021
- 粉丝: 3
- 资源: 54
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页