javax.swing.JScrollPane.setVerticalScrollBarPolicy()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(16.9k)|赞(0)|评价(0)|浏览(183)

本文整理了Java中javax.swing.JScrollPane.setVerticalScrollBarPolicy()方法的一些代码示例,展示了JScrollPane.setVerticalScrollBarPolicy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JScrollPane.setVerticalScrollBarPolicy()方法的具体详情如下:
包路径:javax.swing.JScrollPane
类名称:JScrollPane
方法名:setVerticalScrollBarPolicy

JScrollPane.setVerticalScrollBarPolicy介绍

暂无

代码示例

代码示例来源:origin: bonnyfone/vectalign

private String showInputDialog(String title, String defaultText){
  JTextArea msg = new JTextArea(defaultText);
  msg.setLineWrap(true);
  msg.setWrapStyleWord(true);
  JScrollPane scrollPane = new JScrollPane(msg);
  scrollPane.setPreferredSize(new Dimension(600, 250));
  scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  int ris = JOptionPane.showConfirmDialog(null, scrollPane, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
  if(ris == JOptionPane.OK_OPTION)
    return msg.getText();
  else
    return defaultText;
}

代码示例来源:origin: pmd/pmd

private JPanel makeResultsPanel() {
  JPanel resultsPanel = new JPanel();
  resultsPanel.setLayout(new BorderLayout());
  JScrollPane areaScrollPane = new JScrollPane(resultsTextArea);
  resultsTextArea.setEditable(false);
  areaScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
  areaScrollPane.setPreferredSize(new Dimension(600, 300));
  resultsPanel.add(makeMatchList(), BorderLayout.WEST);
  resultsPanel.add(areaScrollPane, BorderLayout.CENTER);
  return resultsPanel;
}

代码示例来源:origin: stackoverflow.com

public static void main ( String[] args )
{
  JPanel middlePanel = new JPanel ();
  middlePanel.setBorder ( new TitledBorder ( new EtchedBorder (), "Display Area" ) );

  // create the middle panel components

  JTextArea display = new JTextArea ( 16, 58 );
  display.setEditable ( false ); // set textArea non-editable
  JScrollPane scroll = new JScrollPane ( display );
  scroll.setVerticalScrollBarPolicy ( ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS );

  //Add Textarea in to middle panel
  middlePanel.add ( scroll );

  // My code
  JFrame frame = new JFrame ();
  frame.add ( middlePanel );
  frame.pack ();
  frame.setLocationRelativeTo ( null );
  frame.setVisible ( true );
}

代码示例来源:origin: stackoverflow.com

private JPanel panel = new JPanel();
private JScrollPane sp = new JScrollPane(panel);
  panel.add(new JLabel(name, JLabel.LEFT));
  panel.add(jtf);
  list.add(jtf);
    new FocusDrivenScroller(panel));
  sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  sp.validate();
  Dimension d = sp.getPreferredSize();
  internaFrame.add(sp);
  internaFrame.pack();
  internaFrame.setVisible(true);
  desktopPane.add(internaFrame);
  JFrame frmtest = new JFrame();
  frmtest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frmtest.add(desktopPane);
  frmtest.pack();
  frmtest.setVisible(true);
  list.get(0).requestFocusInWindow();

代码示例来源:origin: pmd/pmd

private JPanel createXPathQueryPanel() {
  JPanel p = new JPanel();
  p.setLayout(new BorderLayout());
  xpathQueryArea.setBorder(BorderFactory.createLineBorder(Color.black));
  makeTextComponentUndoable(xpathQueryArea);
  JScrollPane scrollPane = new JScrollPane(xpathQueryArea);
  scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  final JButton b = createGoButton();
  JPanel topPanel = new JPanel();
  topPanel.setLayout(new BorderLayout());
  topPanel.add(new JLabel("XPath Query (if any):"), BorderLayout.WEST);
  topPanel.add(createXPathVersionPanel(), BorderLayout.EAST);
  p.add(topPanel, BorderLayout.NORTH);
  p.add(scrollPane, BorderLayout.CENTER);
  p.add(b, BorderLayout.SOUTH);
  return p;
}

