怎么textarea或其他文本控件中实现高亮显示文本? rt谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 css处理下就可以了,具体我也不会 <textarea name="aaa" style="color: #FF0000">12346</textarea> 使用javasrcipt:document.getElementById('a').select();就这么一句就可以使他高亮了 可能是我没说清楚,是在java中的TextArea 设置对应的foreground, background就行了吧 与JScrollPane结合起来用就可以啦。例如:import java.awt.*;import javax.swing.*;class JPanelTest extends JFrame{ JButton cl,sa,ex; JPanel p1,p2; JTextArea t; public JPanelTest() { super("面板示例"); this.setDefaultCloseOperation(EXIT_ON_CLOSE); testInit(); Container cc=getContentPane(); cc.setLayout(new FlowLayout()); cc.add(p1); cc.add(p2); this.setSize(350,150); this.setVisible(true); } void testInit(){ cl = new JButton("Clear"); sa = new JButton("Save"); ex = new JButton("Exit"); t=new JTextArea(5,20);// t.setLineWrap(true); p1=new JPanel(new GridLayout(3,1,5,5)); p2=new JPanel(); p1.add(cl); p1.add(sa);p1.add(ex); p2.add(new JScrollPane(t)); } public static void main(String[] args) { new JPanelTest(); }} 大家帮忙调试一下我做的小程序(服务器向客户端发送文件) 用java做一个简单的计算器 JProgressBar怎么使用? 流的问题 百分求解一程序(JAVA网络) comm.jar操作串口问题,非常急大家帮忙啊? Do you get a good solution to this question? java在linux下的开发工具 我从网上下载了一些*.jar文件,如何把它加到JBuilder中??? 正则表达式如何表示 或者 和 空格这两个意思? 老鸟进,问个字符集转码的问题 如何用SESSION函数实现将数据插入不同的数据库
import java.awt.*;
import javax.swing.*;class JPanelTest extends JFrame{
JButton cl,sa,ex;
JPanel p1,p2;
JTextArea t;
public JPanelTest() {
super("面板示例");
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
testInit();
Container cc=getContentPane();
cc.setLayout(new FlowLayout());
cc.add(p1);
cc.add(p2);
this.setSize(350,150);
this.setVisible(true);
}
void testInit(){
cl = new JButton("Clear");
sa = new JButton("Save");
ex = new JButton("Exit");
t=new JTextArea(5,20);
// t.setLineWrap(true);
p1=new JPanel(new GridLayout(3,1,5,5));
p2=new JPanel();
p1.add(cl); p1.add(sa);p1.add(ex);
p2.add(new JScrollPane(t)); }
public static void main(String[] args) {
new JPanelTest();
}
}