congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
IconBorder
Code IndexAdd Tabnine to your IDE (free)

How to use
IconBorder
in
org.jdesktop.swingx.border

Best Java code snippets using org.jdesktop.swingx.border.IconBorder (Showing top 20 results out of 315)

origin: stackoverflow.com

 Border border = new CompoundBorder(textField.getBorder(), new IconBorder(...));
textField.setBorder( border );
origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
public Insets getBorderInsets(Component c) {
  int horizontalInset = icon.getIconWidth() + (2 * padding);
  int iconPosition = bidiDecodeLeadingTrailing(c.getComponentOrientation(), this.iconPosition);
  if (iconPosition == SwingConstants.EAST) {
    return new Insets(0, 0, 0, horizontalInset);
  }
  return new Insets(0, horizontalInset, 0, 0);
}
origin: org.swinglabs.swingx/swingx-core

/**
 * Sets the position to place the icon (relative to the component contents).
 * 
 * @param iconPosition must be one of the following {@code SwingConstants}:
 *        <ul>
 *          <li>{@code LEADING}</li>
 *          <li>{@code TRAILING}</li>
 *          <li>{@code EAST}</li>
 *          <li>{@code WEST}</li>
 *        </ul>
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 */
public void setIconPosition(int iconPosition) {
  if (!isValidPosition(iconPosition)) {
    throw new IllegalArgumentException("Invalid icon position");
  }
  this.iconPosition = iconPosition;
}
origin: org.swinglabs.swingx/swingx-all

/**
 * Creates an {@code IconBorder} with the specified constraints. If
 * {@code validIcon} is {@code null}, {@code EMPTY_ICON} is used instead.
 * If {@code padding} is negative, then the border does not use padding.
 * 
 * @param validIcon
 *            the icon to set. This may be {@code null} to represent an
 *            empty icon.
 * @param iconPosition
 *            the position to place the icon relative to the component
 *            contents. This must be one of the following
 *            {@code SwingConstants}:
 *            <ul>
 *            <li>{@code LEADING}</li>
 *            <li>{@code TRAILING}</li>
 *            <li>{@code EAST}</li>
 *            <li>{@code WEST}</li>
 *            </ul>
 * @param padding
 *            the padding to surround the icon with. All non-positive values
 *            set the padding to 0.
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 * @see #EMPTY_ICON
 */
public IconBorder(Icon validIcon, int iconPosition, int padding) {
  setIcon(validIcon);
  setPadding(padding);
  setIconPosition(iconPosition);
}
origin: org.codehaus.jtstand/jtstand-desktop

  public Component getTableCellRendererComponent(JTable table, Object value,
      boolean isSelected, boolean hasFocus, int rowIndex, int columnIndex) {
    Component comp = configureDelegate(table, value, isSelected, hasFocus, rowIndex,
        columnIndex);
    if ((table instanceof JXTable) && (comp instanceof JComponent)) {
      // work-around core issues
      hackBorder((JComponent) comp);
      SortOrder sortOrder = ((JXTable) table).getSortOrder(columnIndex);
//            Border border = UIManager.getBorder("TableHeader.cellBorder");
//            LOG.info("in renderer: " + UIManager.getBorder("TableHeader.cellBorder"));
      if (sortOrder.isSorted()) {
        iconBorder.setIcon(sortOrder.isAscending() ? upIcon : downIcon);
        Border origBorder = ((JComponent) comp).getBorder();
        Border border = new CompoundBorder(origBorder, iconBorder);
        ((JComponent) comp).setBorder(border);
      }
    }
    adjustComponentOrientation(comp);
    return comp;
  }
 
origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * Creates an {@code IconBorder} with the specified constraints. If
 * {@code validIcon} is {@code null}, {@code EMPTY_ICON} is used instead.
 * If {@code padding} is negative, then the border does not use padding.
 * 
 * @param validIcon
 *            the icon to set. This may be {@code null} to represent an
 *            empty icon.
 * @param iconPosition
 *            the position to place the icon relative to the component
 *            contents. This must be one of the following
 *            {@code SwingConstants}:
 *            <ul>
 *            <li>{@code LEADING}</li>
 *            <li>{@code TRAILING}</li>
 *            <li>{@code EAST}</li>
 *            <li>{@code WEST}</li>
 *            </ul>
 * @param padding
 *            the padding to surround the icon with. All non-positive values
 *            set the padding to 0.
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 * @see #EMPTY_ICON
 */
public IconBorder(Icon validIcon, int iconPosition, int padding) {
  setIcon(validIcon);
  setPadding(padding);
  setIconPosition(iconPosition);
}
origin: org.swinglabs.swingx/swingx-core

/**
 * Creates an {@code IconBorder} with the specified constraints. If
 * {@code validIcon} is {@code null}, {@code EMPTY_ICON} is used instead.
 * If {@code padding} is negative, then the border does not use padding.
 * 
 * @param validIcon
 *            the icon to set. This may be {@code null} to represent an
 *            empty icon.
 * @param iconPosition
 *            the position to place the icon relative to the component
 *            contents. This must be one of the following
 *            {@code SwingConstants}:
 *            <ul>
 *            <li>{@code LEADING}</li>
 *            <li>{@code TRAILING}</li>
 *            <li>{@code EAST}</li>
 *            <li>{@code WEST}</li>
 *            </ul>
 * @param padding
 *            the padding to surround the icon with. All non-positive values
 *            set the padding to 0.
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 * @see #EMPTY_ICON
 */
public IconBorder(Icon validIcon, int iconPosition, int padding) {
  setIcon(validIcon);
  setPadding(padding);
  setIconPosition(iconPosition);
}
origin: com.github.insubstantial/substance-swingx

  private Border getTitleBorder() {
    if (monthView.isTraversable()) {
      IconBorder up = new IconBorder(monthUpImage,
          SwingConstants.EAST, monthView.getBoxPaddingX());
      IconBorder down = new IconBorder(monthDownImage,
          SwingConstants.WEST, monthView.getBoxPaddingX());
      Border compound = BorderFactory.createCompoundBorder(up, down);
      Border empty = BorderFactory
          .createEmptyBorder(2 * monthView.getBoxPaddingY(), 0,
              2 * monthView.getBoxPaddingY(), 0);
      return BorderFactory.createCompoundBorder(compound, empty);
    }
    return BorderFactory.createEmptyBorder(monthView.getBoxPaddingY(),
        monthView.getBoxPaddingX(), monthView.getBoxPaddingY(),
        monthView.getBoxPaddingX());
  }
}
origin: org.swinglabs.swingx/swingx-core

/**
 * {@inheritDoc}
 */
public Insets getBorderInsets(Component c) {
  int horizontalInset = icon.getIconWidth() + (2 * padding);
  int iconPosition = bidiDecodeLeadingTrailing(c.getComponentOrientation(), this.iconPosition);
  if (iconPosition == SwingConstants.EAST) {
    return new Insets(0, 0, 0, horizontalInset);
  }
  return new Insets(0, horizontalInset, 0, 0);
}
origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * Sets the position to place the icon (relative to the component contents).
 * 
 * @param iconPosition must be one of the following {@code SwingConstants}:
 *        <ul>
 *          <li>{@code LEADING}</li>
 *          <li>{@code TRAILING}</li>
 *          <li>{@code EAST}</li>
 *          <li>{@code WEST}</li>
 *        </ul>
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 */
public void setIconPosition(int iconPosition) {
  if (!isValidPosition(iconPosition)) {
    throw new IllegalArgumentException("Invalid icon position");
  }
  this.iconPosition = iconPosition;
}
origin: org.codehaus.jtstand/jtstand-desktop

/**
 * Creates an {@code IconBorder} with the specified constraints. If
 * {@code validIcon} is {@code null}, {@code EMPTY_ICON} is used instead.
 * If {@code padding} is negative, then the border does not use padding.
 * 
 * @param validIcon
 *            the icon to set. This may be {@code null} to represent an
 *            empty icon.
 * @param iconPosition
 *            the position to place the icon relative to the component
 *            contents. This must be one of the following
 *            {@code SwingConstants}:
 *            <ul>
 *            <li>{@code LEADING}</li>
 *            <li>{@code TRAILING}</li>
 *            <li>{@code EAST}</li>
 *            <li>{@code WEST}</li>
 *            </ul>
 * @param padding
 *            the padding to surround the icon with. All non-positive values
 *            set the padding to 0.
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 * @see #EMPTY_ICON
 */
public IconBorder(Icon validIcon, int iconPosition, int padding) {
  setIcon(validIcon);
  setPadding(padding);
  setIconPosition(iconPosition);
}
origin: org.codehaus.jtstand/jtstand-desktop

/**
 * @return
 */
private Border getTitleBorder() {
  if (getComponent().isTraversable()) {
    Icon downIcon = UIManager.getIcon("JXMonthView.monthDownFileName");
    Icon upIcon = UIManager.getIcon("JXMonthView.monthUpFileName");
    // fix for #1028-swingx: title border whacky for boxpadding 0
    // in fact there had been a deeper issue - without using the arrowPadding here
    // the hit-detection of the buttons is slightly off target
    IconBorder up = new IconBorder(upIcon, SwingConstants.EAST, arrowPaddingX); 
    IconBorder down = new IconBorder(downIcon, SwingConstants.WEST, arrowPaddingX); 
    Border compound = BorderFactory.createCompoundBorder(up, down);
    Border empty = BorderFactory.createEmptyBorder(2* arrowPaddingY, 0, 2*arrowPaddingY, 0);
    return BorderFactory.createCompoundBorder(compound, empty);
  }
  
  return BorderFactory.createEmptyBorder(getComponent().getBoxPaddingY(), getComponent().getBoxPaddingX(), getComponent().getBoxPaddingY(), getComponent().getBoxPaddingX());
}
origin: org.codehaus.jtstand/jtstand-desktop

/**
 * {@inheritDoc}
 */
public Insets getBorderInsets(Component c) {
  int horizontalInset = icon.getIconWidth() + (2 * padding);
  int iconPosition = bidiDecodeLeadingTrailing(c.getComponentOrientation(), this.iconPosition);
  if (iconPosition == SwingConstants.EAST) {
    return new Insets(0, 0, 0, horizontalInset);
  }
  return new Insets(0, horizontalInset, 0, 0);
}
origin: com.haulmont.thirdparty/swingx-core

/**
 * Sets the position to place the icon (relative to the component contents).
 * 
 * @param iconPosition must be one of the following {@code SwingConstants}:
 *        <ul>
 *          <li>{@code LEADING}</li>
 *          <li>{@code TRAILING}</li>
 *          <li>{@code EAST}</li>
 *          <li>{@code WEST}</li>
 *        </ul>
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 */
public void setIconPosition(int iconPosition) {
  if (!isValidPosition(iconPosition)) {
    throw new IllegalArgumentException("Invalid icon position");
  }
  this.iconPosition = iconPosition;
}
origin: com.haulmont.thirdparty/swingx-core

/**
 * Creates an {@code IconBorder} with the specified constraints. If
 * {@code validIcon} is {@code null}, {@code EMPTY_ICON} is used instead.
 * If {@code padding} is negative, then the border does not use padding.
 * 
 * @param validIcon
 *            the icon to set. This may be {@code null} to represent an
 *            empty icon.
 * @param iconPosition
 *            the position to place the icon relative to the component
 *            contents. This must be one of the following
 *            {@code SwingConstants}:
 *            <ul>
 *            <li>{@code LEADING}</li>
 *            <li>{@code TRAILING}</li>
 *            <li>{@code EAST}</li>
 *            <li>{@code WEST}</li>
 *            </ul>
 * @param padding
 *            the padding to surround the icon with. All non-positive values
 *            set the padding to 0.
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 * @see #EMPTY_ICON
 */
public IconBorder(Icon validIcon, int iconPosition, int padding) {
  setIcon(validIcon);
  setPadding(padding);
  setIconPosition(iconPosition);
}
origin: org.swinglabs.swingx/swingx-all

/**
 * @return
 */
private Border getTitleBorder() {
  if (getComponent().isTraversable()) {
    Icon downIcon = UIManager.getIcon("JXMonthView.monthDownFileName");
    Icon upIcon = UIManager.getIcon("JXMonthView.monthUpFileName");
    // fix for #1028-swingx: title border whacky for boxpadding 0
    // in fact there had been a deeper issue - without using the arrowPadding here
    // the hit-detection of the buttons is slightly off target
    IconBorder up = new IconBorder(upIcon, SwingConstants.EAST, arrowPaddingX); 
    IconBorder down = new IconBorder(downIcon, SwingConstants.WEST, arrowPaddingX); 
    Border compound = BorderFactory.createCompoundBorder(up, down);
    Border empty = BorderFactory.createEmptyBorder(2* arrowPaddingY, 0, 2*arrowPaddingY, 0);
    return BorderFactory.createCompoundBorder(compound, empty);
  }
  
  return BorderFactory.createEmptyBorder(getComponent().getBoxPaddingY(), getComponent().getBoxPaddingX(), getComponent().getBoxPaddingY(), getComponent().getBoxPaddingX());
}
origin: com.haulmont.thirdparty/swingx-core

/**
 * {@inheritDoc}
 */
public Insets getBorderInsets(Component c) {
  int horizontalInset = icon.getIconWidth() + (2 * padding);
  int iconPosition = bidiDecodeLeadingTrailing(c.getComponentOrientation(), this.iconPosition);
  if (iconPosition == SwingConstants.EAST) {
    return new Insets(0, 0, 0, horizontalInset);
  }
  return new Insets(0, horizontalInset, 0, 0);
}
origin: org.swinglabs.swingx/swingx-all

/**
 * Sets the position to place the icon (relative to the component contents).
 * 
 * @param iconPosition must be one of the following {@code SwingConstants}:
 *        <ul>
 *          <li>{@code LEADING}</li>
 *          <li>{@code TRAILING}</li>
 *          <li>{@code EAST}</li>
 *          <li>{@code WEST}</li>
 *        </ul>
 * @throws IllegalArgumentException
 *             if {@code iconPosition} is not a valid position.
 */
public void setIconPosition(int iconPosition) {
  if (!isValidPosition(iconPosition)) {
    throw new IllegalArgumentException("Invalid icon position");
  }
  this.iconPosition = iconPosition;
}
origin: com.haulmont.thirdparty/swingx-core

/**
 * @return
 */
private Border getTitleBorder() {
  if (getComponent().isTraversable()) {
    Icon downIcon = UIManager.getIcon("JXMonthView.monthDownFileName");
    Icon upIcon = UIManager.getIcon("JXMonthView.monthUpFileName");
    // fix for #1028-swingx: title border whacky for boxpadding 0
    // in fact there had been a deeper issue - without using the arrowPadding here
    // the hit-detection of the buttons is slightly off target
    IconBorder up = new IconBorder(upIcon, SwingConstants.EAST, arrowPaddingX); 
    IconBorder down = new IconBorder(downIcon, SwingConstants.WEST, arrowPaddingX); 
    Border compound = BorderFactory.createCompoundBorder(up, down);
    Border empty = BorderFactory.createEmptyBorder(2* arrowPaddingY, 0, 2*arrowPaddingY, 0);
    return BorderFactory.createCompoundBorder(compound, empty);
  }
  
  return BorderFactory.createEmptyBorder(getComponent().getBoxPaddingY(), getComponent().getBoxPaddingX(), getComponent().getBoxPaddingY(), getComponent().getBoxPaddingX());
}
origin: org.swinglabs.swingx/swingx-all

/**
 * {@inheritDoc}
 */
public Insets getBorderInsets(Component c) {
  int horizontalInset = icon.getIconWidth() + (2 * padding);
  int iconPosition = bidiDecodeLeadingTrailing(c.getComponentOrientation(), this.iconPosition);
  if (iconPosition == SwingConstants.EAST) {
    return new Insets(0, 0, 0, horizontalInset);
  }
  return new Insets(0, horizontalInset, 0, 0);
}
org.jdesktop.swingx.borderIconBorder

Javadoc

IconBorder creates a border that places an Icon in the border on the horizontal axis. The border does not add any additional insets other than the inset required to produce the space for the icon. If additional insets are required, users should create a javax.swing.border.CompoundBorder.

This border is useful when attempting to add Icons to pre-existing components without requiring specialty painting.

Most used methods

  • <init>
    Creates an IconBorder with the specified constraints. If validIcon is null, EMPTY_ICON is used inste
  • bidiDecodeLeadingTrailing
    Returns EAST or WEST depending on the ComponentOrientation and the given postion LEADING/TRAILING th
  • isValidPosition
  • setIcon
    Sets the icon for this border.
  • setIconPosition
    Sets the position to place the icon (relative to the component contents).
  • setPadding
    Sets the padding around the icon.

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getSharedPreferences (Context)
  • getSystemService (Context)
  • setRequestProperty (URLConnection)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Notification (javax.management)
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now