更改jTabbedPane对齐方式

时间:2016-03-28 13:40:06

标签: jtabbedpane

我花了几个小时搜索从左到右更改jTabbedPane对齐方式,如下所示:

screen shot: right alignment

screen shot: left alignment

1 个答案:

答案 0 :(得分:0)

这样可以从右到左制作标签 看方法 setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);

JFrame frame = new JFrame("Frame Test");
        frame.setMinimumSize(new Dimension(500, 500));

        JTabbedPane tapPane = new JTabbedPane();
        tapPane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
        tapPane.insertTab("Tab1", null, new JTextField("test"), "Tab1 tip", 0);

        frame.add(tapPane);
        frame.show();