aspose file tools*
The moose likes Applets and the fly likes Creating and opening a window if the button is clicked in an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Creating and opening a window if the button is clicked in an applet" Watch "Creating and opening a window if the button is clicked in an applet" New topic
Author

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

Alam Ikenna
Greenhorn

Joined: Mar 26, 2008
Posts: 16
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.



Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
Continuation from http://www.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?


Ping & DNS - my free Android networking tools app
Alam Ikenna
Greenhorn

Joined: Mar 26, 2008
Posts: 16
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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
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.
Alam Ikenna
Greenhorn

Joined: Mar 26, 2008
Posts: 16
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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
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.
Alam Ikenna
Greenhorn

Joined: Mar 26, 2008
Posts: 16
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.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42292
    
  64
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.
Alam Ikenna
Greenhorn

Joined: Mar 26, 2008
Posts: 16
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating and opening a window if the button is clicked in an applet