src/main/java/com/spinyowl/legui/component/TabbedPanel.java
private ToggleButton createTabButton(Tab tab) {
    ToggleButton tabButton = new ToggleButton(tab.tabName);
    tabButton
        .getListenerMap()
        .addListener(ButtonWidthChangeEvent.class, new UpdateButtonStyleWidthListener());
    tabStrip.updateTabButtonStyles(tabButton);
    tabButton
        .getListenerMap()
        .addListener(
            MouseClickEvent.class,
            event -> {
              if (CLICK.equals(event.getAction())) {
                // we have updated state here (so actually before click it was not toggled).
                if (tabButton.isToggled()) {
                  tabButtons.values().stream()
                      .filter(b -> b != tabButton)
                      .forEach(b -> b.setToggled(false));
                } else {
                  tabButton.setToggled(true);
                }
                setActiveTab(tab);
              }
            });
    return tabButton;
  }
/**
   * Used to create tab button based on provided tab.
   *
   * @param tab tab to use for tab button creation.
   * @return returns newly created tab button with needed logic.
   */
Used to create tab button based on provided tab.
Used to create tab button based on provided tab .
private ToggleButton createTabButton(Tab tab) {
    ToggleButton tabButton = new ToggleButton(tab.tabName);
    tabButton
        .getListenerMap()
        .addListener(ButtonWidthChangeEvent.class, new UpdateButtonStyleWidthListener());
    tabStrip.updateTabButtonStyles(tabButton);
    tabButton
        .getListenerMap()
        .addListener(
            MouseClickEvent.class,
            event -> {
              if (CLICK.equals(event.getAction())) {
                if (tabButton.isToggled()) {
                  tabButtons.values().stream()
                      .filter(b -> b != tabButton)
                      .forEach(b -> b.setToggled(false));
                } else {
                  tabButton.setToggled(true);
                }
                setActiveTab(tab);
              }
            });
    return tabButton;
  }
private ToggleButton createTabButton ( Tab tab ) { ToggleButton tabButton = new ToggleButton ( tab . tabName ) ; tabButton . getListenerMap ( ) . addListener ( ButtonWidthChangeEvent . class , new UpdateButtonStyleWidthListener ( ) ) ; tabStrip . updateTabButtonStyles ( tabButton ) ; tabButton . getListenerMap ( ) . addListener ( MouseClickEvent . class , event -> { if ( CLICK . equals ( event . getAction ( ) ) ) { if ( tabButton . isToggled ( ) ) { tabButtons . values ( ) . stream ( ) . filter ( b -> b != tabButton ) . forEach ( b -> b . setToggled ( false ) ) ; } else { tabButton . setToggled ( true ) ; } setActiveTab ( tab ) ; } } ) ; return tabButton ; }
Used to create tab button based on provided tab.
Used to create tab button based on provided tab .
// we have updated state here (so actually before click it was not toggled).