java类右下角多一块蓝色_java – 如何删除在JTabbedPane中选择选项卡时出现的蓝色边框高亮显示?...

这是我的

previous question的延续,但它解决了一个对其他人有用的特定问题,所以我想我会把它作为一个单独的问题发布.

我已经成功创建了一个JTabbedPane,但是有一个蓝色边框突出显示,显示我要删除的选项卡:

为了澄清我的意思,这里是一张JTabbedPane的图片,没有Eclipse的蓝色边框高亮:

我试过的东西已经被注释掉了:

public class SeaGlassExercise {

public static void initWindow() {

JFrame frame = new JFrame("Application Name");

CustomTabbedPane content = new CustomTabbedPane();

frame.setContentPane(content);

frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

frame.setLocationByPlatform(true);

// try {

// UIManager.setLookAndFeel(

// UIManager.getSystemLookAndFeelClassName());

// } catch (Exception e) {

// e.printStackTrace();

// }

// SwingUtilities.updateComponentTreeUI(frame);

frame.pack();

frame.setVisible(true);

}

public static void main(String[] args) {

SwingUtilities.invokeLater(new Runnable() {

@Override

public void run() {

initWindow();

}

});

}

}

class CustomTabbedPane extends JPanel {

public CustomTabbedPane() {

super(new GridLayout(1, 1));

// UIManager.put("TabbedPane.contentAreaColor", Color.GREEN);

// UIManager.put("TabbedPane.light", ColorUIResource.GREEN);

// UIManager.put("TabbedPane.highlight", ColorUIResource.GREEN);

// UIManager.put("TabbedPane.shadow", ColorUIResource.GREEN);

// UIManager.put("TabbedPane.darkShadow", ColorUIResource.GREEN);

// UIManager.put("TabbedPane.selected", ColorUIResource.GREEN);

// UIManager.put("TabbedPane.borderHightlightColor", ColorUIResource.GREEN);

// UIManager.put("TabbedPane.borderHightlightColor", ColorUIResource.GREEN);

// UIManager.put("TabbedPane.contentBorderInsets", new Insets(0, 0, 0, 0));

JTabbedPane tabbedPane = new JTabbedPane();

JComponent panel1 = makeTextPanel("Panel #1");

tabbedPane.addTab("AAA", panel1);

JComponent panel2 = makeTextPanel("Panel #2");

tabbedPane.addTab("BBB", panel2);

JComponent panel3 = makeTextPanel("Panel #3");

tabbedPane.addTab("CCC", panel3);

JComponent panel4 = makeTextPanel("Panel #4");

tabbedPane.addTab("DDD", panel4);

add(tabbedPane);

tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

}

protected JComponent makeTextPanel(String text) {

JPanel panel = new JPanel();

JLabel filler = new JLabel(text);

filler.setHorizontalAlignment(JLabel.CENTER);

panel.setLayout(new GridLayout(1, 1));

panel.add(filler);

return panel;

}

}

附加信息

我目前正在使用OS X Mountain Lion和java版“1.7.0_25”,Java(TM)SE运行时环境(版本1.7.0_25-b15)运行我的程序.我使用默认外观(即我没有在我的代码中使用.setUI()指定任何内容).

以下是我看过的一些问题:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值