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 add when user type this command. Can any one implement a jTextField. 回答1: An idea would be to use a StyleDocument and DocumentFilter This is actually based on this question, but I wasn't sure if I could attempt to use a JTextField import java.awt.Color; import java.awt.EventQueue; import java.awt.GridBagLayout;