Results 1 to 5 of 5
- 07-12-2008, 11:27 AM #1
Member
- Join Date
- Jul 2008
- Location
- CA
- Posts
- 15
- Rep Power
- 0
[SOLVED] new2java- gettext settext
Code i wrote for ClickPlay is to get the first hand money input into the textfield by using InputDialog, i try to put it in the ClickPlay(), when i click start, it keeps poping up the dialog box, and not reading the number to the textfield, is something wrong with the code or i need to put it to somewhere else(which i tried to put it to different places) please help
Java Code:CASHONHAND = JOptionPane.showInputDialog("Enter The Amount You Wish To Play"); cashonhand = Double.parseDouble(CashOnHandNum.getText()); CashOnHandNum.setText("" + cashonhand);
Java Code:private class ClickPlay implements ActionListener { public void actionPerformed(ActionEvent e) { CASHONHAND = JOptionPane.showInputDialog("Enter The Amount You Wish To Play"); cashonhand = Double.parseDouble(CashOnHandNum.getText()); CashOnHandNum.setText("" + cashonhand); ActionListener Begin = new TimeStamp(); MyTimer = new Timer(35, Begin); MyTimer.start(); } private class TimeStamp implements ActionListener { public void actionPerformed(ActionEvent e) { Action++; if (Action < 20) { HideOne = RandomNumbers(); HideTwo = RandomNumbers(); HideTre = RandomNumbers(); NumberOne.setText("" + HideOne); NumberTwo.setText("" + HideTwo); NumberTre.setText("" + HideTre); } else { Action = 0; MyTimer.stop(); NumberOne.setText("*"); NumberTwo.setText("*"); NumberTre.setText("*"); } } } }Java Code:JTextField CashOnHandNum = new JTextField(); String CASHONHAND;
Last edited by obdi; 07-12-2008 at 11:31 AM.
- 07-12-2008, 04:17 PM #2
For debugging you code, add some println() statements to it to show the values of variables as they are changing and to show control flow.
For example, what is the value of CASHONHAND on return from the JOptonPane call? You don't appear to do anything with it.
- 07-13-2008, 08:28 AM #3
Member
- Join Date
- Jul 2008
- Location
- CA
- Posts
- 15
- Rep Power
- 0
Thanks Norm,
so now i get value for CASHONHAND, here's my question. Why don't i need getText()? or when i use the .parse with String i don't need it? it's like a syntax?Java Code:CASHONHAND = JOptionPane.showInputDialog("Enter The Amount You Wish To Play"); cashonhand = Integer.parseInt(CASHONHAND); //cashonhand = Integer.parseInt(cashonhand.getText()); CashOnHandNum.setText("" + cashonhand);Last edited by obdi; 07-13-2008 at 08:30 AM.
- 07-18-2008, 05:57 AM #4
Member
- Join Date
- Jun 2008
- Posts
- 14
- Rep Power
- 0
jScroolPane in JInternalFrame
Hey everybody,
- I make menu form(JForm) to access another form (this form use max resolution screen which computer run)
- From menu form, I load another form(JInternalFrame) into this form.
- another form have jScroolPane in JInternalFrame.
Process:
- When I run my program, scrool in another form can not functioned.
My question:
- How I must do for activating this scrool?
- I can use scrool with JDialog, but I can not using screen resolution for making display area. How I set display area JDialog?
Thank's a lot for your time.
Salam,
bagianto
- 07-21-2008, 09:28 AM #5
Member
- Join Date
- Jun 2008
- Posts
- 14
- Rep Power
- 0
Similar Threads
-
setText in event
By sniezna.stopa in forum SWT / JFaceReplies: 0Last Post: 06-20-2008, 02:56 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks