Friday, August 7, 2009

Overriding paint dans Netbeans.

For my first post, here is a small tips about the use of Netbeans/

Problem:

If you wan to override the paint method in Netbeans, you can't !
In fact, if you use the Netbeans editor you will obtain a a class like that :
*/
public class PacketMakerView extends FrameView {
Lien
public PacketMakerView(SingleFrameApplication app) {
Et il vous sera impossible d'overrider la méthode paint.

Solution:
In design interface, make a right click on the component then choose customize code.
To override paint, you have to change the initialize with "custom creation".


So now, it's possible to override paint method !

test = new javax.swing.JLabel()
{
public void paint(Graphics g) {
super.paint(g);
// ...
}
}

No comments:

Post a Comment