• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.



 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Alam Ikenna
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic