Esempio n. 1
0
  public void drawRating() {
    int x = 0;
    for (x = 0; x < scheda.vote - 1; x++) {
      JLabel star = new JLabel();
      if ((int) ((FRAME_WIDTH / 4) * 1.49) < FRAME_HEIGHT / 2)
        star.setBounds(20 + (20 * x), (int) ((FRAME_WIDTH / 4) * 1.49) + 95, 20, 20);
      else star.setBounds(20 + (20 * x), FRAME_HEIGHT / 2 + 95, 20, 20);

      star.setIcon(ImageUtils.getIcon("gui/icon20px/star_full.png"));
      this.add(star);
    }
    if (x + 0.5f >= scheda.vote) {
      JLabel star = new JLabel();
      if ((int) ((FRAME_WIDTH / 4) * 1.49) < FRAME_HEIGHT / 2)
        star.setBounds(20 + (20 * x), (int) ((FRAME_WIDTH / 4) * 1.49) + 95, 20, 20);
      else star.setBounds(20 + (20 * x), FRAME_HEIGHT / 2 + 95, 20, 20);
      star.setIcon(ImageUtils.getIcon("gui/icon20px/star_half.png"));
      this.add(star);
      x++;
    }
    for (; x < 10; x++) {
      JLabel star = new JLabel();
      if ((int) ((FRAME_WIDTH / 4) * 1.49) < FRAME_HEIGHT / 2)
        star.setBounds(20 + (20 * x), (int) ((FRAME_WIDTH / 4) * 1.49) + 95, 20, 20);
      else star.setBounds(20 + (20 * x), FRAME_HEIGHT / 2 + 95, 20, 20);
      star.setIcon(ImageUtils.getIcon("gui/icon20px/star_empty.png"));
      this.add(star);
    }
    this.repaint();
  }
