java 切换窗口,Java Processing 2.0(使用Eclipse):从窗口切换到全屏和后退

I am using Processing 2.0 in Eclipse and have a question regarding the transition between windowed mode and fullscreen for a running application (not selecting windowed or fullscreen at startup, which is easily solved).

This question solves the problem of going from the fullscreen mode in Java Processing to windowed mode.

However, I would also like to know how to transition from windowed mode back to fullscreen using Processing. Does anyone have a solution to this problem?

解决方案

A bit hacky, but you can try creating a separate AWT Frame which is fullscreen and drop Processing's applet into it. Normally for fullscreen you should only need a frame with the screen dimensions and no decorations (title bar, close buttons, etc.) The catch is you can't 'undecorate' a java.awt.Frame after it's been set to visible (even if you set visibility to false, attempt to undecorate, then make the frame visible again), so to go around this will simply have a separate Frame instance, already undecorated and with the right dimensions into which we drop Processing's frame content. Also we need to tell processing the bounds are updated.

Here's a quick sketch to illustrate the idea(press 'f' for fullscreen):

import java.awt.Frame;

Frame fullScreenFrame;

void setup(){

fullScreenFrame = new Frame();

fullScreenFrame.setUndecorated(true);//prepare an undecorated fullscreen frame since java won't allow you to 'undecorate' a frame after it's been set visible

fullScreenFrame.setBounds(0,0,displayWidth,displayHeight);

fullScreenFrame.addKeyListener(getKeyListeners()[0]);//pass key events from this applet to the fullScreen Frame

}

void draw(){

background((float)mouseX/width * 255,(float)mouseY/height * 255,0);

}

void keyReleased(){

if(key == 'f') {

setBounds(0,0,displayWidth,displayHeight);//resize the skech

fullScreenFrame.add(frame.getComponent(0));//add the applet to the fullscreen frame from Processing's frame

fullScreenFrame.setVisible(true);//make our fullscreen frame visible

frame.setVisible(false );//and hide Processing's frame

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 要退出Eclipse的Debug模式,可以使用以下方法: 1. 点击Debug视图中的“Terminate”按钮,该按钮位于Debug视图的右上角。这将停止正在运行的调试进程并退出Debug模式。 2. 如果您正在使用Eclipse的调试器,可以使用“Resume”按钮来恢复程序的正常执行。然后,您可以选择在程序执行完毕后退出Debug模式。 3. 您还可以使用Eclipse的“Run”菜单中的“Terminate”命令来停止正在运行的程序并退出Debug模式。 总之,退出Eclipse的Debug模式非常简单,只需要使用上述方法之一即可。 ### 回答2: ### 回答3: Eclipse作为一款常用的集成开发环境,给程序开发带来极大的便利,调试模式想必是开发过程中经常使用的功能。但是有时候我们在调试完毕之后需要退出debug模式,本文主要介绍如何在Eclipse中退出debug模式。 在Eclipse中退出debug模式分为如下几种方式: 1. 停止debug运行 停止程序运行,这也是最直接的退出debug模式的方式。可以通过在调试窗口中点击 terminate button 来停止程序的运行,或者在控制台中输入exit命令来结束程序并退出debug模式。 2. 右键点击debug视图中的程序标签页 首先打开debug视图,然后在标签页上右键点击,会弹出一个上下文菜单,选择关闭(close)按钮即可退出debug模式。 3. 按下运行(Run)按钮 在debug视图左侧,有一个运行(Run)按钮,点击该按钮程序会重新开始运行。如果想退出debug模式,只需点击该按钮即可。 4. 快捷键 在debug模式下,可以按下[Ctrl]+[Shift]+[F8]快捷键来直接退出debug模式。 总之,在Eclipse中退出debug模式是非常简单的,在程序调试结束后选用一种适合自己的方法来退出debug模式即可。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值