📄 deletedialog.java
字号:
package view;import java.awt.*;import javax.swing.*;import com.borland.jbcl.layout.*;import java.awt.event.*;import operation.*;import helper.*;import brgeometry.*;import com.versant.fund.*;import com.versant.trans.*;public class DeleteDialog extends JDialog { private JPanel panel1 = new JPanel(); private XYLayout xYLayout1 = new XYLayout(); private JButton jButton1 = new JButton(); private JButton jButton2 = new JButton(); private JButton jButton3 = new JButton(); private JComboBox jComboBox1 = new JComboBox(); private JLabel jLabel1 = new JLabel(); private JTextField jTextField1 = new JTextField(); private JLabel jLabel2 = new JLabel(); private JLabel jLabel3 = new JLabel(); public DeleteDialog(Frame frame, String title, boolean modal) { super(frame, title, modal); try { jbInit(); pack(); } catch(Exception ex) { ex.printStackTrace(); } } public DeleteDialog() { this(null, "", false); } private void jbInit() throws Exception { panel1.setLayout(xYLayout1); jButton1.setBackground(SystemColor.inactiveCaptionText); jButton1.setBorder(BorderFactory.createLineBorder(Color.black)); jButton1.setText("确定"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); jButton2.setBackground(SystemColor.inactiveCaptionText); jButton2.setBorder(BorderFactory.createLineBorder(Color.black)); jButton2.setText("重置"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton2_actionPerformed(e); } }); jButton3.setBackground(SystemColor.inactiveCaptionText); jButton3.setBorder(BorderFactory.createLineBorder(Color.black)); jButton3.setText("取消"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton3_actionPerformed(e); } }); jLabel1.setText("请输入您要删除的体的类型"); jLabel2.setText("请输入您要删除的体的名字"); panel1.setBackground(SystemColor.info); jLabel3.setFont(new java.awt.Font("Dialog", 0, 20)); jLabel3.setForeground(Color.red); jLabel3.setText("删除"); jTextField1.setToolTipText(""); this.getContentPane().add(panel1, BorderLayout.CENTER); panel1.add(jButton2, new XYConstraints(223, 214, 72, 28)); panel1.add(jButton3, new XYConstraints(344, 213, 67, 30)); panel1.add(jButton1, new XYConstraints(103, 213, 73, 28)); panel1.add(jComboBox1, new XYConstraints(78, 151, 115, 24)); panel1.add(jTextField1, new XYConstraints(280, 145, 138, 29)); panel1.add(jLabel2, new XYConstraints(272, 117, 154, 20)); panel1.add(jLabel1, new XYConstraints(68, 115, -1, -1)); panel1.add(jLabel3, new XYConstraints(225, 52, -1, -1)); jComboBox1.addItem("长方体"); jComboBox1.addItem("立方体"); jComboBox1.addItem("圆柱体"); jComboBox1.addItem("圆锥体"); jComboBox1.addItem("球体" ); } void jButton1_actionPerformed(ActionEvent e) { String s,s1,s2=""; Manager man=null; s=jComboBox1.getSelectedItem().toString(); s1=jTextField1.getText().toString(); TransSession session = new TransSession("mydb"); try { if (s.equals("长方体")){ man=new CoboidPlaneSolidMan(session); s2="Cuboid#"+s1; } else if (s.equals("立方体")){ man=new SquarePlaneSolidMan(session); s2="Cube#"+s1; } else if (s.equals("圆柱体")){ man=new CylinderCurveSoildMan(session); s2="Cylinder#"+s1; } else if (s.equals("圆锥体")){ man=new ConeCurveSolidMan(session); s2="Cone#"+s1; } else if (s.equals("球体")){ man=new SphereCurveSolidMan(session); s2="Sphere#"+s1; } man.deleteByRoot(s2); session.endSession(); JOptionPane.showConfirmDialog(this,"删除成功","confirm",JOptionPane.PLAIN_MESSAGE); } catch (VException exception){ JOptionPane.showConfirmDialog(this,"对不起,没有这个体","confirm",JOptionPane.PLAIN_MESSAGE); } } void jButton2_actionPerformed(ActionEvent e) { jTextField1.setText(""); } void jButton3_actionPerformed(ActionEvent e) { this.dispose();; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -