Java JTextComponent inScrollPane(JTextComponent textComponent, boolean autoscroll)

Here you can find the source of inScrollPane(JTextComponent textComponent, boolean autoscroll)

Description

in Scroll Pane

License

Open Source License

Declaration

public static JScrollPane inScrollPane(JTextComponent textComponent,
            boolean autoscroll) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.JScrollPane;

import javax.swing.text.DefaultCaret;
import javax.swing.text.JTextComponent;

public class Main {
    public static JScrollPane inScrollPane(JTextComponent textComponent,
            boolean autoscroll) {
        JScrollPane pane = new JScrollPane(textComponent);
        if (autoscroll) {
            DefaultCaret caret = (DefaultCaret) textComponent.getCaret();
            caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
            pane.setAutoscrolls(true);//from   w ww .jav a 2  s.  co  m
        }
        return pane;
    }
}

Related

  1. getRenderedLineOfChar(JTextComponent comp, int charIdx)
  2. getStoredBackground(JTextComponent comp)
  3. getStoredBackground(JTextComponent comp)
  4. highlighterIsNext(JTextComponent textComponent, boolean forwards, Highlighter.Highlight highlight)
  5. implyDisabled(final JCheckBox checked, final boolean checkedState, final JTextComponent changed)
  6. installUi(JTextComponent txt)
  7. installUndoManager(JTextComponent textComponent)
  8. isCompletelyVisible(final JTextComponent scrollableComponent, final int pos, final Rectangle visibleRect)
  9. isEmpty(JTextComponent component)