List of usage examples for javax.swing JTextArea JTextArea
public JTextArea()
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_NEVER); pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); }
From source file:Main.java
public static void main(String[] argv) { JTextComponent textComp1 = new JTextArea(); JTextComponent textComp2 = new JTextArea(); textComp2.setDocument(textComp1.getDocument()); }
From source file:Main.java
public static void main(String[] argv) throws Exception { 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; }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextComponent textComp = new JTextArea(); textComp.setDragEnabled(true);/* w w w . j av a 2 s . c o m*/ }
From source file:Main.java
public static void main(String[] argv) { JTextComponent c = new JTextArea(); c.setSelectionColor(Color.green); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextComponent c = new JTextArea(); c.getCaretPosition();/*from w ww .j a v a2 s . c o m*/ if (c.getCaretPosition() < c.getDocument().getLength()) { char ch = c.getText(c.getCaretPosition(), 1).charAt(0); } // Set the caret color c.setCaretColor(Color.red); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextComponent c = new JTextArea(); c.getCaretPosition();/*from w ww . ja v a 2s. c o m*/ if (c.getCaretPosition() < c.getDocument().getLength()) { char ch = c.getText(c.getCaretPosition(), 1).charAt(0); } // Move the caret int newPosition = 0; c.moveCaretPosition(newPosition); }
From source file:Main.java
public static void main(String[] argv) throws Exception { // Create a scrollable text area JTextArea textArea = new JTextArea(); JScrollPane scrollableTextArea = new JScrollPane(textArea); }
From source file:Main.java
public static void main(String[] argv) throws Exception { JTextArea textComp = new JTextArea(); removeHighlights(textComp);/*w w w .j a v a 2s . c om*/ }
From source file:Main.java
public static void main(String[] argv) { JTextComponent textComp = new JTextArea(); textComp.addCaretListener(new CaretListener() { public void caretUpdate(CaretEvent e) { int dot = e.getDot(); System.out.println("dot is the caret position:" + dot); int mark = e.getMark(); System.out.println("mark is the non-caret end of the selection: " + mark); }/*from w w w . j a v a 2 s. c om*/ }); }