代码示例来源:origin: apache/geode

final JScrollPane scroller = new JScrollPane(drawingPane);
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
final TimeAxis timeAxis =
  new TimeAxis(TimeAxis.VERTICAL, sequenceDiagram.getMinTime(), sequenceDiagram.getMaxTime());

代码示例来源:origin: stackoverflow.com

class ParallelTables {
  static JScrollPane createTable() {
    DefaultTableModel model = new DefaultTableModel(100, 2);
    for (int row=model.getRowCount(); --row>=0;) {
      model.setValueAt(row, row, 0);
    }
    JTable table = new JTable(model);
    return new JScrollPane(table);
  }

  public static void main(String[] args) throws Exception {

    JScrollPane scrollerA = createTable();
    JScrollPane scrollerB = createTable();
    scrollerA.setVerticalScrollBarPolicy(
        JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    // the following statement binds the same BoundedRangeModel to both vertical scrollbars.
    scrollerA.getVerticalScrollBar().setModel(
        scrollerB.getVerticalScrollBar().getModel());
    JPanel panel = new JPanel();
    panel.add(scrollerA);
    panel.add(scrollerB);
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);
  }
}

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame();
JPanel pane = new JPanel();
JScrollPane scroller = new JScrollPane(pane);
frame.add(BorderLayout.CENTER, scroller);
scroller.setWheelScrollingEnabled(true);
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
frame.setVisible(true);

代码示例来源:origin: hsz/idea-gitignore

settings = IgnoreSettings.getInstance();
panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 5, 10));
northPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 5));
    scrollPanel.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    scrollPanel.setPreferredSize(new Dimension(0, settings.getOuterIgnoreWrapperHeight()));

代码示例来源:origin: stackoverflow.com

import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

class TextPanel extends JPanel {
  private JTextArea textarea = new JTextArea(20, 40);

  public TextPanel() {
   setLayout(new BorderLayout());
   JScrollPane scrollPane = new JScrollPane(textarea);
   scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
   add(scrollPane);
  }

  public JTextArea getTextarea() {
   return textarea;
  }

  public void clearText() {
   textarea.setText("");
  }

}

代码示例来源:origin: stackoverflow.com

public class ScrollListExample {
  static List<String> stringList = new ArrayList<String>();
  static {
    for (int i = 0; i < 500; i++) {
      stringList.add("test" + i);
    }
  }

  public static void main(final String[] args) {
    final JFrame frame = new JFrame();
    final Container contentPane = frame.getContentPane();
    final JList list = new JList(stringList.toArray());
    final JScrollPane scrollPane = new JScrollPane(list);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    contentPane.add(scrollPane);
    frame.setPreferredSize(new Dimension(200,200));
    frame.pack();
    frame.setVisible(true);
  }
}

代码示例来源:origin: stackoverflow.com

JTable table = new JTable(rowData, headerData)
{
  private static final int DESIRED_WIDTH = 400;

  Dimension dim = new Dimension(DESIRED_WIDTH, Integer.MAX_VALUE);

  {
    JScrollPane dummy = new JScrollPane(this);
    dummy.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JFrame frame = new JFrame();
    frame.add(dummy);
    frame.pack();
    int actualWidth = dummy.getSize().width;
    frame.dispose();
    int excess = actualWidth - DESIRED_WIDTH;
    dim = new Dimension(DESIRED_WIDTH - excess, getRowHeight() * 3);
  }

  public Dimension getPreferredScrollableViewportSize()
  {
    return dim;
  }
};

代码示例来源:origin: stackoverflow.com

public void init() {
  //JFrame frame = new JFrame(); 

  JPanel panel = new JPanel(); 
  JScrollPane scrPane = new JScrollPane(panel); 
  scrPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  scrPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  //  scrPane.setLayout(new ScrollPaneLayout()); 
  //  frame.getContentPane().add(scrPane); 

  getContentPane().add(scrPane);

  // this.setVisible(true); 
}

