📄 fullscreentipui.java
字号:
package com.liming.remind.ui;
import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
/**
* Function : Set full screen tip UI
*
* @author Liming
* @time Dec 29, 2008 7:26:35 PM
* @version 1.0
*/
public class FullScreenTipUI extends JFrame {
/**
* Field : serialVersionUID
*/
private static final long serialVersionUID = 5132386531764195792L;
private JButton close;
// Whether exit or not
private boolean isExit = false;
public FullScreenTipUI(String remindContent) {
close = new JButton("<html><font color='green' size='3'><b>"
+ remindContent + "</b></font></html>");
close.setActionCommand("close");
close.addActionListener(new MyButtonListener());
// To get Content Pane
JPanel panel = (JPanel) this.getContentPane();
panel.setBackground(Color.DARK_GRAY);
panel.setLayout(new GridBagLayout());
panel.add(close);
// Set default close operation
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
// Set no decoration
this.setUndecorated(true);
// Set full screen hint
getGraphicsConfiguration().getDevice().setFullScreenWindow(this);
// Wait for 10 seconds
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Exit if you have't click button close
if (isExit == false) {
dispose();
}
}
/**
* Function : The inner class to listen the clicking event
*
* @author Liming
* @time Dec 29, 2008 7:18:59 PM
* @version 1.0
*/
private class MyButtonListener implements ActionListener {
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("close")) {
isExit = true;
dispose();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -