📄 dialogl.java
字号:
package datastructure;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2004</p> * <p>Company: </p> * @author unascribed * @version 1.0 */import javax.swing.*;import java.awt.*;import java.awt.event.*;class Dialogl extends JDialog implements ActionListener { private JLabel lab1; private JLabel lab2; // 创建一个按钮,单击该按钮关闭对话框 private JButton button; private JPanel panel; public Dialogl(JFrame f, String s,boolean mode) { super(f, s,mode); Container con=getContentPane(); con.setBackground(new Color(194, 208, 221)); lab1 = new JLabel(" 算法演示完成 !"); lab2 = new JLabel(" 单击相关按钮重新开始"); button = new JButton("关闭"); setSize(200, 200); setLocation(200, 100); setVisible(false); con.setLayout(new GridLayout(3, 1)); panel=new JPanel(); panel.setOpaque(false); panel.add(button); con.add(lab1); con.add(lab2); con.add(panel); button.addActionListener(this); } public void actionPerformed(ActionEvent e) { if (e.getSource() == button) { setVisible(false); } } public Dialogl() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { this.getContentPane().setBackground(new Color(194, 208, 221)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -