< prev index next >

test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java

Print this page
rev 59383 : [mq]: final
   1 /*
   2  * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  98     /**
  99      * Implementation of PropertyChangeListener method
 100      */
 101     public void propertyChange(PropertyChangeEvent event) {
 102         changedProperty = event.getPropertyName();
 103         changedValue = toolkit.getDesktopProperty(changedProperty);
 104         System.out.println("Property "+changedProperty+" changed. Changed value: "+changedValue);
 105         synchronized(lock) {
 106             try {
 107                 lock.notifyAll();
 108             } catch (Exception e) {
 109             }
 110         }
 111     }
 112 
 113     public static void main(String[] args) throws Exception {
 114         useGsettings = System.getProperty("useGsettings").equals("true");
 115         tool = System.getProperty("tool");
 116 
 117         String osName = System.getProperty("os.name");
 118         if (!"Linux".equals(osName) && !"SunOS".equals(osName))
 119             System.out.println("This test need not be run on this platform");
 120         else
 121             new rfe4758438().doTest();
 122     }
 123 
 124     void doTest() throws Exception {
 125         for (PROPS p : PROPS.values())
 126             toolkit.addPropertyChangeListener(p.java, this);
 127 
 128         for (PROPS p : PROPS.values()) {
 129             Thread.sleep(1000);
 130             doTest(p);
 131         }
 132         System.out.println("Test passed");
 133     }
 134 
 135     /**
 136      * Do the test for each property. Find the current value
 137      * of the property, set the property to a value not equal
 138      * to the current value, check if the propertyChange event


   1 /*
   2  * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  98     /**
  99      * Implementation of PropertyChangeListener method
 100      */
 101     public void propertyChange(PropertyChangeEvent event) {
 102         changedProperty = event.getPropertyName();
 103         changedValue = toolkit.getDesktopProperty(changedProperty);
 104         System.out.println("Property "+changedProperty+" changed. Changed value: "+changedValue);
 105         synchronized(lock) {
 106             try {
 107                 lock.notifyAll();
 108             } catch (Exception e) {
 109             }
 110         }
 111     }
 112 
 113     public static void main(String[] args) throws Exception {
 114         useGsettings = System.getProperty("useGsettings").equals("true");
 115         tool = System.getProperty("tool");
 116 
 117         String osName = System.getProperty("os.name");
 118         if (!"Linux".equals(osName))
 119             System.out.println("This test need not be run on this platform");
 120         else
 121             new rfe4758438().doTest();
 122     }
 123 
 124     void doTest() throws Exception {
 125         for (PROPS p : PROPS.values())
 126             toolkit.addPropertyChangeListener(p.java, this);
 127 
 128         for (PROPS p : PROPS.values()) {
 129             Thread.sleep(1000);
 130             doTest(p);
 131         }
 132         System.out.println("Test passed");
 133     }
 134 
 135     /**
 136      * Do the test for each property. Find the current value
 137      * of the property, set the property to a value not equal
 138      * to the current value, check if the propertyChange event


< prev index next >