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

📄 sleep2.java

📁 java+sql 图书管理系统
💻 JAVA
字号:
package MyLibraryok.MyMain;
//
//import java.awt.*;
//
//import javax.swing.*;
//import java.awt.event.MouseAdapter;
//import java.awt.event.MouseEvent;
//import java.awt.event.KeyListener;
//import java.awt.event.KeyEvent;
//
///**
// * <p>Title: </p>
// *
// * <p>Description: </p>
// *
// * <p>Copyright: Copyright (c) 2007</p>
// *
// * <p>Company: </p>
// *
// * @author not attributable
// * @version 1.0
// */
//public class Sleep2 extends JFrame {
//
//    Dimension screen = getToolkit().getScreenSize(); //得到屏幕尺寸
//
//    int myWidth = screen.width;
//    int myHeight = screen.height;
//    int x = 100;
//    int y = 100;
//    JPopupMenu popupMenuSleep = new JPopupMenu();
//    JMenuItem menuItemReturn = new JMenuItem("还 原(R)");
//    JMenuItem menuItemReturnSleep = new JMenuItem("退 出(E)");
//    BorderLayout borderLayout1 = new BorderLayout();
//    JLabel label = new JLabel(new ImageIcon("Image/but.png"));
//    public Sleep2() {
//
//        try {
//            jbInit();
//        } catch (Exception exception) {
//            exception.printStackTrace();
//        }
//    }
//
//    JFrame n = new JFrame();
//    private void jbInit() throws Exception {
//        // 鼠标右键弹出菜单
//        this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
//    popupMenuSleep.add(menuItemReturn);
//        popupMenuSleep.addSeparator(); //分隔线
//        popupMenuSleep.add(menuItemReturnSleep);
//
//        menuItemReturn.addActionListener(new SleepMenuItemListener(this));
//        menuItemReturnSleep.addActionListener(new SleepMenuItemListener(this));
//
//        addWindowListener(new SleepWindowListener(this));
//        this.addKeyListener(new KeyListener(){
//      /**
//       * keyPressed
//       *
//       * @param e KeyEvent
//       */
//      public void keyPressed(KeyEvent e) {
//      }
//      public void keyReleased(KeyEvent e) {
//
//      }
//      public void keyTyped(KeyEvent e) {
//      }
//    } );
//
//        addMouseListener(new MouseAdapter() { //窗口的鼠标事件处理
//            public void mousePressed(MouseEvent event) { //点击鼠标
//                triggerEvent(event); //调用triggerEvent方法处理事件
//            }
//
//            public void mouseReleased(MouseEvent event) { //释放鼠标
//                triggerEvent(event);
//            }
//
//            private void triggerEvent(MouseEvent event) { //处理事件
//                if (event.isPopupTrigger()) { //如果是弹出菜单事件(根据平台不同可能不同)
//                    popupMenuSleep.show(event.getComponent(), event.getX(),
//                                        event.getY()); //显示菜单
//                }
//            }
//        });
///////////////////////////鼠标右键弹出菜单
//
//        MySleepFrame bg = new MySleepFrame(n);
//        bg.updateBackground();
//        getContentPane().setLayout(borderLayout1);
//        bg.setLayout(new BorderLayout());
//        bg.add("Center", label);
//        this.setUndecorated(true);
//        this.addMouseListener(new SleepMouseListener(this));
//        this.getContentPane().add(bg);
//        // Center the frame
//        if (x >= myWidth || y >= myHeight) {
//            x = myWidth;
//            y = myHeight;
//            this.setSize(x, y);
//            this.setLocation(0, 0);
//        } else {
//            this.setSize(x, y);
//
//            this.setLocation(myWidth - 120,myHeight-myHeight +50);
//
//        }
//        this.setVisible(true);
//
//    }
//
//    public static void main(String[] args) {
//        Sleep2 frame2 = new Sleep2();
//    }
//}

⌨️ 快捷键说明

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