I am working on a chat application and I want the user to be able to change their font while typing messages.
I tried using the setFont() method but it changes the font for the entire text within the JTextArea component and when the text is sent to the display area, another JTextArea component, the font changes do not appear. Instead i...
A JTextComponent allows you to add a DocumentListener to its Document, which will tell you when text was added or removed, and the offset and length of the change. It will not, however, tell you what the text of the change was.
This is not much of a problem for text addition, as you can use the offset and the length to find the added t...
When you drag a block of text from a Word document into a Java text component, the text is removed from the Word document. This is obviously undesirable in some cases. Is there a way I can prevent Word from removing the text, while still copying it into the Java text component?
...
Hi,
I have JTextAreas and need to get chars, which are added, removed or changed to it. How do I do this?
...
I am using both JLabels and JTextFields, and need to be able to truncate my doubles to two decimal places when they are outputted to the application.
What is the easiest way of doing this (preferably without switching to JFormattedTextFields)?
Thanks,
badPanda :D
...
This really puzzles me.
I have a JTextComponent for which I've added a right-click cut\copy\paste menu using a JPopupMenu and DefaultEditorKit.Cut\Copy\PasteAction().
JMenuItem cutItem = new JMenuItem(new DefaultEditorKit.CutAction());
JMenuItem copyItem = new JMenuItem(new DefaultEditorKit.CopyAction());
JMenuItem pasteItem = new JM...