JLabel : Java Glossary

*0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ (all)

JLabel
is a component used to display decorative text on the screen to label some other component. The user cannot ever modify the text, unlike JTextfields. In AWT (Advanced Windowing Toolkit) you use Label, in Swing JLabel. JLabel.setHorizonalAlignment ( JLabel. LEFT ) or JLabel.setHorizonalAlignment ( JLabel. RIGHT ) lets you control the justification or the shortcut specification in the constructor. You control positioning of the text within the JLabel with setHorizonalAlignment and setVerticalAlignment and with setBorder.

Gotchas

Multiline Labels

Unfortunately, Oracle does not document just what features of HTML are supported. I discovered by experiment the entity &rArr; is not supported. The renderer does not insist on <body>…</body> tags. I have discovered that JEditorPanes accept <style commands. I have written Oracle asking them to clarify.

Learning More

Oracle’s Javadoc on JLabel class : available:


This page is posted
on the web at:

http://mindprod.com/jgloss/jlabel.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\jlabel.html
Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

IP:[65.110.21.43]
Your face IP:[3.128.31.227]
You are visitor number