📄 warndialog.java
字号:
package org.eclipse.ve.model;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPanel;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JButton;
public class WarnDialog extends JDialog implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 3380834375789432402L;
private JPanel jContentPane;
private JLabel jLabelMessage = null;
private JButton jButtonYes = null;
private JButton jButtonNo = null;
final char nl = '\n';// 换行
// private List list = null; //
// @jve:decl-index=0:visual-constraint="456,159"
/**
* This is the default constructor
*/
public WarnDialog(Frame frame) {
super(frame, true);
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((int) (screenSize.width - 416) / 2,
(int) (screenSize.height - 310) / 2);
this.setResizable(false);
SetupDialog.setDefaultLookAndFeelDecorated(true);
Auto.setMouse(this);
}
/**
* This method initializes this
*
* @return void
*/
private void jbInit() {
this.setSize(new Dimension(200, 120));
this.setContentPane(getJContentPane());
this.setResizable(false);
// this.setDefaultLookAndFeelDecorated(true);
// this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.setModal(true);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabelMessage = new JLabel();
jLabelMessage.setBounds(new java.awt.Rectangle(17, 10, 180, 30));
jLabelMessage.setFont(new java.awt.Font("Dialog",
java.awt.Font.BOLD, 14));
jLabelMessage.setForeground(java.awt.Color.black);
jLabelMessage.setText("该文件已存在,是否覆盖?");
jContentPane = new Content(Auto.warningDialogBack);
jContentPane.setLayout(null);
jContentPane.add(jLabelMessage, null);
jContentPane.add(getJButtonYes(), null);
jContentPane.add(getJButtonNo(), null);
}
return jContentPane;
}
/**
* This method initializes jButtonYes
*
* @return javax.swing.JButton
*/
JButton getJButtonYes() {
if (jButtonYes == null) {
jButtonYes = new JButton();
jButtonYes.setBounds(new java.awt.Rectangle(20, 45, 60, 23));
jButtonYes.setIcon(Auto.sure);
jButtonYes.setBorder(Auto.unSelected);
jButtonYes.addActionListener(this);
jButtonYes.setRolloverIcon(Auto.sureBack);
}
return jButtonYes;
}
/**
* This method initializes jButtonNo
*
* @return javax.swing.JButton
*/
JButton getJButtonNo() {
if (jButtonNo == null) {
jButtonNo = new JButton();
jButtonNo.setBounds(new java.awt.Rectangle(120, 45, 60, 23));
jButtonNo.setIcon(Auto.exit);
jButtonNo.setBorder(Auto.unSelected);
jButtonNo.addActionListener(this);
jButtonNo.setRolloverIcon(Auto.exitBack);
}
return jButtonNo;
}
public void actionPerformed(ActionEvent e) {
Object obj = e.getSource();
if (obj == jButtonYes) {
Writer wr = new Writer();
wr.fileCreate(Auto.jtCode.getText(),Auto.proList);
this.dispose();
// 所有参数回复初始状态
Auto.proList.clear();
Auto.listProperty.removeAll();
Auto.flagForeignKey = 0;
Auto.jtCode.setText("");
if (Auto.path.length() > 35) {
Auto.actionPanel.setText(Auto.path.substring(0, 35) + nl
+ Auto.path.substring(35, Auto.path.length()) + "\\"
+ Auto.fileName + "文件已覆盖");
} else
Auto.actionPanel.setText(Auto.path + "\\" + Auto.fileName
+ "文件已覆盖");
Auto.jbSure.setBorder(Auto.unSelected);
} else if (obj == jButtonNo) {
this.dispose();
Auto.jbSure.setBorder(Auto.unSelected);
if (Auto.path.length() > 35) {
Auto.actionPanel.setText(Auto.path.substring(0, 35) + nl
+ Auto.path.substring(35, Auto.path.length()) + "\\"
+ Auto.fileName + "文件未覆盖");
} else
Auto.actionPanel.setText(Auto.path + "\\" + Auto.fileName
+ "文件未覆盖");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -