implementing paint



Hi!
I have extended JButton, and know I wonder how I can implement public void paint(Graphics g)
What I want to do is to draw a triangle in the background, that is would by in right down corner like 40 % of the length and hight of the button, and with 3% distance from bounds.

class MiniCalDay extends JButton {


private Color c;

MiniCalDay(String name, Color color) {
super(name);
this.c=color;
String thisObjectName = this.getClass().getCanonicalName();
setSize(settings.Size.CELL_SIZE);
setToolTipText(name);
setVerticalTextPosition(SwingConstants.CENTER);
setHorizontalTextPosition(SwingConstants.LEADING); setBorderPainted(settings.getBorder(thisObjectName));
setBackground(settings.getBackround(thisObjectName));
setForeground(settings.getForeground(thisObjectName));
setFont(settings.getFont(thisObjectName));
}

@Override
public void paint(Graphics g) {
//draw triangle with color c ???
//how?
}
}

Thanx in advance!
.


Quantcast