📄 application1.java
字号:
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* package18.Application1
* <P>
* @author lomaky
*/
public class Application1 {
/**
* Constructor
*/
public Application1() throws IOException {
Socket s = new Socket ("127.0.0.1",4321);
Frame frame = new lomakyChat ("Chat " + "127.0.0.1" + ":" + "4321",
s.getInputStream (), s.getOutputStream ());
// Frame frame = new lomakyChat();
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
frame.setLocation((screenSize.width - frameSize.width)/2, (screenSize.height - frameSize.height)/2);
frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
frame.setVisible(true);
}
/**
* main
* @param args
*/
public static void main(String[] args) throws IOException{
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception e) {
e.printStackTrace();
}
new Application1();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -