• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dynamically change the position of Button on a panel

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want a simple button to be displayed ..but on clicking it or by any other event I want it to be redrawn at some other coordinates..i.e it should it change its position....I dont want to draw many hidden buttons all over the panel and play with their visibility attribute..
Please help
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out
By manipulating the first two parameters you can move the same button where ever you wish.
Don't forget to call the revalidate() and repaint() on the parent container after you move though!
 
Author
Posts: 986
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maneesh Godbole wrote:Check out
By manipulating the first two parameters you can move the same button where ever you wish.
Don't forget to call the revalidate() and repaint() on the parent container after you move though!



But if you're using one of the standard layout managers than the revalidate() will eventually cause
the layout manager to set the bounds back to where it had been, so set the layout manager to null.
 
Maneesh Godbole
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Brian Cole wrote:

Maneesh Godbole wrote:Check out
By manipulating the first two parameters you can move the same button where ever you wish.
Don't forget to call the revalidate() and repaint() on the parent container after you move though!



But if you're using one of the standard layout managers than the revalidate() will eventually cause
the layout manager to set the bounds back to where it had been, so set the layout manager to null.



Absolutely.
But as the OP had mentioned "co-ordinates" I presumed it was null layout already.
BTW, I really liked the use-cases you cited in the button right click thread. I had missed out on some of them. Fantastic analysis! I picked up a few tips there. Thank you
 
muktesh tripathi
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks your answers were of really great help..I was not using null layoutManager and that was creating problems as I was using netbeans ide to create the application..thanks again.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic