コード例 #1
0
ファイル: Shapes.java プロジェクト: syzh1991/DigitalEarth
    private JPanel makeInteriorAttributesPanel() {
      JPanel outerPanel = new JPanel(new BorderLayout(6, 6));
      outerPanel.setBorder(this.createTitleBorder("Surface Attributes"));

      GridLayout nameLayout = new GridLayout(0, 1, 6, 6);
      JPanel namePanel = new JPanel(nameLayout);

      GridLayout valueLayout = new GridLayout(0, 1, 6, 6);
      JPanel valuePanel = new JPanel(valueLayout);

      namePanel.add(new JLabel("Style"));
      final JComboBox cb1 = new JComboBox(new String[] {"None", "Solid"});
      cb1.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentInteriorStyle = (String) cb1.getSelectedItem();
              update();
            }
          });
      cb1.setSelectedItem("Solid");
      valuePanel.add(cb1);

      namePanel.add(new JLabel("Opacity"));
      JSpinner sp = new JSpinner(new SpinnerNumberModel(this.currentBorderOpacity, 0, 10, 1));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentInteriorOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      valuePanel.add(sp);

      namePanel.add(new JLabel("Color"));
      final JComboBox cb2 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"});
      cb2.setSelectedItem(currentInteriorColor);
      cb2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentInteriorColor =
                  (String) ((JComboBox) actionEvent.getSource()).getSelectedItem();
              update();
            }
          });
      valuePanel.add(cb2);

      namePanel.add(new JLabel("Border"));
      final JComboBox cb5 = new JComboBox(new String[] {"None", "Solid"});
      cb5.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentBorderStyle = (String) cb5.getSelectedItem();
              update();
            }
          });
      cb5.setSelectedItem("Solid");
      valuePanel.add(cb5);

      namePanel.add(new JLabel("Border Width"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentBorderWidth, 1d, 10d, 1d));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentBorderWidth = (Double) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      sp.setValue(currentBorderWidth);
      valuePanel.add(sp);

      namePanel.add(new JLabel("Border Color"));
      JComboBox cb4 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"});
      cb4.setSelectedItem(currentBorderColor);
      cb4.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentBorderColor = (String) ((JComboBox) actionEvent.getSource()).getSelectedItem();
              update();
            }
          });
      valuePanel.add(cb4);

      namePanel.add(new JLabel("Border Opacity"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentBorderOpacity, 0, 10, 1));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentBorderOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      valuePanel.add(sp);

      outerPanel.add(namePanel, BorderLayout.WEST);
      outerPanel.add(valuePanel, BorderLayout.CENTER);

      return outerPanel;
    }
コード例 #2
0
ファイル: Shapes.java プロジェクト: syzh1991/DigitalEarth
    private JPanel makePathAttributesPanel() {
      JPanel outerPanel = new JPanel(new BorderLayout(6, 6));
      outerPanel.setBorder(this.createTitleBorder("Path Attributes"));

      GridLayout nameLayout = new GridLayout(0, 1, 6, 6);
      JPanel namePanel = new JPanel(nameLayout);

      GridLayout valueLayout = new GridLayout(0, 1, 6, 6);
      JPanel valuePanel = new JPanel(valueLayout);

      namePanel.add(new JLabel("Follow Terrain"));
      JCheckBox ckb = new JCheckBox();
      ckb.setSelected(currentFollowTerrain);
      ckb.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentFollowTerrain = ((JCheckBox) actionEvent.getSource()).isSelected();
              update();
            }
          });
      valuePanel.add(ckb);

      JLabel label;

      namePanel.add(label = new JLabel("Conformance"));
      int[] values = new int[] {1, 2, 4, 8, 10, 15, 20, 30, 40, 50};
      String[] strings = new String[values.length];
      for (int i = 0; i < values.length; i++) {
        strings[i] = Integer.toString(values[i]) + " pixels";
      }
      JSpinner sp = new JSpinner(new SpinnerListModel(strings));
      onTerrainOnlyItems.add(label);
      onTerrainOnlyItems.add(sp);
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              String v = (String) ((JSpinner) changeEvent.getSource()).getValue();
              currentTerrainConformance = Integer.parseInt(v.substring(0, v.indexOf(" ")));
              update();
            }
          });
      sp.setValue(Integer.toString(currentTerrainConformance) + " pixels");
      valuePanel.add(sp);

      namePanel.add(label = new JLabel("Subsegments"));
      sp = new JSpinner(new SpinnerListModel(new String[] {"1", "2", "5", "10", "20", "40", "50"}));
      offTerrainOnlyItems.add(label);
      offTerrainOnlyItems.add(sp);
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              String v = (String) ((JSpinner) changeEvent.getSource()).getValue();
              currentNumSubsegments = Integer.parseInt(v);
              update();
            }
          });
      sp.setValue(Integer.toString(currentNumSubsegments));
      valuePanel.add(sp);

      namePanel.add(new JLabel("Type"));
      final JComboBox cb = new JComboBox(new String[] {"Great Circle", "Linear", "Rhumb Line"});
      cb.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentPathType = (String) cb.getSelectedItem();
              update();
            }
          });
      cb.setSelectedItem("Great Circle");
      valuePanel.add(cb);

      namePanel.add(new JLabel("Style"));
      final JComboBox cb1 = new JComboBox(new String[] {"None", "Solid", "Dash"});
      cb1.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentPathStyle = (String) cb1.getSelectedItem();
              update();
            }
          });
      cb1.setSelectedItem("Solid");
      valuePanel.add(cb1);

      namePanel.add(new JLabel("Width"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentPathWidth, 1d, 10d, 1d));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentPathWidth = (Double) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      sp.setValue(currentPathWidth);
      valuePanel.add(sp);

      namePanel.add(new JLabel("Color"));
      JComboBox cb2 = new JComboBox(new String[] {"Red", "Green", "Blue", "Yellow"});
      cb2.setSelectedItem(currentPathColor);
      cb2.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent actionEvent) {
              currentPathColor = (String) ((JComboBox) actionEvent.getSource()).getSelectedItem();
              update();
            }
          });
      valuePanel.add(cb2);

      namePanel.add(new JLabel("Opacity"));
      sp = new JSpinner(new SpinnerNumberModel(this.currentPathOpacity, 0, 10, 1));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentPathOpacity = (Integer) ((JSpinner) changeEvent.getSource()).getValue();
              update();
            }
          });
      valuePanel.add(sp);

      namePanel.add(new JLabel("Offset"));
      sp =
          new JSpinner(
              new SpinnerListModel(
                  new String[] {"0", "10", "100", "1000", "10000", "100000", "1000000"}));
      sp.addChangeListener(
          new ChangeListener() {
            public void stateChanged(ChangeEvent changeEvent) {
              currentOffset =
                  Float.parseFloat((String) ((JSpinner) changeEvent.getSource()).getValue());
              update();
            }
          });
      sp.setValue("0");
      valuePanel.add(sp);

      outerPanel.add(namePanel, BorderLayout.WEST);
      outerPanel.add(valuePanel, BorderLayout.CENTER);

      return outerPanel;
    }