Results 1 to 5 of 5
  1. #1
    obdi is offline Member
    Join Date
    Jul 2008
    Location
    CA
    Posts
    15
    Rep Power
    0

    Question [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.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    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.

  3. #3
    obdi is offline Member
    Join Date
    Jul 2008
    Location
    CA
    Posts
    15
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    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.
    Thanks Norm,
    Java Code:
     CASHONHAND = JOptionPane.showInputDialog("Enter The Amount You Wish To Play");
                            cashonhand = Integer.parseInt(CASHONHAND);
                            //cashonhand = Integer.parseInt(cashonhand.getText());
                            CashOnHandNum.setText("" + cashonhand);
    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?
    Last edited by obdi; 07-13-2008 at 08:30 AM.

  4. #4
    gustio is offline Member
    Join Date
    Jun 2008
    Posts
    14
    Rep Power
    0

    Default 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

  5. #5
    gustio is offline Member
    Join Date
    Jun 2008
    Posts
    14
    Rep Power
    0

Similar Threads

  1. setText in event
    By sniezna.stopa in forum SWT / JFace
    Replies: 0
    Last Post: 06-20-2008, 02:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •