<Swing Dev> How to search for a JRE 7 Mac Bug?
Jeff Martin
jeff at reportmill.com
Thu Aug 23 23:45:15 UTC 2012
Thanks! I filed the bug but it isn't available quite yet: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7193703
My situation is probably unique because my JProgressBar sometimes doesn't get shown onscreen. I found a work around though, which is to call updateUI() on it after setIndeterminate(true) - this stops the timer plus InvocationEvents. I've attached my sample code below.
jeff
On Aug 23, 2012, at 5:11 PM, Sergey Bylokhov wrote:
> Hi, Jeff.
> You can try to use:
> http://bugs.sun.com/bugdatabase/
>
> Probably some related issues:
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7168926
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7124525
>
> 24.08.2012 00:55, Jeff Martin wrote:
>> How do I search for known JRE 7 Swing bugs (or file one)?
>>
>> I find that in JRE7 for Mac, if you have a JProgressBar set to Indeterminate that is hanging around off screen, it sends constant timer events.
>>
>> jeff
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.SwingUtilities;
/**
* A class to show JProgressBar bug on Mac OS.
*/
public class ProgressBarBug extends EventQueue {
static JProgressBar _pb = new JProgressBar();
public static void main(final String args[])
{
if(!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(new Runnable() { public void run() { main(args); }}); return; }
// Create a ProgressBar offscreen, setIndeterminate (turn it off) and hold on to ProgressBar
_pb = new JProgressBar(); _pb.setIndeterminate(true); // This starts timer, even though offscreen or turned off
_pb.setIndeterminate(false); //_pb.updateUI(); <- This stops the timer
// Register EventQueue to print non-stop timer InvocationEvents
try { Toolkit.getDefaultToolkit().getSystemEventQueue().push(new ProgressBarBug()); }
catch(Exception e) { throw new RuntimeException(e); }
// Create and show window to keep app around
new JFrame("Test Frame").setVisible(true);
}
// This method shows all the non-stop timer InvocationEvents
public void dispatchEvent(AWTEvent anEvent)
{
if(anEvent instanceof InvocationEvent) System.out.println(anEvent);
super.dispatchEvent(anEvent);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20120823/bf4437e9/attachment.html>
More information about the swing-dev
mailing list