Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Thermometer problem (JScrollbar / JSlider ).... ??  RSS feed

 
Trisha Murphy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I'm trying to do is draw a thermometer and have a trigger slider which I can slide up and down to set the max temperature allowed before an alert is given.
I'm at a bit of a loss as to how I should approach this.
Is is possible to customize either the JScrollbar or JSlider classes to do what I want?
Or should I be looking at JLayeredPanes or using Drag and Drop classes?

Any suggestions or even general directions would be greatly appreciated.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about a tutorial on How to Use Sliders. It may help to think of your control as a thermostat, which triggers an event when a certain temperature is reached, rather than a thermostat, which simply displays the temperature. A slider makes a good match for a thermostat, whereas a scrollbar makes sense for a thermometer
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could just use a JSlider, put it in a container and draw the thermometer on the container. Here's an example... with a really simple thermometer...

 
Trisha Murphy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nate that's exactly what I wanted!
Now my next question is how do I customize my Slider?
i.e. I want to change the knob/slider to be something else.
I know it's to do with SliderUI but I can't seem to find any tutorials or the like on how to create my own UI for my slider.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!