< prev index next >

test/jdk/java/awt/image/multiresolution/MultiDisplayTest/MultiDisplayTest.java

Print this page
rev 51542 : 8210039: move OSInfo to top level testlibrary
Reviewed-by: duke


  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  */
  23 
  24 
  25 /*
  26   @test
  27   @bug 8142861 8143062 8147016
  28   @summary Check if multiresolution image behaves properly
  29            on HiDPI + non-HiDPI display pair.
  30   @author a.stepanov
  31   @library /lib/testlibrary
  32   @build jdk.testlibrary.OSInfo
  33   @run applet/manual=yesno MultiDisplayTest.html
  34 */
  35 
  36 
  37 import java.applet.Applet;
  38 import java.awt.*;
  39 import java.awt.event.*;
  40 import java.awt.image.*;
  41 import jdk.testlibrary.OSInfo;
  42 

  43 
  44 public class MultiDisplayTest extends Applet {
  45 
  46     private static final int W = 200, H = 200;
  47 
  48     private static final BaseMultiResolutionImage IMG =
  49         new BaseMultiResolutionImage(new BufferedImage[]{
  50         generateImage(1, Color.BLACK), generateImage(2, Color.BLUE)});
  51 
  52     private static boolean checkOS() {
  53         OSInfo.OSType os = OSInfo.getOSType();
  54         return (os.equals(OSInfo.OSType.WINDOWS) ||
  55             os.equals(OSInfo.OSType.MACOSX));
  56     }
  57 
  58     public void init() { this.setLayout(new BorderLayout()); }
  59 
  60     public void start() {
  61 
  62         Button b = new Button("Start");
  63         b.setEnabled(checkOS());
  64 
  65         b.addActionListener(new ActionListener() {
  66             @Override
  67             public void actionPerformed(ActionEvent e) {
  68 
  69                 ParentFrame p = new ParentFrame();
  70                 new ChildDialog(p);
  71             }
  72         });
  73 
  74         add(b, BorderLayout.CENTER);
  75 




  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  */
  23 
  24 
  25 /*
  26   @test
  27   @bug 8142861 8143062 8147016
  28   @summary Check if multiresolution image behaves properly
  29            on HiDPI + non-HiDPI display pair.
  30   @author a.stepanov
  31   @library /test/lib
  32   @build jdk.test.lib.Platform
  33   @run applet/manual=yesno MultiDisplayTest.html
  34 */
  35 
  36 
  37 import java.applet.Applet;
  38 import java.awt.*;
  39 import java.awt.event.*;
  40 import java.awt.image.*;

  41 
  42 import jdk.test.lib.Platform;
  43 
  44 public class MultiDisplayTest extends Applet {
  45 
  46     private static final int W = 200, H = 200;
  47 
  48     private static final BaseMultiResolutionImage IMG =
  49         new BaseMultiResolutionImage(new BufferedImage[]{
  50         generateImage(1, Color.BLACK), generateImage(2, Color.BLUE)});
  51 
  52     private static boolean checkOS() {
  53         return Platform.isWindows() || Platform.isOSX();


  54     }
  55 
  56     public void init() { this.setLayout(new BorderLayout()); }
  57 
  58     public void start() {
  59 
  60         Button b = new Button("Start");
  61         b.setEnabled(checkOS());
  62 
  63         b.addActionListener(new ActionListener() {
  64             @Override
  65             public void actionPerformed(ActionEvent e) {
  66 
  67                 ParentFrame p = new ParentFrame();
  68                 new ChildDialog(p);
  69             }
  70         });
  71 
  72         add(b, BorderLayout.CENTER);
  73 


< prev index next >