gpt4 book ai didi

java - 如何创建全屏宽度 jtoolbar

转载 作者:太空宇宙 更新时间:2023-11-04 13:31:50 25 4
gpt4 key购买 nike

我在java中使用netbeans创建了全屏jform。我需要创建全屏宽度大小的 jtoolbar。我如何做到这一点?

我使用此代码创建全屏尺寸 jform/jform 调整大小

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);

关于java - 如何创建全屏宽度 jtoolbar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32116024/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com