2 Replies - 208 Views - Last Post: 29 November 2012 - 05:50 PM Rate Topic: -----

#1 fvnbab  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 03-November 12

Hold button in a fruit slot machine

Posted 29 November 2012 - 04:39 PM

hi,
i am trying to add hold button to my fruit slot machine it seems not to work!
here code
private JButton btnHOLD1,btnHOLD2,btnHOLD3;
 add(btnHOLD1);
     add(btnHOLD2);
      add(btnHOLD3);
btnHOLD1.addActionListener(this);
      btnHOLD2.addActionListener(this);
      btnHOLD3.addActionListener(this);

if (e.getSource() == btnHOLD1 ){//holds one reel of picture
        	 counter = k1;
        	  timer.stop();









Is This A Good Question/Topic? 0
  • +

Replies To: Hold button in a fruit slot machine

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Hold button in a fruit slot machine

Posted 29 November 2012 - 04:44 PM

We don't have enough code ?
Just guessing you don't have a Timer for each reel ? You should have timer1, timer2, and timer3 and just stop the one off that reel

Actually you should learn how to use array, will work for both JButton and Timer and will allow a nice loop in your actionPerformed()
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10385
  • View blog
  • Posts: 38,434
  • Joined: 27-December 08

Re: Hold button in a fruit slot machine

Posted 29 November 2012 - 05:50 PM

Please avoid duplicate posting.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1