I have a tabbed pane including five tabs on it . This tabbed pane is on a JPanel
I use a button on another JPanel
to get fourth tab as leading tab . But when I click on the button first tab is still display and I have to move to the fourth one manually . Have any ideas . Thanks in deep.
Button action
Center instance1 = Center.getInstance();
instance1.doClickHistoryBtn();
doClickHistoryBtn() method
public void doClickHistoryBtn(){
history_btn.doClick();
}
When I execute this doClickHistoryBtn() method , History_panel is loading.
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(){
}
This is my first screen.
Expected
Actual
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setSelectedIndex(3);
Above code will do it In setSelectedIndex() method you have to pass the index of the tabbedpane you want to set as default. And it will open that pane whose index u will providing as argument to the setSelectedIndex().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With