Solved

Turning Applet into a Frame

Posted on 1998-08-31
3
227 Views
Last Modified: 2006-11-17
I have a working applet that runs from with in the
browser window.  But I have seen other applications
that when you click on a spot or go to a particular page,
instead of fireing up the applet inside the browser, it
fires it up in an external frame! I would like to be
able to do this. Can somebody show me some quick small
code to do this so that I could apply it to my project?
Thanx!
0
Comment
Question by:afsac
3 Comments
 
LVL 2

Expert Comment

by:bernfarr
ID: 1223040
I've done this in the past by extending the Frame class. The applet that is displayed on the web page simply shows a button. When the user clicks on the button, the class I derived from the Frame is invoked.

Two parameters passed into the applet are the width and the height of the frame. When the button is pressed, these are passed as arguments into my Frame constructor. Inside the constructor, you can call the resize() function to set the real size that you want for your window.

The frame itself contains the various interface components the user works with.

I hope this gives you enough to do some further reading yourself.
0
 
LVL 3

Accepted Solution

by:
sailwind earned 200 total points
ID: 1223041
Pretty simple. You will still need an applet to run the new frame from tho.

public class myApplet extends Applet {

     public void init() {
           Frame myFrame = new Frame();
           myFrame.setSize(200,200);
           myFrame.setVisible(true);
           myFrame.add(new Label("Hello World"));
     }
}

Simple as that. You simply make an instance of the frame
when you want to pop up a new window, and specify whatever
components you want to add to the frame. You can always
create a custom Frame class of your own to display your
data. You can also add a button to the applet so that when
it's pressed, it'll pop up the new frame for display.


0
 

Author Comment

by:afsac
ID: 1223042
Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 122
type mismatch (Object[] to double[] 4 41
ejb mdb examples 1 19
how to debug htl and js pages 8 54
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question