问题
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.
Expected panel
Actual panel while running the project
Panel properties
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
回答1:
Take a look at Netbeans look and feel:
http://wiki.netbeans.org/NBLookAndFeels
Default is set to Nimbus, you probably want Windows.
回答2:
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;
}
}
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;
}
}
来源:https://stackoverflow.com/questions/15994569/titled-border-issue-for-jpanel