简体   繁体   中英

How to create swing Tabbed Pane application using the Netbeans GUI editor

I am fairly new to Java. I am trying to create a Java application that has a tabbed pane.

First, I created a Java application named app1 in Netbeans and then I added a TabbedPane to the already existing JFrame .

I noticed the code now has a app1 class extending javax.swing.JFrame . It also has a private javax.swing.JTabbedPane jTabbedPane2; at the bottom of the class.

Why aren't there any import statements for javax.swing.JTabbedPane and javax.swing.JFrame ? A tabbed frame can't be created without at least the javax.swing.JTabbedPane .

Also, I noticed the app1.form file contains the position and size of the items on the GUI Design area. This could lead to issues if I want to transfer code from one development environment to another. Is it best to incorporate the form data into the program at the final stage of development?

Thanks.

This code is not supposed to be read by a human, and imports are unnecessary because the classes are all fully qualified (package name + class name).

I don't know the exact reason for this design choice but I think it enables easier templating : since the code does not depend on any import, you can copy-paste it anywhere, it will work fine without having to care about bringing the necessary imports and merging them to the destination class's imports.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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