Shift + F6和右键单击之间的区别? [英] Difference between Shift + F6 and right click run?

查看:318
本文介绍了Shift + F6和右键单击之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在netbeans中创建了一个Java项目,最近我发现在2种情况下UI有所不同. 1.如果我右键单击并运行主项目,或者如果我按 Shift + F6 . 如果我执行 Shift + F6 ,则会出现一个不错的用户界面(请参见按钮):

I have made a java project in netbeans, I have recently seen that there is a UI difference in 2 cases. 1. if i right-click and run the main project or if i press Shift + F6. If i do Shift + F6, a nice user interface (see the buttons), comes up:

如果我右键单击我的项目并运行它;按钮样式看起来很古老:

If i right click on my project and run it; the button style looks ancient:

我的问题,为什么?第二件事;我想要的是,如果我通过JAR文件将程序转移到其他系统;漂亮的用户界面应该会出现.该怎么做?

My question, Why? and 2nd thing; what i want is that if i transfer my program to other systems via JAR files; the nice UI should come. How to do that?

推荐答案

当我们通过单击运行"运行项目时,该项目将从主类文件(即具有主入口点的类)开始.但是,当我们按 Shift + F6 时,当前在编辑器窗口中打开的文件将使用其自己的主函数运行.因此,可能您正在这样做.可能您已经设置了Look&感觉项目不在定义GUI的文件中,您只需按 Shift + F6 即可启动GUI框架.因此,在没有设置L& F的情况下开始框架.
只需清理并构建项目,然后查看最终.jar文件的输出.

When we run the project by clicking "Run", the project is started with the main class file, i.e., with class having main entry point. But when we press Shift + F6, the file currently open in the editor-window is run using its own main function. So, may be you are doing the same. Probably you have set the Look & Feel of the project in a file other than the file defining your GUI and you are just launching your GUI Frame by pressing Shift + F6. Thus starting the frame without L&F set.
Just clean and build the project and see the output of the final .jar file.

这篇关于Shift + F6和右键单击之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