/** Method to show the picture in a picture frame */ public void show() { // if there is a current picture frame then use it if (pictureFrame != null) pictureFrame.updateImageAndShowIt(); // else create a new picture frame with this picture else pictureFrame = new PictureFrame(this); }
/** * Method to force the picture to repaint itself. This is very useful after you have changed the * pixels in a picture and you want to see the change. */ public void repaint() { // if there is a picture frame tell it to repaint if (pictureFrame != null) pictureFrame.repaint(); // else create a new picture frame else pictureFrame = new PictureFrame(this); }
@Override public boolean onCommand(CommandSender sender, Command cmd, String name, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage(ChatColor.DARK_RED + "This command is only for players!"); return true; } Player p = (Player) sender; if (args.length == 0) { sendHelp(p); return true; } if (args[0].equalsIgnoreCase("create")) { handleFrameCreation(p, args); return true; } if (args[0].equalsIgnoreCase("reload") && sender.hasPermission("pictureframe.reload")) { plugin.reload(); return true; } sendHelp(p); return true; }
/** * Method to replay the frames (pictures) added so far * * @param sleepTime the amount to sleep in milliseconds between frames */ public void replay(int sleepTime) { Picture picture = null; Iterator iterator = pictureList.iterator(); while (iterator.hasNext()) { picture = (Picture) iterator.next(); pictureFrame.setPicture(picture); try { Thread.sleep(sleepTime); } catch (Exception ex) { } } }
/** * Method to add a picture to the frame sequence * * @param picture the picture to add */ public void addFrame(Picture picture) { // add this picture to the list pictureList.add(picture); // write out this frame picture.write(directory + baseName + numberFormat.format(frameNumber) + ".jpg"); // if this sequence is being shown update the frame if (shown) { if (pictureFrame != null) pictureFrame.setPicture(picture); else pictureFrame = new PictureFrame(picture); } // increment the frame number frameNumber++; }
/** Method to hide the picture display */ public void hide() { if (pictureFrame != null) pictureFrame.setVisible(false); }
/** * Method to set the title for the picture * * @param title the title to use for the picture */ public void setTitle(String title) { this.title = title; if (pictureFrame != null) pictureFrame.setTitle(title); }