Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Java Swing Thermometer - how do i do this?

  • 03-02-2004 6:22pm
    #1
    Closed Accounts Posts: 536 ✭✭✭


    Calling all Swing Gurus! ;)

    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.


Comments

  • Registered Users, Registered Users 2 Posts: 885 ✭✭✭clearz


    I would just extend a JPanel and add a JSlider to the right, draw a thermometer on the left and add the needed methods.


  • Registered Users, Registered Users 2 Posts: 6,334 ✭✭✭OfflerCrocGod


    Or use NetBeans automatic code generation for GUI stuff stick in events were neccesary and then just copy all the code into whatever app you are using as your IDE.


  • Closed Accounts Posts: 536 ✭✭✭flyz


    I have my thermometer drawn with a slider now.

    it's more like a red line with a JSlider on top but it does the job ;)


    Now I need to figure out how to customize the knob of the slider.
    I've looked at the SliderUI class but I can't make head or tail of it.

    anyone know of any good tutorials / examples I could look at to customise my jslider?


  • Registered Users, Registered Users 2 Posts: 885 ✭✭✭clearz


    Originally posted by flyz
    I have my thermometer drawn with a slider now.

    it's more like a red line with a JSlider on top but it does the job ;)


    Now I need to figure out how to customize the knob of the slider.
    I've looked at the SliderUI class but I can't make head or tail of it.

    anyone know of any good tutorials / examples I could look at to customise my jslider?

    Look at the decorator design pattern


Advertisement