jtextarea

is there a free open source text area type component for java which supports any number of regular expressions which will be highlighted in the text

I am looking for an existing free component that can support any number of regular expressions that will be highlighted in the text in any colour. The regular expressions should be configurable to work on a line by line basis, or spanning multiple lines. If such a component does not exist, i am considering creating it. In the past whe...

How to set jTextArea to have height that matches the size of a text it contains (to avoid scrollbars)

This problem looks trivial, but I can't find the solution. When I create a form it contains a JTextArea. I want to put large constant text in it. If the text is say 1000 lines long, I want my JTextArea to be 1000 lines high (to be large enough to display the entire text without scrollbars). JTextArea is inside a panel which can have sc...

After JTable cell setDefaultRenderer to jTextArea how to highlight the selected row in jTextArea

This is my renderer class tblCalendarRenderer extends JTextArea implements TableCellRenderer { JTextArea textField; public tblCalendarRenderer() { textField = new JTextArea(); } public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean focused, int row, ...

Centering Text in a JTextArea or JTextPane - Horizontal Text Alignment

Is there a way to create horizontally centered text for a JTextArea like with a JTextField? setHorizontalAlignment(JTextField.CENTER); Is there a way I can accomplish the same thing with a multi-line text area? I can't find a method for it with JTextArea, so is there another option? JTextPane? If so, how? ...

JTextArea in JScrollPane, view coordinate translation

I'm trying to translate between view and viewport coordinates. But the JViewport/JScrollpane doesn't seem to work as documented. JViewport.toViewCoordinates() thinks the view is always at the top left of the component, even though that's clearly not the case. String text = "blahblahblah\nblahblah\nblah"; JFrame frame = new JFrame("titl...

How to write directly to a JTextArea?

I want to write some text into a JTextArea. I think the answer is to extend java.io.Writer, but I'd like an authoritative answer here; is that the right thing to do? ...

JTextArea getting whole line

How can I get chosen line from JTA ? ...

JComboBox sizing issue in a table with Multi line Cells

Hello Everyone, I recently had a problem where I needed to have a field that can wrap the text and increase the height of the row as the text is wrapped, similar to Microsoft Excel. I managed to get it working correctly, the only problem is that the table contains multiple JComboBoxes. When the row's height increases from the field tha...

Java JTextArea that auto-resizes and scrolls

I have a JTextArea in a JPanel. How can I have the JTextArea fill the whole JPanel and resize when the JPanel resizes and scroll when too much text is typed in? ...

Using JTextArea to simulate a text console

My objective here is to obtain a console-like-behaving component in Java, not necessarily in JTextArea, but this seemed like a logical thing to try first. Output is simple enough, using the methods provided by the JTextArea, but input is another thing. I want to intercept input, and act on it - character by character. I've found some exa...

Workaround for adding ActionListener to JTextArea

I have a program that get's input string with file path in one JTextArea and then loads it's content to a second JTextArea. Problem is that when using JTextArea I cannot add an actionListener that will load content in the second JTextArea when leaving this field. How to get around this problem ? protected JTextArea inputField, outputFie...

Override JTextArea.getDocument.remove()?

Okay, I want to override JTextArea's Document's remove method, I can't figure out what class to extend. I can't extend Document cause it's a interface, and that also means it must not be the document that JTextArea creates. So how exactly can I easily override my JTextArea's document's remove method? ...

Java / Swing : JTextArea in a JScrollPane, how to prevent auto-scroll?

Hi all, here's a runnable piece of code that shows what my "problem" is. I've got a JTextArea wrapped in a JScrollPane. When I change the text of the JTextArea, the JScrollPane scrolls automatically to the end of the text and I don't want that. Here are my requirements: the application should not scroll vertically automatically but...

Why does this attempt to output an arrayList object to a JtextArea not work?

ArrayList list_of_employees = new ArrayList(); @Action public void reportAllEmployeesClicked(java.awt.event.ActionEvent evt) { this.outputText.setText(""); int i=0; //JOptionPane.showMessageDialog(null,"test Employee list print"); ListIterator list_ir = list_of_employees.listIterator(); //list_of_employees is of ...

How to stop wordwrapped-JTextArea from resizing to fit large content?

I currently have a wordwrapped-JTextArea as a user input window for a chat program. How do I make it so the JTextArea doesn't resize to automatically fit large text? I have already set the JTextArea to be 2 rows: user_input = new JTextArea(); user_input.addAncestorListener(new RequestFocusListener()); user_input.setRows(2); user_input.s...

JTextArea Real Time Spell Checker

I need a good spell checker library for Java that can spell check a JTextArea (or any JTextComponent) in real time. That is, it should have a wavy red underline appear under text while the user is typing. It needs to be able to list all the available word replacements by left clicking (yes, left clicking) the word. If not possible, ri...

Java JTextArea hightliting text with a bold font

Hello! I need several words to be highlighted in a String while appending it to a JTextArea. So that I try this: jta.append("<html> <b>Termination time : </b></html>" + CriterionFunction.estimateIndividual_top(individual) + "\n"); Where jta is a JTextArea. The output I get is: <html> <b>Termination time : </...