⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 layercontrolbuttonpanel.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        top.addActionListener(this);        add(top);        up = new JButton(upgif);        up.setActionCommand(LayersPanel.LayerUpCmd);        up.setPressedIcon(upclickedgif);        up.setToolTipText(i18n.get(LayerControlButtonPanel.class,                "moveLayerUpOne",                "Move selected layer up one"));        up.addActionListener(this);        add(up);        down = new JButton(downgif);        down.setPressedIcon(downclickedgif);        down.setActionCommand(LayersPanel.LayerDownCmd);        down.setToolTipText(i18n.get(LayerControlButtonPanel.class,                "moveLayerDownOne",                "Move selected layer down one"));        down.addActionListener(this);        add(down);        bottom = new JButton(bottomgif);        bottom.setPressedIcon(bottomclickedgif);        bottom.setActionCommand(LayersPanel.LayerBottomCmd);        bottom.setToolTipText(i18n.get(LayerControlButtonPanel.class,                "moveLayerToBottom",                "Move selected layer to bottom"));        bottom.addActionListener(this);        add(bottom);        if (deleteLayers) {            JLabel blank = new JLabel(" ");            add(blank);            delete = new JButton(deletegif);            delete.setActionCommand(LayersPanel.LayerRemoveCmd);            delete.setToolTipText(i18n.get(LayerControlButtonPanel.class,                    "removeLayer",                    "Remove selected layer"));            delete.addActionListener(this);            delete.setEnabled(false);            add(delete);        }        if (addLayers && add != null) {            add(add);        }    }    /**     * Set the panel that brings up an interface to dynamically add     * layers.     */    public void setLayerAddPanel(LayerAddPanel lap) {        layerAddPanel = lap;        if (layerAddPanel != null) {            add = new JButton(addgif);            add.setActionCommand(LayersPanel.LayerAddCmd);            add.setToolTipText(i18n.get(LayerControlButtonPanel.class,                    "addLayer",                    "Add a layer"));            add.addActionListener(this);            if (addLayers) {                this.add(add);            }        } else if (add != null) {            this.remove(add);        }    }    /**     * Get the panel interface to dynamically add layers.     */    public LayerAddPanel getLayerAddPanel() {        return layerAddPanel;    }    /**     * Method associated with the ActionListener interface. This     * method listens for action events meant to change the order of     * the layers, as fired by the layer order buttons.     *      * @param e ActionEvent     */    public void actionPerformed(java.awt.event.ActionEvent e) {        String command = e.getActionCommand();        if (Debug.debugging("layerbuttons")) {            Debug.output("LayersPanel.actionPerformed(): " + command);        }        if (command == LayersPanel.LayerTopCmd                || command == LayersPanel.LayerBottomCmd                || command == LayersPanel.LayerUpCmd                || command == LayersPanel.LayerDownCmd                || command == LayersPanel.LayerRemoveCmd) {            if (selected != null) {                if (Debug.debugging("layercontrol")) {                    Debug.output("LayerControlButtonPanel: button firing "                            + command + " event for " + selected.getName());                }                firePropertyChange(command, null, selected);            } else {                if (Debug.debugging("layercontrol")) {                    Debug.output("LayerControlButtonPanel: button firing "                            + command + " event with no layer selected");                }            }        } else if (command.equals(LayersPanel.LayerAddCmd)) {            if (layerAddPanel != null) {                layerAddPanel.showPanel();            }        }    }    protected Layer selected = null;    public void propertyChange(PropertyChangeEvent pce) {        String command = pce.getPropertyName();        Object obj = pce.getNewValue();        if (Debug.debugging("layercontrol")) {            Debug.output("LayerControlButtonPanel: receiving PropertyChangeEvent "                    + pce.getPropertyName());        }        if (command == LayersPanel.LayerSelectedCmd && obj instanceof Layer) {            selected = (Layer) obj;            delete.setEnabled(selected.isRemovable());            if (Debug.debugging("layercontrol")) {                Debug.output("LayerControlButtonPanel: got notification that layer is selected: "                        + selected.getName());            }        } else if (command == LayersPanel.LayerDeselectedCmd && selected == obj) {            selected = null;            delete.setEnabled(false);        }    }    public void findAndInit(Object someObj) {        if (someObj instanceof LayerAddPanel) {            setLayerAddPanel((LayerAddPanel) someObj);        }        if (someObj instanceof LayersPanel) {            setLayersPanel((LayersPanel) someObj);        }    }    public void findAndUndo(Object someObj) {        if (someObj instanceof LayerAddPanel) {            if (getLayerAddPanel() == someObj) {                setLayerAddPanel(null);            }        }        if (someObj instanceof LayersPanel) {            removeLayersPanel((LayersPanel) someObj);        }    }    public void setProperties(String prefix, Properties props) {        super.setProperties(prefix, props);        prefix = PropUtils.getScopedPropertyPrefix(prefix);        configuration = props.getProperty(prefix + ConfigurationProperty);        if (configuration == null) {            configuration = DefaultConfiguration;        }        embedded = PropUtils.booleanFromProperties(props, prefix                + EmbeddedProperty, embedded);        deleteLayers = PropUtils.booleanFromProperties(props, prefix                + DeleteLayersProperty, deleteLayers);        addLayers = PropUtils.booleanFromProperties(props, prefix                + AddLayersProperty, addLayers);        String orient = props.getProperty(prefix + OrientationProperty);        if (orient != null                && (orient.equalsIgnoreCase(HORIZONTAL_CONFIG) || (orient.equalsIgnoreCase("false")))) {            orientation = BoxLayout.X_AXIS;        }    }    public Properties getProperties(Properties props) {        props = super.getProperties(props);        String prefix = PropUtils.getScopedPropertyPrefix(this);        props.put(prefix + ConfigurationProperty, configuration);        props.put(prefix + OrientationProperty,                (orientation == BoxLayout.X_AXIS ? HORIZONTAL_CONFIG                        : VERTICAL_CONFIG));        props.put(prefix + EmbeddedProperty, new Boolean(embedded).toString());        props.put(prefix + DeleteLayersProperty,                new Boolean(deleteLayers).toString());        props.put(prefix + AddLayersProperty, new Boolean(addLayers).toString());        return props;    }    public Properties getPropertyInfo(Properties props) {        props = super.getPropertyInfo(props);        String interString = i18n.get(LayerControlButtonPanel.class,                ConfigurationProperty,                I18n.TOOLTIP,                "Pre-Defined Configuration String (WEST, EAST, NORTH, SOUTH, NORTH_SOUTH).");        props.put(ConfigurationProperty, interString);        props.put(ConfigurationProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.ComboBoxPropertyEditor");        props.put(ConfigurationProperty + OptionPropertyEditor.ScopedOptionsProperty,                "west east north south northsouth");        props.put(ConfigurationProperty + ".west", "WEST");        props.put(ConfigurationProperty + ".east", "EAST");        props.put(ConfigurationProperty + ".north", "NORTH");        props.put(ConfigurationProperty + ".south", "SOUTH");        props.put(ConfigurationProperty + ".northsouth", "NORTH_SOUTH");        interString = i18n.get(LayerControlButtonPanel.class, ConfigurationProperty, "Configuration");        props.put(ConfigurationProperty + LabelEditorProperty, interString);                interString = i18n.get(LayerControlButtonPanel.class,                ConfigurationProperty,                I18n.TOOLTIP,                "Layout orientation for buttons.");        props.put(OrientationProperty, interString);        props.put(OrientationProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.OrientationPropertyEditor");        interString = i18n.get(LayerControlButtonPanel.class, OrientationProperty, "Orientation");        props.put(OrientationProperty + LabelEditorProperty, interString);        interString = i18n.get(LayerControlButtonPanel.class,                EmbeddedProperty,                I18n.TOOLTIP,                "Insert itself into Layers panel.");        props.put(EmbeddedProperty, interString);        props.put(EmbeddedProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        interString = i18n.get(LayerControlButtonPanel.class, EmbeddedProperty, "Embedded");        props.put(EmbeddedProperty + LabelEditorProperty, interString);                interString = i18n.get(LayerControlButtonPanel.class,                DeleteLayersProperty,                I18n.TOOLTIP,                "Include button to delete layers.");        props.put(DeleteLayersProperty, interString);        props.put(DeleteLayersProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        interString = i18n.get(LayerControlButtonPanel.class, DeleteLayersProperty, "Add Remove Button");        props.put(DeleteLayersProperty + LabelEditorProperty, interString);                interString = i18n.get(LayerControlButtonPanel.class,                AddLayersProperty,                I18n.TOOLTIP,                "Include button to add layers.");        props.put(AddLayersProperty, interString);        props.put(AddLayersProperty + ScopedEditorProperty,                "com.bbn.openmap.util.propertyEditor.YesNoPropertyEditor");        interString = i18n.get(LayerControlButtonPanel.class, AddLayersProperty, "Add Create Button");        props.put(AddLayersProperty + LabelEditorProperty, interString);                props.put(initPropertiesProperty, ConfigurationProperty + " " +                EmbeddedProperty + " " +                OrientationProperty + " " +                AddLayersProperty + " " +                DeleteLayersProperty);                return props;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -