Component Properties

All components share a common set of properties that can be obtained and set after construction; the properties are listed in Table 11-2.

Table 11-2. java.awt.Component Properties Modifiable at Runtime
Property Set/Get Methods
Background Color void setBackground(Color) Color getBackground()
Bounds void setBounds(Rectangle)

void setBounds(int,int,int,int)

Rectangle getBounds()
Cursor void setCursor(Cursor) Cursor getCursor()
Drop Target void setDropTarget(DropTarget) DropTarget getDropTarget()
Enabled void setEnabled(boolean) boolean isEnabled()
Font void setFont(Font) Font getFont()
Foreground Color void setForeground(Color) Color getForeground()
Locale void setLocale(Locale) Locale getLocale()
Location void setLocation(Point) ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.