e834. 设置JTabbedPane中卡片的位置

The tabs of a tabbed pane can be placed on one of the four edges of its container. By default, when a tabbed pane is created, the tabs are placed on top.

    // Create a tabbed pane with the tabs on top
    JTabbedPane pane = new JTabbedPane();
    
    // Get current location
    int loc = pane.getTabPlacement();  // TOP
    
    // Create a tabbed pane with tabs at a particular location
    int location = JTabbedPane.LEFT; // or TOP, BOTTOM, RIGHT
    pane = new JTabbedPane(location);
    
    // Change the tab location
    pane.setTabPlacement(JTabbedPane.BOTTOM);
Related Examples