private void createComponents(JPanel p) {
    String tt = "Any of these:  45.5 -120.2   or   45 30 0 n 120 12 0 w   or   Seattle";

    JComboBox field = new JComboBox();
    field.setOpaque(false);
    field.setEditable(true);
    field.setLightWeightPopupEnabled(false);
    field.setPreferredSize(new Dimension(200, field.getPreferredSize().height));
    field.setToolTipText(tt);

    JLabel label = new JLabel(ImageLibrary.getIcon("gov/nasa/worldwindow/images/safari-24x24.png"));
    //            new
    // ImageIcon(getClass().getResource("gov/nasa/worldwindow/images/safari-24x24.png")));
    label.setOpaque(false);
    label.setToolTipText(tt);

    p.add(label, BorderLayout.WEST);
    p.add(field, BorderLayout.CENTER);

    field.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent actionEvent) {
            performGazeteerAction(actionEvent);
          }
        });
  }
예제 #2
0
  public GlobalControls() {
    setLayout(new GridBagLayout());
    setBorder(new TitledBorder(new EtchedBorder(), "Global Controls"));

    aliasCB = createCheckBox("Anti-Aliasing", true, 0);
    renderCB = createCheckBox("Rendering Quality", false, 1);
    textureCB = createCheckBox("Texture", false, 2);
    compositeCB = createCheckBox("AlphaComposite", false, 3);

    screenCombo = new JComboBox();
    screenCombo.setPreferredSize(new Dimension(120, 18));
    screenCombo.setLightWeightPopupEnabled(true);
    screenCombo.setFont(font);
    for (int i = 0; i < screenNames.length; i++) {
      screenCombo.addItem(screenNames[i]);
    }
    screenCombo.addItemListener(this);
    Java2Demo.addToGridBag(this, screenCombo, 0, 4, 1, 1, 0.0, 0.0);

    toolBarCB = createCheckBox("Tools", false, 5);

    slider = new JSlider(JSlider.HORIZONTAL, 0, 200, 30);
    slider.addChangeListener(this);
    TitledBorder tb = new TitledBorder(new EtchedBorder());
    tb.setTitleFont(font);
    tb.setTitle("Anim delay = 30 ms");
    slider.setBorder(tb);
    slider.setMinimumSize(new Dimension(80, 46));
    Java2Demo.addToGridBag(this, slider, 0, 6, 1, 1, 1.0, 1.0);

    texturechooser = new TextureChooser(0);
    Java2Demo.addToGridBag(this, texturechooser, 0, 7, 1, 1, 1.0, 1.0);
  }
예제 #3
0
  /**
   * Contruct a new AnimationWidget.
   *
   * @param parentf the parent JFrame
   * @param anim a ucar.visad.display.Animation object to manage
   * @param info Default values for the AnimationInfo
   */
  public AnimationWidget(JFrame parentf, Animation anim, AnimationInfo info) {

    // Initialize sharing to true
    super("AnimationWidget", true);
    timesCbx =
        new JComboBox() {
          public String getToolTipText(MouseEvent event) {
            if (boxPanel != null) {
              return boxPanel.getToolTipText();
            }
            return " ";
          }
        };
    timesCbx.setToolTipText("");
    timesCbxMutex = timesCbx.getTreeLock();
    timesCbx.setFont(new Font("Dialog", Font.PLAIN, 9));
    timesCbx.setLightWeightPopupEnabled(false);
    // set to non-visible until items are added
    timesCbx.setVisible(false);
    timesCbx.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (!ignoreTimesCbxEvents && (anime != null)) {
              debug("got timesCbx event");
              setTimeFromUser((Real) timesCbx.getSelectedItem());
              if (boxPanel != null) {
                boxPanel.setOnIndex(timesCbx.getSelectedIndex());
              }
            }
          }
        });

    animationInfo = new AnimationInfo();
    if (anim != null) {
      setAnimation(anim);
    }
    if (anime != null) {
      animationInfo.set(anime.getAnimationInfo());
    }
    if (info != null) {
      setProperties(info);
      animationInfo.setRunning(info.getRunning());
    }

    boxPanel = new AnimationBoxPanel(this);
    if (timesArray != null) {
      updateBoxPanel(timesArray);
    }
  }