예제 #1
0
 /**
  * Test if third tab can be selected
  *
  * @throws Exception
  */
 @Test
 public void testTab2() throws Exception {
   GUI gui = new GUI();
   gui.setVisible(true);
   gui.getjTabbedPane1().setSelectedIndex(2);
   assertEquals(gui.getjTabbedPane1().getSelectedIndex(), 2);
 }
예제 #2
0
  public static void main(String[] args) {
    GUI dialog = new GUI();

    dialog.pack();
    dialog.setVisible(true);
    System.exit(0);
  }
예제 #3
0
  public static void main(String[] args) {

    Background bg = new Background();

    Player player = new Player(100, 100, 200, 1);

    LinkedList<GameObject> gameObjects = new LinkedList<>();

    gameObjects.sort(
        new Comparator<GameObject>() {
          @Override
          public int compare(GameObject t, GameObject t1) {
            if (t.getY() > t.getY()) {
              return 1;
            }
            if (t.getY() < t.getY()) {
              return -1;
            }
            return 0;
          }
        });

    gameObjects.add(player);

    GUI f = new GUI(bg, gameObjects);
    f.setVisible(true);
    f.setResizable(false);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setSize(800, 600);
    f.setLocationRelativeTo(null);
    f.setTitle("EatGetRekt");
    f.makeStrat();

    long lastFrame = System.currentTimeMillis();
    while (true) {
      long thisFrame = System.currentTimeMillis();
      float tslf = (float) (thisFrame - lastFrame) / 1000;
      lastFrame = thisFrame;

      f.repaintScreen();

      bg.update(tslf);
      for (GameObject gameObject : gameObjects) {
        gameObject.update(tslf);
      }
      try {
        Thread.sleep(15);
      } catch (InterruptedException ex) {
        JOptionPane.showMessageDialog(
            null,
            "You can not travel backwards in time. " + "Error: " + ex.getMessage(),
            "ERROR",
            JOptionPane.ERROR_MESSAGE);
      }
      if (KL.keys[KeyEvent.VK_ESCAPE]) {
        System.exit(0);
      }
    }
  }
예제 #4
0
  public static void main(String args[]) {
    GUI Gu = new GUI("Blaze Server-Graphical User Interface(GUI)");

    Gu.Menu();
    Gu.setVisible(true);
    Gu.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Opening a server connection.

  }
예제 #5
0
  public void readFile() throws IOException {
    try {

      FileInputStream fstream = new FileInputStream("dataIn.txt");
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));

      String strLine;
      int memi = -1;
      int strLineMemory = 59;

      while ((strLine = br.readLine()) != null) {

        t.data[strLineMemory++][1] = String.valueOf(strLine);
        memi++;

        size++;
        while ((strLine = br.readLine()) != null && !strLine.startsWith("*")) {

          String[] arr = strLine.split(" ");
          String command = arr[0];
          String operand = arr[1];

          toMemory(command, operand, memarray[memi]);
          memarray[memi] = memarray[memi] + 2;
          System.out.printf("%s %s ", command, operand);
        }
      }

      in.close();
    } catch (Exception e) { // Catch exception if any
      System.err.println("Error: " + e.getMessage());
    }

    MOSMain mos = new MOSMain();
    mos.planner();

    t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    t.setSize(830, 800);
    t.setVisible(true);
    t.setTitle("Printer");
    sortTime();
  }
예제 #6
0
  /**
   * Application main method.
   *
   * @param args Command line arguments.
   * @throws XBeeException
   * @throws TimeoutException
   */
  public static void main(String[] args) throws TimeoutException, XBeeException {

    // Launch GUI
    final GUI view = new GUI();
    view.setVisible(true);

    ActionListener actionListener;
    final String data = "hola";

    // Instantiate an XBee device object.
    final XBeeDevice myLocalXBeeDevice = new XBeeDevice("COM3", 9600);
    try {
      myLocalXBeeDevice.open();
    } catch (XBeeException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // Instantiate a remote XBee device object.
    final RemoteXBeeDevice myRemoteXBeeDevice =
        new RemoteXBeeDevice(myLocalXBeeDevice, new XBee64BitAddress("0013A20040A2B995"));

    actionListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            String text = view.textField.getText();
            // Send data using the remote object.
            try {
              myLocalXBeeDevice.sendDataAsync(myRemoteXBeeDevice, data.getBytes());
            } catch (XBeeException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        };
    view.getButton().addActionListener(actionListener);
  }
예제 #7
0
 public static void main(String args[]) {
   GUI go = new GUI();
   go.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   go.setSize(300, 200);
   go.setVisible(true);
 }