Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class DrawingPanel

    java.lang.Object
      DrawingPanel

All Implemented Interfaces:
  java.awt.event.ActionListener, java.util.EventListener

    public class DrawingPanel

extends java.lang.Object
implements java.awt.event.ActionListener

The DrawingPanel class provides a simple interface for drawing persistent images using a Graphics object. An internal BufferedImage object is used to keep track of what has been drawn. A client of the class simply constructs a DrawingPanel of a particular size and then draws on it with the Graphics object, setting the background color if they so choose. To ensure that the image is always displayed, a timer calls repaint at regular intervals.

Author:
  Stuart Reges, Marty Stepp

Constructor Summary
`DrawingPanel(int width, int height)`
`DrawingPanel(int width, int height, java.lang.String panelTitle)`

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent e)`
`void` | `addKeyListener(java.awt.event.KeyListener listener)`
`void` | `close()`
`int` | `getClickX()`
`int` | `getClickY()`
`java.awt.Graphics2D` | `getGraphics()`
`int` | `getHeight()`
`int` | `getMouseX()`
`int` | `getMouseY()`
`int` | `getWidth()`
`boolean` | `mousePressed()`
`void` | `setBackground(java.awt.Color c)`
`void` | `setVisible(boolean visible)`
`void` | `sleep(int millis)`
`void` | `toFront()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DrawingPanel

    public DrawingPanel(int width,
                        int height)

### DrawingPanel

    public DrawingPanel(int width,
                        int height,
                        java.lang.String panelTitle)

Method Detail

### addKeyListener

    public void addKeyListener(java.awt.event.KeyListener listener)

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`

### getGraphics

    public java.awt.Graphics2D getGraphics()

### setBackground

    public void setBackground(java.awt.Color c)

### setVisible

    public void setVisible(boolean visible)

### sleep

    public void sleep(int millis)

### close

    public void close()

### toFront

    public void toFront()

### getWidth

    public int getWidth()

### getHeight

    public int getHeight()

### getMouseX

    public int getMouseX()

### getMouseY

    public int getMouseY()

### getClickX

    public int getClickX()

### getClickY

    public int getClickY()

### mousePressed

    public boolean mousePressed()

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD