javax.swing.JLabel.paintImmediately()方法的使用及代码示例

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

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

JLabel.paintImmediately介绍

暂无

代码示例

代码示例来源:origin: edu.stanford.protege/ca.uvic.cs.chisel.cajun

public void setStatus(String msg, boolean error) {
  statusLabel.setText(msg);
  statusLabel.setToolTipText(msg);
  statusLabel.setForeground(error ? Color.red : Color.black);
  
  // force a repaint
  if (SwingUtilities.isEventDispatchThread()) {
    long diff = System.currentTimeMillis() - lastStatusPaint;
    if (diff > MIN_REPAINT) {
      statusLabel.paintImmediately(statusLabel.getBounds());
      lastStatusPaint = System.currentTimeMillis();
    }
  }
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

/**
 * Setter function for message in the status bar.
 *
 * @param newMessage The new message to display.
 * @see #getStatusMessage
 */
public void setStatusMessage(String newMessage) {
  statusMessage.setText(newMessage);
  // We paint immediately for components like
  // org.fife.ui.FindInFilesDialog.
  statusMessage.paintImmediately(statusMessage.getBounds());
}

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

private void setText(final JLabel label, final String text){
 label.setText(text);
 label.paintImmediately(label.getVisibleRect());
}

代码示例来源:origin: igvteam/igv

public void setMessage(final String message) {
  UIUtilities.invokeOnEventThread(() -> {
    messageBox.setText(message);
    messageBox.paintImmediately(messageBox.getBounds());
  });
  if (!SwingUtilities.isEventDispatchThread()) {
    try {
      Thread.currentThread().sleep(10);
    } catch (InterruptedException e) {
      // ignore
    }
  }
}

代码示例来源:origin: igvteam/igv

public void setMessage3(final String message) {
  UIUtilities.invokeOnEventThread(() -> {
    messageBox3.setText(message);
    messageBox3.paintImmediately(messageBox2.getBounds());
  });
}

代码示例来源:origin: igvteam/igv

public void setMessage2(final String message) {
  UIUtilities.invokeOnEventThread(() -> {
    messageBox2.setText(message);
    messageBox2.paintImmediately(messageBox2.getBounds());
  });
}

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

private void paintPageIndex() {
    pageNumber.setText(getPageIndexText());
    pageNumber.paintImmediately(0, 0, pageNumber.getWidth(), pageNumber.getHeight());
  }
}

代码示例来源:origin: com.fifesoft.rtext/fife.common

/**
 * Updates the percent complete bar and the associated status text.
 *
 * @param statusText The new status text to display.
 * @param percentComplete The new percentage to have filled in the percent
 *        complete bar.
 */
public void updateStatus(String statusText, int percentComplete) {
  progressBar.update(statusText, percentComplete);
  // Force a repaint since we (should be) on the EDT.
  // Note that repainting the imageLabel only seems necessary
  // on OS X (and possibly Linux); on Windows it is not needed.
  progressBar.paintImmediately(0,0,
        progressBar.getWidth(),progressBar.getHeight());
  imageLabel.paintImmediately(0,0,
        imageLabel.getWidth(), imageLabel.getHeight());
}

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

private void progress() {
  
  if (display()) {
    final ImageJ ij = IJ.getInstance();
    if (ij != null) { // To avoid exceptions in batch mode
      String s = status();
      final double min = min();
      final double max = max();
      final double p = min + percent*(max - min);
      if (s == null || p >= 1) s = "";
      IJ.showStatus(s);
      IJ.showProgress(p);
      if (enforce()) {
        final Panel sb = ij.getStatusBar();
        final JLabel sl = (JLabel)sb.getComponent(0);
        sl.setOpaque(true); // Transparent by default
        sl.paintImmediately(sl.getBounds());
        final ProgressBar pb = (ProgressBar)sb.getComponent(1);
        final Graphics pg = pb.getGraphics();
        if (pg != null) pb.paint(pg);
      }
    }
  }
}

相关文章

JLabel类方法