Search in sources :

Example 1 with ChangeWallTextureCommand

use of org.concord.energy3d.undo.ChangeWallTextureCommand in project energy3d by concord-consortium.

the class MainFrame method createWallTextureMenuItem.

JRadioButtonMenuItem createWallTextureMenuItem(final int type, final String imageFile) {
    final JRadioButtonMenuItem m = new JRadioButtonMenuItem(new ImageIcon(MainPanel.class.getResource(imageFile)));
    m.setText("Texture #" + (type + 1));
    m.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(final ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                final ChangeWallTextureCommand c = new ChangeWallTextureCommand();
                Scene.getInstance().setTextureMode(TextureMode.Full);
                Scene.getInstance().setWallTextureType(type);
                Scene.getInstance().setEdited(true);
                if (MainPanel.getInstance().getEnergyButton().isSelected()) {
                    MainPanel.getInstance().getEnergyButton().setSelected(false);
                }
                SceneManager.getInstance().getUndoManager().addEdit(c);
            }
        }
    });
    return m;
}
Also used : ImageIcon(javax.swing.ImageIcon) ItemEvent(java.awt.event.ItemEvent) ChangeWallTextureCommand(org.concord.energy3d.undo.ChangeWallTextureCommand) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) ItemListener(java.awt.event.ItemListener)

Aggregations

ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 ImageIcon (javax.swing.ImageIcon)1 JRadioButtonMenuItem (javax.swing.JRadioButtonMenuItem)1 ChangeWallTextureCommand (org.concord.energy3d.undo.ChangeWallTextureCommand)1