001: /*
002: * $Header: /cvs/j3dfly/J3dEditor/src/org/jdesktop/j3dedit/locationeditor/InterpolatorControlPanel.java,v 1.1 2005/04/20 22:20:34 paulby Exp $
003: *
004: * Sun Public License Notice
005: *
006: * The contents of this file are subject to the Sun Public License Version
007: * 1.0 (the "License"). You may not use this file except in compliance with
008: * the License. A copy of the License is available at http://www.sun.com/
009: *
010: * The Original Code is the Java 3D(tm) Scene Graph Editor.
011: * The Initial Developer of the Original Code is Paul Byrne.
012: * Portions created by Paul Byrne are Copyright (C) 2002.
013: * All Rights Reserved.
014: *
015: * Contributor(s): Paul Byrne.
016: *
017: **/
018: package org.jdesktop.j3dedit.locationeditor;
019:
020: import javax.media.j3d.Interpolator;
021:
022: /**
023: *
024: * @author paulby
025: */
026: public class InterpolatorControlPanel extends javax.swing.JPanel {
027:
028: private Interpolator interp;
029:
030: /** Creates new form AlphaControlPanel */
031: public InterpolatorControlPanel() {
032: initComponents();
033: setContainerEnabled(this , false);
034: }
035:
036: public void setInterpolator(Interpolator interp) {
037: this .interp = interp;
038: setContainerEnabled(this , (interp == null) ? false : true);
039: }
040:
041: /**
042: * Set the enable flag for this container and all it's components
043: * recursively
044: */
045: private void setContainerEnabled(java.awt.Container c,
046: boolean enabled) {
047: java.awt.Component[] comp = c.getComponents();
048: for (int i = 0; i < comp.length; i++) {
049: comp[i].setEnabled(enabled);
050: if (comp[i] instanceof java.awt.Container)
051: setContainerEnabled((java.awt.Container) comp[i],
052: enabled);
053: }
054:
055: }
056:
057: /** This method is called from within the constructor to
058: * initialize the form.
059: * WARNING: Do NOT modify this code. The content of this method is
060: * always regenerated by the Form Editor.
061: */
062: private void initComponents() {//GEN-BEGIN:initComponents
063: java.awt.GridBagConstraints gridBagConstraints;
064:
065: alphaS = new javax.swing.JSlider();
066: timeP = new javax.swing.JPanel();
067: startTimeL = new javax.swing.JLabel();
068: endTimeL = new javax.swing.JLabel();
069: startTimeTF = new javax.swing.JTextField();
070: endTimeTF = new javax.swing.JTextField();
071: buttonP = new javax.swing.JPanel();
072: firstFrameB = new javax.swing.JButton();
073: previousFrameB = new javax.swing.JButton();
074: nextFrameB = new javax.swing.JButton();
075: lastFrameB = new javax.swing.JButton();
076: previousKnotB = new javax.swing.JButton();
077: nextKnotB = new javax.swing.JButton();
078: pauseB = new javax.swing.JButton();
079: playB = new javax.swing.JButton();
080: createKnotB = new javax.swing.JButton();
081: deleteKnotB = new javax.swing.JButton();
082: currentTimeTF = new javax.swing.JTextField();
083:
084: setLayout(new java.awt.GridBagLayout());
085:
086: setMinimumSize(new java.awt.Dimension(1200, 100));
087: setPreferredSize(new java.awt.Dimension(1200, 100));
088: alphaS.setMaximum(1200);
089: alphaS.setPaintLabels(true);
090: alphaS.setValue(600);
091: alphaS.setMinimumSize(new java.awt.Dimension(1000, 16));
092: alphaS.setPreferredSize(new java.awt.Dimension(1000, 16));
093: alphaS
094: .addChangeListener(new javax.swing.event.ChangeListener() {
095: public void stateChanged(
096: javax.swing.event.ChangeEvent evt) {
097: alphaSStateChanged(evt);
098: }
099: });
100:
101: gridBagConstraints = new java.awt.GridBagConstraints();
102: gridBagConstraints.gridx = 1;
103: gridBagConstraints.gridy = 0;
104: gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
105: gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
106: add(alphaS, gridBagConstraints);
107:
108: timeP.setLayout(new java.awt.GridBagLayout());
109:
110: startTimeL.setText("Start Time :");
111: gridBagConstraints = new java.awt.GridBagConstraints();
112: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
113: gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
114: timeP.add(startTimeL, gridBagConstraints);
115:
116: endTimeL.setText("End Time :");
117: gridBagConstraints = new java.awt.GridBagConstraints();
118: gridBagConstraints.gridx = 0;
119: gridBagConstraints.gridy = 1;
120: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
121: gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 4);
122: timeP.add(endTimeL, gridBagConstraints);
123:
124: startTimeTF.setText("0");
125: startTimeTF.setMinimumSize(new java.awt.Dimension(50, 21));
126: startTimeTF.setPreferredSize(new java.awt.Dimension(50, 21));
127: timeP.add(startTimeTF, new java.awt.GridBagConstraints());
128:
129: endTimeTF.setText("5000");
130: endTimeTF.setMinimumSize(new java.awt.Dimension(50, 21));
131: endTimeTF.setPreferredSize(new java.awt.Dimension(50, 21));
132: gridBagConstraints = new java.awt.GridBagConstraints();
133: gridBagConstraints.gridx = 1;
134: gridBagConstraints.gridy = 1;
135: timeP.add(endTimeTF, gridBagConstraints);
136:
137: gridBagConstraints = new java.awt.GridBagConstraints();
138: gridBagConstraints.gridx = 2;
139: gridBagConstraints.gridy = 1;
140: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
141: add(timeP, gridBagConstraints);
142:
143: buttonP.setLayout(new java.awt.GridBagLayout());
144:
145: firstFrameB
146: .setIcon(new javax.swing.ImageIcon(
147: getClass()
148: .getResource(
149: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/firstframe.gif")));
150: firstFrameB.setToolTipText("First Frame");
151: firstFrameB.setMargin(new java.awt.Insets(2, 2, 2, 2));
152: firstFrameB
153: .addActionListener(new java.awt.event.ActionListener() {
154: public void actionPerformed(
155: java.awt.event.ActionEvent evt) {
156: firstFrameBActionPerformed(evt);
157: }
158: });
159:
160: buttonP.add(firstFrameB, new java.awt.GridBagConstraints());
161:
162: previousFrameB
163: .setIcon(new javax.swing.ImageIcon(
164: getClass()
165: .getResource(
166: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/previousframe.gif")));
167: previousFrameB.setToolTipText("Previous Frame");
168: previousFrameB.setMargin(new java.awt.Insets(2, 2, 2, 2));
169: previousFrameB
170: .addActionListener(new java.awt.event.ActionListener() {
171: public void actionPerformed(
172: java.awt.event.ActionEvent evt) {
173: previousFrameBActionPerformed(evt);
174: }
175: });
176:
177: gridBagConstraints = new java.awt.GridBagConstraints();
178: gridBagConstraints.gridx = 2;
179: gridBagConstraints.gridy = 0;
180: buttonP.add(previousFrameB, gridBagConstraints);
181:
182: nextFrameB
183: .setIcon(new javax.swing.ImageIcon(
184: getClass()
185: .getResource(
186: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/nextframe.gif")));
187: nextFrameB.setToolTipText("Next Frame");
188: nextFrameB.setMargin(new java.awt.Insets(2, 2, 2, 2));
189: nextFrameB
190: .addActionListener(new java.awt.event.ActionListener() {
191: public void actionPerformed(
192: java.awt.event.ActionEvent evt) {
193: nextFrameBActionPerformed(evt);
194: }
195: });
196:
197: gridBagConstraints = new java.awt.GridBagConstraints();
198: gridBagConstraints.gridx = 3;
199: gridBagConstraints.gridy = 0;
200: buttonP.add(nextFrameB, gridBagConstraints);
201:
202: lastFrameB
203: .setIcon(new javax.swing.ImageIcon(
204: getClass()
205: .getResource(
206: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/lastframe.gif")));
207: lastFrameB.setToolTipText("Last Frame");
208: lastFrameB.setMargin(new java.awt.Insets(2, 2, 2, 2));
209: lastFrameB
210: .addActionListener(new java.awt.event.ActionListener() {
211: public void actionPerformed(
212: java.awt.event.ActionEvent evt) {
213: lastFrameBActionPerformed(evt);
214: }
215: });
216:
217: gridBagConstraints = new java.awt.GridBagConstraints();
218: gridBagConstraints.gridx = 5;
219: gridBagConstraints.gridy = 0;
220: buttonP.add(lastFrameB, gridBagConstraints);
221:
222: previousKnotB
223: .setIcon(new javax.swing.ImageIcon(
224: getClass()
225: .getResource(
226: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/previouskey.gif")));
227: previousKnotB.setToolTipText("Previous Knot");
228: previousKnotB.setMargin(new java.awt.Insets(2, 2, 2, 2));
229: previousKnotB
230: .addActionListener(new java.awt.event.ActionListener() {
231: public void actionPerformed(
232: java.awt.event.ActionEvent evt) {
233: previousKnotBActionPerformed(evt);
234: }
235: });
236:
237: gridBagConstraints = new java.awt.GridBagConstraints();
238: gridBagConstraints.gridx = 1;
239: gridBagConstraints.gridy = 0;
240: buttonP.add(previousKnotB, gridBagConstraints);
241:
242: nextKnotB
243: .setIcon(new javax.swing.ImageIcon(
244: getClass()
245: .getResource(
246: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/nextkey.gif")));
247: nextKnotB.setToolTipText("Next Knot");
248: nextKnotB.setMargin(new java.awt.Insets(2, 2, 2, 2));
249: nextKnotB
250: .addActionListener(new java.awt.event.ActionListener() {
251: public void actionPerformed(
252: java.awt.event.ActionEvent evt) {
253: nextKnotBActionPerformed(evt);
254: }
255: });
256:
257: gridBagConstraints = new java.awt.GridBagConstraints();
258: gridBagConstraints.gridx = 4;
259: gridBagConstraints.gridy = 0;
260: buttonP.add(nextKnotB, gridBagConstraints);
261:
262: pauseB
263: .setIcon(new javax.swing.ImageIcon(
264: getClass()
265: .getResource(
266: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/pause2.gif")));
267: pauseB.setToolTipText("Pause");
268: pauseB.setMargin(new java.awt.Insets(2, 2, 2, 2));
269: pauseB.addActionListener(new java.awt.event.ActionListener() {
270: public void actionPerformed(java.awt.event.ActionEvent evt) {
271: pauseBActionPerformed(evt);
272: }
273: });
274:
275: gridBagConstraints = new java.awt.GridBagConstraints();
276: gridBagConstraints.gridx = 6;
277: gridBagConstraints.gridy = 0;
278: gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 0);
279: buttonP.add(pauseB, gridBagConstraints);
280:
281: playB
282: .setIcon(new javax.swing.ImageIcon(
283: getClass()
284: .getResource(
285: "/com/sun/j3d/demos/j3dedit/locationeditor/resources/play.gif")));
286: playB.setToolTipText("Play");
287: playB.setMargin(new java.awt.Insets(2, 2, 2, 2));
288: playB.addActionListener(new java.awt.event.ActionListener() {
289: public void actionPerformed(java.awt.event.ActionEvent evt) {
290: playBActionPerformed(evt);
291: }
292: });
293:
294: gridBagConstraints = new java.awt.GridBagConstraints();
295: gridBagConstraints.gridx = 7;
296: gridBagConstraints.gridy = 0;
297: buttonP.add(playB, gridBagConstraints);
298:
299: createKnotB.setFont(new java.awt.Font("Dialog", 0, 10));
300: createKnotB.setText("Create Knot");
301: gridBagConstraints = new java.awt.GridBagConstraints();
302: gridBagConstraints.gridx = 1;
303: gridBagConstraints.gridy = 1;
304: gridBagConstraints.gridwidth = 2;
305: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
306: buttonP.add(createKnotB, gridBagConstraints);
307:
308: deleteKnotB.setFont(new java.awt.Font("Dialog", 0, 10));
309: deleteKnotB.setText("Delete Knot");
310: gridBagConstraints = new java.awt.GridBagConstraints();
311: gridBagConstraints.gridx = 3;
312: gridBagConstraints.gridy = 1;
313: gridBagConstraints.gridwidth = 2;
314: gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
315: buttonP.add(deleteKnotB, gridBagConstraints);
316:
317: gridBagConstraints = new java.awt.GridBagConstraints();
318: gridBagConstraints.gridx = 1;
319: gridBagConstraints.gridy = 1;
320: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
321: add(buttonP, gridBagConstraints);
322:
323: currentTimeTF.setText("0");
324: currentTimeTF.setMinimumSize(new java.awt.Dimension(50, 21));
325: currentTimeTF.setPreferredSize(new java.awt.Dimension(50, 21));
326: gridBagConstraints = new java.awt.GridBagConstraints();
327: gridBagConstraints.gridx = 0;
328: gridBagConstraints.gridy = 0;
329: add(currentTimeTF, gridBagConstraints);
330:
331: }//GEN-END:initComponents
332:
333: private void playBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_playBActionPerformed
334: // Add your handling code here:
335: }//GEN-LAST:event_playBActionPerformed
336:
337: private void pauseBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pauseBActionPerformed
338: // Add your handling code here:
339: }//GEN-LAST:event_pauseBActionPerformed
340:
341: private void lastFrameBActionPerformed(
342: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lastFrameBActionPerformed
343: // Add your handling code here:
344: }//GEN-LAST:event_lastFrameBActionPerformed
345:
346: private void nextKnotBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextKnotBActionPerformed
347: // Add your handling code here:
348: }//GEN-LAST:event_nextKnotBActionPerformed
349:
350: private void nextFrameBActionPerformed(
351: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextFrameBActionPerformed
352: // Add your handling code here:
353: }//GEN-LAST:event_nextFrameBActionPerformed
354:
355: private void previousFrameBActionPerformed(
356: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previousFrameBActionPerformed
357: // Add your handling code here:
358: }//GEN-LAST:event_previousFrameBActionPerformed
359:
360: private void previousKnotBActionPerformed(
361: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_previousKnotBActionPerformed
362: // Add your handling code here:
363: }//GEN-LAST:event_previousKnotBActionPerformed
364:
365: private void firstFrameBActionPerformed(
366: java.awt.event.ActionEvent evt) {//GEN-FIRST:event_firstFrameBActionPerformed
367: // Add your handling code here:
368: }//GEN-LAST:event_firstFrameBActionPerformed
369:
370: private void alphaSStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_alphaSStateChanged
371: // Add your handling code here:
372: long startTime = 0;
373: long endTime = 5000;
374: double alpha = ((double) alphaS.getValue())
375: / alphaS.getMaximum();
376: System.out.println(alpha);
377: }//GEN-LAST:event_alphaSStateChanged
378:
379: // Variables declaration - do not modify//GEN-BEGIN:variables
380: private javax.swing.JTextField endTimeTF;
381: private javax.swing.JSlider alphaS;
382: private javax.swing.JButton lastFrameB;
383: private javax.swing.JPanel timeP;
384: private javax.swing.JButton createKnotB;
385: private javax.swing.JPanel buttonP;
386: private javax.swing.JLabel startTimeL;
387: private javax.swing.JTextField currentTimeTF;
388: private javax.swing.JButton deleteKnotB;
389: private javax.swing.JButton playB;
390: private javax.swing.JButton pauseB;
391: private javax.swing.JButton previousFrameB;
392: private javax.swing.JButton nextFrameB;
393: private javax.swing.JButton nextKnotB;
394: private javax.swing.JButton firstFrameB;
395: private javax.swing.JLabel endTimeL;
396: private javax.swing.JButton previousKnotB;
397: private javax.swing.JTextField startTimeTF;
398: // End of variables declaration//GEN-END:variables
399:
400: }
|