Пример #1
0
 public static void setLoggedIn(boolean logged) {
   gui.labelUser.setVisible(!logged);
   gui.labelPass.setVisible(!logged);
   gui.user.setVisible(!logged);
   gui.pass.setVisible(!logged);
   loggedIn = logged;
   if (logged) {
     gui.removeComponent(gui.loginButton);
     gui.removeComponent(gui.loginButtonText);
   } else {
     gui.addComponent(gui.loginButton);
     gui.addComponent(gui.loginButtonText);
   }
 }
Пример #2
0
  public static void main(String[] args) {
    /* Add shutdown event */
    Runtime.getRuntime()
        .addShutdownHook(
            new Thread(
                new Runnable() {
                  public void run() {
                    exit();
                  }
                }));

    preInit();

    /* Try to set Pixel font, if fails, set Arial */
    try {
      InputStream fontstream = OpenLauncher.class.getResourceAsStream("/font/pixel.ttf");
      font = Font.createFont(Font.TRUETYPE_FONT, fontstream).deriveFont(Font.PLAIN, 14);
    } catch (Exception e) {
      font = new Font("Arial", Font.PLAIN, 14);
    }

    /* Set GUI with dimensions 1280x720 */
    gui = new GUI(1280, 720);

    /* Add sidebar Tabs */
    gui.addComponent(
        new ComponentFancyButton(
                29 - gui.insets.left,
                gui.getHeight() - 75 - gui.insets.top - 45 - 45 - 45,
                150,
                40,
                "News")
            .setSelected(true));
    gui.addTab(new TabNews(gui), 0);
    gui.addComponent(
        new ComponentFancyButton(
                29 - gui.insets.left,
                gui.getHeight() - 75 - gui.insets.top - 45 - 45,
                150,
                40,
                "Modpacks")
            .setTab(1));
    gui.addTab(new TabModpacks(gui), 1);
    gui.addComponent(
        new ComponentFancyButton(
                29 - gui.insets.left,
                gui.getHeight() - 75 - gui.insets.top - 45,
                150,
                40,
                "Console")
            .setTab(2));
    gui.addTab(new TabConsole(gui), 2);
    gui.addComponent(
        new ComponentFancyButton(
                29 - gui.insets.left, gui.getHeight() - 75 - gui.insets.top, 150, 40, "Settings")
            .setTab(3));
    gui.addTab(new TabSettings(gui), 3);

    gui.setTab(0);

    init();

    /* Center and show the GUI */
    gui.center();
    gui.show();

    postInit();
  }