Solved

Turning Applet into a Frame

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now