Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSlider  RSS feed

 
maha devan
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am having following doubts on usageof JSlider Cn anybody please clarify

How to modify the size of JSlider.I have used the JSlider constructor and it is displaying a standard size of JSlider

How to change the color of my JSlider. I want a red color on the incerment nob alone in my JSlider.

Anybody ]PLs
 
Venkatesh Chitnis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your code?
 
Venkatesh Chitnis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be this can help...

import javax.swing.*;
import java.awt.*;

public class TestSlider extends JFrame
{
Container c = getContentPane();
public TestSlider()
{
JSlider slider = new JSlider(0,100);
slider.setForeground(Color.RED);
slider.setMajorTickSpacing(10);
slider.setMinorTickSpacing(5);
slider.setPaintLabels(true);
slider.setPaintTrack(true);
slider.setSnapToTicks(true);
c.add(slider);
setSize(400,400);
setVisible(true);
}
public static void main(String[] args)
{
TestSlider slider = new TestSlider();
}
}
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!