< prev index next >

src/demo/share/jfc/J2Ddemo/java2d/TextureChooser.java

Print this page


   1 /*
   2  *
   3  * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
   4  *
   5  * Redistribution and use in source and binary forms, with or without
   6  * modification, are permitted provided that the following conditions
   7  * are met:
   8  *
   9  *   - Redistributions of source code must retain the above copyright
  10  *     notice, this list of conditions and the following disclaimer.
  11  *
  12  *   - Redistributions in binary form must reproduce the above copyright
  13  *     notice, this list of conditions and the following disclaimer in the
  14  *     documentation and/or other materials provided with the distribution.
  15  *
  16  *   - Neither the name of Oracle nor the names of its
  17  *     contributors may be used to endorse or promote products derived
  18  *     from this software without specific prior written permission.
  19  *
  20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  21  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR


 207                 tc.num = num;
 208             }
 209         }
 210 
 211         @Override
 212         public Dimension getMinimumSize() {
 213             return getPreferredSize();
 214         }
 215 
 216         @Override
 217         public Dimension getMaximumSize() {
 218             return getPreferredSize();
 219         }
 220 
 221         @Override
 222         public Dimension getPreferredSize() {
 223             return new Dimension(30, 30);
 224         }
 225     }
 226 
 227     public static void main(String s[]) {
 228         Frame f = new Frame("J2D Demo - TextureChooser");
 229         f.addWindowListener(new WindowAdapter() {
 230 
 231             @Override
 232             public void windowClosing(WindowEvent e) {
 233                 System.exit(0);
 234             }
 235         });
 236         f.add("Center", new TextureChooser(0, new DemoInstVarsAccessorImplBase()));
 237         f.pack();
 238         f.setSize(new Dimension(400, 400));
 239         f.setVisible(true);
 240     }
 241 }
   1 /*
   2  *
   3  * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
   4  *
   5  * Redistribution and use in source and binary forms, with or without
   6  * modification, are permitted provided that the following conditions
   7  * are met:
   8  *
   9  *   - Redistributions of source code must retain the above copyright
  10  *     notice, this list of conditions and the following disclaimer.
  11  *
  12  *   - Redistributions in binary form must reproduce the above copyright
  13  *     notice, this list of conditions and the following disclaimer in the
  14  *     documentation and/or other materials provided with the distribution.
  15  *
  16  *   - Neither the name of Oracle nor the names of its
  17  *     contributors may be used to endorse or promote products derived
  18  *     from this software without specific prior written permission.
  19  *
  20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  21  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR


 207                 tc.num = num;
 208             }
 209         }
 210 
 211         @Override
 212         public Dimension getMinimumSize() {
 213             return getPreferredSize();
 214         }
 215 
 216         @Override
 217         public Dimension getMaximumSize() {
 218             return getPreferredSize();
 219         }
 220 
 221         @Override
 222         public Dimension getPreferredSize() {
 223             return new Dimension(30, 30);
 224         }
 225     }
 226 
 227     public static void main(String[] s) {
 228         Frame f = new Frame("J2D Demo - TextureChooser");
 229         f.addWindowListener(new WindowAdapter() {
 230 
 231             @Override
 232             public void windowClosing(WindowEvent e) {
 233                 System.exit(0);
 234             }
 235         });
 236         f.add("Center", new TextureChooser(0, new DemoInstVarsAccessorImplBase()));
 237         f.pack();
 238         f.setSize(new Dimension(400, 400));
 239         f.setVisible(true);
 240     }
 241 }
< prev index next >