예제 #1
0
파일: Login.java 프로젝트: karlit0/Showcase
 public void handle(String msg) {
   System.out.println("Idem handleat ovaj msg: " + msg);
   if (msg.equals("REGISTEROK")) {
     /*  otvori onaj dialog koji kaze successful registration */
     SuccessRegister dialog = new SuccessRegister();
     dialog.setVisible(true);
     if (reg != null) reg.dispose();
   } else if (msg.equals("OKADMIN")) {
     AdminWindow window = new AdminWindow(socket, UsernameLogin.getText());
     loginThread.setStopper(true);
     /* kada je uspjesan login, zaustavi loginThread
     koji slusa odgovor od servera (ali socket ostaje otvoren!) */
     dispose(); // rjesi se ovog prozora
     window.setVisible(true);
   } else if (msg.equals("OK")) {
     MainWindow window = new MainWindow(socket, UsernameLogin.getText());
     loginThread.setStopper(true);
     /* kada je uspjesan login, zaustavi loginThread
     koji slusa odgovor od servera (ali socket ostaje otvoren!) */
     dispose(); // rjesi se ovog prozora
     window.setVisible(true);
   } else if (msg.equals("REGISTERFAIL")) {
     try {
       /* provjera za slucaj lose definiranog puta za sliku */
       WarningRegister warnReg = new WarningRegister(new javax.swing.JFrame(), true);
       warnReg.setVisible(true);
     } catch (Exception e) {
     }
   } else {
     try {
       /* provjera za slucaj lose definiranog puta za sliku */
       WarningLogin warnLog = new WarningLogin(new javax.swing.JFrame(), true);
       warnLog.setVisible(true);
     } catch (Exception e) {
     }
   }
 }
예제 #2
0
  public static void main(String[] argv) {
    MainWindow win;

    DbgOutput.toStdout();
    win = new MainWindow();
    // process cmd line arguments
    int i;
    for (i = 0; i < argv.length; i++) {
      if (argv[i].equals("-D")) {
        i++;
        // try to interpret the next argument as the debug level
        int dbgLvl = 1; // basic debug level
        if (i >= argv.length) {
          // no more arguments, we stick with debug level 1
          break;
        }
        try {
          dbgLvl = Integer.parseInt(argv[i]);
        } catch (NumberFormatException e) {
          dbgLvl = 1; // didn't work, this is probably a filename
          win.open(argv[i]);
        }
        DbgOutput.setDbgLevel(dbgLvl);
        Libgist.setDbgLevel(dbgLvl);

      } else if (argv[i].equals("-h")) {
        // print help message and exit
        System.out.println("Usage: amdb [-D <dbglevel> | -h] [index]");
        System.exit(0);

      } else {
        // this is a name of an index, open it
        // System.out.println("open " + argv[i]);
        win.open(argv[i]);
      }
    }
    win.setTitle("amdb");
    win.setSize(800, 600);
    win.setLocation(50, 50);
    win.setVisible(true);
  }