更改 jTabbedPane 对齐方式

Change jTabbedPane alignment

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

screen shot: right alignment

screen shot: left alignment

这是为了从右到左制作制表符 看方法 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();