• 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

Making Palette

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
How can I make a palette that contains some shapes so I can drag - drop those shapes to a drawing area?
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One way you could do this is with a glass pane set over your JRootPane on you top–level container. When you start dragging the shape from the origin panel you could set the glass pane visible and draw/drag the shape on the glass pane (possibly removing it from the origin component). When you drop the shape over the destination component (mouseReleased) you can set the glass pane invisible and draw the shape on the destination component. You could remove the shape from the origin component after the drop onto destination or at the initial drag. You would need MouseInputAdapters for both the origin component and glass pane component. The Swing tutorial has a glass pane demonstration example with useful suggestions found on How to Use Root Panes.
 
reply
    Bookmark Topic Watch Topic
  • New Topic