zoukankan      html  css  js  c++  java
  • e821. 设置JScrollPane滚动栏

    A scroll bar in a scroll pane can be set to appear only as needed, always appear, or never appear. By default, both the vertical and horizontal scrollbars in a scroll pane appear only when needed.

        // Create a scrollable text area
        JTextArea textArea = new JTextArea();
        JScrollPane pane = new JScrollPane(textArea);
        
        // Get the default scrollbar policy
        int hpolicy = pane.getHorizontalScrollBarPolicy();
        // JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
        
        int vpolicy = pane.getVerticalScrollBarPolicy();
        // JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;
        
        
        // Make the scrollbars always appear
        pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
        pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        
        // Make the scrollbars never appear
        pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    
    Related Examples
  • 相关阅读:
    Python基础-博客
    已开发程序查询
    新语法
    html基础
    python操作excel
    Selenium
    练习2---(request,ajax爬取头条数据)
    练习1---request+正则(猫眼电影)
    框架---scrapy(基本用法)
    框架---Scrapy (框架安装)
  • 原文地址:https://www.cnblogs.com/borter/p/9596218.html
Copyright © 2011-2022 走看看