Results 1 to 5 of 5
- 10-14-2012, 04:31 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
- 10-14-2012, 05:01 PM #2
Re: How can i display a number on a jlabel.
If you're going to put it in a jlabel, it doesn't have to be numeric because both TextFields and JLabels work with Strings. However, if you need the number for a calculation, you'll need to parse it with one of the wrapper classes - Integer, Float, Double, etc...
- 10-14-2012, 05:40 PM #3
Member
- Join Date
- Oct 2012
- Posts
- 7
- Rep Power
- 0
Re: How can i display a number on a jlabel.
okay i got it now, but how can i send the value of the jtextfield to a jlabel.
Java Code:public void actionPerformed(ActionEvent e) { if (e.getSource() == chk1){ numcf1 = Integer.parseInt(txttall.getText()); }
- 10-15-2012, 05:02 AM #4
Re: How can i display a number on a jlabel.
You have already been told. Both textfields and labels use Strings. So all you need to do is get the String from one and pass it to the other.
- 10-15-2012, 05:13 PM #5
Re: How can i display a number on a jlabel.
JLabel (Java Platform SE 6)
Have you looked at the API at all? Namely the .setText() method?
Similar Threads
-
[Urgent Help] JLabel images display
By baobao816 in forum AWT / SwingReplies: 2Last Post: 05-12-2012, 09:46 AM -
Display number of characters like bar chart
By Dreaming in forum New To JavaReplies: 6Last Post: 10-17-2011, 06:11 AM -
Display occurrence of number based off user input… array
By Jason in forum New To JavaReplies: 14Last Post: 09-12-2011, 11:54 PM -
How can i display the largest number(float) from the notepad?
By jwing7 in forum NetBeansReplies: 0Last Post: 05-09-2011, 02:41 AM -
Java application to calculate and display the cost of a number of tickets according
By herberwz in forum New To JavaReplies: 1Last Post: 04-27-2010, 11:29 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks