package net.minecraft.launcher.ui.tabs;

import java.awt.Component;
import javax.swing.JTabbedPane;
import net.minecraft.launcher.Language;
import net.minecraft.launcher.Launcher;

public class LauncherTabPanel extends JTabbedPane {
   private final Launcher minecraftLauncher;
   private final WebsiteTab blog;
   private final WebsiteTab news;
   private final ConsoleTab console;

   public LauncherTabPanel(Launcher minecraftLauncher) {
      super(1);
      this.news = new WebsiteTab(minecraftLauncher);
      this.minecraftLauncher = minecraftLauncher;
      this.blog = new WebsiteTab(minecraftLauncher);
      this.console = new ConsoleTab(minecraftLauncher);
      this.createInterface();
   }

   protected void createInterface() {
      this.addTab(Language.get("main.tab.news"), this.news);
      this.addTab(Language.get("main.tab.mcnews"), this.blog);
      this.addTab(Language.get("main.tab.devcons"), this.console);
      this.addTab(Language.get("main.tab.peditor"), new ProfileListTab(this.minecraftLauncher));
   }

   public Launcher getMinecraftLauncher() {
      return this.minecraftLauncher;
   }

   public WebsiteTab getBlog() {
      return this.blog;
   }

   public WebsiteTab ggg() {
      return this.news;
   }

   public ConsoleTab getConsole() {
      return this.console;
   }

   public void showConsole() {
      this.setSelectedComponent(this.console);
   }

   protected void removeTab(Component tab) {
      for(int i = 0; i < this.getTabCount(); ++i) {
         if (this.getTabComponentAt(i) == tab) {
            this.removeTabAt(i);
            break;
         }
      }

   }

   public void removeTab(String name) {
      int index = this.indexOfTab(name);
      if (index > -1) {
         this.removeTabAt(index);
      }

   }
}
