像的話,我想改變文字顏色在我的項目這裏是我做了 import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.JFrame;
public class Cool extends JFrame {
private static final long serialVersio
我試圖在JTextPane中搜索並突出顯示單詞。它的工作原理與迄今爲止沒有很多結果的詞語一樣,但當我嘗試搜索一個有很多實例的單詞時,有時候,突出顯示的結果會突出顯示結果,就像錯過了一些字符。 無論如何,這裏是我用於此目的的代碼。 int index = 0;
String text = null;
try {
int length=textPane.getDocume
我的textArea中使用了高亮顯示類。 我的程序應該像這樣工作: 在textArea中,程序檢測到應放置在第一行中的字符串(註釋行以「#」標記,未考慮),突出顯示它並在整個文本區域發生的所有事件。 例: #this is an example code
#these line are comments
**whateverWordIsFine** #this is the word to h