在Netbeans中使用JPanels的正确方法是什么? [英] What is the correct way to use JPanels in Netbeans?

查看:97
本文介绍了在Netbeans中使用JPanels的正确方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java GUI的新手.

I'm new to Java GUI.

首先,我创建了一个JFrame并添加了一个JPanel.之后,我将其设置为Null布局.然后添加标签并为框架设置背景图像.对于我的项目,我需要为此JFrame添加单独的4个JPanels.在这些JPanels上,我将添加标签"和文本"框.我想知道在主JPanel上添加4个JPanels是否正确?

First I created a JFrame and have added a JPanel. After that I set it as a Null Layout. Then added a label and set a background image for the frame. For my project I need to add separate 4 JPanels for this JFrame. On those JPanels I'm going to add Labels and Text boxes. I want to know whether it's correct or not to add 4 JPanels on a main JPanel?

推荐答案

我想知道在主JPanel上添加4个JPanels是否正确?

I want to know whether it's correct or not to add 4 JPanels on a main JPanel?

好的.您看到的大多数Java GUI都不是其他面板中的普通放置面板.

Sure. Most of the Java GUIs you see that are any more than trivial put panels inside other panels.

有时会使用其他面板来对通用控件或输出组件进行分组,并可能给它们加上标题边框.通常,使用不同的面板以便在GUI的不同部分中使用不同的布局管理器.这是一个著名的示例,它将布局的详细信息放在面板的标题边框中.

Sometimes a different panel is used to group common controls or output components and possibly give them a titled border. More commonly different panels are used in order to use different layout managers in separate parts of the GUI. Here is a well known example that puts the details of the layout in a titled border for the panel..

这篇关于在Netbeans中使用JPanels的正确方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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