java 自定义 弹出框中按钮的文字和功能

如下示例:


		JButton[] buttons = new JButton[1];
		JButton openFileB = new JButton("打开文件");
		buttons[0] = openFileB;
		openFileB.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				try {
					Runtime.getRuntime().exec("cmd /c start " + doc);
				} catch (IOException e1) {
					e1.printStackTrace();
				}
			}
		});

		JOptionPane.showOptionDialog(context.getParentFrame(), doc,
				"影响性分析报告生成路径", JOptionPane.YES_OPTION,
				JOptionPane.INFORMATION_MESSAGE, null, buttons, buttons[0]);

 

你可能感兴趣的:(Java基础学习与总结)