I have two classes:

(1) Class A, which extends JApplet, implements Runnable + some Listener stuff
(2) Class B, which has a main method and is not an applet

My question is, how do I create class A with class B's main method? Is this even possible?

What I'm doing right now (and this may be totally wrong because I'm still an amateur) is the following:

public class classB
    static classA applet;

    public static void main(String[] args){

        applet = new classA();

The problem is, the applet isn't showing up.

Using some System.out.println() lines, I'm pretty sure of the following:

  1. If I don't call the applet's init() method, that method isn't executed.
  2. The applet's paint() method is not executed.

Any idea what's going on?

Edit: By the way, the applet functions properly when I launch it manually/without classB.

Edited by kedxu

5 Years
Discussion Span
Last Post by kedxu

Nevermind, figured it out.

I had to make a JFrame and then add the applet to the frame, then make the frame visible.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.