• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI flexibility

 
Nikes Shah
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Is it possible to make GUI control like Button as a container?

For example can I make four regions say left top,right top,left bottom,right bottom on a button, so if I click on left region area some action is fired
and different action is fired on different regions.

Can we make all controls to be displayed in all 360 degree direction? I mean can we rotate it?

Thanks,
Nikesh
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tell us what is the requirement. So we can think of different solution
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since JButton subclasses Container, the answer is yes, but it is going to confuse your users heavily. Why would you want to do it, when you got JPanel's?

Figuring out the click regions won't be that easy, effectively you will be clicking the same button every time. You will need to define the bounds for the top/left/bottom/right regions. Then you will need to trap the mouse clicks. Then you will need to get the co-ordinates for the click. Then you will need to figure out which region was clicked and process accordingly. Not worth the effort in my opinion.
Easier would be a JPanel with different buttons (or some suitable component) added using say BorderLayout (or any other suitable layout)

Graphics2D has a rotate method which you can use. Of course this would involve tweaking the paintComponent method.
 
Dmitry Mamonov
Greenhorn
Posts: 28
 
Maneesh Godbole
Saloon Keeper
Posts: 11096
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The transformer demo is fun.
Thanks for sharing.
 
Chiranjeevi Kanthraj
Ranch Hand
Posts: 290
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya Great
 
Nikes Shah
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing this demo. It's cool.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic