简体   繁体   English

如何在netbeans中创建这样的Java gui应用程序

[英]how to create Java gui application like this in netbeans

I am creating a Java desktop application where the user will enter his name and age and press next, like given below in image 1. 我正在创建一个Java桌面应用程序,用户将在其中输入他的姓名和年龄,然后按下一个,如下图1中所示。

在此输入图像描述

And the action would perform would be like given in the image below in image 2. 并且将执行的动作将如下图2中的图像所示。

在此输入图像描述

I went through all tutorials on the Netbeans site, but still I was not able find any solution. 我浏览了Netbeans网站上的所有教程,但我仍然无法找到任何解决方案。 I want to build this application like what we see when we install some application on Windows, we select some option and press next and a new window will appear with the result or more options. 我想构建这个应用程序就像我们在Windows上安装某些应用程序时看到的那样,我们选择一些选项然后按下一步,将出现一个带有结果或更多选项的新窗口。 Please somebody help me with step by step instruction. 请有人帮我逐步指导。

I don't think you'll get as much out of "step by step" instructions as you will going through the tutorials and learning not only how to do what you're desire, but the whys and hows of what you're doing. 我不认为你会从“一步一步”的指示中获得更多的东西,因为你将通过教程并不仅学习如何做你想做的事,而且学习你正在做的事情的原因和方法。 That being said, you will want to go through several of the Java Swing tutorials to learn how to do this including 话虽这么说,您将需要通过几个Java Swing教程来学习如何做到这一点,包括

Much of learning to code means independent study and much trial and error. 许多学习代码意味着独立学习和许多反复试验。 So start experimenting and have fun doing so! 所以开始尝试并享受乐趣!

As the above answer says, the CardLayout is a one way of doing this. 正如上面的回答所说,CardLayout是这样做的一种方式。 However, in my case, I find that cardlayout is bit difficult for me. 但是,在我的情况下,我发现卡布局对我来说有点困难。 So, what I do is, creating JavaBeans, which extends JPanel, in this case. 所以,我所做的就是创建JavaBeans,在这种情况下扩展JPanel。 So you can add them to the main view and dispose/replace with another JavaBean, making different "Next" views. 因此,您可以将它们添加到主视图中并使用另一个JavaBean进行处置/替换,从而生成不同的“下一个”视图。 This way will help you to seperate your code into several classes, making the code simple too. 这种方式可以帮助您将代码分成几个类,使代码也变得简单。

This article contains more or less a step-by-step tutorial on how to create a wizard in Swing. 本文包含或多或少的有关如何在Swing中创建向导的分步教程。 But before you start with that article make sure you have some basic Swing knowledge or that article will be complete Gibberish 但在你开始阅读这篇文章之前,请确保你有一些基本的Swing知识,或者那篇文章将是完整的Gibberish

You can use installation wizard creator tool for make a setup of your java application 您可以使用安装向导创建工具来设置Java应用程序

for examaple you can use "Setup Factory" tool for create a install exe of your application 例如,您可以使用“安装工厂”工具来创建应用程序的安装exe

it make a installer like that which you in your quetion 它会像你在排队的那样安装一个安装程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM