• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSlider

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post your code?
 
Venkatesh Chitnis
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
}
}
 
What could go wrong in a swell place like "The Evil Eye"? Or with this tiny ad?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic