Questions tagged [jtextcomponent]

JTextComponent is the base class for swing text components. It tries to be compatible with the java.awt.TextComponent class where it can reasonably do so. Also provided are other services for additional flexibility (beyond the pluggable UI and bean support).

149 questions
3
votes
4 answers

browse html files in java swing

Possible Duplicate: Swing JDialog/JTextPane and HTML links I want to browse HTML files in swing and I have done that, the content of html file is being displayed with the help of JEditorPane but links of html file are not opening another HTML…
ADESH RAJPUT
  • 131
  • 1
  • 5
  • 10
2
votes
2 answers

Coloring texts in java

I have a file which i will read it line by line. Split each line into words by using the split method and color the words based on their positions (first 4 chars of each line etc) and also based on the words. Different color should be applied to…
FirmView
  • 3,130
  • 8
  • 34
  • 50
2
votes
1 answer

Scroll to a specific part of a JFrame

Using Cobra, I have a void function which will scroll to a given node of a dom tree or a given pixel of the htmlpane. When I use JFrame.setContentPane() function to set the htmlpane as the container, and I use the scroll() function to scroll the…
lonesome
  • 2,503
  • 6
  • 35
  • 61
2
votes
1 answer

Need help on validating autocomplete

Searching around for single line auto-completion I have found code here and there and finally ended up using this one public class AutoCompleteDocument extends PlainDocument { private final List dictionary = new ArrayList(); …
HpTerm
  • 8,151
  • 12
  • 51
  • 67
2
votes
2 answers

Using DocumentFilter.FilterBypass

I want to have a method like this on my DocumentFilter public void replaceUpdate(int offset, int length, String text) { try { super.replace(byPass, offset, length, text, null); } catch (BadLocationException ex) { …
Giannis
  • 5,286
  • 15
  • 58
  • 113
2
votes
1 answer

Java text field hit tab to create a tag

I am trying to create a text field similar to the 'tags' field in the Stackoverflow flow 'ask a question' page. That is, every time the use hits tab, the preceding text gets enclosed in a colored rounded rectangle and becomes a 'tag'. I have started…
rustybeanstalk
  • 2,722
  • 9
  • 37
  • 57
2
votes
1 answer

Changing the font of text being typed in a JTextArea

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…
None
2
votes
1 answer

Text component displaying lines in reverse order

Alright, I do not know how to fix this and only ran into this problem after trying to put in some longer text on a UI Text component. I have tried both pasting a value into its Text attribute through the Unity editor, and setting its value…
blue
  • 7,175
  • 16
  • 81
  • 179
2
votes
1 answer

Invoke a method when text component's content is not edited for a while

I have a JTextComponent and I want to invoke a method when user stops editing text in that JTextComponent for a period of time. I was thinking to start a timer every time the model is modified and cancel it if another text edit arrives, but it gives…
polis
  • 795
  • 7
  • 23
2
votes
1 answer

How do I override JTextPane's selection behavior when Swing D&D is disabled?

Background: I am using custom AWT D&D in my (heavily) customized JTextPane subclass. In other words, I have disabled Swing's D&D with pane.setDragEnabled(false) and I use my own DragSource, DragGestureListener, etc. The problem: The default…
BrianY
  • 195
  • 10
2
votes
1 answer

How to globally change the ActionMap of Swing JTextFields?

I want to change the ActionMap of Swing JTextFields in my entire Application by replacing a few actions by my custom implmentations. For an explanation why you can refer to the following post: How do I make the caret of a JTextComponent skip…
user1573546
  • 523
  • 5
  • 13
2
votes
1 answer

Find a word jtextfield in java notepad

What condition should i put so that it highlights all the words in the JTextArea? This code works without the while loop but it only finds and highlights the first word match. String findstr = findTextField.getText().toUpperCase(); // User Input…
Sharad Tank
  • 209
  • 1
  • 3
  • 10
2
votes
1 answer

Reuse JEditorPane across application

public class EditorPane extends javax.swing.JPanel { /** * Creates new form EditorPane */ public EditorPane() { initComponents(); } private void launchHyperLink(HyperlinkEvent e) { try { if…
MooHa
  • 819
  • 3
  • 11
  • 23
2
votes
1 answer

Product label printing application in Java swing

I am working on a personal project in order to learn Java. Basically its a swing application to print out product labels. I am planning to have 12 labels per sheet. --------------------------------- | | …
Deepak B
  • 2,245
  • 5
  • 26
  • 28
2
votes
2 answers

Most efficient way to read text file and dump content into JTextArea

I am curious what the most efficient way is to read a text file (do not worry about size, it is reasonably small so java.io is fine) and then dump its contents into a JTextArea for display. E.g. can I somehow consume the entire file in a single…
amphibient
  • 29,770
  • 54
  • 146
  • 240
1 2
3
9 10