Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

urgent..how to continue getting input

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i am a Java beginner. I have a doubt regarding the applet programming... what should be done to continue getting input once one i/p is got from keyboard processed...for eg, consider the problem of drawing some rectangles in an applet and first u get dimension using the JOption pane class and do the processing and o/p is displayed...but how do i do it if i want to accept one more i/p from keyboard after the first one and continue to do the program? where should i include in coding...in paint or init method.....please help....
thank you in advance
gaya
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends how your program runs, but basically you would just have a loop, usually in start(), like
while( running ) // running is bool you set to stop program
{
getInput();
drawStuff();
repaint(); // this makes paint() get called
}
is this what you mean?
 
gayathri bhushan
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Grant,
Thank you for your reply. Though your reply answered my question i have some doubts regarding how to achieve this now.
I am just a beginner programmer and so iam confused. Will the getinput() function have the JOptionpane input message instead of the init() doing it? and the drawstuff() have the actual drawing instructons instead of the paint() method. am i clear in my question? if so, please take time to answer me.
thank you.
gayathri
 
Can you smell this for me? I think this tiny ad smells like blueberry pie!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic