Ejemplo n.º 1
0
  public PathProperPanel(final PathLayer layer, final DartEarthAppFrame frame) {
    this.setLayout(new GridLayout(0, 1, 2, 2));

    this.layer = layer;
    this.frame = frame;
    this.path = layer.getPath();
    deleteBtns = new ArrayList<JButton>();
    latTexts = new ArrayList<JTextField>();
    lngTexts = new ArrayList<JTextField>();
    pointPanels = new ArrayList<JPanel>();

    layerNameLabel = new JLabel("图层名:");
    layerNameTextField = new JTextField();
    layerNameTextField.setText(layer.getName());
    put(layerNameLabel, layerNameTextField);

    // this.buildPointPanels();

    colorLabel = new JLabel("颜色:");
    // this.add(colorLabel);
    // colorChooser = new JColorChooser();
    color = path.getAttributes().getOutlineMaterial().getDiffuse();
    // colorChooser.setColor(color);
    // colorChooser.set
    // color=JColorChooser.showDialog(this, "请选择颜色", color);
    colorBtn = new JButton();
    // colorBtn.setText("");
    colorBtn.setBackground(color);
    // final LineProperPanel panel = this;
    ActionListener colorChooseListener =
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent event) {
            Color choosenColor = JColorChooser.showDialog(null, "请选择颜色", color);
            colorBtn.setBackground(choosenColor);
            // line.setColor(color);
            // layer.refresh();
          }
        };
    colorBtn.addActionListener(colorChooseListener);
    put(colorLabel, colorBtn);
    // this.add(colorBtn);

    opacityLabel = new JLabel("透明度:");
    // this.add(opacityLable);
    opacityTextField = new JTextField();
    opacityTextField.setText(layer.getPath().getAttributes().getOutlineOpacity() + "");
    // this.add(opacityTextField);
    put(opacityLabel, opacityTextField);

    sizeLabel = new JLabel("粗细:");
    // this.add(sizeLabel);
    sizeTextField = new JTextField();
    sizeTextField.setText(path.getAttributes().getOutlineWidth() + "");
    // this.add(sizeTextField);
    put(sizeLabel, sizeTextField);

    initialDialogBtns();
    buildPointPanels();
  }