Examples of AutoHideButton


Examples of com.vlsolutions.swing.docking.AutoHideButton

  }

  public void installUI(JComponent comp){
    super.installUI(comp);
   
    AutoHideButton btn = (AutoHideButton) comp;
   
    installBorder(btn);
   
    btn.addPropertyChangeListener(AutoHideButton.PROPERTY_ZONE, this);
   
    //Font f = UIManager.getFont("MenuItem.font");
    Font f = UIManager.getFont("AutoHideButton.font");
    if (f != null) {
      btn.setFont(f);
    } else {
      btn.setFont(new Font("Dialog", Font.PLAIN, 10));
    }
  }
View Full Code Here

Examples of com.vlsolutions.swing.docking.AutoHideButton

 
  /** Overriden to paint properly the button on vertical sides.
   */
  public void paint(Graphics g, JComponent comp){
    AutoHideButton btn = (AutoHideButton) comp;
    int zone = btn.getZone();
    if (zone == DockingConstants.INT_HIDE_TOP || zone == DockingConstants.INT_SPLIT_BOTTOM){
      super.paint(g, comp);
    } else {
      // vertical button : we have to rely on a custom paint
      if (btn.isOpaque()) {
        g.setColor(btn.getBackground());
        g.fillRect(0, 0, btn.getWidth(), btn.getHeight());
      }
     
      double pid2 = Math.PI / 2d;
      Graphics2D g2 = ( (Graphics2D) g.create());
      g2.setFont(btn.getFont());
      g2.setColor(btn.getForeground());
      FontMetrics fm = btn.getFontMetrics(btn.getFont());
      Icon icon = btn.getIcon();
      Insets i = btn.getInsets();
     
      String text = btn.getText(); // 2005/07/12 added text != null controls
     
      if (zone == DockingConstants.INT_HIDE_LEFT) {
        g2.translate(0, btn.getHeight());
        g2.rotate( -pid2);
        if (icon != null) {
          icon.paintIcon(btn, g2, i.bottom, i.left);
          if (text != null){
            g2.drawString(text,
                i.bottom + icon.getIconWidth() + btn.getIconTextGap(),
                i.left + btn.getWidth() / 2 +
                fm.getAscent() / 2 /*       fm.getAscent()*/);
          }
        } else {
          if (text != null){
            g2.drawString(text, i.bottom,
                i.left + btn.getWidth() / 2 + fm.getAscent() / 2);
          }
        }
      } else {
        g2.translate(btn.getWidth(), 0);
        g2.rotate(pid2);
        if (icon != null) {
          icon.paintIcon(btn, g2, 1, 1);
          if (text != null){
            g2.drawString(text, i.top + icon.getIconWidth() + btn.getIconTextGap(),
                btn.getWidth() / 2 + fm.getAscent() / 2);
          }
        } else {
          if (text != null){
            g2.drawString(text, i.top,
                btn.getWidth() / 2 + fm.getAscent() / 2);
          }
        }
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.