public MainScreen() {

      Eve.setLayout(
          new MigLayout(
              "wrap 2", "[0:0, grow 50, fill][0:0, grow 50, fill]", "[pref!][grow, fill]"));

      quick.addActionListener(
          (ActionEvent e) -> {
            DraftScreen draft = new DraftScreen(null, this);
            draft.Switch();
          });

      viewAll.addActionListener(
          (ActionEvent e) -> {
            called = new BrowseScreen(this);
            called.Switch();
          });

      manageTeams.addActionListener(
          (ActionEvent e) -> {
            called = new ManageScreen("team", this);
            called.Switch();
          });

      managePlayers.addActionListener(
          (ActionEvent e) -> {
            called = new ManageScreen("player", this);
            called.Switch();
          });

      teams.setBorder(BorderFactory.createLineBorder(Color.black));
      players.setBorder(BorderFactory.createLineBorder(Color.black));

      teamScroll.setBorder(BorderFactory.createEmptyBorder());
      teamScroll.getVerticalScrollBar().setUnitIncrement(16);
      teamScroll.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER);
      playerScroll.setBorder(BorderFactory.createEmptyBorder());
      playerScroll.getVerticalScrollBar().setUnitIncrement(16);
      playerScroll.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_NEVER);

      this.drawScreen();

      Adam.setMinimumSize(windowSize);
      Adam.setLocationRelativeTo(null);
      Adam.setVisible(true);
    }
    public ManageScreen(String type, Screen callerScreen) {
      caller = callerScreen;

      Eve.setLayout(new MigLayout("wrap 3", "[][grow 25][grow 75]", "[][][grow]"));
      this.type = type;

      back.addActionListener(
          (ActionEvent e) -> {
            caller.refresh();
            caller.Return();
          });
      addB.setMargin(new Insets(0, 0, 0, 0));
      addB.addActionListener(
          (ActionEvent e) -> {
            if (type.matches("player")) {
              new ModifyPlayerPopup(null, this, null);
            } else if (type.matches("team")) {
              called = new ModifyTeamScreen(null, this);
              called.Switch();
            }
          });

      view.setBorder(BorderFactory.createLineBorder(Color.black));

      viewScroll.getVerticalScrollBar().setUnitIncrement(16);

      this.drawScreen();
    }
Exemple #3
0
 public void draw(Graphics g, Screen s) {
   int x = s.translateXToScreen(location.xInt());
   int y = s.translateYToScreen(location.yInt());
   if (team != null)
     draw(g, x, y, angle.getValue(), sightAngle.getValue(), 1, (int) (team.getByte()), kills);
   else draw(g, x, y, angle.getValue(), sightAngle.getValue(), 1, -1, kills);
 }
 /* (non-Javadoc)
  * @see Displayable#addCommand(Command)
  */
 public void addCommand(Command command) {
   if (command != DISMISS_COMMAND) {
     super.addCommand(command);
     super.removeCommand(DISMISS_COMMAND);
     setCommandsVisibility(isModal());
   }
 }
 /* (non-Javadoc)
  * @see Displayable#removeCommand(Command)
  */
 public void removeCommand(Command command) {
   if (command != DISMISS_COMMAND) {
     super.removeCommand(command);
     if (getNumCommands() == 0) {
       super.addCommand(DISMISS_COMMAND);
     }
     setCommandsVisibility(isModal());
   }
 }
Exemple #6
0
 public static void setScreen(Screen screen) {
   // We can only dispose if currentScreen has screen contents
   if (currentScreen != null)
     // Disposes the previous currentScreen screen contents
     currentScreen.dispose();
   currentScreen = screen;
   // Creates currentScreen with contents of screen
   currentScreen.create();
 }
