Results 1 to 4 of 4
Thread: problem with JLabels
- 01-30-2008, 09:00 PM #1
problem with JLabels
this is my first time writing, and i need some help.
i want to be able to make a JLabel in which i can store a value (such as int) which i can add one or subtract one from. it doesn't seem to like:
JLabel score = new JLabel(num);
int num = 5;
i probabely have done soemthing really stupid or missed soemthing out but hey! i'm new to java.
if you can help me: thank you so much, because i am really confused. :confused:
- 01-30-2008, 10:02 PM #2
Welcome, geork, to Java Forums!
First, you must declare the integer, num, and then you can use it like this:
int num = 10; JLabel label = new JLabel(([COLOR="RoyalBlue"]new Integer(num)[/COLOR]).[COLOR="Teal"]toString()[/COLOR]);
Hope this helped. :D
Last edited by tim; 01-31-2008 at 07:43 PM. Reason: For some reason I keep typing "the" instead of "to" :DEyes dwelling into the past are blind to what lies in the future. Step carefully.
- 01-31-2008, 02:05 AM #3
- 01-31-2008, 02:30 PM #4
- By Mark_Petrov in forum AWT / SwingReplies: 0Last Post: 01-20-2008, 05:22 PM