Java JScrollBar class

Description

Java JScrollBar class

import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JScrollBar;

public class Main extends JFrame {

  public Main() {
    JScrollBar sb1 = new JScrollBar();
    JScrollBar sb2 = new JScrollBar(JScrollBar.HORIZONTAL);
    JScrollBar sb3 = new JScrollBar(JScrollBar.HORIZONTAL, 50, 15, 1, 150);
    getContentPane().setLayout(new FlowLayout());
    getContentPane().add(sb1);//from w w  w .ja  v  a2s .c o  m
    getContentPane().add(sb2);
    getContentPane().add(sb3);
  }

  public static void main(String[] args) {
    Main gui = new Main();
    gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    gui.setSize(400, 250);
    gui.setVisible(true);
  }
}



PreviousNext

Related