protected void beforeMyProfile(Form f) { Myprofile = f; Label l1 = (Label) findByName("propic", f); name = (TextField) findByName("name", Myprofile); index = (TextField) findByName("index", Myprofile); tel = (TextField) findByName("tel", Myprofile); addr = (TextField) findByName("addr", Myprofile); email = (TextField) findByName("email", Myprofile); group = (TextField) findByName("group", Myprofile); try { String userde[] = Splitter.Split(new String(record.getRecord(4)), "-"); name.setText(userde[0]); index.setText(userde[1]); tel.setText(userde[2]); addr.setText(userde[3]); email.setText(userde[4]); group.setText(userde[5]); if (new String(record.getRecord(2)).equals("no")) { l1.setIcon(Image.createImage("/no_user.png").scaledHeight(72)); } else { l1.setIcon(Image.createImage(new String(record.getRecord(2))).scaledHeight(72)); } System.gc(); } catch (Exception e) { } super.beforeMyProfile(f); }
/** * Tests whether the specified password matches to a level password. If a match is found, the * according level number is saved. */ private void checkPassword(String password) { passwordLevelNumber = -1; for (Level l : gameScreen.getAllLevels()) { if (l.getLevelPassword().equals(password)) { passwordOkLabel.setIcon(GameScreen.ICON_OK); passwordOkLabel.setText("Level " + l.getLevelNumber()); passwordLevelNumber = l.getLevelNumber(); break; } } if (passwordLevelNumber == -1) { passwordOkLabel.setIcon(GameScreen.ICON_LOCKED); passwordOkLabel.setText(""); } }
protected void beforeDepartments(Form f) { department = f; Label l = (Label) findByName("Label2", f); try { HttpCon con12 = new HttpCon( String.valueOf(departmentPerson) + "-p", PropertyClass.ServerUrl + "DepartmentOffiecer"); con12.SetContype(true, true, true); Thread t = new Thread(con12); synchronized (t) { t.start(); t.wait(); } String a[] = Splitter.Split(con12.getValue().toString(), "-"); ((Label) findByName("Label3", f)).setText(a[4]); ((TextArea) findByName("aboutDepartmentt", f)).setText(a[0]); ((Label) findByName("name", f)).setText("Head Dept: " + a[1]); ((Label) findByName("Label7", f)).setText(a[2]); ((Label) findByName("Label8", f)).setText("Tel : " + a[3]); switch (departmentPerson) { case 1: l.setIcon(Image.createImage("/ceo.png").scaledHeight(78)); break; case 2: l.setIcon(Image.createImage("/div1.png").scaledHeight(78)); break; case 3: l.setIcon(Image.createImage("/div2.png").scaledHeight(78)); break; case 4: l.setIcon(Image.createImage("/div3.png").scaledHeight(78)); break; default: l.setIcon(Image.createImage("no_user.png").scaledHeight(78)); break; } departmentPerson = 0; super.beforeDepartments(f); System.gc(); } catch (Exception e) { } }
@Override // from BComponent protected Dimension computePreferredSize(final int whint, final int hhint) { // our preferred size is based on the widest of our items; computing this is rather // expensive, so we cache it like we do the menu if (_psize == null) { _psize = new Dimension(); Label label = new Label(this); for (ComboMenuItem mitem : _items) { if (mitem.item instanceof BIcon) { label.setIcon((BIcon) mitem.item); } else { label.setText(mitem.item == null ? "" : mitem.item.toString()); } Dimension lsize = label.computePreferredSize(-1, -1); _psize.width = Math.max(_psize.width, lsize.width); _psize.height = Math.max(_psize.height, lsize.height); } } return new Dimension(_psize); }
/** Initializes the screen. */ public void initScreen() { gameScreen.createBlackBackground(); Label highscoreTitleLabel = new Label( gameScreen, "Highscore Level " + currentHighscoreLevel, 500, 70, GameScreen.FONT_XL); highscoreTitleLabel.setTextColor(new Color(255, 205, 205)); highscoreTitleLabel.setBackgroundColor(Color.BLACK); gameScreen.addObject(highscoreTitleLabel, GameScreen.WIDTH_IN_CELLS / 2, 1); arrowRightButton = new Button(gameScreen, 26, 27, WorldImages.ICON_ARROW_RIGHT); arrowRightButton.setBackgroundColor(Color.BLACK); arrowRightButton.setBorderColor(Color.RED); arrowRightButton.setInset(0); arrowRightButton.setAlign(Label.ALIGN_LEFT); arrowRightButton.setBackgroundColor(new Color(255, 205, 205)); gameScreen.addObject(arrowRightButton, GameScreen.WIDTH_IN_CELLS / 2 + 6, 1); arrowLeftButton = new Button(gameScreen, 26, 27, WorldImages.ICON_ARROW_LEFT); arrowLeftButton.setBackgroundColor(Color.BLACK); arrowLeftButton.setBorderColor(Color.RED); arrowLeftButton.setInset(0); arrowLeftButton.setAlign(Label.ALIGN_LEFT); arrowLeftButton.setBackgroundColor(new Color(255, 205, 205)); gameScreen.addObject(arrowLeftButton, GameScreen.WIDTH_IN_CELLS / 2 - 6, 1); backToMenuButton = new Button(gameScreen, "Main Menu", 130, 30, GameScreen.FONT_M); backToMenuButton.setBorderColor(Color.RED); backToMenuButton.setIcon(WorldImages.ICON_HOME); backToMenuButton.setBackgroundColor(new Color(255, 205, 205)); gameScreen.addObject(backToMenuButton, GameScreen.WIDTH_IN_CELLS / 2, 16); BufferedImage levelImg = gameScreen.getLevel(currentHighscoreLevel).toImage(KaraWorld.CELL_SIZE); int width = 420; int height = 360; levelImg = GGImage.scale(levelImg, width, height); Label highscoreLevelLabel = new Label(gameScreen, width, height, levelImg); highscoreLevelLabel.setBorderColor(null); highscoreLevelLabel.setBackgroundColor(Color.BLACK); gameScreen.addObject( highscoreLevelLabel, GameScreen.WIDTH_IN_CELLS / 2, GameScreen.HEIGHT_IN_CELLS / 2); if (gameScreen.isHighscoreAvailable()) { // Get the highscore entries Highscore highscore = gameScreen.getHighscoreForLevel(currentHighscoreLevel); String first = highscore.getFirstEntry().toString(); String second = highscore.getSecondEntry().toString(); String third = highscore.getThirdEntry().toString(); Label highscoreGoldLabel = new Label(gameScreen, first, 400, 40, GameScreen.FONT_L); highscoreGoldLabel.setTextColor(new Color(255, 205, 205)); highscoreGoldLabel.setBackgroundColor(Color.BLACK); highscoreGoldLabel.setBackgroundTransparency(150); highscoreGoldLabel.setBorderColor(null); highscoreGoldLabel.setIcon(WorldImages.ICON_GOLD); gameScreen.addObject(highscoreGoldLabel, GameScreen.WIDTH_IN_CELLS / 2, 10); Label highscoreSilverLabel = new Label(gameScreen, second, 400, 40, GameScreen.FONT_L); highscoreSilverLabel.setTextColor(new Color(255, 205, 205)); highscoreSilverLabel.setBackgroundColor(Color.BLACK); highscoreSilverLabel.setBackgroundTransparency(150); highscoreSilverLabel.setBorderColor(null); highscoreSilverLabel.setIcon(WorldImages.ICON_SILVER); gameScreen.addObject(highscoreSilverLabel, GameScreen.WIDTH_IN_CELLS / 2, 12); Label highscoreBronzeLabel = new Label(gameScreen, third, 400, 40, GameScreen.FONT_L); highscoreBronzeLabel.setTextColor(new Color(255, 205, 205)); highscoreBronzeLabel.setBackgroundColor(Color.BLACK); highscoreBronzeLabel.setBackgroundTransparency(150); highscoreBronzeLabel.setBorderColor(null); highscoreBronzeLabel.setIcon(WorldImages.ICON_BRONZE); gameScreen.addObject(highscoreBronzeLabel, GameScreen.WIDTH_IN_CELLS / 2, 14); } else { // Highscore is not available --> give a hint to the user Label highscoreNa1 = new Label(gameScreen, "Highscore is not available!", 400, 40, GameScreen.FONT_XL); highscoreNa1.setTextColor(new Color(255, 205, 205)); highscoreNa1.setBackgroundColor(Color.BLACK); highscoreNa1.setBackgroundTransparency(150); highscoreNa1.setBorderColor(null); gameScreen.addObject(highscoreNa1, GameScreen.WIDTH_IN_CELLS / 2, 13); } }