Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Turning Applet into a Frame

Posted on 1998-08-31
3
Medium Priority
?
231 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 800 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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

972 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