Solved

Turning Applet into a Frame

Posted on 1998-08-31
3
226 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
object oriented programming comparison 5 71
even odd program using while loop 3 40
by zero exception 10 40
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 33
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
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.

770 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