MyCanvaspublic class MyCanvas extends JLabel Dummy Canvas class, to represent the real main part of an application * |
Fields Summary |
---|
protected int | width | protected int | height | protected int | pad | protected Color | col |
Constructors Summary |
---|
MyCanvas(int w, int h)
this("", w, h);
| MyCanvas(String l, int w, int h)
super(l, JLabel.CENTER);
width = w; height = h;
| MyCanvas(String l, int w, int h, Color c)
this(l, w, h);
setBackground(c);
|
Methods Summary |
---|
public java.awt.Dimension | getMinimumSize()
return new Dimension(width, height);
| public java.awt.Dimension | getPreferredSize()
return new Dimension(width+pad, height+pad);
| public void | paint(java.awt.Graphics g)
Dimension d = getSize();
g.setColor(col);
g.fillRect(0, 0, d.width-1, d.height-1);
| public void | setColor(java.awt.Color c)
col = c;
repaint();
|
|