944,054 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 1397
  • Java RSS
Apr 6th, 2006
0

who can help me with GUI??

Expand Post »
already done the TIO one as follows:
do
{ dStr=JOptionPane.showInputDialog("Please enter "+name+"'s demand:");
d=console.nextInt();
if (d<0)
System.out.println("Demand can't be negative.");
}while(d<0);

but don't know how to transfer it into GUI style?
anyone can help me? Thx!!!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
c_est_la_vie is offline Offline
1 posts
since Apr 2006
Apr 6th, 2006
0

Re: who can help me with GUI??

Quote originally posted by c_est_la_vie ...
already done the TIO one as follows:
do
{ dStr=JOptionPane.showInputDialog("Please enter "+name+"'s demand:");
d=console.nextInt();
if (d<0)
System.out.println("Demand can't be negative.");
}while(d<0);

but don't know how to transfer it into GUI style?
anyone can help me? Thx!!!!
Get a good book which shows you how to do the basics of creating and listening to user input with GUI's.
Featured Poster
Reputation Points: 1536
Solved Threads: 431
Posting Expert
iamthwee is offline Offline
5,865 posts
since Aug 2005
Apr 7th, 2006
0

Re: who can help me with GUI??

What are you trying to do exactly. Are you doing a console app with JOption pane that will write to the console or do you want it to show up on like a GUI?, both are pretty simple. If you are just writing it to console then System.out.print(); will work. If you want to print it to a GUI, you will nees a label, JLabel label = new JLabel(), then set the text of the label to the input you recieved, which I think is a method called setText, so label.setText(inputHere); and I am not sure but I think you might have to repaint.
Reputation Points: 23
Solved Threads: 6
Posting Pro
Dark_Omen is offline Offline
573 posts
since Apr 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Class File, making directories... relative to
Next Thread in Java Forum Timeline: Topological Sort using dfsOut method





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC