Solved

Turning Applet into a Frame

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This video teaches viewers about errors in exception handling.
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.

760 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

21 Experts available now in Live!

Get 1:1 Help Now