• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Application to be implemented???

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to make an application using applets, front-end of which should be similar to a dialog box kind of interface (independent of a browser and the appletviewer frontend) and has 5 steps each on one dailog box kind of interface where the user will be putting some data in the respective fields. When I say next it should display the next step above the dialog box ( height and width of that next step similar to dailog box).I mean to say that the first step gets hidden over the next step so that the data also remains on the client side.
Can anybody please suggest me what should I use and can anybody give me the similar example..
Thanks in advance
Kajol
 
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kajol!
I am trying to understand your question.
You say you want to use applets but


(independent of a browser and the appletviewer frontend)


Unfortunately, applets will not run outside of a browser or applet viewer. You would have to use an application.
Or are you saying you want your applet in the client's browser to pop up dialogs in which the user enters information? If so, why do you need the dialogs? Why not just use an applet with user-input controls and card layout (so that once the user completes a data-entry step, the next data-entry step covers the first)?
Please forgive me if I have misunderstood you. I would like to help, but I need to understand your question better. Please post again.
Stephanie
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kajol,
I have to agree with Stephanie that your question is hard to understand... (I think you want a series of screens in next/previous order, run as an application... am I right?) But I have to disagree with her assessment that Applets cannot be run outside of the browser or AppletViewer! Applet extends Panel, thus it can be added to any Container... cool, huh? The behavior you specified (screens displayed in a next/previous series) is what the CardLayout was made for. All I would do is make a Frame and a Panel. Set the Panel's layout to CardLayout, then just add each Applet you have to the Panel. Add this Panel to the Frame at BorderLayout.CENTER, then create another Panel, add two Buttons to it (Next and Previous), and then add the second Panel to the Frame at BorderLayout.SOUTH. In the Buttons ActionListeners call previous() and next() for the appropriate Button ( these are methods of CardLayout... read up on them to see exactly how to use them.) Also, you may just want to use Panels instead of Applets since you don't need the added functionality that Applet provides.
HTH,
-Nate
[This message has been edited by Nathan Pruett (edited February 14, 2001).]
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thnks Nathan & Stephanie
Thats exactly I was looking for..
But Nathan can u just elaborate on this ....by an exaple...
That would be really nice
Kajol
[This message has been edited by Kajol Shroff (edited February 15, 2001).]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure Kajol,

HTH,
-Nate
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathan,
Thanks for ur example but its giving me error..have u compiled it and sent to me
Kajol
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kajol,
It will give you an error unless you replace applet1 through appletn in this code with your own applets :

I tested it out with some applets I had lying around in the same directory and it worked fine...
HTH,
-Nate
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathan,
First of all thanks a lot for all ur replies.
Nathan I tried running the applet by putting some other applets file names which are in the same directory.
My queries are:
1) Should the applet be named as just AbcApplet or AbcApplet.java
2) I couldnt understand the following statements in the main method:
ct.addWindowListener( new WindowAdapter { public void windowClosing( WindowEvent e ) { System.exit( 0 ); } } );
Can u explain me them...
3) Can we use instead of main init()....i mean I was told by my professor that applet dosent use main metod as it has init().
Kajol
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathan
Are u busy...why are u not replying....
Guys anybody else can reply...
Kajol

 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kajol,
Sorry, I usually slack off on here on the weekends... the faster internet connection at my office is so much better than my connection at home...
Here are the answers to your questions...
1.) It should be AbcApplet not AbcApplet.java... AbcApplet.java is just the source code file... AbcApplet is the class you are creating objects from... in fact, if you were using AbcApplet, your code would look like :

2.) I added a windowListener ( an interface that listens for events related to windows ) by creating an anonymous inner class of WindowAdapter. Basically, I just created a new class inside my code to take care of window events in the frame that I made...
3.) Well, this code is not an Applet, it is a Frame... so init() would not mean anything special to it... but you could write an Applet that would use it, like so...

This code is very much like the main() method in the original program... but it is a new program... an Applet that uses the CardTest program I made earlier... the init() method is basically the same as the main() method of the original program, and I used the Applet itself to listen for window events from the CardTest frame, instead of using an anonymous WindowAdapter like I used in the CardTest main() method ( this is why I must put all the methods in windowListener inside the new applet ). The windowClosing() method, instead of calling System.exit( 0 ) now just makes the CardTest frame invisible. (Applets cannot call System.exit() because they are running inside the browser...)
HTH,
-Nate
[This message has been edited by Nathan Pruett (edited February 19, 2001).]
 
Kajol Shroff
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathan,
I couldnt get the second and the third part....all i want to know is
ct.addWindowListener( new WindowAdapter { public void windowClosing( WindowEvent e ) { System.exit( 0 ); } } );
Can u explain me them...
See i tried running the applet but it is giving me error at this statement....is it right....
Kajol
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kajol,
It is giving you an error when running, right? That is because an applet should not call System.exit()... that would shut down the browser (or the JVM inside the browser... either would be bad for an applet to do), so you have to call ct.setVisible(false) like I did in my applet example. If you want to continue using the anonymous WindowAdapter (the code you quoted) you will have to make ct final (i.e. final CardTest ct; when you declare ct. ) This just hides the window instead of exiting the system.
HTH,
-Nate
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic