📄 ensureseatdialog.java
字号:
package librarysearchingsystem;
import javax.swing.JDialog;
import javax.swing.JLabel;
import java.awt.*;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import fileUtility.ReadingRoom;
public class EnsureSeatDialog extends JDialog implements ActionListener {
JLabel jLabel1 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
BorderLayout borderLayout1 = new BorderLayout();
JPanel jPanel1 = new JPanel();
private final int width = 220;
private final int height = 140;
static Frame f;
int x = -1, y = -1;
ReadingRoom r;
public EnsureSeatDialog() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public EnsureSeatDialog(Frame fr) {
this.f = fr;
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public EnsureSeatDialog(ReadingRoom r, int x, int y) {
// this.f = fr;
this.x = x;
this.y = y;
this.r = r;
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public static void main(String[] args) {
EnsureSeatDialog untitled1 = new EnsureSeatDialog();
}
private void jbInit() throws Exception {
this.getContentPane().setBackground(new Color(173, 138, 187));
this.setName("");
// this.setResizable(false);
this.setSize(width, height);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((d.width - width) / 2, (d.height - height) / 2);
this.getContentPane().setLayout(borderLayout1);
jLabel1.setFont(new java.awt.Font("华文行楷", Font.PLAIN, 20));
jLabel1.setBorder(null);
jLabel1.setText("您确认选择此座位?");
jLabel1.setHorizontalAlignment(JLabel.CENTER);
jButton2.setFont(new java.awt.Font("隶书", Font.PLAIN, 14));
jButton2.setText("取消");
jButton1.setFont(new java.awt.Font("隶书", Font.PLAIN, 14));
jButton1.setText("确认");
this.getContentPane().add(jLabel1, java.awt.BorderLayout.CENTER);
this.getContentPane().add(jPanel1, java.awt.BorderLayout.SOUTH);
jPanel1.setBackground(new Color(228, 187, 225));
jPanel1.add(jButton1);
jButton1.addActionListener(this);
jPanel1.add(jButton2);
jButton2.addActionListener(this);
this.setModal(true);
this.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
this.dispose();
if (e.getSource() == jButton1) {
f.ensureSeat(x, y);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -