< prev index next >

src/demo/share/jfc/J2Ddemo/java2d/demos/Paint/TextureAnim.java

Print this page




 282                 curval = lowval + (lowval - curval);
 283                 if (curval > highval) {
 284                     curval = lowval;
 285                 }
 286                 currate = randval(lowrate, highrate);
 287             }
 288         }
 289 
 290         public void newlimits(int lowval, int highval) {
 291             this.lowval = lowval;
 292             this.highval = highval;
 293             clip();
 294         }
 295     }  // End AnimVal class
 296 
 297 
 298     final class DemoControls extends CustomControls implements ActionListener {
 299 
 300         TextureAnim demo;
 301         JToolBar toolbar;
 302         JComboBox combo;
 303         JMenu menu;
 304         JMenuItem[] menuitems;
 305         int iconSize = 20;
 306         ButtonBorder buttonBorder = new ButtonBorder();
 307 
 308         @SuppressWarnings("LeakingThisInConstructor")
 309         public DemoControls(TextureAnim demo) {
 310             super(demo.name);
 311             this.demo = demo;
 312             menuitems = new JMenuItem[3];
 313             add(toolbar = new JToolBar());
 314             toolbar.setFloatable(false);
 315             addTool("BO", "bounce", true);
 316             addTool("SA", "show anchor", true);
 317             addTool("RS", "resize", false);
 318             addTool("RO", "rotate", false);
 319             addTool("SX", "shear x", false);
 320             addTool("SY", "shear y", false);
 321             add(combo = new JComboBox());
 322             combo.addActionListener(this);
 323             combo.addItem("8");
 324             combo.addItem("16");
 325             combo.addItem("32");
 326             combo.addItem("64");
 327             combo.addItem("80");
 328             combo.setSelectedIndex(2);
 329 
 330             JMenuBar menuBar = new JMenuBar();
 331             menu = menuBar.add(new JMenu());
 332             for (int i = 0; i < 3; i++) {
 333                 BufferedImage bimg = demo.makeImage(iconSize, i);
 334                 TexturedIcon icon = new TexturedIcon(bimg);
 335                 menuitems[i] = menu.add(new JMenuItem(icon));
 336                 menuitems[i].addActionListener(this);
 337             }
 338             menu.setIcon(menuitems[0].getIcon());
 339             add(menuBar);
 340             demo.bNum = 0;
 341         }




 282                 curval = lowval + (lowval - curval);
 283                 if (curval > highval) {
 284                     curval = lowval;
 285                 }
 286                 currate = randval(lowrate, highrate);
 287             }
 288         }
 289 
 290         public void newlimits(int lowval, int highval) {
 291             this.lowval = lowval;
 292             this.highval = highval;
 293             clip();
 294         }
 295     }  // End AnimVal class
 296 
 297 
 298     final class DemoControls extends CustomControls implements ActionListener {
 299 
 300         TextureAnim demo;
 301         JToolBar toolbar;
 302         JComboBox<String> combo;
 303         JMenu menu;
 304         JMenuItem[] menuitems;
 305         int iconSize = 20;
 306         ButtonBorder buttonBorder = new ButtonBorder();
 307 
 308         @SuppressWarnings("LeakingThisInConstructor")
 309         public DemoControls(TextureAnim demo) {
 310             super(demo.name);
 311             this.demo = demo;
 312             menuitems = new JMenuItem[3];
 313             add(toolbar = new JToolBar());
 314             toolbar.setFloatable(false);
 315             addTool("BO", "bounce", true);
 316             addTool("SA", "show anchor", true);
 317             addTool("RS", "resize", false);
 318             addTool("RO", "rotate", false);
 319             addTool("SX", "shear x", false);
 320             addTool("SY", "shear y", false);
 321             add(combo = new JComboBox<>());
 322             combo.addActionListener(this);
 323             combo.addItem("8");
 324             combo.addItem("16");
 325             combo.addItem("32");
 326             combo.addItem("64");
 327             combo.addItem("80");
 328             combo.setSelectedIndex(2);
 329 
 330             JMenuBar menuBar = new JMenuBar();
 331             menu = menuBar.add(new JMenu());
 332             for (int i = 0; i < 3; i++) {
 333                 BufferedImage bimg = demo.makeImage(iconSize, i);
 334                 TexturedIcon icon = new TexturedIcon(bimg);
 335                 menuitems[i] = menu.add(new JMenuItem(icon));
 336                 menuitems[i].addActionListener(this);
 337             }
 338             menu.setIcon(menuitems[0].getIcon());
 339             add(menuBar);
 340             demo.bNum = 0;
 341         }


< prev index next >