<Swing Dev> JDK-8178091 : Bug I will workin on

Patrick Chen chen.j.patrick at gmail.com
Tue Apr 11 16:51:40 UTC 2017


Hi ,
yes ;
with theses options it works !
but what that means ?

so it not a bug ?

2017-04-11 18:46 GMT+02:00 Sergey Bylokhov <sergey.bylokhov at oracle.com>:

> Hi, Patrick.
> Can you please run the code using these options:
> -Dsun.java2d.xrender=true
> -Dsun.java2d.xrender=false
> -Dsun.java2d.opengl=true
> -Dsun.java2d.opengl=false
>
>
>
> After tests it seems that the problem doesn't come from Timer , but
> the repaint() method ,
>
>
> even with this code the bug is here.
> the bug is on Linux.
>
> 2017-04-11 11:07 GMT+02:00 Walter Laan <WLaan at costengineering.eu>:
>
>> Note that the example code in JDK-8178091 sleeps on the EDT, so you’re
>> lucky it paints at all instead of hanging the UI.
>>
>>
>>
>> It looks like you adapted the code from http://codereview.stackexchang
>> e.com/questions/29630/simple-java-animation-with-swing where no-one
>> experienced with Swing pointed out this error L.
>>
>>
>>
>> Using a javax.swing.Timer (not the java.util.Timer!) and it runs okay
>> (using Win10, Java 8u101):
>>
>>
>>
>>     *private* *void* go() {
>>
>>
>>
>>         *new* Timer(10, *new* ActionListener() {
>>
>>             // *Les* *coordonnées* *de* *départ* *de* *notre* *rond*
>>
>>             *private* *int* x = pan.getPosX(), y = pan.getPosY();
>>
>>             // *Le* *booléen* pour *savoir* *si* l'on *recule* *ou* non
>> *sur* l'axe x
>>
>>             *private* *boolean* backX = *false*;
>>
>>             // *Le* *booléen* pour *savoir* *si* l'on *recule* *ou* non
>> *sur* l'axe y
>>
>>             *private* *boolean* backY = *false*;
>>
>>
>>
>>             @Override
>>
>>             *public* *void* actionPerformed(ActionEvent e) {
>>
>>                 // *Si* *la* *coordonnée* x est *inférieure* à 1, on
>> *avance*
>>
>>                 *if*(x < 1) {
>>
>>                     backX = *false*;
>>
>>                 }
>>
>>                 // *Si* *la* *coordonnée* x est *supérieure* à *la*
>> *taille* *du* *Panneau* *moins* *la* *taille* *du* *rond*, on *recule*
>>
>>                 *if*(x > pan.getWidth() - 50) {
>>
>>                     backX = *true*;
>>
>>                 }
>>
>>                 // *Idem* pour l'axe y
>>
>>                 *if*(y < 1) {
>>
>>                     backY = *false*;
>>
>>                 }
>>
>>                 *if*(y > pan.getHeight() - 50) {
>>
>>                     backY = *true*;
>>
>>                 }
>>
>>
>>
>>                 // *Si* on *avance*, on *incrémente* *la* *coordonnée*
>>
>>                 // backX est *un* *booléen*, *donc* !backX *revient* à
>> *écrire*
>>
>>                 // if (backX == false)
>>
>>                 *if*(!backX) {
>>
>>                     pan.setPosX(++x);
>>
>>                 // *Sinon*, on *décrémente*
>>
>>                 }
>>
>>                 *else* {
>>
>>                     pan.setPosX(--x);
>>
>>                 }
>>
>>                 // *Idem* pour l'axe Y
>>
>>                 *if*(!backY) {
>>
>>                     pan.setPosY(++y);
>>
>>                 }
>>
>>                 *else* {
>>
>>                     pan.setPosY(--y);
>>
>>                 }
>>
>>
>>
>>                 // On *redessine* *notre* *Panneau*
>>
>>                 pan.repaint();
>>
>>             }
>>
>>         }).start();
>>
>>     }
>>
>>
>>
>> Hope that helps,
>>
>> Walter.
>>
>>
>>
>> *From:* swing-dev [mailto:swing-dev-bounces at openjdk.java.net] *On Behalf
>> Of *Patrick Chen
>> *Sent:* maandag 10 april 2017 12:23
>> *To:* swing-dev at openjdk.java.net
>> *Subject:* Re: <Swing Dev> JDK-8178091 : Bug I will workin on
>>
>>
>>
>> (edit : for example this game coded in java :
>> https://github.com/cloudStrif/GoldenSunD will work with java 7
>>
>> but clearly not with java8 (linux 64 bits) because of lags)
>>
>>
>>
>> 2017-04-10 12:19 GMT+02:00 Patrick Chen <chen.j.patrick at gmail.com>:
>>
>> Hi every one ,
>>
>> just wanted to inform that I am working to fix this bug.
>>
>>
>>
>> it is when we devellop animations thanks to repaint() method ,
>>
>> for java 7 it works well
>>
>> but with java8 not ,
>>
>> (linux 64 bits it doesn't really work )
>>
>>
>>
>> so after watching the source code it seem that it is not a swing problem
>>
>> but AWT : Component.java .
>>
>>
>>
>> thank you
>>
>>
>>
>>
>>
>>
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20170411/b56932ca/attachment.html>


More information about the swing-dev mailing list