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.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; /** * This class contains the code to build the Animation Panel UI. The real * arcobjects work is done in the AnimationPanelActionListener which is used to * handle events triggered by swing components in this class. */ public class AnimationPanel extends JPanel { private static final long serialVersionUID = 1L; public AnimationPanel() { super(); try { GridBagConstraints gridBagConstraints6 = new GridBagConstraints(); gridBagConstraints6.gridx = 1; gridBagConstraints6.anchor = GridBagConstraints.WEST; gridBagConstraints6.insets = new Insets(0, 5, 10, 0); gridBagConstraints6.gridy = 1; GridBagConstraints gridBagConstraints5 = new GridBagConstraints(); gridBagConstraints5.insets = new Insets(10, 5, 0, 5); GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.insets = new Insets(10, 5, 0, 5); gridBagConstraints4.anchor = GridBagConstraints.WEST; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.insets = new Insets(10, 10, 0, 5); GridBagConstraints gridBagConstraints2 = new GridBagConstraints(); gridBagConstraints2.insets = new Insets(10, 5, 0, 5); gridBagConstraints2.anchor = GridBagConstraints.WEST; GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); gridBagConstraints1.fill = GridBagConstraints.VERTICAL; gridBagConstraints1.insets = new Insets(10, 5, 0, 10); gridBagConstraints1.anchor = GridBagConstraints.WEST; gridBagConstraints1.weightx = 1.0; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.insets = new Insets(10, 5, 0, 5); gridBagConstraints.anchor = GridBagConstraints.WEST; gridBagConstraints.weightx = 0.0D; this.setLayout(new GridBagLayout()); this.add(getBtnLoad(), gridBagConstraints3); this.add(getRadioDuration(), gridBagConstraints4); this.add(getTxtDuration(), gridBagConstraints); this.add(getBtnPlay(), gridBagConstraints2); this.add(getLabelCycle(), gridBagConstraints5); this.add(getTxtCycle(), gridBagConstraints1); this.add(getRadioIterations(), gridBagConstraints6); } catch (java.lang.Throwable e) { e.printStackTrace(); } } public JLabel getLabelCycle() { if (labelCycle == null) { labelCycle = new JLabel(); labelCycle.setText("Cycle"); labelCycle.setEnabled(true); } return labelCycle; } public JButton getBtnLoad() { if (btnLoad == null) { try { btnLoad = new JButton(); btnLoad.setText("Load Animation ..."); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return btnLoad; } private ButtonGroup group = new ButtonGroup(); public JRadioButton getRadioDuration() { if (radioDuration == null) { try { radioDuration = new JRadioButton(); radioDuration.setText("Duration (secs)"); radioDuration.setEnabled(true); radioDuration.setSelected(true); group.add(radioDuration); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return radioDuration; } public JTextField getTxtDuration() { if (txtDuration == null) { try { txtDuration = new JTextField(); txtDuration.setText("30"); txtDuration.setPreferredSize(new Dimension(40, 20)); txtDuration.setEnabled(true); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return txtDuration; } public JButton getBtnPlay() { if (btnPlay == null) { try { btnPlay = new JButton(); btnPlay.setText("Play Animation"); btnPlay.setEnabled(true); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return btnPlay; } public JTextField getTxtCycle() { if (txtCycle == null) { try { txtCycle = new JTextField(); txtCycle.setPreferredSize(new Dimension(25, 20)); txtCycle.setText("2"); txtCycle.setEnabled(true); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return txtCycle; } public JRadioButton getRadioIterations() { if (radioIterations == null) { try { radioIterations = new JRadioButton(); radioIterations.setText("Iterations"); radioIterations.setEnabled(true); group.add(radioIterations); } catch (java.lang.Throwable e) { e.printStackTrace(); } } return radioIterations; } private JButton btnLoad = null; private JRadioButton radioDuration = null; private JTextField txtDuration = null; private JButton btnPlay = null; private JLabel labelCycle = null; private JTextField txtCycle = null; private JRadioButton radioIterations = null; }