コード例 #1
0
  /** 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);
  }
コード例 #2
0
  /**
   * 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);
  }
コード例 #3
0
  @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;
  }
コード例 #4
0
 /**
  * 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) {
     }
   }
 }
コード例 #5
0
  /**
   * 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++;
  }
コード例 #6
0
 /** Method to hide the picture display */
 public void hide() {
   if (pictureFrame != null) pictureFrame.setVisible(false);
 }
コード例 #7
0
 /**
  * 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);
 }