• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

To make label for sum value to change while I move slider

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys, I have a problem again

I'm trying to make some calculations and to calculate this equation:

Tl = Tt + Tp + Tq.

I have drawn each of this fields as labels and 2 of them take values from JSliders and 3rd from JCombo box. Here is the corresponding code:



It works just fine with values Tt, Tp and Tw, but it doesnt animate while I move slider in TL (sum value). Where to put variable for Tl and how to make that sum value changing while I change other parameters? I have made variable valfinal which takes this value valfinal=valu/300000+valu1/valu2+counter/0.1. It is actually the sum of these 3 fields, but the problem is where to place it...?
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tl, being the sum, would be better as a JLabel or non-editable JTextField. (The latter allows copying it.) For both you convert the sum to a String and call setText.
 
maja neskovic
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I solved the problem

It gets the sum value and changes as other values change.
reply
    Bookmark Topic Watch Topic
  • New Topic