• 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

painting a custom JComponent

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy,
I searched through the forum archives and I couldnt find the answer to my question so I figured i'd post this in hopes that someone can help me.
I want to eventually create an canvas where i can click and draw rectangles and interact with them(e.g. move them around- have borders on them etc). I figured that having a JComponent that drew itself as a rectangle would be a good idea, instead of creating a hack graphic using AWT(two rectangles overlapping - one for the border, one for the regular rectangle).
my two questions are:
1. Is extending JComponent the best approach to this?
2. Can anyone tell me or point me in the direction of a good tutorial on how to extend JComponent and get it to draw itself?
thanks in advance!!
 
Bruce Ichiban
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmmm i think i may have figured out a solution -
to extend JButton. i think this may be the easiest way...
but other solutions are welcome!
Cheers!
 
On top of spaghetti all covered in cheese, there was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic