Example #1
0
 /**
  * Returns an enum indicating how the baseline of the component changes as the size changes.
  *
  * @throws NullPointerException {@inheritDoc}
  * @see javax.swing.JComponent#getBaseline(int, int)
  * @since 1.6
  */
 public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c) {
   super.getBaselineResizeBehavior(c);
   Border border = c.getBorder();
   if (border instanceof AbstractBorder) {
     return ((AbstractBorder) border).getBaselineResizeBehavior(c);
   }
   return Component.BaselineResizeBehavior.OTHER;
 }
Example #2
0
 /**
  * Returns the baseline.
  *
  * @throws NullPointerException {@inheritDoc}
  * @throws IllegalArgumentException {@inheritDoc}
  * @see javax.swing.JComponent#getBaseline(int, int)
  * @since 1.6
  */
 public int getBaseline(JComponent c, int width, int height) {
   super.getBaseline(c, width, height);
   Border border = c.getBorder();
   if (border instanceof AbstractBorder) {
     return ((AbstractBorder) border).getBaseline(c, width, height);
   }
   return -1;
 }
Example #3
0
 /**
  * Removes the previous content border from the specified component, and sets an empty border if
  * there has been no border or an UIResource instance before.
  */
 private void stripContentBorder(Object c) {
   if (c instanceof JComponent) {
     JComponent contentComp = (JComponent) c;
     Border contentBorder = contentComp.getBorder();
     if (contentBorder == null || contentBorder instanceof UIResource) {
       contentComp.setBorder(handyEmptyBorder);
     }
   }
 }
 private boolean isFixedHeight(JComponent c) {
   Border b = c.getBorder();
   if (b != null && b instanceof BackgroundBorder) {
     b = ((BackgroundBorder) b).getBackgroundBorder();
     if (b != null && b instanceof QuaquaButtonBorder) {
       return ((QuaquaButtonBorder) b).isFixedHeight(c);
     }
   }
   return false;
 }
Example #5
0
  /** Uninstalls the UI delegate for the specified component */
  public void uninstallUI(JComponent c) {
    frame = (JInternalFrame) c;

    Container cont = ((JInternalFrame) (c)).getContentPane();
    if (cont instanceof JComponent) {
      JComponent content = (JComponent) cont;
      if (content.getBorder() == handyEmptyBorder) {
        content.setBorder(null);
      }
    }
    super.uninstallUI(c);
  }
  @Override
  public void paint(Graphics g, JComponent c) {

    String style = (String) c.getClientProperty("Quaqua.Button.style");
    if (style != null && style.equals("help")) {
      Insets insets = c.getInsets();
      UIManager.getIcon("Button.helpIcon").paintIcon(c, g, insets.left, insets.top);
      return;
    }

    Object oldHints = QuaquaUtilities.beginGraphics((Graphics2D) g);
    if (((AbstractButton) c).isBorderPainted()) {
      Border b = c.getBorder();
      if (b != null && b instanceof BackgroundBorder) {
        ((BackgroundBorder) b)
            .getBackgroundBorder()
            .paintBorder(c, g, 0, 0, c.getWidth(), c.getHeight());
      }
    }
    super.paint(g, c);
    QuaquaUtilities.endGraphics((Graphics2D) g, oldHints);
    Debug.paint(g, c, this);
  }