• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Panel to acts like Button

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 77554
372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also good reading:

http://faq.javaranch.com/java/SwingIsAProperNoun
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic