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

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

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

JButton.repaint介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

public void setConnectButtonText(String status) {
  this.btnConnect.setText(status);
  changeGUISize(); // Needed to layout the tooltbar after text length change
  this.btnConnect.repaint();
  this.btnConnect.revalidate();
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

@Override
public void repaint() {
  if (painting) {
    // skip repaint requests while painting
    return;
  }
  super.repaint();
}

代码示例来源:origin: org.jspresso.framework/jspresso-swing-components

/**
 * Sets the value.
 *
 * @param value
 *          the value to set.
 */
public void setValue(Color value) {
 this.value = value;
 chooseButton.repaint();
 fireStateChanged();
}

代码示例来源:origin: org.jspresso/jspresso-swing-components

/**
 * Sets the value.
 * 
 * @param value
 *            the value to set.
 */
public void setValue(Color value) {
 this.value = value;
 chooseButton.repaint();
 fireStateChanged();
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

public void actionPerformed(ActionEvent e) {
    JButton defaultButton = (JButton) defaultButtonRef.get();
    // no default button, thus stop running
    if (defaultButton == null && defaultButtonTimer.isRunning()) {
      defaultButtonTimer.stop();
      defaultButtonRef = null;
      return;
    }
    defaultButtonAlpha += (defaultButtonAlphaDir) ? 10 : -10;
    if (defaultButtonAlpha == 200 || defaultButtonAlpha == 10) {
      defaultButtonAlphaDir = !defaultButtonAlphaDir;
    }
    defaultButton.repaint();
  }
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
 public void propertyChange(PropertyChangeEvent evt) {
  if ("messages".equals(evt.getPropertyName())) {
   if (TmmUIMessageCollector.instance.getNewMessagesCount() > 0) {
    btnNotifications.setVisible(true);
    btnNotifications.setEnabled(true);
    btnNotifications.setText("" + TmmUIMessageCollector.instance.getNewMessagesCount());
   }
   else {
    btnNotifications.setVisible(false);
    btnNotifications.setEnabled(false);
   }
   btnNotifications.repaint();
  }
 }
};

代码示例来源:origin: mucommander/mucommander

private void setCurrentColor(Color color, boolean initiatedByUser) {
  currentColor = color;
  if(themeData.isColorDifferent(colorId, currentColor))
    initiatedByUser &= themeData.setColor(colorId, currentColor);
  button.repaint();
  if(updatedPreviewComponents != null && previewColorPropertyName != null) {
    int nbPreviewComponents = updatedPreviewComponents.size();
    for(int i = 0; i < nbPreviewComponents; i++)
      updatedPreviewComponents.get(i).putClientProperty(previewColorPropertyName, color);
  }
  
  if (initiatedByUser)
    parent.componentChanged(null);
}

代码示例来源:origin: sc.fiji/3D_Viewer

/**
 * Toggle play/pause
 */
public synchronized void togglePlay() {
  if (!p.isVisible()) return;
  if (buttons[playIndex].getActionCommand().equals("PLAY")) {
    buttons[playIndex].setActionCommand("PAUSE");
    buttons[playIndex].setIcon(new ImageIcon(pauseImage));
    buttons[playIndex].setBorder(null);
    buttons[playIndex].repaint();
    timeline.play();
  }
  else {
    buttons[playIndex].setActionCommand("PLAY");
    buttons[playIndex].setIcon(new ImageIcon(playImage));
    buttons[playIndex].setBorder(null);
    buttons[playIndex].repaint();
    timeline.pause();
  }
}

代码示例来源:origin: IanDarwin/javasrc

/** Unset any previously highlighted day */
private void clearDayActive() {
  JButton b;
  // First un-shade the previously-selected square, if any
  if (activeDay > 0) {
    b = labs[(leadGap+activeDay)/7][(leadGap+activeDay)%7];
    b.setBackground(b0.getBackground());
    b.repaint();
    activeDay = -1;
  }
}

代码示例来源:origin: IanDarwin/javasrc

/** Unset any previously highlighted day */
private void clearDayActive() {
  JButton b;
  // First un-shade the previously-selected square, if any
  if (activeDay > 0) {
    b = labs[(leadGap+activeDay-1)/7][(leadGap+activeDay-1)%7];
    b.setBackground(b0.getBackground());
    b.repaint();
    activeDay = -1;
  }
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Synchronizes the tooltip of the close button.
 */
protected void syncCloseButtonTooltip() {
  if (SubstanceCoreUtilities.isInternalFrameModified(this.frame)) {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(frame).getString("SystemMenu.close")
        + " ["
        + SubstanceCoreUtilities.getResourceBundle(frame)
            .getString("Tooltip.contentsNotSaved") + "]");
  } else {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(frame).getString("SystemMenu.close"));
  }
  this.closeButton.repaint();
}

代码示例来源:origin: org.java.net.substance/substance

/**
 * Synchronizes the tooltip of the close button.
 */
protected void syncCloseButtonTooltip() {
  if (SubstanceCoreUtilities.isInternalFrameModified(this.frame)) {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(frame).getString("SystemMenu.close")
        + " ["
        + SubstanceCoreUtilities.getResourceBundle(frame)
            .getString("Tooltip.contentsNotSaved") + "]");
  } else {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(frame).getString("SystemMenu.close"));
  }
  this.closeButton.repaint();
}

代码示例来源:origin: stackoverflow.com

public class ButtonEditor extends DefaultCellEditor
{
  protected JButton button;

  public ButtonEditor(JCheckBox checkBox) 
  {
    super(checkBox);
    button = new JButton();
    button.setOpaque(true);
    button.addActionListener(new ActionListener() 
    {
      public void actionPerformed(ActionEvent e)
      {
        button.setBackground(Color.GREEN);
        button.repaint();
      }
    });
  }

  public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int row, int column) 
  {
    return button;
  }

}

代码示例来源:origin: org.java.net.substance/substance

/**
 * Synchronizes the tooltip of the close button.
 */
protected void syncCloseButtonTooltip() {
  if (SubstanceCoreUtilities.isRootPaneModified(this.getRootPane())) {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(rootPane).getString("SystemMenu.close")
        + " ["
        + SubstanceCoreUtilities.getResourceBundle(rootPane)
            .getString("Tooltip.contentsNotSaved") + "]");
  } else {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(rootPane).getString("SystemMenu.close"));
  }
  this.closeButton.repaint();
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Synchronizes the tooltip of the close button.
 */
protected void syncCloseButtonTooltip() {
  if (SubstanceCoreUtilities.isRootPaneModified(this.getRootPane())) {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(rootPane).getString("SystemMenu.close")
        + " ["
        + SubstanceCoreUtilities.getResourceBundle(rootPane)
            .getString("Tooltip.contentsNotSaved") + "]");
  } else {
    this.closeButton.setToolTipText(SubstanceCoreUtilities
        .getResourceBundle(rootPane).getString("SystemMenu.close"));
  }
  this.closeButton.repaint();
}

代码示例来源:origin: MegaMek/mekhq

@Override
  public void propertyChange(PropertyChangeEvent evt) {
    String txt = "Parts Acquisition";
    
    if (PartsAcquisitionService.getMissingCount() > 0) {
      if (PartsAcquisitionService.getUnavailableCount() > 0) {
        txt += String.format(" (%s missing, %s unavailable)", PartsAcquisitionService.getMissingCount(), PartsAcquisitionService.getUnavailableCount());
      } else {
        txt += String.format(" (%s missing)", PartsAcquisitionService.getMissingCount());
      }
    }
    
    btnAcquisitions.setText(txt);
    
    btnAcquisitions.repaint();
  }
});

代码示例来源:origin: freeplane/freeplane

/**
 * Initializes both day names and weeks of the year.
 */
protected void initDecorations() {
  for (int x = 0; x < 7; x++) {
    days[x].setContentAreaFilled(decorationBackgroundVisible);
    days[x].setBorderPainted(decorationBordersVisible);
    days[x].invalidate();
    days[x].repaint();
    weeks[x].setContentAreaFilled(decorationBackgroundVisible);
    weeks[x].setBorderPainted(decorationBordersVisible);
    weeks[x].invalidate();
    weeks[x].repaint();
  }
}

代码示例来源:origin: org.tentackle/tentackle-swing

@Override
 public void actionPerformed(ActionEvent e)  {
  if (!comboBox.isEditable()) {
   flasherVisible = !flasherVisible;
   if (!flasherVisible)  {
    Graphics g = arrowButton.getGraphics();
    if (g != null)  {
     g.setColor(usingOcean ? UIManager.getColor("Button.focus") : arrowButton.getBackground());
     Insets insets = arrowButton.getInsets();
     int width = arrowButton.getWidth() - (insets.left + insets.right);
     int height = arrowButton.getHeight() - (insets.top + insets.bottom);
     if (height > 0 && width > 0) {
      int left = insets.left;
      int top = insets.top;
      g.drawRect( left - 1, top - 1, width + 3, height + 1 );
     }
    }
   }
   else  {
    arrowButton.repaint();
   }
  }
 }
}

代码示例来源: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();
}

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

public void setTarget(final BControleAffichageTarget _target) {
 target_ = _target;
 txt_.setSrc(target_);
 setEnable(target_ != null);
 if (target_ != null) {
  cbOmbre_.setSelected(target_.isEclairage());
  cbRapide_.setSelected(target_.isRapide());
  cbRapide_.setEnabled(target_.isRapideEditable());
  cbVisible_.setSelected(target_.isVisible());
  cbFilaire_.setSelected(target_.isFilaire());
  cbFilaire_.setEnabled(target_.isFilaireEditable());
  icColor_.setCouleur(target_.getCouleur());
  btColor_.repaint();
  updateApplyBt();
 }
}

相关文章

JButton类方法