예제 #1
0
  /**
   * Given a photoList, builds for each picture a label to display in the main view
   *
   * @author Anas Alaoui M'Darhri
   * @param pl a existing PhotoList
   */
  public static void buildLabels(PhotoList pl) {
    ArrayList<JLabel> ret = new ArrayList<>();
    for (final ImgModel im : pl.getPhotolist()) {
      JLabel labPic = new JLabel();
      labPic.setIcon(
          new ImageIcon(
              new ImageIcon(im.getFile().toString())
                  .getImage()
                  .getScaledInstance(90, 90, Image.SCALE_SMOOTH)));
      labPic.setText("Toto " + im.getPath());
      labPic.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
      labPic.setBorder(BorderFactory.createRaisedBevelBorder());
      labPic.setVisible(true);
      labPic.addMouseListener(
          new MouseAdapter() {
            public void mouseClicked(MouseEvent me) {
              if (im.equals(UICtrlV2.getSelected())) {
                UICtrlV2.setSelected(null);
                UICtrlV2.refreshImgDP();
              } else {
                UICtrlV2.setSelected(im.getId());
                UICtrlV2.refreshImgDP();
              }
            }
          });
      ret.add(labPic);
    }

    labels.put(pl.getId(), ret);
  }
예제 #2
0
 /**
  * @author Anas Alaoui M'Darhri
  * @param toCurrent the new PhotoList you want to display on the main panel
  */
 public static void setCurrent(UUID toCurrent) {
   UICtrlV2.current = ProcessingCtrl.loadedPhotoLists.get(toCurrent);
   if (toCurrent != null) {
     System.out.println("curr " + current.toString());
     UICtrlV2.gui.getMp().getPlp().refresh(toCurrent);
     UICtrlV2.refreshDataDP();
     UICtrlV2.gui.repaint();
   }
 }