I noticed that the JButton is not shown when in the class there is a
public void paint(Graphics g)
You can then only see when you have your mouse over it...
can somebody tell me how the button can still be shown, even with a
public void paint(Graphics g)?
here's the code:
/**
* @(#)test.java
*
* test Applet application
*
* @H�ctor van den Boorn
* @version 1.00 2007/2/26
*/
import java.awt.*;
import java.applet.*;
import javax.swing.*;
public class test extends Applet
{
JButton button;
public void init()
{
setLayout(null);
button = new JButton("Click here");
button.setBounds(20,20,100,20);
this.add(button);
}
public void paint(Graphics g)
{
g.drawString("Why isn't this working?",100,100);
}
}