implementing paint
- From: Carramba <user@xxxxxxxxxxx>
- Date: Wed, 21 Mar 2007 14:43:33 +0100
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!
.
- Follow-Ups:
- Re: implementing paint
- From: Andrew Thompson
- Re: implementing paint
- Prev by Date: Re: JTable calls setValueAt with index out of bounds
- Next by Date: Re: implementing paint
- Previous by thread: HTML table used in JTextPane not working with cellspacing="0" attribute
- Next by thread: Re: implementing paint
- Index(es):