Example usage for javax.swing JTextArea JTextArea

List of usage examples for javax.swing JTextArea JTextArea

Introduction

In this page you can find the example usage for javax.swing JTextArea JTextArea.

Prototype

public JTextArea() 

Source Link

Document

Constructs a new TextArea.

Usage

From source file:Main.java

public static void main(String[] argv) {

    JTextArea c = new JTextArea();

    // Enable line-wrapping
    c.setLineWrap(true);/*from  www.j a v a  2 s . co m*/
    c.setWrapStyleWord(false);
}

From source file:Main.java

public static void main(String[] argv) {
    JTextArea textarea = new JTextArea();

    Font font = textarea.getFont();
    System.out.println(font);/*  w  ww.  jav a 2 s  .  com*/
}

From source file:Main.java

public static void main(String[] argv) {
    JTextComponent c = new JTextArea();

    c.setSelectionEnd(20);
}

From source file:Main.java

public static void main(String[] argv) {
    JTextComponent c = new JTextArea();

    c.setSelectionStart(10);
}

From source file:Main.java

public static void main(String[] argv) {
    JTextComponent c = new JTextArea();

    c.replaceSelection("replacement text");
}

From source file:Main.java

public static void main(String[] argv) {
    JTextArea textarea = new JTextArea();
    // Get the default tab size
    int tabSize = textarea.getTabSize(); // 8

    // Change the tab size
    tabSize = 4;//from  w w  w  .  j  ava  2s  .c om
    textarea.setTabSize(tabSize);

    Font font = textarea.getFont();
    System.out.println(font);
}

From source file:Main.java

public static void main(String[] argv) {
    JTextComponent c = new JTextArea();

    c.select(10, 20);
}

From source file:Main.java

public static void main(String[] argv) {
    JTextComponent c = new JTextArea();

    // Get text inside selection
    c.getSelectedText();/*from   w  w  w .j  ava2  s  .  co  m*/
}

From source file:Main.java

public static void main(String[] argv) {
    JTextComponent c = new JTextArea();

    // Set rate to blink once a second
    c.getCaret().setBlinkRate(1000);/* www  . j av  a  2 s .  c  om*/

    // Set the caret to stop blinking
    c.getCaret().setBlinkRate(0);
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JTextArea textArea = new JTextArea();
    JScrollPane pane = new JScrollPane(textArea);
    pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

}