Esempio n. 1
0
  public static void init() {

    WorldShapes.init();
    ImageLibrary.init();

    worldOne = new World();

    // Setting up arbitrary testing entities
    for (int i = -10; i < 10; i++) {
      for (int j = -10; j < 10; j++) {
        Entity e = new Entity(i * 10, j * 10, 5, ImageLibrary.randomImage());
        e.getParticle()
            .setVelocityVector(
                new Complex(Calculation.rand(-0.1f, 0.1f), Calculation.rand(-0.1f, 0.1f)));
        e.getParticle().setAngularVelocity(Calculation.rand(-1, 1));
        e.getParticle().setAngularVelocity(Calculation.rand(-100, 100));
        worldOne.Entity_HashMap.put(Calculation.rand(0, 1000) + "", e);
      }
    }

    worldOne.Entity_HashMap.put("player", new Entity(12, 12, 12, ImageLibrary.get("smile")));
    mainCamera =
        new POV(
            worldOne.Entity_HashMap.get("player").getParticle().getPositionVector(),
            Display.getWidth(),
            Display.getHeight(),
            0,
            5,
            worldOne);
  }
  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. 3
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();
  }