Exemple #7
0
 public void setOnAir(boolean onAir) {
   if (!onAir) {
     screen.suspend();
   } else {
     if (!started) {
       start();
     }
     screen.resume();
   }
 }
  public void render(Screen screen) {

    screen.clear(0);
    //        screen.blit(Art.titles[1], 0, 10);
    screen.blit(Art.titleScreen, 0, 0);

    super.render(screen);

    screen.blit(Art.lordLard[0][6], (gameWidth - 128) / 2 - 40, 180 + selectedItem * 40);
  }
  public Buttons(Screen screen, AbstractColor buttonClr, int width, int height, int offset) {
    this.buttonClr = buttonClr;

    leftButton = new Rectangle(0, 0, width, height);
    leftButton.translate(offset, screen.height() - height - offset);
    rightButton = new Rectangle(0, 0, width, height);
    rightButton.translate(screen.width() - width - offset, screen.height() - height - offset);
    fireButton = new Rectangle(0, 0, width, height);
    fireButton.translate(offset, screen.height() - height * 2 - offset * 2);
  }
 /**
  * Create a new Alert with the specified title, text, image, and alert type.
  *
  * @param title the title string
  * @param text the text string
  * @param image the image
  * @param type the alert type
  */
 public Alert(String title, String text, Image image, AlertType type) {
   super(title);
   construct();
   this.type = type;
   setImage(image);
   setString(text);
   setTimeout(getDefaultTimeout());
   super.addCommand(DISMISS_COMMAND);
   super.setCommandListener(implicitListener);
 }
Exemple #11
0
  protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
    Screen screen = (Screen) getScreen();

    x = (x >= 0) ? x : this.x;
    y = (x >= 0) ? y : this.y;
    width = (width > 0) ? width : this.width;
    height = (height > 0) ? height : this.height;

    if (width > screen.getWidth()) {
      width = screen.getWidth();
    }
    if (height > screen.getHeight()) {
      height = screen.getHeight();
    }
    if ((x + width) > screen.getWidth()) {
      x = screen.getWidth() - width;
    }
    if ((y + height) > screen.getHeight()) {
      y = screen.getHeight() - height;
    }

    if (0 != surfaceHandle) {
      SetBounds0(
          surfaceHandle, getScreen().getWidth(), getScreen().getHeight(), x, y, width, height);
    }

    if (0 != (FLAG_CHANGE_VISIBILITY & flags)) {
      if (0 != (FLAG_IS_VISIBLE & flags)) {
        ((Display) getScreen().getDisplay()).setFocus(this);
      }
      visibleChanged(false, 0 != (FLAG_IS_VISIBLE & flags));
    }

    return true;
  }
  @Override
  public void onPause() {
    super.onPause();
    wakeLock.release();
    renderView.pause();
    screen.pause();

    if (isFinishing()) {
      screen.dispose();
    }
  }
  static Window createWindow(
      final Capabilities caps,
      final int x,
      final int y,
      final int width,
      final int height,
      final boolean onscreen,
      final boolean undecorated)
      throws InterruptedException {
    final boolean userPos = x >= 0 && y >= 0; // user has specified a position

    Assert.assertNotNull(caps);
    caps.setOnscreen(onscreen);
    // System.out.println("Requested: "+caps);

    //
    // Create native windowing resources .. X11/Win/OSX
    //
    final Window window = NewtFactory.createWindow(caps);
    Assert.assertNotNull(window);
    final Screen screen = window.getScreen();
    final Display display = screen.getDisplay();
    window.setUndecorated(onscreen && undecorated);
    if (userPos) {
      window.setPosition(x, y);
    }
    window.setSize(width, height);
    Assert.assertEquals(false, window.isNativeValid());
    Assert.assertEquals(false, window.isVisible());
    window.setVisible(true);
    // System.err.println("************* Created: "+window);

    Assert.assertEquals(true, display.isNativeValid());
    Assert.assertEquals(true, screen.isNativeValid());
    Assert.assertEquals(true, window.isVisible());
    Assert.assertEquals(true, window.isNativeValid());
    Assert.assertEquals(width, window.getWidth());
    Assert.assertEquals(height, window.getHeight());

    /**
     * we don't sync on position - unreliable test Point p0 = window.getLocationOnScreen(null);
     * Assert.assertEquals(p0.getX(), window.getX()); Assert.assertEquals(p0.getY(), window.getY());
     * if(userPos) { Assert.assertEquals(x, window.getX()); Assert.assertEquals(y, window.getY()); }
     */
    final CapabilitiesImmutable chosenCapabilities =
        window.getGraphicsConfiguration().getChosenCapabilities();
    Assert.assertNotNull(chosenCapabilities);
    Assert.assertTrue(chosenCapabilities.getGreenBits() >= 5);
    Assert.assertTrue(chosenCapabilities.getBlueBits() >= 5);
    Assert.assertTrue(chosenCapabilities.getRedBits() >= 5);
    Assert.assertEquals(chosenCapabilities.isOnscreen(), onscreen);

    return window;
  }
 @SuppressWarnings("rawtypes")
 private Result getEntityList(Screen.Button button) {
   Result result = new Result();
   Screen next;
   List<Manager> entityList = application.getManagers();
   next = new Screen(this, button.destination());
   next.setValue(Screen.AVAILABLE_ENTITIES, entityList);
   result.objectValue(next);
   result.success();
   return result;
 }
Exemple #15
0
 public static void draw(String msg, int x, int y, int color, int data, Screen screen) {
   int length = msg.length();
   for (int i = 0; i < length; i++) {
     String c = msg.charAt(i) + "";
     int icon = characters.indexOf(c);
     if (icon >= 0) {
       screen.drawWithWash(Art.FONT[icon % 16][icon / 16], (i * 8) + x, y, color, data, false);
     } else {
       screen.drawWithWash(Art.FONT[0][7], (i * 8) + x, y, color, data, false);
     }
   }
 }
  @Override
  public void setScreen(Screen screen) {
    if (screen == null) {
      throw new IllegalArgumentException("Screen must not be null");
    }

    this.screen.pause();
    this.screen.dispose();
    screen.resume();
    screen.update(0);
    this.screen = screen;
  }
Exemple #17
0
 public void reset() {
   if (this.pos.x < scr.getWidth() / 2 - 10) {
     this.pos.x = scr.p1.pos.x;
     this.pos.y = scr.getHeight() - scr.p1.size - this.size;
   }
   if (this.pos.x < scr.getWidth() / 2 + 10) {
     this.pos.x = scr.p2.pos.x;
     this.pos.y = scr.getHeight() - scr.p2.size - this.size;
   }
   this.v.y = 0;
   this.v.x = 0;
 }
Exemple #18
0
  // prompt user to enter a deposit amount in cents
  private double promptForDepositAmount() {
    Screen screen = getScreen(); // get reference to screen

    // display the prompt
    screen.displayMessage("\nPlease enter a deposit amount in " + "CENTS (or 0 to cancel): ");
    int input = keypad.getInput(); // receive input of deposit amount

    // check whether the user canceled or entered a valid amount
    if (input == CANCELED) return CANCELED;
    else {
      return (double) input / 100; // return dollar amount
    } // end else
  } // end method promptForDepositAmount
Exemple #19
0
	@Override
	public void LoadContent() {
		super.LoadContent();
		super.bgTexture = Global.Load("SkillScreen");
		t2DButtonBack = Global.Load("ButtonCancel");
		t2DButtonPlay = Global.Load("ButtonConfirm");
		t2DTagReload = Global.Load("SkillFastReload");
		t2DTagAAGun = Global.Load("SkillAAGunner");
		t2DExtendedMag = Global.Load("SkillExtMag");
		t2DTagAim = Global.Load("SkillSniper");
		t2DTagOverRepair = Global.Load("SkillOverRepair");
		t2DTagFieldRepair = Global.Load("SkillFieldRepair");
		t2DTagLearning = Global.Load("SkillLearner");
		t2DTagGunner = Global.Load("SkillLeader");
		t2DTagArtillery = Global.Load("SkillArtillery");
		t2DTagBoost = Global.Load("SkillBoost");
		t2DSkillDetail = Global.Load("SkillDetailBox");
		t2DPreReqNotMet = Global.Load("PreReqNotMet");
		t2DBattleEngineer = Global.Load("BattleEngineer");
		t2DRifleman = Global.Load("Rifleman");
		maskSkill = Global.Load("MaskSkill");
		tagAAGun = new TagAAGun(t2DTagAAGun, new Vector2f(440f, 420f), 0f,
				Help.ButtonID.TagAAGun, 0);
		tagAim = new TagAim(t2DTagAim, new Vector2f(460f, 240f), 0f,
				Help.ButtonID.TagAim, 0);
		tagLearning = new TagLearning(t2DTagLearning, new Vector2f(327f, 367f),
				0f, Help.ButtonID.TagLearning, 0);
		tagGunner = new TagGunner(t2DTagGunner, new Vector2f(655f, 367f), 0f,
				Help.ButtonID.TagGunner, 0);
		tagOverRepair = new TagOverRepair(t2DTagOverRepair, new Vector2f(327f,
				196f), 0f, Help.ButtonID.TagOverRepair, 0);
		tagFieldRepair = new TagFieldRepair(t2DTagFieldRepair, new Vector2f(
				655f, 196f), 0f, Help.ButtonID.TagFieldRepair, 0);
		tagReloading = new TagReloading(t2DTagReload, new Vector2f(327f, 196f),
				0f, Help.ButtonID.TagReloading, 0);
		tagExtendedMag = new TagExtendedMag(t2DExtendedMag, new Vector2f(655f,
				196f), 0f, Help.ButtonID.TagExtendedMag, 0);
		tagArtillery = new TagArtillerySupport(t2DTagArtillery,
				this.pTagArtillery, 0f, Help.ButtonID.TagArtillery, 0);
		tagBoost = new TagBoost(t2DTagBoost, this.pTagBoost, 0f,
				Help.ButtonID.TagBoost, 0);
		super.buttonList.add(new Button(t2DButtonBack, new Vector2f(60f, 430f),
				0f, Help.ButtonID.Back, 20));
		this.buttonCancel = new Button(t2DButtonBack, new Vector2f(260f, 330f),
				0f, Help.ButtonID.No, 0);
		this.buttonConfirm = new Button(t2DButtonPlay,
				new Vector2f(530f, 330f), 0f, Help.ButtonID.Yes, 0);
		super.screenPause.LoadContent();
	}
 private Result getRoleList(Screen.Button button) {
   Result result;
   Screen next;
   List<Role> roleList = new ArrayList<Role>();
   result = listAllRoles(roleList);
   if (result.isSuccessful()) {
     next = new Screen(this, button.destination());
     next.setValue(Screen.AVAILABLE_ROLES, roleList);
     result.objectValue(next);
   } else {
     log(result.getReason().name());
     log(result.allMessages());
   }
   return result;
 }
 private Result getUserList(Screen.Button button) {
   Result result;
   Screen next;
   List<User> userList = new ArrayList<User>();
   result = listUsers(userList);
   if (result.isSuccessful()) {
     next = new Screen(this, button.destination());
     next.setValue(Screen.USERS_LIST, userList);
     result.objectValue(next);
   } else {
     log(result.getReason().name());
     log(result.allMessages());
   }
   return result;
 }
Exemple #22
0
  TileSet(String setname) throws IOException {
    // Jedes Tileset ist in einem Ordner gespeichert, der dessen Namen trägt
    // Darin muss sich eine 320x320 Pixel große Datei 'set.png' befinden, sowie
    // eine Textdatei 'passable.txt', die aus 10 Zeilen besteht, die jeweils
    // 10 Einsen und Nullen beinhalten und angeben, ob über die im Tileset
    // entpsrechende Kachel gelaufen werden darf.
    set = new BufferedImage(320, 320, BufferedImage.TYPE_INT_ARGB);
    String path = "res/tileset/" + setname + "/";
    try {
      set.getGraphics().drawImage(ImageIO.read(new File(path + "set.png")), 0, 0, null);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    // Hintergrundfarbe entfernen
    Screen.makeTransparent(set);

    // Lade 'passable.txt'
    FileReader fr = new FileReader(path + "passable.txt");
    BufferedReader br = new BufferedReader(fr);
    passable = new int[10][10];
    String[] line;
    for (int y = 0; y < 10; y++) {
      line = br.readLine().split(" ");
      for (int x = 0; x < 10; x++) {
        passable[y][x] = Integer.parseInt(line[x]);
      }
    }
    br.close();
    fr.close();
  }
 public void run(DisplayMode dm) {
   setBackground(Color.GRAY);
   setForeground(Color.ORANGE);
   setFont(new Font("Arial", Font.BOLD, 24));
   Screen s = new Screen();
   try {
     s.setFullScreen(dm, this);
     try {
       Thread.sleep(5000);
     } catch (Exception s1) {
     }
   } catch (Exception sd) {
   } finally {
     s.restoreWindow();
   }
 }
Exemple #24
0
  private void init() {
    this.setLayout(new GridBagLayout());
    final JPanel screenP = initScreen();
    final JScrollPane commentary = initCommentary();
    statusBar = new ILabel("EMPTYSTR");
    initDS();

    final GridBagConstraints cs = new GridBagConstraints();
    cs.gridx = 0;
    cs.gridy = 0;
    cs.fill = GridBagConstraints.BOTH;
    add(screenP, cs);

    final GridBagConstraints cc = new GridBagConstraints();
    cc.gridx = 1;
    cc.gridy = 0;
    cc.gridheight = 2;
    cc.fill = GridBagConstraints.VERTICAL;
    add(commentary, cc);

    final GridBagConstraints cb = new GridBagConstraints();
    cb.gridx = 0;
    cb.gridy = 1;
    cb.fill = GridBagConstraints.HORIZONTAL;
    add(buttons, cb);

    final GridBagConstraints csb = new GridBagConstraints();
    csb.gridx = 0;
    csb.gridy = 2;
    csb.fill = GridBagConstraints.HORIZONTAL;
    add(statusBar, csb);

    screen.setDS(D);
    languageChanged();
  }
 @Override
 public void init(GameContainer gc) throws SlickException {
   input = gc.getInput();
   varContainer = new VarContainer();
   setScreen(new TitleScreen(this));
   curScreen.passVarContainer(varContainer);
 }
 public void endMovie() {
   System.out.println("Shutting movie theater down...");
   tuner.off();
   screen.off();
   cdPlayer.off();
   dvdPlayer.off();
 }
 @Override
 public void onResume() {
   super.onResume();
   wakeLock.acquire();
   screen.resume();
   renderView.resume();
 }
Exemple #28
0
 public Field getFieldAt(int index) {
   if (index < 0 || index >= length()) throw new IndexOutOfBoundsException();
   int y = index / (width + 1);
   int x = index % (width + 1);
   if (x == width) return null;
   else return screen.getInputFieldAt(x, y);
 }
 public JSONObject toJSON() {
   JSONObject obj = new JSONObject();
   try {
     putSafe(obj, "time", time);
     putSafe(obj, "localtime", localTime);
     putSafe(obj, "deviceid", SHA1Util.SHA1(deviceId));
     JSONArray array = new JSONArray();
     try {
       for (Ping p : pings) {
         array.put(p.toJSON());
       }
     } catch (Exception e) {
     }
     putSafe(obj, "pings", array);
     JSONArray tmparray = new JSONArray();
     try {
       for (LastMile p : lastMiles) {
         tmparray.put(p.toJSON());
       }
     } catch (Exception e) {
     }
     putSafe(obj, "lastmiles", tmparray);
     JSONArray array2 = new JSONArray();
     for (Screen s : screens) {
       array2.put(s.toJSON());
     }
     if (screens != null) putSafe(obj, "screens", array2);
     if (device != null) putSafe(obj, "device", device.toJSON());
     if (throughput != null) putSafe(obj, "throughput", throughput.toJSON());
     if (gps != null) putSafe(obj, "gps", gps.toJSON());
     if (battery != null) putSafe(obj, "battery", battery.toJSON());
     if (usage != null) putSafe(obj, "usage", usage.toJSON());
     if (network != null) putSafe(obj, "network", network.toJSON());
     if (warmupExperiment != null) putSafe(obj, "warmup_experiment", warmupExperiment.toJSON());
     if (sim != null) putSafe(obj, "sim", sim.toJSON());
     if (wifi != null) putSafe(obj, "wifi", wifi.toJSON());
     if (state != null) putSafe(obj, "state", state.toJSON());
     if (isManual) putSafe(obj, "isManual", 1);
     else putSafe(obj, "isManual", 0);
     if (loss != null) putSafe(obj, "loss", loss.toJSON());
     if (ipdv != null) putSafe(obj, "delay_variation", ipdv.toJSON());
   } catch (Exception e) {
     e.printStackTrace();
   }
   printJSON(obj.toString());
   return obj;
 }
Exemple #30
0
 private void setMissions() {
   if (turnIndex == 0) {
     screen.showMessage(24, 40, "YOU NEED " + neededMissions + " MISSIONS");
     missionBuffer = MISSION_BUFFER;
   }
   if ((turnIndex + 3) % MISSION_LENGTH == 0) {
     numMissions++;
     screen.showMessage(
         24, 40, "YOU HAVE " + numMissions, "OUT OF " + neededMissions + " MISSIONS");
     missionBuffer = MISSION_BUFFER;
   }
   if (Math.random() < .001 * Math.pow(.1, neededMissions - numMissions - 3)) {
     neededMissions += 5;
     screen.showMessage(24, 40, "THE NUMBER OF MISSIONS", "HAS BEEN RAISED TO " + neededMissions);
     missionBuffer = MISSION_BUFFER;
   }
 }