Design a swing GUI program with the NetBeans IDE

Source: Internet
Author: User
Tags netbeans

In the tutorial you will learn how to:

Using the GUI Builder interface

Create a GUI container

Adding components

resizing components

aligning components

Adjust component anchor Spacing

To set the automatic resizing behavior of a component

Edit Component Properties

This tutorial takes approximately 30 minutes to complete.

Note: When you see a diagram, you can click it to view a more detailed interactive explanation of GUI builder related features.

Entry

The IDE's GUI builder makes it possible for users who do not have in-depth knowledge of layout management to create a GUI application with a professional look.

For a visual feedback description of GUI Builder, you can refer to the GUI Builder visual feedback legend.

Create a project

Because all Java development work in the IDE is done with projects, we first create a new Contacteditor project to hold the source code and its project files. An IDE project is a set of Java source code files and associated metadata data that includes project-specific property files, an ant build script to control build and run settings, and an project.xml file that maps ant targets to IDE commands. Although Java applications are often made up of multiple IDE projects, in this tutorial, for the sake of simplicity, we build a simple application that is all stored in a single project.

To begin the process of creating a new Contacteditor Application project:

Select File > New Project. Or you can click the New Project icon on the IDE toolbar.

In the Categories pane, select the Java node, and then from the Projects pane, select Java application. Click Next.

Enter Contacteditor in the Project Name field and specify the path to save the project in Project Location.

Make sure that the check box for the Set as Main Project is selected and clears the selected state of the Create Main Class.

Click Finish.

The IDE creates the Contacteditor folder on your system based on the location you just specified. This folder contains all the project-related files, including the project's ant script, the folder where the source code and the test code are stored, and a folder that is used to hold the project meta data. To view the file structure of your project, click the IDE's Files window.

Create a GUI container after you create a new application, you may have noticed that the source packages folder in the Projects window contains an empty package <default package> node. To start building the user interface, we need to create a Java container to place the other required GUI components. In this step, we will use JFrame to create a container and place it in a new package.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.