| public void setSize(int width,int height) - used to set the width and height in pixels of the Component public void setBackground(Color c) - used to set the background color of the Component public void setVisible(boolean b) - used to make the Component visible or invisible public void setLocation(int x,int y) - used to set the Location of the upper left-hand corner of the Component public Graphics getGraphics() - used to create a Graphics object associated with that Component public void paint(Graphics g) - used to draw Graphics on a Panel or Applet public void update(Graphics g) - used to clear the drawing area before making a call to paint public void repaint() - used to make a call to update as soon as the controlling environment (browser/appletviewer) can |
| public Component add(Component comp) - used to add a Component to a Container public void setLayout(LayoutManager mgr) - used to set the Layout of the Container |
| Interface | Methods |
| ActionListener | public abstract void actionPerformed(ActionEvent e) |
| ItemListener | public abstract void itemStateChanged(ItemEvent e) |
| MouseListener | public abstract void mouseClicked(MouseEvent e) public abstract void mousePressed(MouseEvent e) public abstract void mouseReleased(MouseEvent e) public abstract void mouseEntered(MouseEvent e) public abstract void mouseExited(MouseEvent e) |
| WindowListener | public abstract void windowActivated(WindowEvent e) public abstract void windowClosed(WindowEvent e) public abstract void windowClosing(WindowEvent e) public abstract void windowDeactivated(WindowEvent e) public abstract void windowDeiconified(WindowEvent e) public abstract void windowIconified(WindowEvent e) public abstract void windowOpened(WindowEvent e) |
| TextListener | public abstract void textValueChanged(TextEvent e) |
| Component | Event Generated |
| Button | ActionEvent |
| Checkbox | ItemEvent |
| Component | Code added |
| Button | addActionListener(ActionListener l) |
| Checkbox | addItemListener(ItemListener l) |
| <applet code=MyApplet width=w height=h> </applet> |
| public abstract void clearRect(int x,int y,int width,int height) clears a rectangular area whose upper left-hand coordinate is (x,y) with the specified width and height public abstract void drawLine(int xl,int yl,int x2,int y2) draws a line from (x1,y1) to (x2,y2) public abstract void drawOval(int x,int y,int width,int length) draws an oval whose bounding box is a rectangle whose upper left-hand corner is (x,y) with the specified width and height public void drawRect(int x,int y,int width,int height) draws a rectangle whose upper left-hand coordinate is (x,y) with specified width and height public abstract void drawString(String str,int x,int y) draws a string on the Panel or Applet at the coordinates (x,y) public abstract void fillOval(int x,int y,int width,int height) draws an oval like drawOval does but fills it with the drawing color public abstract void fillRect(int x,int y,int width,int height) draws a rectangle like drawRect does but fills it with the drawing color public void drawPolygon(int xpoints[],int ypoints[],int points) draws a polygon on the Panel or Applet whose coordinates are specified in the arrays xpoints and ypoints and the number of points in the polygon specified by points public void fillPolygon(int xpoints[],int ypoints[],int points) draws a polygon like drawPolygon does but fills it with the drawing color public abstract void setColor(Color c) sets the color to use for drawing |