JPanel的标题边框问题 [英] Titled border issue for JPanel

查看:258
本文介绍了JPanel的标题边框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用netbeans开发了一个应用程序.但是,JPanel标题边框的标题存在一些对齐问题.在显示预览"中,标题按预期显示,但是在运行代码时,标题位于面板上方.谁能帮我解决这个问题.

I developed an application using netbeans. But the title of the titled border of JPanel has some alignment issue. In the 'show preview' the title is displaying as expected, but while running the code, the title goes up above the panel. Can any one help me to resolve this issue.

我知道这是面板的一些属性问题.我用google搜索找不到有效的解决方案.堆栈专家请帮助解决此问题.我正在使用Netbeans 7.2.1

I know this is some property issue with panel. I googled by couldn't find a valid solution. Stack experts please help to resolve this issue. I am using netbeans 7.2.1

推荐答案

通过编辑应用程序的外观设置,您可以获得预期的结果.

By editing Look and feel setting of the application you can get the expected result.

    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            javax.swing.UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }

您必须将nimbus的外观更改为Windows.

You have to change nimbus look and feel to windows..

    for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Windows".equals(info.getName())) {
            javax.swing.UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }

这篇关于JPanel的标题边框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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