java代码全屏显示 java怎么全屏

java显示全屏的代码怎么写?GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = environment.getDefaultScreenDevice();
device.setFullScreenWindow(this);// this ==jframeinstance(window子类都可以)
楼上那个只是最大化而已 。不能实现全屏 。。这个才是实现全屏 。
java如何改全屏为窗口?求啊啊啊啊这个研究了java代码全屏显示,半上午java代码全屏显示,没办法,直接简单java代码全屏显示的改几行代码,就能变成窗体程序的 , 
需要重构代码的
把 ScreenManager 重构成 JFrame 或是 剥离开 ScreenManager直接用 Jframe
如果 。只是想简单的,变成 窗体 , 可以
修改 frame.setUndecorated(true)把这个屏蔽掉
但是,你只是,临时的方法,不推荐,不能解决根本
如何用java设置全屏的代码创建一个JFrame ,设置成undecorated,设置bounds为屏幕大小
//import 如下java代码全屏显示:
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Toolkit;
import javax.swing.JFrame;
代码如下java代码全屏显示:
JFrame frame = new JFrame();
frame.setUndecorated(true);
// 取得屏幕大小
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle bounds = new Rectangle( screenSize );
frame.setBounds( bounds );
frame.setVisibale(true);
Java全屏带分辨率设置 Java代码
import java awt Color;
import java awt DisplayMode;
import java awt Font;
import java awt Graphics;
import javax swing JFrame;
public class FullScreenTest extends JFrame {
public static void main(String[] args) {
DisplayMode displayMode;
if (args length == ) {
displayMode = new DisplayMode(
Integer parseInt(args[ ])
Integer parseInt(args[ ])
Integer parseInt(args[ ])
DisplayMode REFRESH_RATE_UNKNOWN);
}
else {
displayMode = new DisplayMode(
DisplayMode REFRESH_RATE_UNKNOWN);
}
FullScreenTest test = new FullScreenTest();
test run(displayMode);
}
private static final long DEMO_TIME = ;
public void run(DisplayMode displayMode) {
setBackground(Color blue);
setForeground(Color white);
setFont(new Font( Dialog Font PLAIN ));
SimpleScreenManager screen = new SimpleScreenManager();
try {
screen setFullScreen(displayMode this);
try {
Thread sleep(DEMO_TIME);
}
catch (InterruptedException ex) { }
}
finally {
screen restoreScreen();
}
}
public void paint(Graphics g) {
g drawString( Hello World! );
}
}
Java代码
import java awt DisplayMode;
import java awt GraphicsDevice;
import java awt GraphicsEnvironment;
import java awt Window;
import javax swing JFrame;
/**
* 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
getLocalGraphicsEnvironment();
device = environment getDefaultScreenDevice();
}
/**
* Enters full screen mode and changes the display mode
*/
public void setFullScreen(DisplayMode displayMode JFrame window) {
window setUndecorated(true);
window setResizable(false);
device setFullScreenWindow(window);
if (displayMode != nulldevice isDisplayChangeSupported()) {
try {
device setDisplayMode(displayMode);
} catch (IllegalArgumentException ex) {

推荐阅读