Results 1 to 3 of 3
  1. #1
    tianchen is offline Member
    Join Date
    Jan 2014
    Rep Power

    Default Label for JSlider

    Hi everyone,

    Is it possible to put the label just above the slider rather than below it? How can it be done?

    Or just put something like a title on the leftmost corner just above the slider?

    Thank you very much for your time :)
    Last edited by tianchen; 02-03-2014 at 09:17 PM.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Label for JSlider

    All of that is possible. What have you tried?
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3
    tianchen is offline Member
    Join Date
    Jan 2014
    Rep Power

    Default Re: Label for JSlider

    Hi Kevin,
    I have tried to customize the label for JSlider,for example
    Java Code:
    //slider setting
    		int FPS_MIN = 0;
    		int FPS_MAX = 100;
    		int FPS_INIT = 0;  
    		JSlider slider1 = new JSlider(JSlider.HORIZONTAL,FPS_MIN, FPS_MAX, FPS_INIT);
    		//set customized Tick Table
    //		Hashtable labelTable = new Hashtable();
    //		JLabel scale1=new JLabel("Überhaupt nicht");
    //		scale1.setForeground(Color.WHITE);
    //		scale1.setFont(Global.font3);
    //		JLabel scale2=new JLabel("sehr stark");
    //		scale2.setForeground(Color.WHITE);
    //		scale2.setFont(Global.font3);
    //		labelTable.put(new Integer(FPS_MIN), scale1);
    //		labelTable.put(new Integer(FPS_MAX), scale2);
    //		slider1.setLabelTable(labelTable);
    //		slider1.setPaintLabels(true);
    but there is no clue for a label above the slider or a title, either in SUN tutorial or google search engine.
    It will be so great that you can give some clues. The task is quite urgent. So I might have no time to learn slowly from scratch. Thank you.

Similar Threads

  1. How to improve Jslider
    By JohnST in forum New To Java
    Replies: 3
    Last Post: 01-12-2010, 02:04 AM
  2. Jslider changeListner
    By Basit56 in forum Java Applets
    Replies: 1
    Last Post: 09-14-2009, 05:04 PM
  3. How can we zoom a map using JSlider
    By barney in forum AWT / Swing
    Replies: 5
    Last Post: 02-23-2009, 02:48 PM
  4. Got Trouble with JSlider
    By hungleon88 in forum Advanced Java
    Replies: 6
    Last Post: 08-30-2008, 06:02 PM
  5. jmf & JSlider
    By nathanr_kamal in forum AWT / Swing
    Replies: 6
    Last Post: 06-28-2008, 08:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts