如何创建全屏宽度的 jtoolbar [英] How to create Full Screen width jtoolbar

查看:23
本文介绍了如何创建全屏宽度的 jtoolbar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 java 中使用 netbeans 创建了全屏 jform.我需要创建全屏宽度大小的 jtoolbar.我怎么做?

I created full screen jform using netbeans in java. I need to create Full Screen width sized jtoolbar. How I do this?

我用来创建全屏尺寸 jform/jform resize 的代码

this code I use for create full screen size jform / jform resize

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setBounds(0, 0, screenSize.width, screenSize.height);

推荐答案

使用 JToolBar 继承方法 Component::setBounds.

将工具栏置于顶部:

toolBar.setBounds(0, 0, screenSize.width, yourDesiredHeight);

将工具栏放在底部:

toolBar.setBounds(0, screensize.height - yourDesiredHeight, screenSize.width, yourDesiredHeight);

这篇关于如何创建全屏宽度的 jtoolbar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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