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);
          }
        });
  }
Esempio n. 2
0
  public void initialize(final Controller controller) {
    super.initialize(controller);

    WWMenu fileMenu = (WWMenu) this.getController().getRegisteredObject(Constants.FILE_MENU);
    if (fileMenu != null) fileMenu.addMenu(this.getFeatureID());

    this.tabbedPane = new JTabbedPane();
    this.tabbedPane.setOpaque(false);

    this.tabbedPane.add(new JPanel());
    this.tabbedPane.setTitleAt(0, "+"); // this tab is just a button for adding servers/panels
    this.tabbedPane.setToolTipTextAt(0, "Connect to WMS Server");

    this.tabbedPane.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent changeEvent) {
            if (tabbedPane.getSelectedIndex() == 0) {
              addNewPanel(tabbedPane); // Add new panel when '+' is selected
            }
          }
        });

    // Add an initial panel to the tabbed pane
    this.addNewPanel(this.tabbedPane);
    tabbedPane.setSelectedIndex(1);

    this.setTaskComponent(this.tabbedPane);
    this.setLocation(SwingConstants.CENTER, SwingConstants.CENTER);
    this.getJDialog().setResizable(true);

    JButton deleteButton =
        new JButton(ImageLibrary.getIcon("gov/nasa/worldwindow/images/delete-20x20.png"));
    deleteButton.setToolTipText("Remove Server");
    deleteButton.setOpaque(false);
    deleteButton.setBackground(new Color(0, 0, 0, 0));
    deleteButton.setBorderPainted(false);
    deleteButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            deleteCurrentPanel();
          }
        });
    deleteButton.setEnabled(true);
    this.insertLeftDialogComponent(deleteButton);
    //
    //        JButton cancelButton = new JButton("Cancel");
    //        cancelButton.setToolTipText("Cancel capabilities retrieval from server");
    //        cancelButton.setOpaque(false);
    //        cancelButton.addActionListener(new ActionListener()
    //        {
    //            public void actionPerformed(ActionEvent actionEvent)
    //            {
    //                cancelCurrentRetrieval();
    //            }
    //        });
    //        this.insertRightDialogComponent(cancelButton);

    this.setTitle("WMS Servers");
    this.dialog.validate();
    this.dialog.pack();
  }