Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

setVerticalAlignment and setHorizontalAlignment for JLabel.

$
0
0
Both setVerticalAlignment and setHorizontalAlignment don't seem to have any effect at all.

I was playing around with the methods of JLabels and found the above two methods.

I inserted a String, an icon and lastly the Vertical/Horizontal Alignment property. I tried all the properties ( JLabel.LEFT , JLabel.RIGHT etc for horizontal alignment ) and all produced the exact same result.

 label1 = new JLabel("Testtttttttttttttt");
    label1.setIcon(icon);
    label1.setHorizontalAlignment(JLabel.TRAILING);


Is it supposed to be this way ?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>