This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Panel to acts like Button

 
Anil Patil
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanted to create Panel which will acts like a button.
Like
In panel i ll use labels and textbox, and whole panel should have property of button.

Or in Button, it is possible to put labels and text area
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is possible to add a text box to a button. Or you can use extends. Or you can have a button occupying the whole of a panel, and set the button to be transparent.

But all those suggestions appear bad design to me; a button is a button, not a text box, and a panel is a panel, not a button.
 
Anil Patil
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ritchie,

Thanks for suggestion, But my requirements are specific.

Can you elaborate more how can add Labels in button, as I am new to Swings/AWT components
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JComponent extends Container, so all JComponent subclasses including JButton can be used (or abused) as a container.

I am new to Swings/AWT components

Recommended reading: The Java� Tutorials : Creating a GUI with JFC/Swing
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic