【发布时间】:2010-06-25 12:36:51
【问题描述】:
我创建了一个 Java 对话框,它使用嵌入式 HTML 来显示消息。该消息应包含一个链接,单击该链接时应触发一个事件(启动另一个对话框)。我不知道该怎么做。这真的可能吗?
代码如下:
message = new JLabel("<html>You have selected <i>"+registry_name+" "+ registry_version +"</i><BR> in the " +"<FONT COLOR=\"#0000FF\"><U><A href=\"javascript:popup();\" id=\"test-link\">container.</A></U></FONT>" +"<script type=\"text/javascript\">"+"function popup(){var generator=window.setVisible(true);}</script></html>");
JOptionPane.showConfirmDialog(dialog.dialog, message , "Selection Window",JOptionPane.CLOSED_OPTION, JOptionPane.INFORMATION_MESSAGE);
【问题讨论】: