- Swing 教程
- Swing - 首页
- Swing - 概述
- Swing - 环境
- Swing - 控件
- Swing - 事件处理
- Swing - 事件类
- Swing - 事件监听器
- Swing - 事件适配器
- Swing - 布局
- Swing - 菜单
- Swing - 容器
- Swing 有用资源
- Swing - 快速指南
- Swing - 有用资源
- Swing - 讨论
Swing - 组件类
介绍
类Component是AWT非菜单用户界面控件的抽象基类。Component表示具有图形表示的对象。
类声明
以下是java.awt.Component类的声明:
public abstract class Component
extends Object
implements ImageObserver, MenuContainer, Serializable
字段
以下是java.awt.Component类的字段:
static float BOTTOM_ALIGNMENT - 获取getAlignmentY的易用性常量。
static float CENTER_ALIGNMENT - 获取getAlignmentY和getAlignmentX的易用性常量。
static float LEFT_ALIGNMENT - 获取getAlignmentX的易用性常量。
static float RIGHT_ALIGNMENT - 获取getAlignmentX的易用性常量。
static float TOP_ALIGNMENT - 获取getAlignmentY()的易用性常量。
类构造函数
| 序号 | 构造函数和说明 |
|---|---|
| 1 |
protected Component() 这将创建一个新的Component。 |
类方法
| 序号 | 方法和说明 |
|---|---|
| 1 |
boolean action(Event evt, Object what) 已弃用。从JDK 1.1版开始,应将此组件注册为触发操作事件的组件上的ActionListener。 |
| 2 |
void add(PopupMenu popup) 将指定的弹出菜单添加到组件。 |
| 3 |
void addComponentListener(ComponentListener l) 添加指定的组件监听器以接收来自此组件的组件事件。 |
| 4 |
void addFocusListener(FocusListener l) 添加指定的焦点监听器以接收来自此组件的焦点事件,当此组件获得输入焦点时。 |
| 5 |
void addHierarchyBoundsListener(HierarchyBoundsListener l) 添加指定的层次边界监听器以接收来自此组件的层次边界事件,当此容器所属的层次结构发生更改时。 |
| 6 |
void addHierarchyListener(HierarchyListener l) 添加指定的层次监听器以接收来自此组件的层次结构更改事件,当此容器所属的层次结构发生更改时。 |
| 7 |
void addInputMethodListener(InputMethodListener l) 添加指定的输入方法监听器以接收来自此组件的输入方法事件。 |
| 8 |
void addKeyListener(KeyListener l) 添加指定的键监听器以接收来自此组件的键事件。 |
| 9 |
void addMouseListener(MouseListener l) 添加指定的鼠标监听器以接收来自此组件的鼠标事件。 |
| 10 |
void addMouseMotionListener(MouseMotionListener l) 添加指定的鼠标移动监听器以接收来自此组件的鼠标移动事件。 |
| 11 |
void addMouseWheelListener(MouseWheelListener l) 添加指定的鼠标滚轮监听器以接收来自此组件的鼠标滚轮事件。 |
| 12 |
void addNotify() 通过将其连接到本机屏幕资源来使此组件可显示。 |
| 13 |
void addPropertyChangeListener(PropertyChangeListener listener) 向监听器列表添加PropertyChangeListener。 |
| 14 |
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) 为特定属性向监听器列表添加PropertyChangeListener。 |
| 15 |
void applyComponentOrientation(ComponentOrientation orientation) 设置此组件及其包含的所有组件的ComponentOrientation属性。 |
| 16 |
boolean areFocusTraversalKeysSet(int id) 返回是否为此组件显式定义了给定焦点遍历操作的焦点遍历键集。 |
| 17 |
int checkImage(Image image, ImageObserver observer) 返回指定图像的屏幕表示的构造状态。 |
| 18 |
int checkImage(Image image,int width,int height, ImageObserver observer) 返回指定图像的屏幕表示的构造状态。 |
| 19 |
boolean contains(int x,int y) 检查此组件是否“包含”指定的点,其中x和y被定义为相对于此组件的坐标系。 |
| 20 |
boolean contains(Point p) 检查此组件是否“包含”指定的点,其中点的x和y坐标被定义为相对于此组件的坐标系。 |
| 21 |
Image createImage(ImageProducer producer) 从指定的图像生产者创建图像。 |
| 22 |
Image createImage(int width,int height) 创建一个离屏可绘制图像,用于双缓冲。 |
| 23 |
VolatileImage createVolatileImage(int width,int height) 创建一个易失性离屏可绘制图像,用于双缓冲。 |
| 24 |
VolatileImage createVolatileImage(int width,int height, ImageCapabilities caps) 创建一个具有给定功能的易失性离屏可绘制图像。 |
| 25 |
void deliverEvent(Event e) 已弃用。从JDK 1.1版开始,由dispatchEvent(AWTEvent e)替换。 |
| 26 |
void disable() 已弃用。从JDK 1.1版开始,由setEnabled(boolean)替换。 |
| 27 |
protected void disableEvents(long eventsToDisable) 禁用由指定的事件掩码参数定义的事件传递到此组件。 |
| 28 |
void dispatchEvent(AWTEvent e) 将事件分派到此组件或其子组件之一。 |
| 29 |
void doLayout() 提示布局管理器布局此组件。 |
| 30 |
void enable() 已弃用。从JDK 1.1版开始,由setEnabled(boolean)替换。 |
| 31 |
void enable(boolean b) 已弃用。从JDK 1.1版开始,由setEnabled(boolean)替换。 |
| 32 |
protected void enableEvents(long eventsToEnable) 启用由指定的事件掩码参数定义的事件传递到此组件。 |
| 33 |
void enableInputMethods(boolean enable) 启用或禁用此组件的输入方法支持。 |
| 34 |
protected void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) 支持为布尔属性报告绑定属性更改。 |
| 35 |
void firePropertyChange(String propertyName, byte oldValue, byte newValue) 报告绑定属性更改。 |
| 36 |
void firePropertyChange(String propertyName, char oldValue, char newValue) 报告绑定属性更改。 |
| 37 |
void firePropertyChange(String propertyName, double oldValue, double newValue) 报告绑定属性更改。 |
| 38 |
void firePropertyChange(String propertyName, float oldValue, float newValue) 报告绑定属性更改。 |
| 39 |
void firePropertyChange(String propertyName, long oldValue, long newValue) 报告绑定属性更改。 |
| 40 |
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) 支持为Object属性报告绑定属性更改。 |
| 41 |
void firePropertyChange(String propertyName, short oldValue, short newValue) 报告绑定属性更改。 |
| 42 |
AccessibleContext getAccessibleContext() 获取与此Component关联的AccessibleContext。 |
| 43 |
float getAlignmentX() 返回沿x轴的对齐方式。 |
| 44 |
float getAlignmentY() 返回沿y轴的对齐方式。 |
| 45 |
Color getBackground() 获取此组件的背景颜色。 |
| 46 |
int getBaseline(int width,int height) 返回基线。 |
| 47 |
Component.BaselineResizeBehavior getBaselineResizeBehavior() 返回一个枚举,指示组件的基线如何随着大小的变化而变化。 |
| 48 |
Rectangle getBounds() 以Rectangle对象的形式获取此组件的边界。 |
| 49 |
Rectangle getBounds(Rectangle rv) 将此组件的边界存储到“返回值”rv中并返回rv。 |
| 50 |
ColorModel getColorModel() 获取用于在输出设备上显示组件的ColorModel实例。 |
| 51 |
Component getComponentAt(int x,int y) 确定此组件或其直接子组件之一是否包含(x, y)位置,如果包含,则返回包含组件。 |
| 52 |
Component getComponentAt(Point p) 返回包含指定点的组件或子组件。 |
| 53 |
ComponentListener[] getComponentListeners() 返回在此组件上注册的所有组件监听器的数组。 |
| 54 |
ComponentOrientation getComponentOrientation() 检索用于对齐此组件中元素或文本的语言敏感方向。 |
| 55 |
Cursor getCursor() 获取组件中设置的光标。 |
| 56 |
DropTarget getDropTarget() 获取与此Component关联的DropTarget。 |
| 57 |
Container getFocusCycleRootAncestor() 返回此Component的焦点遍历循环的焦点循环根容器。 |
| 58 |
FocusListener[] getFocusListeners() 返回在此组件上注册的所有焦点监听器的数组。 |
| 59 |
Set<AWTKeyStroke> getFocusTraversalKeys(int id) 返回此组件给定遍历操作的焦点遍历键集。 |
| 60 |
boolean getFocusTraversalKeysEnabled() 返回此组件是否启用了焦点遍历键。 |
| 61 |
Font getFont() 获取此组件的字体。 |
| 62 |
FontMetrics getFontMetrics(Font font) 获取指定字体的字体度量。 |
| 63 |
Color getForeground() 获取此组件的前景色。 |
| 64 |
Graphics getGraphics() 为此组件创建图形上下文。 |
| 65 |
GraphicsConfiguration getGraphicsConfiguration() 获取与此Component关联的GraphicsConfiguration。 |
| 66 |
int getHeight() 返回此组件的当前高度。 |
| 67 |
HierarchyBoundsListener[] getHierarchyBoundsListeners() 返回在此组件上注册的所有层次边界监听器的数组。 |
| 68 |
HierarchyListener[] getHierarchyListeners() 返回在此组件上注册的所有层次监听器的数组。 |
| 69 |
boolean getIgnoreRepaint() |
| 70 |
InputContext getInputContext() 获取此组件用于处理与输入方法通信的输入上下文,当在此组件中输入文本时。 |
| 71 |
InputMethodListener[] getInputMethodListeners() 返回在此组件上注册的所有输入方法监听器的数组。 |
| 72 |
InputMethodRequests getInputMethodRequests() 获取支持此组件输入方法请求的输入方法请求处理程序。 |
| 73 |
KeyListener[] getKeyListeners() 返回在此组件上注册的所有键监听器的数组。 |
| 74 |
<T extends EventListener> T[] getListeners(Class<T> listenerType) 返回当前在此组件上注册为FooListeners的所有对象的数组。 |
| 75 |
Locale getLocale() 获取此组件的区域设置。 |
| 76 |
Point getLocation() 以指定组件左上角的点的形式获取此组件的位置。 |
| 77 |
Point getLocation(Point rv) 将此组件的x,y原点存储到“返回值”rv中并返回rv。 |
| 78 |
Point getLocationOnScreen() 以指定组件在屏幕坐标空间中左上角的点的形式获取此组件的位置。 |
| 79 |
Dimension getMaximumSize() 获取此组件的最大大小。 |
| 80 |
Dimension getMinimumSize() 获取此组件的最小大小。 |
| 81 |
MouseListener[] getMouseListeners() 返回在此组件上注册的所有鼠标监听器的数组。 |
| 82 |
MouseMotionListener[] getMouseMotionListeners() 返回在此组件上注册的所有鼠标移动监听器的数组。 |
| 83 |
Point getMousePosition() 如果组件直接位于鼠标指针下方,则返回该组件坐标空间中鼠标指针的位置;否则返回 null。 |
| 84 |
MouseWheelListener[] getMouseWheelListeners() 返回在此组件上注册的所有鼠标滚轮监听器的数组。 |
| 85 |
String getName() 获取组件的名称。 |
| 86 |
Container getParent() 获取此组件的父容器。 |
| 87 |
java.awt.peer.ComponentPeer getPeer() 已过时。从 JDK 1.1 版开始,程序不应直接操作对等体;已由 boolean isDisplayable() 替代。 |
| 88 |
Dimension getPreferredSize() 获取此组件的首选大小。 |
| 89 |
PropertyChangeListener[] getPropertyChangeListeners() 返回在此组件上注册的所有属性更改监听器的数组。 |
| 90 |
PropertyChangeListener[] getPropertyChangeListeners(String propertyName) 返回已与命名属性关联的所有监听器的数组。 |
| 91 |
Dimension getSize() 以 Dimension 对象的形式返回此组件的大小。 |
| 92 |
Dimension getSize(Dimension rv) 将此组件的宽度/高度存储到“返回值:rv”中并返回 rv。 |
| 93 |
Toolkit getToolkit() 获取此组件的工具包。 |
| 94 |
Object getTreeLock() 获取此组件的锁定对象(拥有 AWT 组件树和布局操作的线程同步监视器的对象)。 |
| 95 |
int getWidth() 返回此组件的当前宽度。 |
| 96 |
int getX() 返回组件原点的当前 x 坐标。 |
| 97 |
int getY() 返回组件原点的当前 y 坐标。 |
| 98 |
boolean gotFocus(Event evt, Object what) 已过时。从 JDK 1.1 版开始,已由 processFocusEvent(FocusEvent) 替代。 |
| 99 |
boolean handleEvent(Event evt) 已过时。从 JDK 1.1 版开始,已由 processEvent(AWTEvent) 替代。 |
| 100 |
boolean hasFocus() 如果此组件是焦点所有者,则返回 true。 |
| 101 |
void hide() 已过时。从 JDK 1.1 版开始,已由 setVisible(boolean) 替代。 |
| 102 |
boolean imageUpdate(Image img,int infoflags,int x,int y,int w,int h) 图像更改时重新绘制组件。 |
| 103 |
boolean inside(int x,int y) 已过时。从 JDK 1.1 版开始,已由 contains(int, int) 替代。 |
| 104 |
void invalidate() 使此组件无效。 |
| 105 |
boolean isBackgroundSet() 返回是否为此组件显式设置了背景颜色。 |
| 106 |
boolean isCursorSet() 返回是否为此组件显式设置了光标。 |
| 107 |
boolean isDisplayable() 确定此组件是否可显示。 |
| 108 |
boolean isDoubleBuffered() 如果此组件绘制到稍后复制到屏幕的离屏图像(缓冲区),则返回 true。 |
| 109 |
boolean isEnabled() 确定此组件是否已启用。 |
| 110 |
boolean isFocusable() 返回此组件是否可获得焦点。 |
| 111 |
boolean isFocusCycleRoot(Container container) 返回指定的容器是否为此组件的焦点遍历循环的焦点循环根。 |
| 112 |
boolean isFocusOwner() 如果此组件是焦点所有者,则返回 true。 |
| 113 |
boolean isFocusTraversable() 已过时。从 1.4 版开始,已由 isFocusable() 替代。 |
| 114 |
boolean isFontSet() 返回是否为此组件显式设置了字体。 |
| 115 |
boolean isForegroundSet() 返回是否为此组件显式设置了前景色。 |
| 116 |
boolean isLightweight() 轻量级组件没有本机工具包对等体。 |
| 117 |
boolean isMaximumSizeSet() 如果最大大小已设置为非 null 值,则返回 true;否则返回 false。 |
| 118 |
boolean isMinimumSizeSet() 返回是否已使用非 null 值调用 setMinimumSize。 |
| 119 |
boolean isOpaque() 如果此组件完全不透明,则返回 true;默认情况下返回 false。 |
| 120 |
boolean isPreferredSizeSet() 如果首选大小已设置为非 null 值,则返回 true;否则返回 false。 |
| 121 |
boolean isShowing() 确定此组件是否正在屏幕上显示。 |
| 122 |
boolean isValid() 确定此组件是否有效。 |
| 123 |
boolean isVisible() 确定此组件的父组件可见时,此组件是否应可见。 |
| 124 |
boolean keyDown(Event evt,int key) 已过时。从 JDK 1.1 版开始,已由 processKeyEvent(KeyEvent) 替代。 |
| 125 |
boolean keyUp(Event evt,int key) 已过时。从 JDK 1.1 版开始,已由 processKeyEvent(KeyEvent) 替代。 |
| 126 |
void layout() 已过时。从 JDK 1.1 版开始,已由 doLayout() 替代。 |
| 127 |
void list() 将此组件的列表打印到标准系统输出流 System.out。 |
| 128 |
void list(PrintStream out) 将此组件的列表打印到指定的输出流。 |
| 129 |
void list(PrintStream out,int indent) 从指定的缩进开始,将列表打印到指定的打印流。 |
| 130 |
void list(PrintWriter out) 将列表打印到指定的打印编写器。 |
| 131 |
void list(PrintWriter out,int indent) 从指定的缩进开始,将列表打印到指定的打印编写器。 |
| 132 |
Component locate(int x,int y) 已过时。从 JDK 1.1 版开始,已由 getComponentAt(int, int) 替代。 |
| 133 |
Point location() 已过时。从 JDK 1.1 版开始,已由 getLocation() 替代。 |
| 134 |
boolean lostFocus(Event evt, Object what) 已过时。从 JDK 1.1 版开始,已由 processFocusEvent(FocusEvent) 替代。 |
| 135 |
boolean mouseDown(Event evt,int x,int y) 已过时。从 JDK 1.1 版开始,已由 processMouseEvent(MouseEvent) 替代。 |
| 136 |
boolean mouseDrag(Event evt,int x,int y) 已过时。从 JDK 1.1 版开始,已由 processMouseMotionEvent(MouseEvent) 替代。 |
| 137 |
boolean mouseEnter(Event evt,int x,int y) 已过时。从 JDK 1.1 版开始,已由 processMouseEvent(MouseEvent) 替代。 |
| 138 |
boolean mouseExit(Event evt,int x,int y) 已过时。从 JDK 1.1 版开始,已由 processMouseEvent(MouseEvent) 替代。 |
| 139 |
boolean mouseMove(Event evt,int x,int y) 已过时。从 JDK 1.1 版开始,已由 processMouseMotionEvent(MouseEvent) 替代。 |
| 140 |
boolean mouseUp(Event evt,int x,int y) 已过时。从 JDK 1.1 版开始,已由 processMouseEvent(MouseEvent) 替代。 |
| 141 |
void move(int x,int y) 已过时。从 JDK 1.1 版开始,已由 setLocation(int, int) 替代。 |
| 142 |
void nextFocus() 已过时。从 JDK 1.1 版开始,已由 transferFocus() 替代。 |
| 143 |
void paint(Graphics g) 绘制此组件。 |
| 144 |
void paintAll(Graphics g) 绘制此组件及其所有子组件。 |
| 145 |
boolean postEvent(Event e) 已过时。从 JDK 1.1 版开始,已由 dispatchEvent(AWTEvent) 替代。 |
| 146 |
boolean prepareImage(Image image,int width,int height, ImageObserver observer) 准备在此组件上以指定的宽度和高度渲染图像。 |
| 147 |
void print(Graphics g) 打印此组件。 |
| 148 |
void printAll(Graphics g) 打印此组件及其所有子组件。 |
| 149 |
protected void processComponentEvent(ComponentEvent e) 通过将组件事件分派给任何已注册的 ComponentListener 对象来处理在此组件上发生的组件事件。 |
| 150 |
protected void processEvent(AWTEvent e) 处理在此组件上发生的事件。 |
| 151 |
protected void processFocusEvent(FocusEvent e) 通过将焦点事件分派给任何已注册的 FocusListener 对象来处理在此组件上发生的焦点事件。 |
| 152 |
protected void processHierarchyBoundsEvent(HierarchyEvent e) 通过将层次结构边界事件分派给任何已注册的 HierarchyBoundsListener 对象来处理在此组件上发生的层次结构边界事件。 |
| 153 |
protected void processHierarchyEvent(HierarchyEvent e) 通过将层次结构事件分派给任何已注册的 HierarchyListener 对象来处理在此组件上发生的层次结构事件。 |
| 154 |
protected void processInputMethodEvent(InputMethodEvent e) 通过将输入方法事件分派给任何已注册的 InputMethodListener 对象来处理在此组件上发生的输入方法事件。 |
| 155 |
protected void processKeyEvent(KeyEvent e) 通过将键盘事件分派给任何已注册的 KeyListener 对象来处理在此组件上发生的键盘事件。 |
| 156 |
protected void processMouseEvent(MouseEvent e) 通过将鼠标事件分派给任何已注册的 MouseListener 对象来处理在此组件上发生的鼠标事件。 |
| 157 |
protected void processMouseMotionEvent(MouseEvent e) 通过将鼠标移动事件分派给任何已注册的 MouseMotionListener 对象来处理在此组件上发生的鼠标移动事件。 |
| 158 |
protected void processMouseWheelEvent(MouseWheelEvent e) 通过将鼠标滚轮事件分派给任何已注册的 MouseWheelListener 对象来处理在此组件上发生的鼠标滚轮事件。 |
| 159 |
void remove(MenuComponent popup) 从此组件中删除指定的弹出菜单。 |
| 160 |
void removeComponentListener(ComponentListener l) 移除指定的组件监听器,以便它不再接收来自此组件的组件事件。 |
| 161 |
void removeFocusListener(FocusListener l) 移除指定的焦点监听器,以便它不再接收来自此组件的焦点事件。 |
| 162 |
void removeHierarchyBoundsListener(HierarchyBoundsListener l) 移除指定的层次结构边界监听器,以便它不再接收来自此组件的层次结构边界事件。 |
| 163 |
void removeHierarchyListener(HierarchyListener l) 移除指定的层次结构监听器,以便它不再接收来自此组件的层次结构更改事件。 |
| 164 |
void removeInputMethodListener(InputMethodListener l) 移除指定的输入方法监听器,以便它不再接收来自此组件的输入方法事件。 |
| 165 |
void removeKeyListener(KeyListener l) 移除指定的键盘监听器,以便它不再接收来自此组件的键盘事件。 |
| 166 |
void removeMouseListener(MouseListener l) 移除指定的鼠标监听器,以便它不再接收来自此组件的鼠标事件。 |
| 167 |
void removeMouseMotionListener(MouseMotionListener l) 移除指定的鼠标移动监听器,以便它不再接收来自此组件的鼠标移动事件。 |
| 168 |
void removeMouseWheelListener(MouseWheelListener l) 移除指定的鼠标滚轮监听器,以便它不再接收来自此组件的鼠标滚轮事件。 |
| 169 |
void removeNotify() 通过销毁其本机屏幕资源来使此组件不可显示。 |
| 170 |
void removePropertyChangeListener(PropertyChangeListener listener) 从此监听器列表中移除 PropertyChangeListener。 |
| 171 |
void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) 从特定属性的监听器列表中移除 PropertyChangeListener。 |
| 172 |
void repaint() 重新绘制此组件。 |
| 173 |
void repaint(int x,int y,int width,int height) 重新绘制此组件的指定矩形。 |
| 174 |
void repaint(long tm) 重新绘制组件。 |
| 175 |
void repaint(long tm,int x,int y,int width,int height) 在 tm 毫秒内重新绘制此组件的指定矩形。 |
| 176 |
void requestFocus() 请求此组件获取输入焦点,并使此组件的顶级祖先成为聚焦窗口。 |
| 177 |
protected boolean requestFocus(boolean temporary) 请求此组件获取输入焦点,并使此组件的顶级祖先成为聚焦窗口。 |
| 178 |
boolean requestFocusInWindow() 如果此组件的顶级祖先已经是聚焦窗口,则请求此组件获取输入焦点。 |
| 179 |
protected boolean requestFocusInWindow(boolean temporary) 如果此组件的顶级祖先已经是聚焦窗口,则请求此组件获取输入焦点。 |
| 180 |
void reshape(int x,int y,int width,int height) 已过时。从 JDK 1.1 版开始,已由 setBounds(int, int, int, int) 替代。 |
| 181 |
void resize(Dimension d) 已过时。从 JDK 1.1 版开始,已由 setSize(Dimension) 替代。 |
| 182 |
void resize(int width,int height) 已过时。从 JDK 1.1 版开始,已由 setSize(int, int) 替代。 |
| 183 |
void setBackground(Color c) 设置此组件的背景颜色。 |
| 184 |
void setBounds(int x,int y,int width,int height) 移动并调整此组件的大小。 |
| 185 |
void setBounds(Rectangle r) 移动并调整此组件的大小,使其符合新的边界矩形r。 |
| 186 |
void setComponentOrientation(ComponentOrientation o) 设置用于排序此组件内元素或文本的语言敏感方向。 |
| 187 |
void setCursor(Cursor cursor) 将光标图像设置为指定的光标。 |
| 188 |
void setDropTarget(DropTarget dt) 将DropTarget与该组件关联。 |
| 189 |
void setEnabled(boolean b) 根据参数b的值启用或禁用此组件。 |
| 190 |
void setFocusable(boolean focusable) 将此组件的可聚焦状态设置为指定的值。 |
| 191 |
void setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes) 为该组件的给定遍历操作设置焦点遍历键。 |
| 192 |
void setFocusTraversalKeysEnabled(boolean focusTraversalKeysEnabled) 设置是否为此组件启用焦点遍历键。 |
| 193 |
void setFont(Font f) 设置此组件的字体。 |
| 194 |
void setForeground(Color c) 设置此组件的前景色。 |
| 195 |
void setIgnoreRepaint(boolean ignoreRepaint) 设置是否应忽略从操作系统接收到的绘制消息。 |
| 196 |
void setLocale(Locale l) 设置此组件的区域设置。 |
| 197 |
void setLocation(int x,int y) 将此组件移动到新位置。 |
| 198 |
void setLocation(Point p) 将此组件移动到新位置。 |
| 199 |
void setMaximumSize(Dimension maximumSize) 将此组件的最大大小设置为一个常数值。 |
| 200 |
void setMinimumSize(Dimension minimumSize) 将此组件的最小大小设置为一个常数值。 |
| 201 |
void setName(String name) 将组件的名称设置为指定的字符串。 |
| 202 |
void setPreferredSize(Dimension preferredSize) 将此组件的首选大小设置为一个常数值。 |
| 203 |
void setSize(Dimension d) 调整此组件的大小,使其宽度为d.width,高度为d.height。 |
| 204 |
void setSize(int width,int height) 调整此组件的大小,使其宽度为width,高度为height。 |
| 205 |
void setVisible(boolean b) 根据参数b的值显示或隐藏此组件。 |
| 206 |
void show() 已过时。从 JDK 1.1 版开始,已由 setVisible(boolean) 替代。 |
| 207 |
void show(boolean b) 已过时。从 JDK 1.1 版开始,已由 setVisible(boolean) 替代。 |
| 208 |
Dimension size() 已过时。从JDK版本1.1开始,已由getSize()替换。 |
| 209 |
String toString() 返回此组件及其值的字符串表示形式。 |
| 210 |
void transferFocus() 将焦点转移到下一个组件,就好像此组件是焦点所有者一样。 |
| 211 |
void transferFocusBackward() 将焦点转移到上一个组件,就好像此组件是焦点所有者一样。 |
| 212 |
void transferFocusUpCycle() 将焦点向上转移一个焦点遍历周期。 |
| 213 |
void update(Graphics g) 更新此组件。 |
| 214 |
void validate() 确保此组件具有有效的布局。 |
| 215 |
Rectangle bounds() 已过时。从JDK版本1.1开始,已由getBounds()替换。 |
| 216 |
protected AWTEvent coalesceEvents(AWTEvent existingEvent, AWTEvent newEvent) 可能将要发布的事件与现有事件合并。 |
| 217 |
protected String paramString() 返回表示此组件状态的字符串。 |
| 218 |
protected void firePropertyChange(String propertyName,int oldValue,int newValue) 支持为整型属性报告绑定属性更改。 |
| 219 |
Dimension preferredSize() 已过时。从JDK版本1.1开始,已由getPreferredSize()替换。 |
| 220 |
boolean prepareImage(Image image, ImageObserver observer) 准备在此组件上呈现图像。 |
| 221 |
Dimension minimumSize() 已过时。从JDK版本1.1开始,已由getMinimumSize()替换。 |
继承的方法
此类继承自以下类:
- java.lang.Object