代码示例来源:origin: stackoverflow.com

JFrame f = new JFrame();
 f.setLayout(new BorderLayout());
 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 JPanel p = new JPanel(new GridLayout(0, 5));
 JScrollPane jsp = new JScrollPane(p);
 jsp.setPreferredSize(new Dimension(300,300));
 jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
 jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
 for (int i = 0; i < 100; i++) {
   JButton b = new JButton("Button " + i);
   p.add(b);
 }
 f.add(jsp, BorderLayout.CENTER);
 f.setLocation(300, 300);
 f.setVisible(true);
 f.pack();

代码示例来源:origin: stackoverflow.com

JFrame displayframe = new JFrame("All Details");
displayframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
displayframe.setLayout(new FlowLayout());

JTextArea text = new JTextArea(30,30);
text.setEditable(false);
text.append("22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs\n22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs\n22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs\n22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs22323sfasfs\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline\nline123");

JScrollPane scroll = new JScrollPane(text);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

displayframe.getContentPane().add(scroll);
displayframe.setSize(400, 600);
displayframe.setVisible(true);

代码示例来源:origin: stackoverflow.com

import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;

public class Test {

  public static void main(String... args) {
    JFrame frame = new JFrame();
    JPanel panel = new JPanel();
    for (int i = 0; i < 10; i++) {
      panel.add(new JButton("Hello-" + i));
    }
    JScrollPane scrollPane = new JScrollPane(panel);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    scrollPane.setBounds(50, 30, 300, 50);
    JPanel contentPane = new JPanel(null);
    contentPane.setPreferredSize(new Dimension(500, 400));
    contentPane.add(scrollPane);
    frame.setContentPane(contentPane);
    frame.pack();
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.setVisible(true);
  }
}

代码示例来源:origin: redwarp/9-Patch-Resizer

private JPanel createOutputPanel() {
 JPanel outputPanel = new JPanel();
 outputPanel.setLayout(new BorderLayout(0, 0));
 JScrollPane scrollPane = new JScrollPane(this.resultTable);
 scrollPane
   .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
 scrollPane
   .setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
 outputPanel.add(scrollPane, BorderLayout.CENTER);

代码示例来源:origin: deathmarine/Luyten

protected JPanel getFontFamilyPanel() {
  if (fontNamePanel == null) {
    fontNamePanel = new JPanel();
    fontNamePanel.setLayout(new BorderLayout());
    fontNamePanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    fontNamePanel.setPreferredSize(new Dimension(180, 130));
    JScrollPane scrollPane = new JScrollPane(getFontFamilyList());
    scrollPane.getVerticalScrollBar().setFocusable(false);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    JPanel p = new JPanel();
    p.setLayout(new BorderLayout());
    p.add(getFontFamilyTextField(), BorderLayout.NORTH);
    p.add(scrollPane, BorderLayout.CENTER);
    JLabel label = new JLabel(("Font Name"));
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setHorizontalTextPosition(JLabel.LEFT);
    label.setLabelFor(getFontFamilyTextField());
    label.setDisplayedMnemonic('F');
    fontNamePanel.add(label, BorderLayout.NORTH);
    fontNamePanel.add(p, BorderLayout.CENTER);
  }
  return fontNamePanel;
}

代码示例来源:origin: magefree/mage

jScrollPane2 = new JScrollPane();
jScrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jScrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

代码示例来源:origin: stackoverflow.com

JFrame frame = new JFrame();
JPanel middlePanel = new JPanel();
frame.add(middlePanel);
final JTextArea display = new JTextArea(16, 58);
display.setEditable(true); // set textArea non-editable
JScrollPane scroll = new JScrollPane(display);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.
                  VERTICAL_SCROLLBAR_ALWAYS);

// Add Textarea in to middle panel
middlePanel.add(scroll);

相关文章

JScrollPane类方法