亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jcollapsiblepane.java

?? java swing控件
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
          setAnimationParams(new AnimationParams(30, Math.max(8,
            getContentPane().getPreferredSize().height / 10), 0.01f, 1.0f));
          animator.reinit(wrapper.getHeight(), getContentPane()
            .getPreferredSize().height);
          animateTimer.start();
        }
      } else {
        wrapper.c.setVisible(!collapsed);
        invalidate();
        doLayout();
      }
      repaint();
      firePropertyChange("collapsed", !collapsed, collapsed);
    }
  }

  public Dimension getMinimumSize() {
    return getPreferredSize();
  }

  /**
   * The critical part of the animation of this <code>JCollapsiblePane</code>
   * relies on the calculation of its preferred size. During the animation, its
   * preferred size (specially its height) will change, when expanding, from 0
   * to the preferred size of the content pane, and the reverse when collapsing.
   * 
   * @return this component preferred size
   */
  public Dimension getPreferredSize() {
    /*
     * The preferred size is calculated based on the current position of the
     * component in its animation sequence. If the Component is expanded, then
     * the preferred size will be the preferred size of the top component plus
     * the preferred size of the embedded content container. <p>However, if the
     * scroll up is in any state of animation, the height component of the
     * preferred size will be the current height of the component (as contained
     * in the currentHeight variable)
     */
    Dimension dim;
    if (!isAnimated()) {
      if (getContentPane().isVisible()) {
        dim = getContentPane().getPreferredSize();
      } else {
        dim = super.getPreferredSize();
      }
    } else {
      dim = new Dimension(getContentPane().getPreferredSize());
      if (!getContentPane().isVisible() && currentHeight != -1) {
        dim.height = currentHeight;
      }
    }
    return dim;
  }

  /**
   * Sets the parameters controlling the animation
   * 
   * @param params
   * @throws IllegalArgumentException
   *           if params is null
   */
  private void setAnimationParams(AnimationParams params) {
    if (params == null) { throw new IllegalArgumentException(
      "params can't be null"); }
    if (animateTimer != null) {
      animateTimer.stop();
    }
    animationParams = params;
    animateTimer = new Timer(animationParams.waitTime, animator);
    animateTimer.setInitialDelay(0);
  }
  
  /**
   * Tagging interface for containers in a JCollapsiblePane hierarchy who needs
   * to be revalidated (invalidate/validate/repaint) when the pane is expanding
   * or collapsing. Usually validating only the parent of the JCollapsiblePane
   * is enough but there might be cases where the parent parent must be
   * validated.
   */
  public static interface JCollapsiblePaneContainer {
    Container getValidatingContainer();
  }

  /**
   * Parameters controlling the animations
   */
  private static class AnimationParams {
    final int waitTime;
    final int deltaY;
    final float alphaStart;
    final float alphaEnd;

    /**
     * @param waitTime
     *          the amount of time in milliseconds to wait between calls to the
     *          animation thread
     * @param deltaY
     *          the delta in the Y direction to inc/dec the size of the scroll
     *          up by
     * @param alphaStart
     *          the starting alpha transparency level
     * @param alphaEnd
     *          the ending alpha transparency level
     */
    public AnimationParams(int waitTime, int deltaY, float alphaStart,
      float alphaEnd) {
      this.waitTime = waitTime;
      this.deltaY = deltaY;
      this.alphaStart = alphaStart;
      this.alphaEnd = alphaEnd;
    }
  }

  /**
   * This class actual provides the animation support for scrolling up/down this
   * component. This listener is called whenever the animateTimer fires off. It
   * fires off in response to scroll up/down requests. This listener is
   * responsible for modifying the size of the content container and causing it
   * to be repainted.
   * 
   * @author Richard Bair
   */
  private final class AnimationListener implements ActionListener {
    /**
     * Mutex used to ensure that the startHeight/finalHeight are not changed
     * during a repaint operation.
     */
    private final Object ANIMATION_MUTEX = "Animation Synchronization Mutex";
    /**
     * This is the starting height when animating. If > finalHeight, then the
     * animation is going to be to scroll up the component. If it is < then
     * finalHeight, then the animation will scroll down the component.
     */
    private int startHeight = 0;
    /**
     * This is the final height that the content container is going to be when
     * scrolling is finished.
     */
    private int finalHeight = 0;
    /**
     * The current alpha setting used during "animation" (fade-in/fade-out)
     */
    private float animateAlpha = 1.0f;

    public void actionPerformed(ActionEvent e) {
      /*
       * Pre-1) If startHeight == finalHeight, then we're done so stop the timer
       * 1) Calculate whether we're contracting or expanding. 2) Calculate the
       * delta (which is either positive or negative, depending on the results
       * of (1)) 3) Calculate the alpha value 4) Resize the ContentContainer 5)
       * Revalidate/Repaint the content container
       */
      synchronized (ANIMATION_MUTEX) {
        if (startHeight == finalHeight) {
          animateTimer.stop();
          animateAlpha = animationParams.alphaEnd;
          // keep the content pane hidden when it is collapsed, other it may
          // still receive focus.
          if (finalHeight > 0) {
            wrapper.showContent();   
            validate();
            JCollapsiblePane.this.firePropertyChange(ANIMATION_STATE_KEY, null,
              "expanded");
            return;
          }
        }

        final boolean contracting = startHeight > finalHeight;
        final int delta_y = contracting?-1 * animationParams.deltaY
          :animationParams.deltaY;
        int newHeight = wrapper.getHeight() + delta_y;
        if (contracting) {
          if (newHeight < finalHeight) {
            newHeight = finalHeight;
          }
        } else {
          if (newHeight > finalHeight) {
            newHeight = finalHeight;
          }
        }
        animateAlpha = (float)newHeight
          / (float)wrapper.c.getPreferredSize().height;

        Rectangle bounds = wrapper.getBounds();
        int oldHeight = bounds.height;
        bounds.height = newHeight;
        wrapper.setBounds(bounds);
        bounds = getBounds();
        bounds.height = (bounds.height - oldHeight) + newHeight;
        currentHeight = bounds.height;
        setBounds(bounds);
        startHeight = newHeight;
        
        // it happens the animateAlpha goes over the alphaStart/alphaEnd range
        // this code ensures it stays in bounds. This behavior is seen when
        // component such as JTextComponents are used in the container.
        if (contracting) {
          // alphaStart > animateAlpha > alphaEnd
          if (animateAlpha < animationParams.alphaEnd) {
            animateAlpha = animationParams.alphaEnd;
          }
          if (animateAlpha > animationParams.alphaStart) {
            animateAlpha = animationParams.alphaStart;            
          }
        } else {
          // alphaStart < animateAlpha < alphaEnd
          if (animateAlpha > animationParams.alphaEnd) {
            animateAlpha = animationParams.alphaEnd;
          }
          if (animateAlpha < animationParams.alphaStart) {
            animateAlpha = animationParams.alphaStart;
          }
        }
        wrapper.alpha = animateAlpha;

        validate();
      }
    }
      
    void validate() {
      Container parent = SwingUtilities.getAncestorOfClass(
        JCollapsiblePaneContainer.class, JCollapsiblePane.this);
      if (parent != null) {
        parent = ((JCollapsiblePaneContainer)parent).getValidatingContainer();
      } else {
        parent = getParent();
      }

      if (parent != null) {
        if (parent instanceof JComponent) {
          ((JComponent)parent).revalidate();
        } else {
          parent.invalidate();
        }
        parent.doLayout();
        parent.repaint();
      }        
    }

    /**
     * Reinitializes the timer for scrolling up/down the component. This method
     * is properly synchronized, so you may make this call regardless of whether
     * the timer is currently executing or not.
     * 
     * @param startHeight
     * @param stopHeight
     */
    public void reinit(int startHeight, int stopHeight) {
      synchronized (ANIMATION_MUTEX) {
        JCollapsiblePane.this.firePropertyChange(ANIMATION_STATE_KEY, null,
          "reinit");
        this.startHeight = startHeight;
        this.finalHeight = stopHeight;
        animateAlpha = animationParams.alphaStart;
        currentHeight = -1;
        wrapper.showImage();
      }
    }
  }

  private final class WrapperContainer extends JPanel {
    private BufferedImage img;
    private Container c;
    float alpha = 1.0f;

    public WrapperContainer(Container c) {
      super(new BorderLayout());
      this.c = c;
      add(c, BorderLayout.CENTER);
      
      // we must ensure the container is opaque. It is not opaque it introduces
      // painting glitches specially on Linux with JDK 1.5 and GTK look and feel.
      // GTK look and feel calls setOpaque(false)
      if (c instanceof JComponent && !((JComponent)c).isOpaque()) {
        ((JComponent)c).setOpaque(true);
      }
    }

    public void showImage() {
      // render c into the img
      makeImage();
      c.setVisible(false);
    }

    public void showContent() {
      currentHeight = -1;
      c.setVisible(true);
    }

    void makeImage() {
      // if we have no image or if the image has changed      
      if (getGraphicsConfiguration() != null && getWidth() > 0) {
        Dimension dim = c.getPreferredSize();
        // width and height must be > 0 to be able to create an image
        if (dim.height > 0) {
          img = getGraphicsConfiguration().createCompatibleImage(getWidth(),
            dim.height);
          c.setSize(getWidth(), dim.height);
          c.paint(img.getGraphics());
        } else {
          img = null;
        }
      }
    }
    
    public void paintComponent(Graphics g) {
      if (!useAnimation || c.isVisible()) {
        super.paintComponent(g);
      } else {
        // within netbeans, it happens we arrive here and the image has not been
        // created yet. We ensure it is.
        if (img == null) {
          makeImage();
        }
        // and we paint it only if it has been created and only if we have a
        // valid graphics
        if (g != null && img != null) {
          // draw the image with y being height - imageHeight
          g.drawImage(img, 0, getHeight() - img.getHeight(), null);
        }
      }
    }

    public void paint(Graphics g) {
      Graphics2D g2d = (Graphics2D)g;
      Composite oldComp = g2d.getComposite();
      Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
        alpha);
      g2d.setComposite(alphaComp);
      super.paint(g2d);
      g2d.setComposite(oldComp);
    }

  }
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久一二三区| 免费在线视频一区| 国产精品伦理一区二区| 2024国产精品| 久久综合999| 久久久久99精品一区| 日韩欧美国产系列| 日韩限制级电影在线观看| 欧美日高清视频| 欧美浪妇xxxx高跟鞋交| 7878成人国产在线观看| 51精品国自产在线| 欧美videossexotv100| 久久久亚洲精品一区二区三区| 精品久久久久久久久久久久久久久久久 | 亚洲香蕉伊在人在线观| 亚洲综合男人的天堂| 亚洲一卡二卡三卡四卡五卡| 一区二区三区四区高清精品免费观看| 亚洲精品视频观看| 亚洲午夜电影在线| 美国三级日本三级久久99| 国产毛片精品一区| 成人av电影观看| 欧美性大战久久久久久久| 3d成人动漫网站| 日韩精品专区在线影院重磅| 国产午夜精品在线观看| 亚洲欧美国产高清| 性久久久久久久久久久久| 国模娜娜一区二区三区| 成人av集中营| 7878成人国产在线观看| 国产日韩欧美高清| 一卡二卡三卡日韩欧美| 精品综合免费视频观看| 不卡一区在线观看| 欧美另类z0zxhd电影| 久久久久久免费网| 亚洲欧美日韩国产另类专区| 日本aⅴ精品一区二区三区| 国模娜娜一区二区三区| 色悠久久久久综合欧美99| 欧美一区二区三区视频免费| 国产视频视频一区| 午夜一区二区三区视频| 高清不卡一二三区| 欧美日韩亚洲综合| 国产精品私人自拍| 日韩国产欧美三级| a美女胸又www黄视频久久| 欧美日本在线播放| 国产精品免费视频一区| 免费成人在线影院| 99久久久国产精品免费蜜臀| 欧美一级高清片| 亚洲丝袜自拍清纯另类| 国产一区二区三区四区五区入口 | 日韩一区二区三区av| 国产精品久久久久久久久久久免费看| 午夜精品爽啪视频| 91在线视频18| 国产日韩成人精品| 免费在线观看一区| 在线亚洲高清视频| 欧美国产日本视频| 毛片不卡一区二区| 欧美午夜理伦三级在线观看| 国产精品免费看片| 麻豆极品一区二区三区| 欧美日韩精品一区二区三区| 国产精品电影院| 激情综合网激情| 欧美群妇大交群中文字幕| 国产精品久久99| 国产在线视频一区二区三区| 欧美日韩国产影片| 亚洲综合免费观看高清完整版| 国产成a人亚洲精| 久久人人超碰精品| 免费三级欧美电影| 91精选在线观看| 亚洲自拍偷拍麻豆| 色综合天天综合网国产成人综合天 | 国产成人精品免费网站| 777久久久精品| 亚洲一区二区四区蜜桃| 99视频精品在线| 中文字幕乱码久久午夜不卡| 国内精品嫩模私拍在线| 日韩欧美一级二级| 日韩成人免费看| 欧美一区二区免费| 午夜精品久久久久久久99水蜜桃| 91福利区一区二区三区| 亚洲精品第1页| 91视频精品在这里| 亚洲欧美偷拍另类a∨色屁股| 成人ar影院免费观看视频| 国产精品视频一二三| 福利电影一区二区三区| 国产精品美女久久久久久久久久久| 国产乱子伦一区二区三区国色天香| 91精品国产91综合久久蜜臀| 免费在线观看一区二区三区| 欧美一区二区三区成人| 青青草国产精品97视觉盛宴 | 亚洲精品成人悠悠色影视| 99精品视频一区二区三区| 国产精品理论片在线观看| 精品一区二区三区在线观看 | 精品视频在线视频| 久久综合999| 成人免费高清在线| 国产精品福利一区二区| 91视频免费观看| 亚洲线精品一区二区三区八戒| 欧美精品 日韩| 麻豆一区二区99久久久久| 日韩三级电影网址| 国产精品一二三四五| 亚洲精品一区二区在线观看| 国产精品香蕉一区二区三区| 国产色产综合产在线视频| 99国产精品久久| 亚洲激情图片一区| 日韩一区二区三区视频| 国产福利精品导航| 国产精品视频一二三区| 91国产视频在线观看| 日韩成人精品在线| 久久精品视频一区二区三区| 成人三级在线视频| 亚洲综合久久av| 欧美夫妻性生活| 免费成人小视频| 国产嫩草影院久久久久| 色综合色综合色综合色综合色综合 | 亚洲精品免费看| 91精品国产欧美一区二区| 国产精品99久久久久久久vr | 国产一区二区三区高清播放| 国产精品国产三级国产aⅴ中文| 色综合色综合色综合色综合色综合| 香蕉乱码成人久久天堂爱免费| 精品少妇一区二区三区免费观看| 国产成人在线观看| 国产精品久久久久一区| 欧美在线视频全部完| 精品一区二区三区在线播放| 亚洲欧美一区二区在线观看| 337p亚洲精品色噜噜噜| 粉嫩高潮美女一区二区三区| 无码av中文一区二区三区桃花岛| 欧美极品aⅴ影院| 欧美日韩精品是欧美日韩精品| 国产一区二区剧情av在线| 亚洲午夜三级在线| 久久久精品免费观看| 欧美日韩精品久久久| 国产成人午夜片在线观看高清观看| 亚洲丶国产丶欧美一区二区三区| 国产女主播视频一区二区| 在线不卡一区二区| a亚洲天堂av| 韩国成人精品a∨在线观看| 一区二区三区高清不卡| 国产人妖乱国产精品人妖| 欧美亚洲高清一区| 国产高清视频一区| 另类小说欧美激情| 亚洲一级二级三级| 成人免费在线播放视频| 精品国产乱码久久久久久闺蜜| 欧美中文字幕一二三区视频| 东方欧美亚洲色图在线| 麻豆精品国产传媒mv男同| 性做久久久久久免费观看欧美| 国产精品理伦片| 久久久久久日产精品| 日韩精品综合一本久道在线视频| 欧洲精品一区二区| 99久久婷婷国产| 粉嫩av一区二区三区在线播放| 久久99精品久久久久久久久久久久| 亚洲一区在线观看免费| 国产精品美女久久久久aⅴ| 精品免费视频.| 欧美一区二区三区色| 欧美色综合影院| 在线视频欧美区| 91在线免费看| 97超碰欧美中文字幕| 国产**成人网毛片九色| 极品美女销魂一区二区三区| 秋霞成人午夜伦在线观看| 亚洲国产另类精品专区| 亚洲午夜激情网页| 亚洲在线观看免费| 亚洲国产精品麻豆|