1 /*
2 *
3 * Copyright (c) 2007, 2010, 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
47
48 /**
49 * BezierAnimationPanel
50 *
51 * @author Jim Graham
52 * @author Jeff Dinkins (removed dynamic setting changes, made swing friendly)
53 */
54 class BezierAnimationPanel extends JPanel implements Runnable {
55
56 Color backgroundColor = new Color(0, 0, 153);
57 Color outerColor = new Color(255, 255, 255);
58 Color gradientColorA = new Color(255, 0, 101);
59 Color gradientColorB = new Color(255, 255, 0);
60
61 boolean bgChanged = false;
62
63 GradientPaint gradient = null;
64
65 public final int NUMPTS = 6;
66
67 float animpts[] = new float[NUMPTS * 2];
68
69 float deltas[] = new float[NUMPTS * 2];
70
71 float staticpts[] = {
72 50.0f, 0.0f,
73 150.0f, 0.0f,
74 200.0f, 75.0f,
75 150.0f, 150.0f,
76 50.0f, 150.0f,
77 0.0f, 75.0f,
78 };
79
80 float movepts[] = new float[staticpts.length];
81
82 BufferedImage img;
83
84 Rectangle bounds = null;
85
86 Thread anim;
87
88 private final Object lock = new Object();
89
90 /**
91 * BezierAnimationPanel Constructor
92 */
93 public BezierAnimationPanel() {
94 addHierarchyListener(
95 new HierarchyListener() {
96 public void hierarchyChanged(HierarchyEvent e) {
97 if(isShowing()) {
98 start();
99 } else {
100 stop();
|
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
47
48 /**
49 * BezierAnimationPanel
50 *
51 * @author Jim Graham
52 * @author Jeff Dinkins (removed dynamic setting changes, made swing friendly)
53 */
54 class BezierAnimationPanel extends JPanel implements Runnable {
55
56 Color backgroundColor = new Color(0, 0, 153);
57 Color outerColor = new Color(255, 255, 255);
58 Color gradientColorA = new Color(255, 0, 101);
59 Color gradientColorB = new Color(255, 255, 0);
60
61 boolean bgChanged = false;
62
63 GradientPaint gradient = null;
64
65 public final int NUMPTS = 6;
66
67 float[] animpts = new float[NUMPTS * 2];
68
69 float[] deltas = new float[NUMPTS * 2];
70
71 float[] staticpts = {
72 50.0f, 0.0f,
73 150.0f, 0.0f,
74 200.0f, 75.0f,
75 150.0f, 150.0f,
76 50.0f, 150.0f,
77 0.0f, 75.0f,
78 };
79
80 float[] movepts = new float[staticpts.length];
81
82 BufferedImage img;
83
84 Rectangle bounds = null;
85
86 Thread anim;
87
88 private final Object lock = new Object();
89
90 /**
91 * BezierAnimationPanel Constructor
92 */
93 public BezierAnimationPanel() {
94 addHierarchyListener(
95 new HierarchyListener() {
96 public void hierarchyChanged(HierarchyEvent e) {
97 if(isShowing()) {
98 start();
99 } else {
100 stop();
|