首页>代码>java swing通过socket模拟多人聊天>/chat/src/chatclient/Start.java
package chatclient;

import java.awt.Toolkit;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension;

public class Start {
    boolean packFrame = false;

    /**
     * Construct and show the application.
     */
    public Start() {
        LoginJFrame frame = new LoginJFrame();
        // Validate frames that have preset sizes
        // Pack frames that have useful preferred size info, e.g. from their layout
        if (packFrame) {
            frame.pack();
        } else {
            frame.validate();
        }

        // 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.setVisible(true);
        frame.txtNick.requestFocus(true);
    }

    /**
     * Application entry point.
     *
     * @param args String[]
     */
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                try {
                    UIManager.setLookAndFeel(UIManager.
                                             getSystemLookAndFeelClassName());
                } catch (Exception exception) {
                    exception.printStackTrace();
                }

                new Start();
            }
        });
    }
}
最近下载更多
1690356080  LV37 4月23日
CL200228  LV4 2023年5月4日
oyonogul  LV1 2022年11月21日
youwuzuichen  LV10 2022年9月8日
huevnn  LV5 2022年6月16日
bearloadprogress  LV7 2022年5月12日
liys1234  LV9 2022年4月22日
装了磁铁的果冻  LV1 2022年1月7日
9843637  LV9 2021年12月14日
tttyyyytt  LV2 2021年6月22日
最近浏览更多
1690356080  LV37 4月23日
krispeng  LV6 4月15日
lalalla159  LV3 2023年12月2日
Sutnuf 2023年11月27日
暂无贡献等级
13161895  LV1 2023年7月4日
2017143155  LV12 2023年6月24日
链路预测 2023年6月19日
暂无贡献等级
17683946472  LV9 2023年6月8日
CL200228  LV4 2023年5月4日
fewfsdaf  LV4 2023年4月18日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友