Forums Login/signup

Creating and opening a window if the button is clicked in an applet

+Pie Number of slices to send: Send
Thank you sir - Mr Ulf Dittmer. Please, this is how far I gone below:

Please note that there are two(2) classes or sets of codes: Form2.java and Qualification.java files. Each were written in different files.

Thanks, once more Sir.



+Pie Number of slices to send: Send
Continuation from https://coderanch.com/t/439882/Applets/java/Opening-Calling-up-applet-window

Please be careful to use the "Post Reply" button, and not the "New Topic" button.

That's way too much irrelevant code to go through and try to understand. What does it do now, what would you like it to do, and where are you stuck making progress?
+Pie Number of slices to send: Send
I am stucked in the area of clicking on a button in an applet code to open another applet window. That is all Sir.

Thanks for the correction you gave to me regarding the use of "post Reply" and "New Topic" Button.
+Pie Number of slices to send: Send
You posted close to 600 lines of code. As I said, that's way too much for people to go through and try to make sense of. At least tell us the lines numbers and variable names that you're talking about, and -just as important- what is and isn't happening according to your expectations.
+Pie Number of slices to send: Send
 

Ulf Dittmer wrote:You posted close to 600 lines of code. As I said, that's way too much for people to go through and try to make sense of. At least tell us the lines numbers and variable names that you're talking about, and -just as important- what is and isn't happening according to your expectations.



First of all thank you sir for your concern show toward putting me through. According to what you asked me to do:

I have problem in line 398, I have to click in that Jbutton to call up another applet file/window - I am familiar with calling up JFrame windows but not Applet windows.
So I want someone to put me through in doing same in Applet(That is calling up applet window from an applet by clicking a button). If possible, ignor what the codes I have there and give a simple one to demostrate it.

Thanks

Alam Winner Loveday I.
+Pie Number of slices to send: Send
You'll need to add an ActionListener to the JButton that opens a new JFrame. There's nothing applet-specific about the newly-opened window (except that it shows a little message telling the user that this is an applet-opened window).

You may also want to disable the button after the window has been created, so that clicking it repeatedly doesn't open multiple windows.
+Pie Number of slices to send: Send
 

Ulf Dittmer wrote:You'll need to add an ActionListener to the JButton that opens a new JFrame. There's nothing applet-specific about the newly-opened window (except that it shows a little message telling the user that this is an applet-opened window).

You may also want to disable the button after the window has been created, so that clicking it repeatedly doesn't open multiple windows.



Thank you sir. Don't be bored please, but there are somethings I want you to see with me, and these are:
First, can an applet have an actionPerformed() method in it?
Secondly, I got this line of code:
My confusion is that, I dont understand how to make use of "new URL", "otherApplet.html" and "NEWWIN" in the code.

Thanks
Alam Ikenna.

+Pie Number of slices to send: Send
 

First, can an applet have an actionPerformed() method in it?


It's not the applet that has an actionPerformed method - it's the object that implements the ActionListener interface. So any Button or JButton can have one.

Secondly, I got this line of code:
My confusion is that, I dont understand how to make use of "new URL", "otherApplet.html" and "NEWWIN" in the code.


That line of code opens a new browser window showing the "otherApplet.html" page. Have you read the javadocs of the showDocument method? Have you tried using it in your applet code?
Is this related to the window you want to open when the button is clicked? I had assumed that you want to open a Swing window, but this looks like you want a new browser window; please clarify which of these it is.
+Pie Number of slices to send: Send
 

Is this related to the window you want to open when the button is clicked? I had assumed that you want to open a Swing window, but this looks like you want a new browser window; please clarify which of these it is.



Actually, its a new browser window I want to open.

I have tried out that code and its running but the button couldn't open the required window. I did it this way:


Should I use a ftp protocol like this("ftp:80///d:/Alam/Qualification.html") Or what should I do to make it callup a window browser?

Thanks
Alam Winner Loveday I.

reply
reply
This thread has been viewed 3066 times.
Similar Threads
Applets
Applets
code can't work
JPanels with different content should have the same size
Applet doesn't show up with IE
More...

All times above are in ranch (not your local) time.
The current ranch time is
Jun 28, 2025 19:40:21.