javax.swing.JButton.getForeground()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中javax.swing.JButton.getForeground()方法的一些代码示例,展示了JButton.getForeground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JButton.getForeground()方法的具体详情如下:
包路径:javax.swing.JButton
类名称:JButton
方法名:getForeground

JButton.getForeground介绍

暂无

代码示例

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = FOREGROUND_JSDOC)
@Override
public Color getForeground() {
  return super.getForeground();
}

代码示例来源:origin: org.cytoscape/network-analyzer-impl

public void actionPerformed(ActionEvent e) {
  if ("color".equals(e.getActionCommand())) {
    JButton invoker = (JButton) e.getSource();
    Color newColor = JColorChooser.showDialog(this, Messages.DI_SELECTCOLOR, invoker.getForeground());
    if (newColor != null) {
      invoker.setForeground(newColor);
    }
  }
}

代码示例来源:origin: datacleaner/DataCleaner

public int getSelectedIndex() {
  int i = 0;
  for (final VerticalTab<?> tab : _tabs) {
    final JButton button = tab.getButton();
    if (button.getForeground() == COLOR_SELECTED_FOREGROUND
        && button.getBackground() == COLOR_SELECTED_BACKGROUND) {
      return i;
    }
    i++;
  }
  return -1;
}

代码示例来源:origin: jrtom/jung

public void actionPerformed(ActionEvent e) {
  Color color =
    JColorChooser.showDialog(
      colorChooser, "Annotation Color", colorChooser.getForeground());
  annotatingPlugin.setAnnotationColor(color);
  colorChooser.setForeground(color);
 }
});

代码示例来源:origin: net.sf.jung/jung-visualization

public void actionPerformed(ActionEvent e) {
    Color color = JColorChooser.showDialog(colorChooser, "Annotation Color", 
        colorChooser.getForeground());
    annotatingPlugin.setAnnotationColor(color);
    colorChooser.setForeground(color);
  }});
return colorChooser;

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * <p>Apply an icon to a button. Both icon states (enabled/disabled) will be added.</p>
 * <p>The icon will use the font and color from the button, but <strong>will not</strong> reflect any subsequent updates.</p>
 *
 * @param icon              The icon reference
 * @param button            The button
 * @param leading           True if the icon comes before the text in the reading direction (LTR and RTL is handled automatically)
 * @param verticalAlignment One of JLabel.TOP, JLabel.CENTER, JLabel.BOTTOM The position of the text relative to the icon
 * @param size              The icon size (font metrics)
 */
public static void applyIcon(AwesomeIcon icon, JButton button, boolean leading, int verticalAlignment, int size) {
 JButton iconButton = new JButton();
 iconButton.setFont(iconButton.getFont().deriveFont((float) size));
 iconButton.setForeground(button.getForeground());
 Icon enabledIcon = new AwesomeSwingIcon(iconButton, icon.getChar(), true);
 Icon disabledIcon = new AwesomeSwingIcon(iconButton, icon.getChar(), false);
 button.setIcon(enabledIcon);
 button.setDisabledIcon(disabledIcon);
 align(button, leading);
 if (verticalAlignment == JLabel.TOP || verticalAlignment == JLabel.BOTTOM) {
  button.setVerticalTextPosition(verticalAlignment);
  // Override the horizontal alignment
  button.setHorizontalTextPosition(JLabel.CENTER);
 }
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

void updatePanel() {
 if (plageEnCours_ == null) {
  ic_.setCouleur(btColor_.getForeground());
  valueEditor_.setValue(CtuluLibString.EMPTY_STRING, txtMax_);
  valueEditor_.setValue(CtuluLibString.EMPTY_STRING, txtMin_);
 } else {
  ic_.setCouleur(plageEnCours_.getCouleur());
  ic_.setTaille(plageEnCours_.getIconeTaille());
  ic_.setType(plageEnCours_.getIconeType());
  // final CtuluNumberFormatI fmt = plageEnCours_.getgetDefaultFormat();
  String s = Double.toString(plageEnCours_.getMin());
  valueEditor_.setValue(s, txtMin_);
  txtMin_.setToolTipText(s);
  s = Double.toString(plageEnCours_.getMax());
  valueEditor_.setValue(s, txtMax_);
  txtMax_.setToolTipText(s);
 }
 if (cbChangedLeg_ != null) {
  cbChangedLeg_.setSelected(plageEnCours_.isLegendCustomized());
 }
 btColor_.repaint();
}

相关文章

JButton类方法