📄 popedomeditdialog.java
字号:
package com.ciash.bms.gui.impl;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import com.ciash.bms.entity.Popedom;
import com.ciash.bms.gui.uiInter.PopEditUI;
import com.ciash.common.gui.GroupPanel;
import com.ciash.common.gui.tool.ToolKit;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JOptionPane;
/**
* <p>
* Title: BMS
* </p>
* <p>
* Description:
* </p>
* <p>
* Copyright: Copyright (c) 2009
* </p>
* <p>
* Company: Cigarette Ash Inc.
* </p>
*
* @author Cigarette Ash
* @version 1.0
*/
public class PopedomEditDialog extends JDialog implements PopEditUI {
private JPanel panel1 = new JPanel();
private BorderLayout borderLayout1 = new BorderLayout();
private PopedomViewPanel p = new PopedomViewPanel();
private JTextField t1 = new JTextField();
// private JTextField t2 = new JTextField();
private JLabel jLabel1 = new JLabel();
// private JLabel jLabel2 = new JLabel();
private GroupPanel jPanel1 = new GroupPanel();
private GridBagLayout gridBagLayout1 = new GridBagLayout();
private JButton b1 = new JButton();
private JButton b2 = new JButton();
private int option;
public PopedomEditDialog(Frame frame, String title, boolean modal) {
super(frame, title, modal);
jbInit();
pack();
}
public PopedomEditDialog() {
this(null, "", true);
setResizable(false);
}
private void jbInit() {
panel1.setLayout(borderLayout1);
this.getContentPane().setLayout(null);
t1.setText("jTextField1");
// t2.setText("jTextField2");
jLabel1.setText("权限名:");
// jLabel2.setRequestFocusEnabled(true);
// jLabel2.setText("权限描述:");
jPanel1.setLayout(gridBagLayout1);
b1.setBounds(new Rectangle(224, 9, 93, 30));
b1.setText("确定");
b1.addActionListener(new PopedomCreateDialog_b1_actionAdapter(this));
b1.addActionListener(new PopedomCreateDialog_b1_actionAdapter(this));
b2.setBounds(new Rectangle(225, 41, 92, 30));
b2.setText("取消");
b2.addActionListener(new PopedomCreateDialog_b2_actionAdapter(this));
p.setBounds(new Rectangle(-2, 79, 320, 212));
jPanel1.setBounds(new Rectangle(7, 7, 213, 63));
panel1.setBounds(new Rectangle(10, 10, 0, 0));
this
.addWindowListener(new PopedomCreateDialog_this_windowAdapter(
this));
getContentPane().add(panel1, null);
getContentPane().add(p, null);
jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4,
12, 0, 12), 0, 0));
//// jPanel1.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
// GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(
// 11, 12, 3, 0), 0, 0));
// jPanel1.add(t2, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,
// GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
// new Insets(0, 19, 3, 11), 44, 0));
jPanel1.add(t1, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
new Insets(4, 19, 0, 11), 44, 0));
this.getContentPane().add(b1, null);
this.getContentPane().add(b2, null);
this.getContentPane().add(jPanel1, null);
}
public int showDialog() {
initSize();
this.t1.setText("");
// this.t2.setText("");
setVisible(true);
return option;
}
private void initSize() {
setSize(325, 340);
setLocation(ToolKit.getScreenCenterLocation(getSize()));
}
public int showDialog(Popedom popedom) {
initSize();
setPop(popedom);
setVisible(true);
return showDialog();
}
public int getOption() {
return option;
}
void b1_actionPerformed(ActionEvent e) {
if (ToolKit.isNull(t1.getText())) {
JOptionPane.showMessageDialog(null, "用户权限名不能为空", "错误!"
, JOptionPane.ERROR_MESSAGE);
}
// else if(ToolKit.isNull(t2.getText())){
// JOptionPane.showMessageDialog(null, "用户权限描述不能为空", "错误!"
// , JOptionPane.ERROR_MESSAGE);
// }
// else if(!ToolKit.isInt(t1.getText())){
// JOptionPane.showMessageDialog(null, "用户权限值只能是数字", "错误!"
// , JOptionPane.ERROR_MESSAGE);
// }
else{
this.option = OK_OPTION;
setVisible(false);
}
}
void b2_actionPerformed(ActionEvent e) {
this.option = CANCEL_OPTION;
setVisible(false);
}
void this_windowClosing(WindowEvent e) {
this.option = CANCEL_OPTION;
setVisible(false);
}
public Popedom getPop() {
Popedom pop = p.getSelectPop();
pop.setPopedom(t1.getText());
return pop;
}
public void setPop(Popedom pop) {
this.t1.setText(pop.getPopedom());
// this.t2.setText(pop.getPopedom());
p.setSelectPop(pop);
}
class PopedomCreateDialog_b1_actionAdapter implements
java.awt.event.ActionListener {
public PopedomEditDialog adaptee;
PopedomCreateDialog_b1_actionAdapter(PopedomEditDialog adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.b1_actionPerformed(e);
}
}
class PopedomCreateDialog_b2_actionAdapter implements
java.awt.event.ActionListener {
public PopedomEditDialog adaptee;
PopedomCreateDialog_b2_actionAdapter(PopedomEditDialog adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.b2_actionPerformed(e);
}
}
class PopedomCreateDialog_this_windowAdapter extends
java.awt.event.WindowAdapter {
public PopedomEditDialog adaptee;
PopedomCreateDialog_this_windowAdapter(PopedomEditDialog adaptee) {
this.adaptee = adaptee;
}
public void windowClosing(WindowEvent e) {
adaptee.this_windowClosing(e);
}
}
}
class PopedomCreateDialog_b1_actionAdapter implements java.awt.event.ActionListener {
public PopedomEditDialog adaptee;
PopedomCreateDialog_b1_actionAdapter(PopedomEditDialog adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.b1_actionPerformed(e);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -