Draw a JButton to look like a JLabel (or at least without the button edge?)

Posted by Electrons_Ahoy on Stack Overflow See other posts from Stack Overflow or by Electrons_Ahoy
Published on 2010-06-11T18:36:02Z Indexed on 2010/06/11 18:43 UTC
Read the original article Hit count: 357

Filed under:
|
|
|

I've got a JButton that for various reasons I want to act like a button, but look like a JLabel. It doesn't actually have to be a JLabel under the hood, I just don't want the raised button edge to show up.

Is there an easy way to turn off the "button look" for JButtons but keep all the button functionality?

I could build some kind of composed subclass hyperbutton that delegated to a jlabel for display purposes, but I'm really hoping there's something along the lines of button.lookLikeAButton(false).

© Stack Overflow or respective owner

Related posts about java

Related posts about swing