System.getProperty("os.name") Returns ... (3 dots) windows 8 java 7

486 views Asked by At

im using windows 8 and java 1.8.0_25. This might sound a little noobish but, i made a jlabel called OS (the variable name is OS). The text of the jlabel is originally -

i also have a button which sets the text of the jlabel to OS name when clicked.

Here is my code:

OS.setText(System.getProperty("os.name", "cannot find os name"));

After i run it and click the button, the - turns into a ... ( 3 dots), it doesnt return "cannot find os name" or the os im using (windows 8). It doesnt give any compiler errors or anything like that, its just not working.

Can someone tell why?

1

There are 1 answers

1
Reimeus On BEST ANSWER

It's likely that you're not providing enough space for the text to be displayed on the component. Add a label with the maximum possible width & call pack to size