Questions about javax.swing.text.Highlighter.
Questions tagged [swing-highlighter]
27 questions
1
vote
0 answers
JFormattedTextField unusual format
I am formatting a text field like this:
bidField = new JFormattedTextField();
DecimalFormat d = new DecimalFormat("0.00");
int dp = 5;
d.setMinimumFractionDigits(dp);
NumberFormatter dnff = new NumberFormatter(d);
DefaultFormatterFactory factory =…

ManInMoon
- 6,795
- 15
- 70
- 133
1
vote
1 answer
Set hilighting color in jTextField
I am developing a Java Swing application. This app allows user use basic command line. For example user can add event with simply type add "Something to be added.".I wanna highlight addwhen user type this command. Can any one implement a jTextField.
user2346544
1
vote
1 answer
Apply Highlighter to line only when first Character encountered till LineEndOffset in JtextArea
My Question is quite simple.
I have a JtextArea. My aim is to highlight a line in that textarea from the start of the first character in that line..
By using Java line start and end offset, am able to highlight the whole line, but it looks ugly.
Am…

Ms_Joe
- 160
- 2
- 7
- 16
0
votes
0 answers
How to highlight a word in the JTextArea java using different colors?
I have a java code which requires highlighting different words in a text area using different colors. I managed to get the default blue color highlighting by
JTextArea textArea=new JTextArea();
textArea.setText('some text in textArea');
String…

Nipuna Dilhara
- 424
- 2
- 6
- 18
0
votes
1 answer
Highlighter highlights all the textArea instead of a specific word and its occurrences [java]
I have some problems using the highlighter class within my textArea.
My program should work like this:
In a textArea the program detects a string that should be placed in the first line (the lines of comments, marked by "#", are not taken into…

Pino
- 619
- 1
- 8
- 25
0
votes
1 answer
Text editor in NetBeans
I am trying to implement a text editor in NetBeans with simple functions like: text styling (bold, italic, underlined ...), open file, save file and search. Search function searches for a specified string in the document and highlights the results.…

user3476140
- 3
- 3
0
votes
0 answers
Highlight backgroung colors of some words in HTML Document in java
I am reading HTML document as text and extracting matched strings(with start and end index) from documents based on string array.Now i have to change the background color of those extracted strings in the original HTML document.But i should not…

user3004131
- 21
- 3
0
votes
3 answers
How highlighter of Java Swing works on marginal cases?
I have this code :
JTextArea textComp;
Highlighter hilite = textComp.getHighlighter();
if (word.toString().equals(pattern[i]))
{
hilite.addHighlight(posStart, (posEnd), myHighlighter);
break;
}
word is a StringBuilder
Suppose the…

soham
- 1,508
- 6
- 30
- 47
0
votes
1 answer
How do I update a ColourHighlighter (swingx) when the predicate has changed
I have a class called ErrorHighlighter which gets notified anytime a property called errorString is changed. Based on this propertychangeevent I update the HighLighterPredicate to highlight a particular row with a red background.
ErrorHighlighter…

sethu
- 8,181
- 7
- 39
- 65
0
votes
2 answers
Highlight a string according to given line number in JtextArea
Is there any function I can use to actually pass a line number and the string to highlight the word in that line number. I got no clue on how to achieve this.
Am able to load my File on the JtextArea.
The File am loading "Hello.txt"…

Ms_Joe
- 160
- 2
- 7
- 16
0
votes
0 answers
Find location of character index in a Swing text control
I want to do some custom drawing of brackets around certain text in a text control in Java Swing. But I need to know where to draw them. I do know the exact range of characters in the text content, so I just need to be able to translate those…

mentics
- 6,852
- 5
- 39
- 93
-1
votes
1 answer
Java - Text format to change
Like in word I want to change the text color in my project here's the code I made
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.JFrame;
public class Cool extends JFrame {
private static final long…

user3725193
- 15
- 2