Java Reference
In-Depth Information
TABLE 12-1
Constructors and Methods of the
class
Component
(continued)
public void
setForeground(Color c)
//Sets the foreground color of this component to color c.
public
Font getFont()
//Returns the font of this component.
public void
setFont(Font ft)
//Sets the font of this component to ft.
public void
setSize(
int
w,
int
h)
//Sets the size of this component to width w and height h
public boolean
isVisible()
//Returns true if the component is visible; false otherwise.
public void
setVisible(
boolean
tog)
//If tog is true, sets the component to visible;
//if tog is false, the component is not shown.
public void
paint(Graphics g)
//Paints the component with the graphic component specified by g.
public void
repaint()
//Repaints the component.
public void
repaint(
int
x,
int
y,
int
wid,
int
ht)
//Repaints the rectangular portion of the component from (x, y)
//to (x + wid, y + ht)
public void
setLocation(
int
x,
int
y)
//Sets the component at the location (x, y).
public
String toString()
//Returns a string representation of this component.
public void
update(Graphics g)
//Invokes the paint method.
public void
validate()
//Validates this container and all of its subcomponents; the
//method validate is used to cause a container to lay out its
//subcomponents once more. Typically called after the components
//it contains have been added to or modified.
The
class
Container
inherits all the methods of the
class
Component
. In addition to
the methods listed in Table 12-1, Table 12-2 shows some commonly used methods of the
class
Container
.
Search WWH ::
Custom Search