【问题标题】:How to create Full Screen width jtoolbar如何创建全屏宽度的 jtoolbar
【发布时间】:2015-08-20 10:39:41
【问题描述】:

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

此代码用于创建全屏大小的 jform / jform resize

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

【问题讨论】:

    标签: java swing jtoolbar


    【解决方案1】:

    使用JToolBar继承方法Component::setBounds

    将工具栏放在顶部:

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

    将工具栏放在底部:

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

    【讨论】:

      猜你喜欢
      • 2017-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-28
      • 2019-06-22
      • 1970-01-01
      相关资源
      最近更新 更多