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(); } } }
/** * 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()); }
private void setText(final JLabel label, final String text){ label.setText(text); label.paintImmediately(label.getVisibleRect()); }
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 } } }
public void setMessage3(final String message) { UIUtilities.invokeOnEventThread(() -> { messageBox3.setText(message); messageBox3.paintImmediately(messageBox2.getBounds()); }); }
public void setMessage2(final String message) { UIUtilities.invokeOnEventThread(() -> { messageBox2.setText(message); messageBox2.paintImmediately(messageBox2.getBounds()); }); }
private void paintPageIndex() { pageNumber.setText(getPageIndexText()); pageNumber.paintImmediately(0, 0, pageNumber.getWidth(), pageNumber.getHeight()); } }
/** * 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()); }
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); } } } }