JDK-8014369 : [macosx] Intermittently only some components refresh
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7,7u21,8
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • Submitted: 2013-05-10
  • Updated: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
JDK 8 build 88

ADDITIONAL OS VERSION INFORMATION :
MacOS 10.8.3

A DESCRIPTION OF THE PROBLEM :
This is intended to mimic in a small applet the component display problems illustrated at http://segal.org/java/refresh3/.  The basic problem is that intermittently some components don't refresh.

REGRESSION.  Last worked in version 6u45

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Example 1:
1.  Load the applet at http://segal.org/java/refresh4/, with full source code given below.
2.  Click the Refresh button in the applet several times.

Example 2:
1.  Load the applet at http://segal.org/java/refresh5/, with full source code given below.
2.  Click the  " Change panel once "  button in the applet several times.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
All components should update in all refreshes in both examples.
ACTUAL -
In each of the two examples, intermittently some components don't update, similar to the behavior seen in a large applet as shown at http://www/segal.org/refresh3/.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
None.

It should be noted that Example 2 was subject of a previous sun bug report, determined years ago to be attributable to the following bugs in Java for Windows fixed long ago:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5065001
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6229122

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Source code for Example 1:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class CanvasTable3 extends Applet implements ActionListener {

Button b;
Panel labelPanel;
int labels;
int count;
Font f;

public void init()
{
f = new Font( " SansSerif " , Font.BOLD, 15);
b = new Button( " Refresh " );
add(b);
b.addActionListener(this);
labels = 200;
labelPanel = new Panel();
labelPanel.setLayout(new GridLayout(labels/20, 20, 4, 4));
labelPanel.setBackground(Color.green);
addElements();
add(labelPanel);
}

final void addElements()
{
LabelCanvas[] myLabel = new LabelCanvas[labels];
Color color = ((count%2 == 0)? Color.orange : Color.yellow);
count++;
for (int i=0; i<labels; i++)
{
myLabel[i] = new LabelCanvas(String.valueOf(i), f);
myLabel[i].setBackground(color);
labelPanel.add(myLabel[i]);
}
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == b)
{
labelPanel.removeAll();
addElements();
validate();
}
}
}  // END OF Class CanvasTable3



class LabelCanvas extends Canvas  {

Font f;
String label;

LabelCanvas(String label, Font f)
{
this.label = label;
this.f = f;
}

public final void paint(Graphics g)
{
g.setFont(f);
g.drawString(label, 0, 25);
}

public final Dimension getMinimumSize()
{
return (new Dimension(30, 30));
}

public final Dimension getPreferredSize()
{
return(getMinimumSize());
}
}  // END OF Class LabelCanvas



Source code for Example 2:

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class StressNotify extends Applet implements ActionListener {

Button onceButton, manyButton;
LabelPanel labelPanelGreen, labelPanelRed;
int panelShowing = -1;
static final int RED = 0;
static final int GREEN = 1;
Panel panel;

public void init()
{
onceButton = new Button( " Change panel once " );
add(onceButton);
onceButton.addActionListener(this);
manyButton = new Button( " Change panel many times " );
add(manyButton);
manyButton.addActionListener(this);
panel = new Panel();
add(panel);
addLabelPanel(GREEN);
}

void addLabelPanel(int panelToAdd)
{
panel.removeAll();
if (panelToAdd == GREEN)
{
labelPanelGreen = new LabelPanel(Color.green);
panel.add(labelPanelGreen);
}
else if (panelToAdd == RED)
{
labelPanelRed = new LabelPanel(Color.red);
panel.add(labelPanelRed);
}
panelShowing = panelToAdd;
}

public void actionPerformed(ActionEvent ae)
{
if (ae.getSource() == onceButton)
{
addLabelPanel(1 - panelShowing);
validate();
}
else if (ae.getSource() == manyButton)
{
for (int i=0; i<101; i++)
{
addLabelPanel(1 - panelShowing);
validate();
}
}
}
}  // END OF Class StressNotify


class LabelPanel extends Panel {

int labels = 200;

LabelPanel(Color color)
{
setLayout(new GridLayout(labels/20, 20, 4, 4));
setBackground(color);
Label[] myLabel = new Label[labels];
for (int i=0; i<labels; i++)
{
myLabel[i] = new Label(String.valueOf(i));
myLabel[i].setBackground(color);
add(myLabel[i]);
}
}
}  //  END OF Class LabelPanel
---------- END SOURCE ----------
Comments
We've reviewed your bulk request (120 bugs) and are OK with deferring them to JDK 9. You can go ahead and update these to: - Set label to 8-defer-approved - FixVersion to 9 Thanks for doing a great job of summarizing the details for the bulk deferral for us! Kind regards, Mathias
19-09-2013

jdk8: SQE OK to defer
19-09-2013

Andrei, Yuri, since it is not easy to fix , please consider to defer
19-09-2013

No, this is a problem in the system implementation. We can inmplement workaround somehow, but currently i do not know how.
19-09-2013

Sergey, is it easy to fix?
19-09-2013

It is easy to fix, isn't it?
19-09-2013

Part of the issue is in the CAlayer implementation. The reason is simple: setNeedsDisplay is not followed by the drawInGLContext.
28-05-2013