How to open fourth tab as first tab in JTabbedPane in netbeans

I have a tabbed panel including five tabs. This tabbed panel is on JPanelI use a button on the other JPanelto get the fourth tab as the main tab. But when I click on the button, the first tab is still displayed, and I have to go to the fourth manually. Any ideas. Thanks deeply.

Button action

Center instance1 = Center.getInstance();
instance1.doClickHistoryBtn();

doClickHistoryBtn () method

public void doClickHistoryBtn(){
    history_btn.doClick();
}

When I execute this doClickHistoryBtn () method, the History_panel is loaded.

second JPanel (History_panel)

private JPanel history_panel1;
private JPanel history_panel2;
private JPanel history_panel3;
private JPanel history_panel4;
private JPanel history_panel5;

public History_panel()
{
    initComponents();
    setPanels();
}   

private void setPanels(){    

}

first screen image

This is my first screen.

Expected

resized image

Actual

image result

+4
source share
1 answer

JTabbedPane tabbedPane = JTabbedPane (JTabbedPane.TOP); tabbedPane.setSelectedIndex(3);

setSelectedIndex() tabbedpane, . , u setSelectedIndex().

+2

Source: https://habr.com/ru/post/1623859/