Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Ronnie Mccoy   on Oct 08 In Java Category.

  
Question Answered By: Alfonsine Miller   on Oct 08

I am not sure if this is the one  that you are looking for.
Let the class  extends the JApplet as follow:

public class calcg extends JApplet implements ActionListener {
.....

// Initialize the applet
public void init() {
new calcg();
}

public calcg() {
//Create Title
//super("Calculator");
...
//Set size  and make visible
//setSize( 190, 225 );
//setVisible( true );
//setResizable( false  );
}

public void actionPerformed(ActionEvent ae) {
...
}

public static void main(String[] args) {
calcg application  = new calcg();

JFrame frame = new JFrame("Calculator");
frame.getContentPane().add(application);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(..,..);
frame.setVisible(true);
}
}

By doing this, the application can be run as a standalone
and as an applet.

I hope this will help  to solve your problem.

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on JApplet Problem Or get search suggestion and latest updates.


Tagged: