快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

java打开全屏页面代码 java怎么退出全屏

如何用java设置全屏的代码

创建一个JFrame ,设置成undecorated,设置bounds为屏幕大小

静乐网站制作公司哪家好,找成都创新互联!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。成都创新互联成立与2013年到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选成都创新互联

//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);

java中如何进行全屏模式和窗口模式的转换 详细�0�3

java 中如何进行全屏模式和窗口模式的转换 代码如下所示: import java.awt.Dimension; import java.awt.DisplayMode; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; @SuppressWarnings("serial") public class WindowModelSample extends JFrame { public WindowModelSample() { super("窗口/全屏模式转换例子"); final JPanel panel = new JPanel(); final JButton button = new JButton("切换模式"); panel.setLocation(0, 0); Dimension dimension = new Dimension(1024, 768); panel.setSize(dimension); panel.setMaximumSize(dimension); panel.setMinimumSize(dimension); panel.setPreferredSize(dimension); panel.setLayout(null); button.addActionListener(new ActionListener() { boolean isWindowModel = true; @Override public void actionPerformed(ActionEvent e) { if ((isWindowModel = !isWindowModel)) { // 切换为窗口模式 WindowModelSample.this.dispose(); WindowModelSample.this.setUndecorated(false); WindowModelSample.this.getGraphicsConfiguration().getDevice().setFullScreenWindow(nu ll); WindowModelSample.this.setVisible(true); } else { // 切换为全屏独占模式 WindowModelSample.this.dispose(); WindowModelSample.this.setUndecorated(true); WindowModelSample.this.getGraphicsConfiguration().getDevice().setFullScreenWindow(W indowModelSample.this); WindowModelSample.this.getGraphicsConfiguration().getDevice().setDisplayMode(new DisplayMode(Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height, 16, DisplayMode.REFRESH_RATE_UNKNOWN)); WindowModelSample.this.repaint(); } } }); button.setBounds(100, 100, 100, 100); panel.add(button); setResizable(false); setLayout(null); setDefaultCloseOperation(EXIT_ON_CLOSE); setContentPane(panel); pack(); setLocationRelativeTo(null); setVisible(true); } public static void main(String[] args) { new WindowModelSample(); } } 上边这段代码就是关于窗口模式和全屏模式之间的切换代码,匆忙之间写的,有点简陋。

java如何改全屏为窗口?求啊啊啊啊

这个研究了,半上午,没办法,直接简单的改几行代码,就能变成窗体程序的,

需要重构代码的

把 ScreenManager 重构成 JFrame 或是 剥离开 ScreenManager 直接用 Jframe

如果。只是想简单的 ,变成 窗体,可以

修改 frame.setUndecorated(true) 把这个屏蔽掉

但是,你只是,临时的方法,不推荐,不能解决根本

java显示全屏的代码怎么写?

GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();

GraphicsDevice device = environment.getDefaultScreenDevice();

device.setFullScreenWindow(this); // this == jframe instance (window子类都可以)

楼上那个只是最大化而已。 不能实现全屏。。 这个才是实现全屏。

java 在ubuntu下实现全屏,上面的状态栏依然显示。如下图,不想要上面的状态栏

您好,这样的:

Google从KK开始增加了状态栏透明以及全屏界面有通知可以下拉状态栏的设计,而这个设计出现的隐患是设置了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。

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:打开模态窗口的宽度

* height:打开模态窗口的高度

* 注意:打开模态窗口的页面中要在head后面加上

* meta http-equiv="Pragma" content="no-cache":禁止模态窗口缓存

* 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";

}


网页题目:java打开全屏页面代码 java怎么退出全屏
文章分享:http://6mz.cn/article/hijddd.html

其他资讯