当 jTextArea 变得太大时,jScrollPane 中的栏消失

The bar in jScrollPane dissapears when jTextArea gets too big

当在 jTextArea 中输入多行文本时,有时该栏会消失以向下滚动。 (即使没有那个栏,我也可以滚动 up/down 但没有它看起来很糟糕)

这是栏(右侧)的样子。

后来的一些行,由于行数较多,条形图变得非常小,添加更多行后,它会在某个时刻消失。

我该如何解决这个问题?

我找到的最佳解决方案是更改您的 Look and Feel 标准应如下所示:

public static void main(String args[]) {
try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }

        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainFrame().setVisible(true);
            }
        });


}

通过将 Nimbus 更改为其他主题之一,您还将更改滑块。