TA的每日心情 | 开心 2021-3-12 23:18 |
---|
签到天数: 2 天 [LV.1]初来乍到
|
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FullScreenTest1{
public static void main(String[] args){
//取得GraphicsDevice,显示卡,此程序在有些集成显卡上不能工作
GraphicsEnvironment ge =GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
//显示模式:分辨率,颜色,刷新率
DisplayMode displayMode=
new DisplayMode(800,600,16,DisplayMode.REFRESH_RATE_UNKNOWN);
//用JFrmae作为全屏窗口
FullScreenWindow myWindow = new FullScreenWindow();
if ( gd.isFullScreenSupported() ){
gd.setFullScreenWindow(myWindow);//全屏工作
if(gd.isDisplayChangeSupported()){
try{
gd.setDisplayMode(displayMode);//设置显示方式
}catch(IllegalArgumentException e){}
}
}
else
System.out.println("Unsupported full screen.");
}
}
class FullScreenWindow extends JFrame{
public FullScreenWindow(){
setUndecorated(true);//隐藏JFrame上的Title bar
setResizable(false);
this.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt){
dispose();
System.exit(0);
}
});
}
public void quit(){
this.dispose();
}
public void paint(Graphics g){
setBackground(Color.blue);
setForeground(Color.white);
g.setFont(new Font("Dialog",Font.BOLD,30));
g.drawString("这是全屏幕模式",100,100);
}
}
function TempSave(ElementID)
{
CommentsPersistDiv.setAttribute("CommentContent",document.getElementById(ElementID).value);
CommentsPersistDiv.save("CommentXMLStore");
}
function Restore(ElementID)
{
CommentsPersistDiv.load("CommentXMLStore");
document.getElementById(ElementID).value=CommentsPersistDiv.getAttribute("CommentContent");
} |
|