arcgissamples\globe\AnimationPanel.java
/* Copyright 2010 ESRI * * All rights reserved under the copyright laws of the United States * and applicable international laws, treaties, and conventions. * * You may freely redistribute and use this sample code, with or * without modification, provided you include the original copyright * notice and use restrictions. * * See the use restrictions. * */ package arcgissamples.globe; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.JTextField; import javax.swing.border.TitledBorder; public class AnimationPanel extends JPanel { public AnimationPanel() { super(); initialize(); } private void initialize() { GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 0; gridBagConstraints3.weightx = 1.0D; gridBagConstraints3.weighty = 1.0D; gridBagConstraints3.insets = new Insets(5, 0, 5, 0); gridBagConstraints3.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints3.gridy = 3; GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.gridx = 0; gridBagConstraints2.fill = GridBagConstraints.BOTH; gridBagConstraints2.weightx = 1.0D; gridBagConstraints2.weighty = 0.0D; gridBagConstraints2.insets = new Insets(5, 0, 0, 0); gridBagConstraints2.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints2.gridy = 2; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.gridx = 0; gridBagConstraints1.fill = GridBagConstraints.BOTH; gridBagConstraints1.weightx = 1.0D; gridBagConstraints1.weighty = 0.0D; gridBagConstraints1.insets = new Insets(5, 0, 0, 0); gridBagConstraints1.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints1.gridy = 1; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0D; gridBagConstraints.weighty = 0.0D; gridBagConstraints.insets = new Insets(0, 0, 0, 0); gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints.gridy = 0; // this.setSize(339, 377); this.setLayout(new GridBagLayout()); this.setPreferredSize(new Dimension(250, 500)); this.setSize(new Dimension(350, 500)); this.add(getJPanel(), gridBagConstraints); this.add(getJPanel1(), gridBagConstraints1); this.add(getJPanel2(), gridBagConstraints2); this.add(getJPanel3(), gridBagConstraints3); } private JPanel getJPanel() { if (jPanel == null) { try { GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.anchor = GridBagConstraints.WEST; GridBagConstraints gridBagConstraints9 = new GridBagConstraints(); gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints9.gridy = 2; gridBagConstraints9.weightx = 0.0D; gridBagConstraints9.anchor = GridBagConstraints.WEST; gridBagConstraints9.gridx = 1; GridBagConstraints gridBagConstraints8 = new GridBagConstraints(); gridBagConstraints8.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints8.gridy = 1; gridBagConstraints8.weightx = 0.0D; gridBagConstraints8.anchor = GridBagConstraints.WEST; gridBagConstraints8.gridx = 1; GridBagConstraints gridBagConstraints7 = new GridBagConstraints(); gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints7.gridy = 0; gridBagConstraints7.weightx = 1.0D; gridBagConstraints7.anchor = GridBagConstraints.WEST; gridBagConstraints7.gridx = 1; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.gridx = 0; gridBagConstraints5.anchor = GridBagConstraints.WEST; gridBagConstraints5.gridy = 2; jLabel2 = new JLabel(); jLabel2.setText("End Time: "); GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.gridx = 0; gridBagConstraints4.anchor = GridBagConstraints.WEST; gridBagConstraints4.gridy = 1; jLabel1 = new JLabel(); jLabel1.setText("Begin Time: "); jLabel = new JLabel(); jLabel.setText("Tracks Name: "); jPanel = new JPanel(); jPanel.setLayout(new GridBagLayout()); jPanel.setBorder(BorderFactory.createTitledBorder(null, "Animation track properties", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanel.add(jLabel, gridBagConstraints11); jPanel.add(jLabel1, gridBagConstraints4); jPanel.add(jLabel2, gridBagConstraints5); jPanel.add(getTxtTracks(), gridBagConstraints7); jPanel.add(getTxtBegin(), gridBagConstraints8); jPanel.add(getTxtEnd(), gridBagConstraints9); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return jPanel; } private JPanel getJPanel1() { if (jPanel1 == null) { try { GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.gridx = 0; gridBagConstraints14.anchor = GridBagConstraints.WEST; gridBagConstraints14.fill = GridBagConstraints.NONE; gridBagConstraints14.weightx = 1.0D; gridBagConstraints14.gridy = 2; GridBagConstraints gridBagConstraints13 = new GridBagConstraints(); gridBagConstraints13.gridx = 0; gridBagConstraints13.weightx = 1.0D; gridBagConstraints13.anchor = GridBagConstraints.WEST; gridBagConstraints13.gridy = 1; GridBagConstraints gridBagConstraints12 = new GridBagConstraints(); gridBagConstraints12.gridx = 0; gridBagConstraints12.anchor = GridBagConstraints.WEST; gridBagConstraints12.weightx = 1.0D; gridBagConstraints12.gridy = 0; jPanel1 = new JPanel(); jPanel1.setLayout(new GridBagLayout()); jPanel1.setBorder(BorderFactory.createTitledBorder(null, "Layer visibility", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanel1.add(getChkboxOneLayer(), gridBagConstraints12); jPanel1.add(getChkboxLayerAppear(), gridBagConstraints13); jPanel1.add(getChkboxInvertOrder(), gridBagConstraints14); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return jPanel1; } private JPanel getJPanel2() { if (jPanel2 == null) { try { GridBagConstraints gridBagConstraints20 = new GridBagConstraints(); gridBagConstraints20.gridx = 3; gridBagConstraints20.insets = new Insets(0, 2, 0, 5); gridBagConstraints20.anchor = GridBagConstraints.WEST; gridBagConstraints20.gridy = 0; jLabel6 = new JLabel(); jLabel6.setText("All"); jLabel6.setFont(new Font("Dialog", Font.BOLD, 8)); GridBagConstraints gridBagConstraints19 = new GridBagConstraints(); gridBagConstraints19.fill = GridBagConstraints.BOTH; gridBagConstraints19.gridy = 0; gridBagConstraints19.weightx = 1.0; gridBagConstraints19.gridx = 2; GridBagConstraints gridBagConstraints18 = new GridBagConstraints(); gridBagConstraints18.gridx = 1; gridBagConstraints18.insets = new Insets(0, 5, 0, 2); gridBagConstraints18.anchor = GridBagConstraints.EAST; gridBagConstraints18.gridy = 0; jLabel5 = new JLabel(); jLabel5.setText("None"); jLabel5.setFont(new Font("Dialog", Font.BOLD, 8)); GridBagConstraints gridBagConstraints17 = new GridBagConstraints(); gridBagConstraints17.gridx = 0; gridBagConstraints17.gridwidth = 4; gridBagConstraints17.anchor = GridBagConstraints.WEST; gridBagConstraints17.gridy = 2; GridBagConstraints gridBagConstraints16 = new GridBagConstraints(); gridBagConstraints16.gridx = 0; gridBagConstraints16.gridwidth = 4; gridBagConstraints16.anchor = GridBagConstraints.WEST; gridBagConstraints16.gridy = 1; GridBagConstraints gridBagConstraints15 = new GridBagConstraints(); gridBagConstraints15.gridx = 0; gridBagConstraints15.gridy = 0; jLabel4 = new JLabel(); jLabel4.setText("Fading Tansition: "); jPanel2 = new JPanel(); jPanel2.setLayout(new GridBagLayout()); jPanel2.setBorder(BorderFactory.createTitledBorder(null, "Transitions", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); jPanel2.add(jLabel4, gridBagConstraints15); jPanel2.add(getChkboxBlendLayer(), gridBagConstraints16); jPanel2.add(getChkboxLoopAnimation(), gridBagConstraints17); jPanel2.add(jLabel5, gridBagConstraints18); jPanel2.add(getSliderTransition(), gridBagConstraints19); jPanel2.add(jLabel6, gridBagConstraints20); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return jPanel2; } private JPanel getJPanel3() { if (jPanel3 == null) { try { GridBagConstraints gridBagConstraints22 = new GridBagConstraints(); gridBagConstraints22.gridx = 0; gridBagConstraints22.weightx = 1.0D; gridBagConstraints22.anchor = GridBagConstraints.NORTHEAST; gridBagConstraints22.insets = new Insets(0, 0, 0, 5); gridBagConstraints22.gridy = 1; GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints21.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints21.weightx = 1.0D; jPanel3 = new JPanel(); jPanel3.setLayout(new GridBagLayout()); jPanel3.add(getChkboxOverwrite(), gridBagConstraints21); jPanel3.add(getBtnPlay(), gridBagConstraints22); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return jPanel3; } public JTextField getTxtTracks() { if (txtTracks == null) { try { txtTracks = new JTextField(); txtTracks.setPreferredSize(new Dimension(150, 20)); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return txtTracks; } public JTextField getTxtBegin() { if (txtBegin == null) { try { txtBegin = new JTextField(); txtBegin.setPreferredSize(new Dimension(40, 20)); txtBegin.setText("0.0"); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return txtBegin; } public JTextField getTxtEnd() { if (txtEnd == null) { try { txtEnd = new JTextField(); txtEnd.setPreferredSize(new Dimension(40, 20)); txtEnd.setText("1.0"); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return txtEnd; } public JCheckBox getChkboxOneLayer() { if (chkboxOneLayer == null) { try { chkboxOneLayer = new JCheckBox(); chkboxOneLayer.setText("One layer at a time"); chkboxOneLayer.setSelected(true); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return chkboxOneLayer; } public JCheckBox getChkboxLayerAppear() { if (chkboxLayerAppear == null) { try { chkboxLayerAppear = new JCheckBox(); chkboxLayerAppear.setText("Make layer appear"); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return chkboxLayerAppear; } public JCheckBox getChkboxInvertOrder() { if (chkboxInvertOrder == null) { try { chkboxInvertOrder = new JCheckBox(); chkboxInvertOrder.setText("Invert order"); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return chkboxInvertOrder; } public JCheckBox getChkboxBlendLayer() { if (chkboxBlendLayer == null) { try { chkboxBlendLayer = new JCheckBox(); chkboxBlendLayer.setText("Blend layers"); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return chkboxBlendLayer; } public JCheckBox getChkboxLoopAnimation() { if (chkboxLoopAnimation == null) { try { chkboxLoopAnimation = new JCheckBox(); chkboxLoopAnimation.setText("Create looped animation"); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return chkboxLoopAnimation; } public JSlider getSliderTransition() { if (sliderTransition == null) { try { sliderTransition = new JSlider(); sliderTransition.setPaintLabels(true); sliderTransition.setPaintTicks(true); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return sliderTransition; } public JCheckBox getChkboxOverwrite() { if (chkboxOverwrite == null) { try { chkboxOverwrite = new JCheckBox(); chkboxOverwrite.setText("Overwrite last imported track"); chkboxOverwrite.setSelected(true); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return chkboxOverwrite; } public JButton getBtnPlay() { if (btnPlay == null) { try { btnPlay = new JButton(); btnPlay.setText("Play Animation"); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return btnPlay; } private static final long serialVersionUID = 1L; private JPanel jPanel = null; private JPanel jPanel1 = null; private JPanel jPanel2 = null; private JPanel jPanel3 = null; private JLabel jLabel = null; private JLabel jLabel1 = null; private JLabel jLabel2 = null; private JTextField txtTracks = null; private JTextField txtBegin = null; private JTextField txtEnd = null; private JCheckBox chkboxOneLayer = null; private JCheckBox chkboxLayerAppear = null; private JCheckBox chkboxInvertOrder = null; private JLabel jLabel4 = null; private JCheckBox chkboxBlendLayer = null; private JCheckBox chkboxLoopAnimation = null; private JLabel jLabel5 = null; private JSlider sliderTransition = null; private JLabel jLabel6 = null; private JCheckBox chkboxOverwrite = null; private JButton btnPlay = null; }