3
JOptionPane.showConfirmDialog(this,
message,
"title",
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
消息可以是10行,消息可以是500行。它動態變化。如果消息超出屏幕高度,我想實現滾動條。當消息較大時,JOptionPane.showConfirmDialog不在屏幕上
所以,我想:
JTextArea textArea = new JTextArea (message);
JscrollPane scrollPane = new JScrollPane(textArea,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
JOptionPane.showConfirmDialog(this,
scrollPane,
"title",
JOptionPane.YES_NO_OPTION,
JOptionPane.WARNING_MESSAGE);
這將打開一個對話框和窗口滾動條,它工作正常,但在Mac OS的對話框超出屏幕。
任何人都可以幫助我嗎?