📄 clientmainframe.java
字号:
package com.tarena.abs.client;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.*;
import com.tarena.abs.model.*;
public class ClientMainFrame extends JFrame{
private JScrollPane center;
private Agent user;
private ObjectInputStream ois;
private ObjectOutputStream oos;
public ClientMainFrame(ObjectInputStream ois,ObjectOutputStream oos,Agent user){
super("航班出票系统客户端 v1.0");
this.ois=ois;
this.oos=oos;
this.user=user;
center=new JScrollPane(new JPanel());
this.add(new SeachFlightPanel(ois,oos) ,BorderLayout.NORTH);
this.add(center,BorderLayout.CENTER);
this.add(new AddOrderItemPanel(ois,oos),BorderLayout.SOUTH);
}
public void setCenterComponent(Component com){
center.setViewportView(com);
this.setVisible(true);
}
public void showMe(){
this.setSize(800,600);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent arg0) {
int select=JOptionPane.showConfirmDialog(ClientMainFrame.this,"退出程序将中断与服务器的连接,确定退出吗?",
"确定退出程序吗?",JOptionPane.YES_NO_OPTION);
if(select==JOptionPane.YES_OPTION){
try {
Request req=new Request("quit");
oos.writeObject(req);
oos.flush();
System.exit(0);
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -