Java代碼
import java
import java
import java
import java
import javax
public class FullScreenTest extends JFrame {
public static void main(String[] args) {
DisplayMode displayMode;
if (args
displayMode = new DisplayMode(
Integer
Integer
Integer
DisplayMode
}
else {
displayMode = new DisplayMode(
DisplayMode
}
FullScreenTest test = new FullScreenTest();
test
}
private static final long DEMO_TIME =
public void run(DisplayMode displayMode) {
setBackground(Color
setForeground(Color
setFont(new Font(
SimpleScreenManager screen = new SimpleScreenManager();
try {
screen
try {
Thread
}
catch (InterruptedException ex) { }
}
finally {
screen
}
}
public void paint(Graphics g) {
g
}
}
Java代碼
import java
import java
import java
import java
import javax
/**
* The SimpleScreenManager class manages initializing and displaying full screen
* graphics modes
*/
public class SimpleScreenManager {
private GraphicsDevice device;
/**
* Creates a new SimpleScreenManager object
*/
public SimpleScreenManager() {
GraphicsEnvironment environment = GraphicsEnvironment
device = environment
}
/**
* Enters full screen mode and changes the display mode
*/
public void setFullScreen(DisplayMode displayMode
window
window
device
if (displayMode != null && device
try {
device
} catch (IllegalArgumentException ex) {
// ignore
}
}
}
/**
* Returns the window currently used in full screen mode
*/
public Window getFullScreenWindow() {
return device
}
/**
* Restores the screen
*/
public void restoreScreen() {
Window window = device
if (window != null) {
window
}
device
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26128.html