如何使用NetBeans Gui Builder对JLabel进行居中? [英] How Can I Center JLabel using NetBeans Gui Builder?

查看:227
本文介绍了如何使用NetBeans Gui Builder对JLabel进行居中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很长一段时间后,我决定切换回Java NetBeans Gui构建器.我想创建管理系统并使它在用户界面方面保持专业.但是,在将JLabel居中时遇到了问题. 我的标签"占据面板的整个宽度,并且面板可调整大小.无论窗口大小如何,我都希望我的Label可以调整大小并居中.这可能吗?请不要使用netbeans Gui构建器进行硬编码.我怎样才能做到这一点?供您参考,我的声誉太低,无法发布图片,因此现在无任何显示.....

After long time i have decided to switch back to Java NetBeans Gui builder. I want to create Management System and keep it professional in terms of User Interface. However am having problem centering the JLabel. My Label takes the full width of the panel and panel is resizable. I want my Label to be resizable and to be centered no matter the size my window. Is this possible? Please I don't want hard coding am using netbeans Gui builder. How can I achieve this? For your information my reputations are too low to post images so nothing to show right now.....

推荐答案

这似乎对我有用.

  1. 将面板拖动到您的设计中
  2. 右键单击面板,然后选中菜单复选框:自动调整大小"->水平"和自动调整大小->垂直"
  3. 将标签拖动为唯一组件
  4. 选择面板.右键单击->设置布局->边框布局
  5. 选择标签.右键单击->属性
  6. 选择水平对齐"和垂直对齐"的中心.

这篇关于如何使用NetBeans Gui Builder对JLabel进行居中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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