User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 422,996 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,896 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 2457 | Replies: 3
Reply
Join Date: Apr 2004
Posts: 2
Reputation: jim1 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jim1 jim1 is offline Offline
Newbie Poster

How can i swap two buttons by clicking on them

  #1  
Apr 4th, 2004
that is i've got an array of buttons and i want to replace two buttons (their location on the screen) by clicking on first and then clicking on the second to replace thier location i.e. when i click on button1 first (which is at the first location in a row of buttons on the screen) and then button5, then these two button should replace locations i.e. after clicking on button5 at the fifth location in a row of buttons button5 goes to the location of button1 and button1 goes to the location of button5.

Is there any way that i can do this without replacing their captions with each other as currently i can swap them by swapping thier captions.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2004
Posts: 218
Reputation: BountyX is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 6
BountyX's Avatar
BountyX BountyX is offline Offline
Code Guru

Re: How can i swap two buttons by clicking on them

  #2  
Apr 6th, 2004
If you are using breezy swing (not sure if it works on standard swing):

just use the setLocation() method with the appropraite button object.

ex

myButton.setLocation(1,1);
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
Reply With Quote  
Join Date: Jul 2004
Location: Pakistan
Posts: 1,673
Reputation: nanosani is an unknown quantity at this point 
Rep Power: 8
Solved Threads: 49
Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

Re: How can i swap two buttons by clicking on them

  #3  
Jul 15th, 2004
explain more ... what layout are you using ??
Reply With Quote  
Join Date: Apr 2004
Posts: 2
Reputation: jim1 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
jim1 jim1 is offline Offline
Newbie Poster

Re: How can i swap two buttons by clicking on them

  #4  
Jul 23rd, 2004
thanks for your reply but i have already sorted it out therefore i have unsbscribed from this thread.
many thanks
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Java Forum

All times are GMT -4. The time now is 3:38 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC