We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,171 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

button + loop

Hi guys I have a loop that increases my setsize to 1100 which works fine. My question is is it possiable for when I click my button the loop executes then if I click the button again it does not execute the loop and carry's on with the rest of the functions set for the button?

if (e.getSource() == check) {
   
      
      
     
      for (int i = 900; i < 1100; i++) {
   
          if(i == 1100) break;{
          
setSize(i,700);
} 
          
    

      }
2
Contributors
3
Replies
9 Hours
Discussion Span
1 Year Ago
Last Updated
4
Views
TIM_M_91
Junior Poster in Training
83 posts since Feb 2012
Reputation Points: 18
Solved Threads: 0
Skill Endorsements: 0

well ... one way is to do it in a thread.
first time you click => start
next time you click => sleep

stultuske
Industrious Poster
4,374 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24

well ... one way is to do it in a thread.
first time you click => start
next time you click => sleep

How would I implement it?

TIM_M_91
Junior Poster in Training
83 posts since Feb 2012
Reputation Points: 18
Solved Threads: 0
Skill Endorsements: 0

thread tutorial.

I would go for the 'implements Runnable' solution. might be a good exercise for you to figure out why.

stultuske
Industrious Poster
4,374 posts since Jan 2007
Reputation Points: 1,318
Solved Threads: 610
Skill Endorsements: 24

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0698 seconds using 2.72MB