
正文
java打开全屏页面代码 java窗口全屏
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
如何用java设置全屏的代码
创建一个JFrame ,设置成undecorated,设置bounds为屏幕大小
//import 如下:
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Toolkit;
import javax.swing.JFrame;
代码如下:
JFrame frame = new JFrame();
frame.setUndecorated(true);
// 取得屏幕大小
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle bounds = new Rectangle( screenSize );
frame.setBounds( bounds );
frame.setVisibale(true);
相关问答
Q1: JAVA中打开新页面代码
/**
* 打开打印窗口
* url:链接页面或action动作
* Banglu
*/
function printWindow(url){
var sURL = url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "
+ "location=no, status=no, titlebar=no, width=800, height=600, top=100, left=100";
window.open(sURL,'notoolbar',sFeatures);
}function exportWindow(url){
var sURL = url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no,resizable=yes, "
+ "location=no, status=no, titlebar=no, width=800, height=600, top=50, left=50";
var objwin=window.open(sURL,'export'+randomNum(),sFeatures);
objwin.close();
}
/**
* 打开模态窗口
* url:链接页面或action动作
* width:打开模态窗口java打开全屏页面代码的宽度
* height:打开模态窗口java打开全屏页面代码的高度
* 注意java打开全屏页面代码:打开模态窗口java打开全屏页面代码的页面中要在head后面加上
* meta http-equiv="Pragma" content="no-cache"java打开全屏页面代码:禁止模态窗口缓存
* base target="_self"/:模态窗口中的表单在本窗口中提交
* a onClick='window.location = "view-source:" + window.location.href'b源文件/b/a 可以查看模态窗口的源文件
* Banglu
*/
function modalWindow(url, width, height){
var sURL = url;
var sFeatures = "dialogWidth:" + width + "px; dialogHeight:" + height + "px; "
+ "help:no; scroll:yes; center:yes; status:no;resizable:yes";
window.showModalDialog(sURL, window, sFeatures);
}/**
* 打开普通窗口
* url:链接页面或action动作
* width:宽度
* height:高度
* Banglu
*/
function openWindow(url, width, height){
var sURL=url;
var sFeatures = "scrollbars=yes, status=yes, resizable=yes,"
+ "toolbar=yes, menubar=yes, location=yes, titlebar=yes"
if(width!=null){
sFeatures+=", width="+width;
}
if(height!=null){
sFeatures+=", height="+height;
}
window.open(sURL, 'open'+randomNum(), sFeatures);
}/**
* 打开窗口
* url:链接页面或action动作
* width:宽度
* height:高度
Banglu
*/
function openNoBarWindow(url, width, height){
var sURL=url;
var sFeatures = "scrollbars=no, status=no, resizable=no,"
+ "toolbar=no, menubar=no, location=no, titlebar=no"
if(width!=null){
sFeatures+=", width="+width;
sFeatures+=", left="+(screen.width-width)/2;
}
if(height!=null){
sFeatures+=", height="+height;
sFeatures+=", top="+(screen.height-height-100)/2;
}
window.open(sURL, 'openNoBar'+randomNum(), sFeatures);
}
/**
* 打开全屏窗口
* url:链接页面或action动作
* Banglu
*/
function openFullWindow(url){
var sURL=url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "
+ "location=no, status=no, titlebar=no, width="+(screen.width-10)+", "
+ "height="+(screen.height-60)+", top=0, left=0";
window.open(sURL, 'full'+randomNum(), sFeatures);
}/**
* 打开主窗口
* url:链接页面或action动作
* Banglu
*/
function openMainWindow(url){
var sURL=url;
var sFeatures = "toolbar=no, menubar=no, scrollbars=no, resizable=yes, "
+ "location=no, status=no,titlebar=no, width="+(screen.width-10)+", "
+ "height="+(screen.height-60)+", top=0, left=0";
window.open(sURL, 'main', sFeatures);
}
/**
* 设置链接
* url:连接的jsp页面或action动作
* Banglu
*/
function link(url, frameID){
if(frameID==null){
window.location.href = url;
}
else{
window.frames[frameID].location = url
}
}/**
* 回车代替tab
* Banglu
*/
function handleKey(){
var gk = window.event.keyCode;
if (gk==13) {
if(window.event.srcElement.tagName!='TEXTAREA'){
window.event.keyCode=9;
return;
}
}
}/**
* 全屏显示
* Banglu
*/
function fullScreen(){
window.dialogHeight=window.screen.availHeight;
window.dialogWidth=window.screen.availWidth;
}
function Resize_dialog(t,l,w,h) {
window.dialogTop = t+"px";
window.dialogLeft = l+"px";
window.dialogHeight = h+"px";
window.dialogWidth = w+"px";
}
Q2: java 在ubuntu下实现全屏,上面的状态栏依然显示。如下图,不想要上面的状态栏
您好java打开全屏页面代码,这样的:
Google从KK开始增加java打开全屏页面代码了状态栏透明以及全屏界面有通知可以下拉状态栏的设计,而这个设计出现的隐患是设置java打开全屏页面代码了FULL_SCREEN的界面是无法禁止状态栏下拉的,这样对一些工程测试app可能会造成一定的影响,但是以google默认的设计,应用端无法修改此设计来满足自己的需求。
MTK 内部已经开发提供新的接口来实现全屏界面禁止下拉状态栏,如果贵司的代码还没有这部分逻辑,请参考如下:
1. frameworks\base\core\java\android\view\View.java
[java] view plaincopy
public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 0x00001000;
+ /**
+ * @hide
+ *
+ * NOTE: Flag for {@link #setSystemUiVisibility(int)}: It help user to disable transient
+ * status bar triggered by gesture
+ */
+ public static final int SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED = 0x00002000;
2. frameworks\base\policy\src\com\android\internal\policy\impl\PhoneWindowManager.java
[java] view plaincopy
// monitor for system gestures
mSystemGestures = new SystemGesturesPointerEventListener(context,
new SystemGesturesPointerEventListener.Callbacks() {
@Override
public void onSwipeFromTop() {
+ if (isGestureIsolated())
+ return;
if (mStatusBar != null) {
requestTransientBars(mStatusBar);
}
}
@Override
public void onSwipeFromBottom() {
+ if (isGestureIsolated())
+ return;
if (mNavigationBar != null mNavigationBarOnBottom) {
requestTransientBars(mNavigationBar);
}
}
@Override
public void onSwipeFromRight() {
+ if (isGestureIsolated())
+ return;
if (mNavigationBar != null !mNavigationBarOnBottom) {
requestTransientBars(mNavigationBar);
}
}
@Override
public void onDebug() {
// no-op
}
+ private boolean isGestureIsolated() {
+ WindowState win = mFocusedWindow != null ? mFocusedWindow : mTopFullscreenOpaqueWindowState;
+ if (win != null (win.getSystemUiVisibility() View.SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED) != 0)
+ return true;
+ else
+ return false;
+ }
});
3. 请在修改完framework后,将测试app用setSystemUiVisibility的API加上SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED的flag。
Q3: java显示全屏的代码怎么写?
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice device = environment.getDefaultScreenDevice();
device.setFullScreenWindow(this); // this == jframe instance (window子类都可以)
楼上那个只是最大化而已。 不能实现全屏。。 这个才是实现全屏。
Q4: 求教-------------java重定向的页面怎么实现全屏(IE的F11功能)?
html
body
input type= "text " id= "txt " /input
script
window.onload=function(){
var txt=document.getElementById( "txt ");
txt.onkeypress=function(evt){
evt=evt?evt:window.event;//根据不同浏览器取得按键事件产生java打开全屏页面代码的数据
evt.keyCode=49;//更改事件java打开全屏页面代码的keyCode,更改键盘输出,这样不管按下什么键都是输出1
}
}
/script
/body
/html
按键 F11java打开全屏页面代码的keycode是 122
Q5: java如何改全屏为窗口?求啊啊啊啊
这个研究了,半上午,没办法,直接简单的改几行代码,就能变成窗体程序的,
需要重构代码的
把 ScreenManager 重构成 JFrame 或是 剥离开 ScreenManager 直接用 Jframe
如果。只是想简单的 ,变成 窗体,可以
修改 frame.setUndecorated(true) 把这个屏蔽掉
但是,你只是,临时的方法,不推荐,不能解决根本
java打开全屏页面代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java窗口全屏、java打开全屏页面代码的信息别忘了在本站进行查找喔。