Esempio n. 2
0
  public void loadComponent() {
    this.removeAll();
    JLabel sep2 = new JLabel();
    sep2.setBounds(0, 40, FRAME_WIDTH, 1);
    sep2.setBorder(BorderFactory.createLineBorder(ColorUtils.Separator));
    this.add(sep2);

    JLabel title = new JLabel();
    title.setBounds(FRAME_WIDTH / 8, 0, FRAME_WIDTH * 3 / 4, 40);
    title.setText("<html><h1>" + scheda.title + "</html>");
    title.setHorizontalAlignment(JLabel.CENTER);
    this.add(title);

    ImageButton backbt =
        new ImageButton(
            ImageUtils.getImage("gui/icon32px/arrow_left.png"),
            ImageUtils.getImage("gui/icon32px/arrow_left_over.png"),
            ImageUtils.getImage("gui/icon32px/arrow_left_over.png"),
            BackGui);
    backbt.setBounds(5, 5, 32, 32);
    backbt.setToolTipText("Indietro");
    this.add(backbt);

    ImageButton homePage =
        new ImageButton(
            ImageUtils.getImage("gui/icon32px/home.png"),
            ImageUtils.getImage("gui/icon32px/home_over.png"),
            ImageUtils.getImage("gui/icon32px/home_over.png"),
            OpenHomePage);
    homePage.setBounds(40, 5, 32, 32);
    homePage.setToolTipText("Home");
    this.add(homePage);

    if (cover == null) cover = new JLabel();

    if ((int) ((FRAME_WIDTH / 4) * 1.49) < FRAME_HEIGHT / 2)
      cover.setBounds(20, 80, FRAME_WIDTH / 4, (int) ((FRAME_WIDTH / 4) * 1.5));
    else cover.setBounds(20, 80, (int) ((FRAME_HEIGHT / 2) * 0.67), FRAME_HEIGHT / 2);

    cover.setBorder(BorderFactory.createEtchedBorder());
    cover.setIcon(
        ImageUtils.getIcon(
            ImageUtils.scaleImage(
                scheda.initPoster_w500(cover), cover.getWidth(), cover.getHeight())));

    add(cover);

    text = new JEditorPane();
    text.setEditable(false);
    text.setHighlighter(null);
    text.setOpaque(false);
    text.setContentType("text/html");
    text.setText("<html><h2>" + scheda.desc + "</html>");
    text.setBorder(BorderFactory.createEmptyBorder());
    text.setBackground(ColorUtils.Trasparent);

    scroll = new JScrollPane(text);
    scroll.setFocusable(true);
    scroll.setBorder(BorderFactory.createEmptyBorder());
    scroll.setBackground(ColorUtils.Trasparent);

    if ((int) ((FRAME_WIDTH / 4) * 1.49) < FRAME_HEIGHT / 2)
      scroll.setBounds(
          FRAME_WIDTH / 4 + 60,
          80,
          FRAME_WIDTH - (FRAME_WIDTH / 4 + 80),
          (int) ((FRAME_WIDTH / 4) * 1.49) - 35);
    else
      scroll.setBounds(
          (int) ((FRAME_HEIGHT / 2) * 0.67) + 60,
          80,
          FRAME_WIDTH - ((int) ((FRAME_HEIGHT / 2) * 0.67) + 80),
          FRAME_HEIGHT / 2 - 35);

    scroll.setOpaque(false);
    scroll.setVisible(false);
    this.add(scroll);
    ThreadManager.submitCacheTask(UpdateText);

    info = new JLabel();
    if ((int) ((FRAME_WIDTH / 4) * 1.49) < FRAME_HEIGHT / 2)
      info.setBounds(
          FRAME_WIDTH / 4 + 60,
          (int) ((FRAME_WIDTH / 4) * 1.49) + 50,
          FRAME_WIDTH - (FRAME_WIDTH / 4 + 80),
          30);
    else
      info.setBounds(
          (int) ((FRAME_HEIGHT / 2) * 0.67) + 60,
          FRAME_HEIGHT / 2 + 50,
          FRAME_WIDTH - ((int) ((FRAME_HEIGHT / 2) * 0.67) + 80),
          30);

    info.setText(
        "<html><h4> "
            + "Data di Uscita: "
            + scheda.relese
            + "<br>"
            + "Generi: "
            + scheda.getGeneri()
            + "</html>");
    info.setVisible(true);
    this.add(info);
    drawRating();

    downloads =
        new ImageButton(
            ImageUtils.getImage("gui/icon64px/download.png"),
            ImageUtils.getImage("gui/icon64px/download_over.png"),
            ImageUtils.getImage("gui/icon64px/download_over.png"),
            OpenDownloads);
    downloads.setBounds((FRAME_WIDTH - 64) / 2, FRAME_HEIGHT - 100, 64, 64);
    downloads.setVisible(!syncRunning);
    downloads.setToolTipText("Scarica");
    this.add(downloads);

    sync = new AnimatedImageButton("SyncBig(n)", 5, null, 500);
    sync.setBounds((FRAME_WIDTH - 64) / 2, FRAME_HEIGHT - 100, 64, 64);
    sync.setToolTipText("Sincronizzazione con il server Attedere qualche secondo");
    sync.setVisible(syncRunning);
    this.add(sync);

    if (backGround == null) {
      backGround = new JLabel();
      scheda.initBack_w1920(backGround);
    }

    backGround.setBounds(0, 0, FRAME_WIDTH, FRAME_HEIGHT);

    if (scheda.back_w1920 != null) {
      if (backGround.getWidth() > backGround.getHeight()) {
        BufferedImage img =
            ImageUtils.scaleWithAspectHeight(scheda.back_w1920, backGround.getHeight());
        if (img.getWidth() < backGround.getWidth())
          img = ImageUtils.scaleWithAspectWidth(scheda.back_w1920, backGround.getWidth());
        backGround.setIcon(ImageUtils.getIcon(img));
      } else {
        BufferedImage img =
            ImageUtils.scaleWithAspectWidth(scheda.back_w1920, backGround.getWidth());
        if (img.getHeight() < backGround.getHeight())
          img = ImageUtils.scaleWithAspectHeight(scheda.back_w1920, backGround.getHeight());
        backGround.setIcon(ImageUtils.getIcon(img));
      }
    }
    this.add(backGround);
    super.loadComponent();
  }