Search in sources :

Example 6 with MapObjectType

use of de.gurkenlabs.litiengine.environment.tilemap.MapObjectType in project litiengine by gurkenlabs.

the class MapObjectPanel method setupChangedListeners.

private void setupChangedListeners() {
    comboBoxType.addItemListener(new MapObjectPropertyItemListener(m -> {
        MapObjectType type = (MapObjectType) comboBoxType.getSelectedItem();
        m.setType(type.toString());
    }));
    comboBoxType.addItemListener(e -> {
        MapObjectType type = (MapObjectType) comboBoxType.getSelectedItem();
        switchPanel(type);
    });
    this.textFieldName.addFocusListener(new MapObjectPropteryFocusListener(m -> m.setName(textFieldName.getText())));
    this.textFieldName.addActionListener(new MapObjectPropertyActionListener(m -> m.setName(textFieldName.getText())));
    this.spinnerX.addChangeListener(new MapObjectPropertyChangeListener(m -> {
        m.setX((int) spinnerX.getValue());
        EditorScreen.instance().getMapComponent().updateTransformControls();
    }));
    this.spinnerY.addChangeListener(new MapObjectPropertyChangeListener(m -> {
        m.setY((int) spinnerY.getValue());
        EditorScreen.instance().getMapComponent().updateTransformControls();
    }));
    this.spinnerWidth.addChangeListener(new MapObjectPropertyChangeListener(m -> {
        m.setWidth((int) spinnerWidth.getValue());
        EditorScreen.instance().getMapComponent().updateTransformControls();
    }));
    this.spinnerHeight.addChangeListener(new MapObjectPropertyChangeListener(m -> {
        m.setHeight((int) spinnerHeight.getValue());
        EditorScreen.instance().getMapComponent().updateTransformControls();
    }));
    this.tagPanel.addActionListener(new MapObjectPropertyActionListener(m -> m.setCustomProperty(MapObjectProperty.TAGS, this.tagPanel.getTagsString())));
}
Also used : Resources(de.gurkenlabs.litiengine.Resources) JSpinner(javax.swing.JSpinner) JTextField(javax.swing.JTextField) Font(java.awt.Font) EditorScreen(de.gurkenlabs.utiliti.EditorScreen) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ComponentPlacement(javax.swing.LayoutStyle.ComponentPlacement) IMapObject(de.gurkenlabs.litiengine.environment.tilemap.IMapObject) Dimension(java.awt.Dimension) Alignment(javax.swing.GroupLayout.Alignment) MapObjectType(de.gurkenlabs.litiengine.environment.tilemap.MapObjectType) JLabel(javax.swing.JLabel) Map(java.util.Map) GroupLayout(javax.swing.GroupLayout) TagPanel(de.gurkenlabs.utiliti.swing.TagPanel) MapObjectProperty(de.gurkenlabs.litiengine.environment.tilemap.MapObjectProperty) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) JPanel(javax.swing.JPanel) MapObjectType(de.gurkenlabs.litiengine.environment.tilemap.MapObjectType)

Aggregations

MapObjectType (de.gurkenlabs.litiengine.environment.tilemap.MapObjectType)6 IMapObject (de.gurkenlabs.litiengine.environment.tilemap.IMapObject)3 IMapObjectLayer (de.gurkenlabs.litiengine.environment.tilemap.IMapObjectLayer)2 Color (java.awt.Color)2 Rectangle2D (java.awt.geom.Rectangle2D)2 Resources (de.gurkenlabs.litiengine.Resources)1 MapObjectProperty (de.gurkenlabs.litiengine.environment.tilemap.MapObjectProperty)1 EditorScreen (de.gurkenlabs.utiliti.EditorScreen)1 TagPanel (de.gurkenlabs.utiliti.swing.TagPanel)1 BasicStroke (java.awt.BasicStroke)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 Font (java.awt.Font)1 Path2D (java.awt.geom.Path2D)1 Point2D (java.awt.geom.Point2D)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)1 GroupLayout (javax.swing.GroupLayout)1 Alignment (javax.swing.GroupLayout.Alignment)1