我已經編寫了下面的代碼以顯示一些信息並通過jOptionPane從用戶獲取響應。現在提供給此方法的文本會隨着時間的推移而增長,並且在文本數量增加一段時間後,jOptionPane會變得很奇怪,有時不會顯示按鈕,並且整個面板被文本佔據,並且按鈕無法訪問。正確顯示jOptionPane中顯示的消息的文本大小的按鈕時
我該如何解決這個問題?
public void jOptionPane1(agent, text) {
if (GetParameter("MessagesCheck")) {
String[] choices = ["Yes", "No", "Default"]
JTextArea textArea = new JTextArea(text);
textArea.setColumns(125);
textArea.setLineWrap(true); textArea.setWrapStyleWord(true);
int response = JOptionPane.showOptionDialog(null,textArea,"choices",0,JOptionPane.INFORMATION_MESSAGE,null,choices,choices[2]);
}
}
非常感謝:)一行額外的代碼,並完成它! – blackace 2011-03-21 17:39:42