java.awt
Class Component
java.lang.Object
|
+--java.awt.Component
- Direct Known Subclasses:
- Button, Canvas, Checkbox, Choice, Container, Label, List, Scrollbar, java.awt.TextComponent
- public abstract class Component
- extends java.lang.Object
Important Limitations:
- Only one listener of each type is allowed
- Many methods are still missing
Many events are not passed through the processXXXEvent-Methods
but delivered directly to the registered listener.
Method Summary |
void |
addKeyListener(KeyListener l)
|
void |
addMouseListener(MouseListener l)
|
boolean |
contains(int x,
int y)
|
Component |
findComponentAt(int px,
int py)
|
Font |
getFont()
|
FontMetrics |
getFontMetrics(Font font)
|
Graphics |
getGraphics()
|
int |
getHeight()
|
Point |
getLocationOnScreen()
returns null if not visible / on screen |
Dimension |
getMinimumSize()
|
Dimension |
getPreferredSize()
|
int |
getWidth()
|
int |
getX()
|
int |
getY()
|
void |
invalidate()
|
boolean |
isEnabled()
|
void |
paint(Graphics g)
|
void |
paintAll(Graphics g)
|
void |
processKeyEvent(KeyEvent e)
|
void |
processMouseEvent(MouseEvent e)
Does not work because of the type cast Problem!
|
void |
proxyRequestFocus(Component c)
|
void |
repaint()
|
void |
repaint(int x,
int y,
int w,
int h)
|
void |
requestFocus()
|
void |
setBackground(Color color)
the Backgroundcolor is currently ignored completely (always white) |
void |
setBounds(int x,
int y,
int w,
int h)
|
void |
setEnabled(boolean b)
|
void |
setLocation(int x,
int y)
|
void |
setSize(Dimension d)
|
void |
setSize(int w,
int h)
|
void |
setVisible(boolean v)
|
void |
update(Graphics g)
|
void |
validate()
|
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Component
public Component()
addMouseListener
public void addMouseListener(MouseListener l)
addKeyListener
public void addKeyListener(KeyListener l)
findComponentAt
public Component findComponentAt(int px,
int py)
getLocationOnScreen
public Point getLocationOnScreen()
- returns null if not visible / on screen
getFont
public Font getFont()
getFontMetrics
public FontMetrics getFontMetrics(Font font)
getGraphics
public Graphics getGraphics()
getX
public int getX()
getY
public int getY()
getWidth
public int getWidth()
getHeight
public int getHeight()
getPreferredSize
public Dimension getPreferredSize()
getMinimumSize
public Dimension getMinimumSize()
contains
public boolean contains(int x,
int y)
invalidate
public void invalidate()
isEnabled
public boolean isEnabled()
setBounds
public void setBounds(int x,
int y,
int w,
int h)
setEnabled
public void setEnabled(boolean b)
setLocation
public void setLocation(int x,
int y)
setSize
public void setSize(int w,
int h)
setSize
public void setSize(Dimension d)
paint
public void paint(Graphics g)
paintAll
public void paintAll(Graphics g)
proxyRequestFocus
public void proxyRequestFocus(Component c)
requestFocus
public void requestFocus()
update
public void update(Graphics g)
repaint
public void repaint(int x,
int y,
int w,
int h)
repaint
public void repaint()
processMouseEvent
public void processMouseEvent(MouseEvent e)
- Does not work because of the type cast Problem!
All event sources call the specialized method
(e.g. processMouseEvent) directly
processKeyEvent
public void processKeyEvent(KeyEvent e)
setBackground
public void setBackground(Color color)
- the Backgroundcolor is currently ignored completely (always white)
setVisible
public void setVisible(boolean v)
validate
public void validate()