• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Help , Help .... how to solve this problem ???  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ......
I am studing java Applets ...
And i am facing a problem that needs your help ...
I am trying to write a simple program that ask user to enter a number (from the Menu by using switch command) ...
this what i wrote ..
===========================

==================
The problem is ...
That i want to use ( public void init() , and public void paint ( Graphics g ) ) at the same time ....
Becuse i need them both ...
The init() .... will be used in the input box ..
The Paint(G...) ... will be used to get the result in the Applet box ...

Help me pleaz ....... Pleaaaaaaaaaaaaaaaaz

The Bear
[ October 11, 2002: Message edited by: Rob Ross ]
 
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"The Bear,"
Please change your name to comply with the naming policy to which you agreed when you registered here..


For your publicly displayed name,
use a first name, a space, and a last name.


You can change your name
here:

You can also find the naming policy
here:
Thank You!
 
A.Rahman Yusuf
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Rob ....
I get your point and changed my Publicly Displayed Name:
...
But any help in solving my problem ??!!!

ThanX
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for changing your name.
First, realize that your init() method only gets called one time, so your drawstring also only gets called one time.
What you really want to do is add a JButton to your applet, and when the user clicks the button, then you bring up your dialog. That way you can bring up your dialog more than one time.
You're doing the right thing by making "c" a member variable. I'd suggest however you rename it to something that more clearly defines its purpose, like userChoiceNumber or something like that.
You do indeed need to add a paint() method as well. In that method, you can just put your switch statement that you currently have in your init() method.
I hope this helps!
[ October 11, 2002: Message edited by: Rob Ross ]
 
Screaming fools! It's nothing more than a tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!