Home java How to enlarge the size of the slider (pointer) in java in...

How to enlarge the size of the slider (pointer) in java in jslider?




I write to the NetBeans application on Java, as the most simple way to increase the size of the slider itself (pointer) in JSlider (not the entire component)?


Answer 1

import java.awt.borderlayout;
Import javax.swing.jframe;
Import javax.swing.jpanel;
Import javax.swing.jslider;
Import javax.swing.uidefaults;
Import javax.swing.uimanager;
Import javax.swing.uimanager.lookandfeelinfo;
Public Class Sliderthumbsize EXTENDS JPANEL {
  Public Sliderthumbsize () {
    Super (True);
    this.setlayout (new borderlayout ());
    JSLIDER Slider = New JSlider (jslider.horizontal);
    Defaults.put ("Slider.thumbheight", 50);
    Defaults.put ("Slider.thumbwidth", 50);
    Slider.putClientProperty ("Nimbus.Ordrides", Defaults);
    Slider.setLabeltable (Slider.CreateStandardLabels (10));
    Add (Slider, BorderLayout.Center);
  Public Static Void Main (String S []) {
    Try {
      For (Lookandfeelinfo info: uimanager.getInstalledlookandfeels ()) {
        if ("nimbus" .equals (info.getname ())) {
          Uimanager.setlookandfeel (info.getclassname ());
    } Catch (Exception Exc) {}
    JFrame Frame = New JFrame ("Slider Example");
    frame.setdefaultcloseoperation (jframe.exit_on_close);
    frame.setContentPane (New Sliderthumbsize ());
    frame.pack ();
    frame.setvisible (TRUE);

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions