A JLabel's Size
Something I'm curious about...
When I create a JLabel and place it into a JPanel/JDialog/some other
component, it always appears as the correct size (just large enough to
display the text + appropriate boundary around the text). But, when I
attempt to get that JLabel's size, it returns 0 width and 0 height
unless I specifically set the size of the JLabel.
Shouldn't the size have been set correctly upon the addition of the
text to the label? I'm confused on how this is working and why it's
working that way.
.
Relevant Pages
- Problem updating a label
... I'm using a JLabel to indicate the status of a program I'm running in ... then use "label.setText" to display the result. ... There are a set of selection buttons that initially set label l3 as ... Then the run button trys to set it to Please Wait util the results ... (comp.lang.java.programmer) - Unable to see JLabel added to JDesktopPane
... Basically I am trying to display an animated graphic of a clock while my ... succeeded in adding a JLabel to a JDesktopPane. ... I want to get the graphics context before I ... display the label, but this does not appear to be permitted. ... (comp.lang.java.gui) - Re: A JLabels Size
... When I create a JLabel and place it into a JPanel/JDialog/some other ... The component has to be realized first. ... public static void main{ ... (comp.lang.java.gui) - Re: Applet help for beginner
... buttons I can increase or decrease its value. ... You can use a JLabel to display the current value ... The Down button should have an ActionListener ... (comp.lang.java.help) - Problem With Threads
... program that would display a jlabel through a thread. ... public void start{ ... Oddly enough, the System.out.println statement works fine, the jlabel ... if I put an infinite loop in ... (comp.lang.java.help) |
|