Here is my simple application which I built just to show my issue (original app is a huge, but issue is the same).
The problem is I can not show the JApplet (and can't show anything inside it too). Working in Netbeans, Java SE. Can you tell me what I've missed?
package testjava;
import java.awt.BorderLayout;
import java.awt.Component;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JPanel;
/**
*
* @author Epsilon
*/
public class TestJava extends JApplet implements Runnable {
protected Thread ivThread;
protected JPanel p1, p2;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
JApplet applet = new TestJava();
applet.init();
applet.start();
}
@Override
public void init() {
super.init();
setSize(880, 710+28);
setLayout(new BorderLayout());
setVisible(true);
p1 = new JPanel();
add(p1, BorderLayout.CENTER);
p2 = new JPanel();
add(p2, BorderLayout.SOUTH);
p1.requestFocus();
}
@Override
public void start()
{
if(ivThread == null)
{
ivThread = new Thread(this, "TestJava");
ivThread.start();
}
}
@Override
public void run() {
System.out.println("Hello from Thread!");
Component b1 = new JButton("Click Me");
p1.add(b1);
}
}