Welcome to Dream.In.Code
Become a Java Expert!

Join 150,172 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,222 people online right now. Registration is fast and FREE... Join Now!




trying to send a value to a private label text from

 
Reply to this topicStart new topic

trying to send a value to a private label text from

rwilliamj
27 Aug, 2008 - 03:50 PM
Post #1

New D.I.C Head
*

Joined: 14 Aug, 2008
Posts: 15

hi.

i have a program that consists of several classes. the main class opens a jframe with buttons on it. the buttons, when clicked open other jframes, twelve in all. each secondary jframe calculates the time elapsed since each of their openings.

i have tried without success to send the value of the individual elapsed times to the text of a label on the main class, but since i developed the main class in netbeans, the label components are private. i tried a set and get, but apparently there is a discrepancy between the type of value i wish to send from the other classes (elapsed =int, or string) and the value accepted by the private label object in the main class

suggestions?
User is offlineProfile CardPM
+Quote Post

pbl
RE: Trying To Send A Value To A Private Label Text From
27 Aug, 2008 - 04:11 PM
Post #2

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(rwilliamj @ 27 Aug, 2008 - 04:50 PM) *

but apparently there is a discrepancy between the type of value i wish to send from the other classes (elapsed =int, or string) and the value accepted by the private label object in the main class

One thing for sure, the setText() method of JLabel expects a String
so your choice to have the setter in your main class to accept a long (time is long not int) or a String but then you would have to act accordingly. Or call the setText() method with the String received if you receive a String or format the time into String before calling setText() if you receive a long.

Without seing your code that is all I can say
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:23AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month