ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS : ScrollPaneConstants « javax.swing « Java by API






ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS

  



import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.WindowConstants;

public class Main extends JFrame {
  JTextArea textArea;

  public Main() {
    super();
    this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    Container contentPane = this.getContentPane();
    textArea = new JTextArea();
    JScrollPane pane = new JScrollPane(textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    contentPane.add(pane, BorderLayout.CENTER);
  }

  public static void main(String[] args) {
    JFrame f = new Main();
    f.setSize(300, 200);
    f.setVisible(true);
  }
}

   
    
  








Related examples in the same category

1.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED
2.ScrollPaneConstants.LOWER_LEFT_CORNER
3.ScrollPaneConstants.LOWER_RIGHT_CORNER
4.ScrollPaneConstants.UPPER_LEFT_CORNER
5.ScrollPaneConstants.UPPER_RIGHT_CORNER
6.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED