954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

who can help me with GUI??

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!!!!

c_est_la_vie
Newbie Poster
1 post since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

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.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

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.

Dark_Omen
Posting Pro
573 posts since Apr 2004
Reputation Points: 23
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You