Value « JTextArea « Java Swing Q&A





1. Java Swing: How to get TextArea value including the char just typed?    stackoverflow.com

What's the best way to get a value of a TextArea after a key is typed, including this character? If I do it in the even listener, textarea.getText() returns the value without ...

2. Getting the first and last index values of highlighted text in a JTextArea    stackoverflow.com

I am writing a text editor(in java) where I am using a JTextArea for the main text editing and I am putting the text into a stringbuilder. When I highlight the ...

3. JTextArea only with numbers, but allowing negative values    stackoverflow.com

I have a JTextArea which only has to accept numbers. This is my code:

DocumentFilter onlyNumberFilter = new AxisJTextFilter();
    final JTextArea areaTextoXMin = new JTextArea(String.valueOf(xMin));
    ((AbstractDocument)areaTextoXMin.getDocument()).setDocumentFilter(onlyNumberFilter);
Works ...

4. Refreshing JTextArea with new values    stackoverflow.com

I am new to java. I have a project from college where I have to make entries to txt file through 2 JTextField boxes and 1 JButton (save) which will display the ...

5. How to set the value of a JTextArea    coderanch.com

I have a JList and JTextArea. When I choose a value in my ListBox it must automatically change my JTextArea value. This is not happening!!!. I have pasted my code. Can anyone please look into and find out the bug. import java.awt.*; import java.awt.event.*; import java.applet.*; import javax.swing.*; import javax.swing.event.*; import java.util.*; public class testmenu extends JApplet implements MouseListener { boolean ...

6. textarea array value stored in another array    coderanch.com

I am using a TextArea array to store various values. The program is basically booking a room. When one room is booked, the background color changes and some text appears. It then needs to move to the next room. I can get the color and the text to appear, but I can't get it to move to the next room. I ...

7. The textarea is not getting value    coderanch.com

import javax.swing.*; import java.awt.event.*; import static java.lang.System.*; import java.awt.*; import javax.swing.border.*; import java.io.*; import java.util.*; public class CodeObfuscatorGui { public static void main(String... args) { EventQueue.invokeLater(new Runnable() { public void run() { TFrame tf1=new TFrame(); tf1.setVisible(true); tf1.setDefaultCloseOperation(tf1.EXIT_ON_CLOSE); } }); } } class TFrame extends JFrame { private JTextArea jta1,jta2; private JEditorPane jep1; private JFileChooser jfc1; private String path; private Font f1; ...

9. how to pass values from jtextarea to other classes    forums.oracle.com

Hello, I am trying to take some submitted values from a jText area and pass those values to another class so it can perform some calculations. How do I access these variables from my second class? Code in initial class: ... private void jButton1MouseReleased(java.awt.event.MouseEvent evt) { String num1_str = jTextField1.getText(); String num2_str = jTextField3.getText(); String num3_str = jTextField4.getText(); String num4_str = ...