大佬教程收集整理的这篇文章主要介绍了阶段:未调整到场景,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我在舞台上有一个场景。场景的宽度为 337.0 像素。但是,当我将其添加到舞台时,舞台的大小为 337.6 像素,由于 0.6 像素的差异,在屏幕的右边缘留下了白色间隙。
我尝试过使用 stage.sizetoScene()
,但它不起作用。我还尝试通过尝试 stage.setWIDth(337)
手动设置舞台的宽度。在不影响舞台宽度的情况下,仍然保持337.6。
我尝试了以下方法:stage.setWIDth(337.0)
。然后当我在控制台上打印舞台宽度时,通过使用stage.getWIDth()
,打印的值为337.0,但实际上,0.6像素的白线仍然存在。
我尝试执行以下操作:
stage.hIDe();
stage.show();
这行得通,它去除了白线,但它显示的窗口切换看起来很糟糕。有没有办法在不像上面那样切换窗口的情况下做同样的事情。
任何帮助将不胜感激。
我在为舞台设置正确尺寸时遇到了类似的问题。
对我来说有帮助的是使用:
stage.setMinWidth(newActiveScene.getRoot().minWidth(-1));
stage.setMinHeight(newActiveScene.getRoot().minHeight(-1));
其中 stage
是您正在使用的舞台,newActiveScene
是您在舞台上设置的新场景。
实际上我正在使用一种方法在舞台上设置新场景,如下所示:
/**
* Sets a new active {@link ScenE} on the stage.
*
* @param newActiveScene the new scene to show
*/
public static void setActiveScene(Scene newActiveScenE) {
stage.setScene(newActiveScenE);
stage.setMinWidth(newActiveScene.getRoot().minWidth(-1));
stage.setMinHeight(newActiveScene.getRoot().minHeight(-1));
}
其中 stage
是使用的舞台。这假设 stage.show()
已经被调用过一次(例如在初始化阶段时)。
按照 Simon Wall 的建议,我想对他的代码进行一些编辑。这对我来说效果很好:
package xyz.fastview.tesTing.ui.mode.request;
import javax.validation.consTraints.Email;
import javax.validation.consTraints.NotNull;
import javax.validation.consTraints.Size;
public class UserDetailrequestModel {
@NotNull(message = "firstName cAnnot be null")
private String firstName;
@NotNull(message = "lastName cAnnot be null")
private String lastName;
@NotNull(message = "email cAnnot be null")
@Email(message = "email should be a proper email address")
private String email;
@NotNull
@Size(min = 8,max = 20,message = "password length can be 8 to 20 characters")
private String password;
// getters,setters
}
以上是大佬教程为你收集整理的阶段:未调整到场景全部内容,希望文章能够帮你解决阶段:未调整到场景所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。