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

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

本文整理了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

  1. @ScriptFunction(jsDoc = FOREGROUND_JSDOC)
  2. @Override
  3. public Color getForeground() {
  4. return super.getForeground();
  5. }

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

  1. public void actionPerformed(ActionEvent e) {
  2. if ("color".equals(e.getActionCommand())) {
  3. JButton invoker = (JButton) e.getSource();
  4. Color newColor = JColorChooser.showDialog(this, Messages.DI_SELECTCOLOR, invoker.getForeground());
  5. if (newColor != null) {
  6. invoker.setForeground(newColor);
  7. }
  8. }
  9. }

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

  1. public int getSelectedIndex() {
  2. int i = 0;
  3. for (final VerticalTab<?> tab : _tabs) {
  4. final JButton button = tab.getButton();
  5. if (button.getForeground() == COLOR_SELECTED_FOREGROUND
  6. && button.getBackground() == COLOR_SELECTED_BACKGROUND) {
  7. return i;
  8. }
  9. i++;
  10. }
  11. return -1;
  12. }

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

  1. public void actionPerformed(ActionEvent e) {
  2. Color color =
  3. JColorChooser.showDialog(
  4. colorChooser, "Annotation Color", colorChooser.getForeground());
  5. annotatingPlugin.setAnnotationColor(color);
  6. colorChooser.setForeground(color);
  7. }
  8. });

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

  1. public void actionPerformed(ActionEvent e) {
  2. Color color = JColorChooser.showDialog(colorChooser, "Annotation Color",
  3. colorChooser.getForeground());
  4. annotatingPlugin.setAnnotationColor(color);
  5. colorChooser.setForeground(color);
  6. }});
  7. return colorChooser;

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

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

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

  1. void updatePanel() {
  2. if (plageEnCours_ == null) {
  3. ic_.setCouleur(btColor_.getForeground());
  4. valueEditor_.setValue(CtuluLibString.EMPTY_STRING, txtMax_);
  5. valueEditor_.setValue(CtuluLibString.EMPTY_STRING, txtMin_);
  6. } else {
  7. ic_.setCouleur(plageEnCours_.getCouleur());
  8. ic_.setTaille(plageEnCours_.getIconeTaille());
  9. ic_.setType(plageEnCours_.getIconeType());
  10. // final CtuluNumberFormatI fmt = plageEnCours_.getgetDefaultFormat();
  11. String s = Double.toString(plageEnCours_.getMin());
  12. valueEditor_.setValue(s, txtMin_);
  13. txtMin_.setToolTipText(s);
  14. s = Double.toString(plageEnCours_.getMax());
  15. valueEditor_.setValue(s, txtMax_);
  16. txtMax_.setToolTipText(s);
  17. }
  18. if (cbChangedLeg_ != null) {
  19. cbChangedLeg_.setSelected(plageEnCours_.isLegendCustomized());
  20. }
  21. btColor_.repaint();
  22. }

相关文章

JButton类方法