Ariyan
Ariyan

Reputation: 15138

Display text over the icon in JXLabel

I'm using SwingX label for a image select/preview.
I need to show both text and icon together but when I set icon the text disappear!
How can I show text over the icon on a JXLabel?

Thanks

Upvotes: 1

Views: 287

Answers (1)

mKorbel
mKorbel

Reputation: 109823

there no issue with that, there are two ways

1.correct way (implemented in the API, good habits, blablabla)

JLabel.setHorizontalTextPosition(JLabel.CENTER); 
// search for equivalent in SwingX

2.crazy way to set proper LayoutManager for JXLabel and put there another JXLabel to the desired coordinates Location

Upvotes: 3

Related Questions