JTextArea在JOptionPane.showMessage后,显示的字符可以更改删除的问题。 什么意思!?哪显示的应该是只读的!? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import javax.swing.*;public class RollDie { public static void main ( String[] args ) { int face, frequency[] = new int[7]; String output = ""; for ( int roll = 1; roll <= 6000; roll++ ) { face = 1 + ( int ) ( Math.random() * 6 ); ++frequency[ face ]; } output += "Face\tFrequency"; for ( face = 1; face < frequency.length; face++ ) output += "\n" + face + "\t" + frequency[ face ]; JTextArea outputArea = new JTextArea( 7, 10 ); outputArea.append( output ); JOptionPane.showMessageDialog( null, outputArea, "Rolling a Die 6000 Times", JOptionPane.INFORMATION_MESSAGE ); System.exit( 0 ); }}在显示出来的JTextArea区域里的内容,是可以用鼠标定位后手工改掉或删除。如何禁止这样的操作,就像VB或C#那种一样? 这个小程序有一小段不太理解,谁能帮我解释一下 高分求助: JFace TableViewer UNDO的问题 这段代码怎么运行没有结果啊!! 关于JTextPane的困惑 这种报错怎么改 请大家帮个忙! 请教一个郁闷的问题,急。抛出异常-NullPointerException,求解。 jdk菜鸟问题 数据库不能更新 要运行JDBC的程序,该如何设置? 编写bat文件,遇到文件目录名中有空格,如何处理? 错误信息: 'class' or 'interface' expected 求助
public static void main ( String[] args )
{
int face, frequency[] = new int[7];
String output = "";
for ( int roll = 1; roll <= 6000; roll++ )
{
face = 1 + ( int ) ( Math.random() * 6 );
++frequency[ face ];
}
output += "Face\tFrequency";
for ( face = 1; face < frequency.length; face++ )
output += "\n" + face + "\t" + frequency[ face ];
JTextArea outputArea = new JTextArea( 7, 10 );
outputArea.append( output );
JOptionPane.showMessageDialog( null, outputArea,
"Rolling a Die 6000 Times",
JOptionPane.INFORMATION_MESSAGE );
System.exit( 0 );
}
}在显示出来的JTextArea区域里的内容,是可以用鼠标定位后手工改掉或删除。
如何禁止这样的操作,就像VB或C#那种一样?