⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainframe.java

📁 自己写的一个Java swing 单机框架
💻 JAVA
字号:
/* * MainFrame.java * * Created on 2009年1月15日, 下午2:36 */package cn.haha.main;import cn.haha.login.LoginFrame;import cn.haha.time.BackupTask;import cn.haha.time.Scheduler;import java.awt.event.WindowAdapter;import java.awt.event.WindowEvent;import java.util.Date;import javax.swing.JOptionPane;import org.apache.log4j.Logger;/** * * @author  tzy */public class MainFrame extends javax.swing.JFrame {    private LoginFrame login ;    private MyTray mytray ;    private BackupTask backup = new BackupTask(this);    private Scheduler myscheduler = new Scheduler();    static Logger log = Logger.getLogger(MainFrame.class.getName ());//日志输出对象        public MainFrame(LoginFrame login){        initComponents();        this.login = login;        mytray = new MyTray(this);        init();    }    private void addListener() {        this.addWindowListener(new WindowAdapter() {			public void windowClosing(WindowEvent e) {				int i = JOptionPane.showConfirmDialog(null, new String(						"是否最小化到托盘(单击否退出)"), "警告", JOptionPane.YES_NO_OPTION);				                                if (i == 1) {					System.exit(0);				}else{                                    mytray.tray();                                }                            			}                        public void windowIconified(WindowEvent e) {                            mytray.tray();                        }		});                //        throw new UnsupportedOperationException("Not yet implemented");    }    private void init() {        this.setTitle("clown通用框架V1.0 之 主界面");        setLocationRelativeTo(null);        addListener();        startTimeTask();        this.setVisible(false);             }    /** This method is called from within the constructor to     * initialize the form.     * WARNING: Do NOT modify this code. The content of this method is     * always regenerated by the Form Editor.     */    @SuppressWarnings("unchecked")    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents    private void initComponents() {        jLabel1 = new javax.swing.JLabel();        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);        jLabel1.setText("主界面");        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());        getContentPane().setLayout(layout);        layout.setHorizontalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()                .addContainerGap(200, Short.MAX_VALUE)                .addComponent(jLabel1)                .addGap(242, 242, 242))        );        layout.setVerticalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addGap(143, 143, 143)                .addComponent(jLabel1)                .addContainerGap(216, Short.MAX_VALUE))        );        pack();    }// </editor-fold>//GEN-END:initComponents    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JLabel jLabel1;    // End of variables declaration//GEN-END:variables    private void startTimeTask() {        myscheduler.scheduler(backup, new Date(),1000*60*5);//        throw new UnsupportedOperationException("Not yet implemented");    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -