experimental
parent
1286fa0fba
commit
ff877160e8
@ -0,0 +1,66 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> |
||||
<Properties> |
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> |
||||
<Dimension value="[474, 25]"/> |
||||
</Property> |
||||
</Properties> |
||||
<AuxValues> |
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> |
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> |
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> |
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> |
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/> |
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> |
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> |
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> |
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> |
||||
</AuxValues> |
||||
|
||||
<Layout> |
||||
<DimensionLayout dim="0"> |
||||
<Group type="103" groupAlignment="0" attributes="0"> |
||||
<Group type="102" alignment="0" attributes="0"> |
||||
<Component id="jLabel1" min="-2" pref="71" max="-2" attributes="0"/> |
||||
<EmptySpace max="-2" attributes="0"/> |
||||
<Component id="techniqueComboBox" min="-2" pref="136" max="-2" attributes="0"/> |
||||
<EmptySpace min="0" pref="337" max="32767" attributes="0"/> |
||||
</Group> |
||||
</Group> |
||||
</DimensionLayout> |
||||
<DimensionLayout dim="1"> |
||||
<Group type="103" groupAlignment="0" attributes="0"> |
||||
<Group type="103" alignment="0" groupAlignment="3" attributes="0"> |
||||
<Component id="jLabel1" alignment="3" pref="25" max="32767" attributes="0"/> |
||||
<Component id="techniqueComboBox" alignment="3" min="-2" max="-2" attributes="0"/> |
||||
</Group> |
||||
</Group> |
||||
</DimensionLayout> |
||||
</Layout> |
||||
<SubComponents> |
||||
<Component class="javax.swing.JLabel" name="jLabel1"> |
||||
<Properties> |
||||
<Property name="horizontalAlignment" type="int" value="11"/> |
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||
<ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="MatDefEditorToolBar.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||
</Property> |
||||
</Properties> |
||||
</Component> |
||||
<Component class="javax.swing.JComboBox" name="techniqueComboBox"> |
||||
<Properties> |
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> |
||||
<StringArray count="4"> |
||||
<StringItem index="0" value="Item 1"/> |
||||
<StringItem index="1" value="Item 2"/> |
||||
<StringItem index="2" value="Item 3"/> |
||||
<StringItem index="3" value="Item 4"/> |
||||
</StringArray> |
||||
</Property> |
||||
</Properties> |
||||
<Events> |
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="techniqueComboBoxActionPerformed"/> |
||||
</Events> |
||||
</Component> |
||||
</SubComponents> |
||||
</Form> |
@ -0,0 +1,105 @@ |
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package com.jme3.gde.materialdefinition.editor; |
||||
|
||||
import com.jme3.gde.materialdefinition.fileStructure.TechniqueBlock; |
||||
import java.awt.Component; |
||||
import java.util.List; |
||||
import javax.swing.DefaultComboBoxModel; |
||||
import javax.swing.DefaultListCellRenderer; |
||||
import javax.swing.JLabel; |
||||
import javax.swing.JList; |
||||
import javax.swing.ListCellRenderer; |
||||
|
||||
/** |
||||
* |
||||
* @author Nehon |
||||
*/ |
||||
public class MatDefEditorToolBar extends javax.swing.JPanel { |
||||
|
||||
private MatDefEditorlElement parent; |
||||
private final DefaultComboBoxModel<TechniqueBlock> comboModel = new DefaultComboBoxModel<TechniqueBlock>(); |
||||
/** |
||||
* Creates new form MatDefEditorToolBar |
||||
*/ |
||||
public MatDefEditorToolBar() { |
||||
initComponents(); |
||||
techniqueComboBox.setModel(comboModel); |
||||
final DefaultListCellRenderer renderer = new DefaultListCellRenderer(); |
||||
techniqueComboBox.setRenderer(new ListCellRenderer<TechniqueBlock>() { |
||||
|
||||
public Component getListCellRendererComponent(JList list, TechniqueBlock value, int index, boolean isSelected, boolean cellHasFocus) { |
||||
JLabel c = (JLabel)renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||
c.setText(value.getName()); |
||||
return c; |
||||
} |
||||
}); |
||||
|
||||
} |
||||
|
||||
public void setParent(MatDefEditorlElement parent) { |
||||
this.parent = parent; |
||||
} |
||||
|
||||
public void addTechnique(List<TechniqueBlock> tech){ |
||||
for (TechniqueBlock tech1 : tech) { |
||||
comboModel.addElement(tech1); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* This method is called from within the constructor to initialize the form. |
||||
* WARNING: Do NOT modify this code. The content of this method is always |
||||
* regenerated by the Form Editor. |
||||
*/ |
||||
@SuppressWarnings("unchecked") |
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() { |
||||
|
||||
jLabel1 = new javax.swing.JLabel(); |
||||
techniqueComboBox = new javax.swing.JComboBox(); |
||||
|
||||
setPreferredSize(new java.awt.Dimension(474, 25)); |
||||
|
||||
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING); |
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(MatDefEditorToolBar.class, "MatDefEditorToolBar.jLabel1.text")); // NOI18N
|
||||
|
||||
techniqueComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); |
||||
techniqueComboBox.addActionListener(new java.awt.event.ActionListener() { |
||||
public void actionPerformed(java.awt.event.ActionEvent evt) { |
||||
techniqueComboBoxActionPerformed(evt); |
||||
} |
||||
}); |
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
||||
this.setLayout(layout); |
||||
layout.setHorizontalGroup( |
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||
.addGroup(layout.createSequentialGroup() |
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) |
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
||||
.addComponent(techniqueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE) |
||||
.addGap(0, 337, Short.MAX_VALUE)) |
||||
); |
||||
layout.setVerticalGroup( |
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
||||
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE) |
||||
.addComponent(techniqueComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) |
||||
); |
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void techniqueComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_techniqueComboBoxActionPerformed
|
||||
parent.switchTechnique((TechniqueBlock)techniqueComboBox.getSelectedItem()); |
||||
}//GEN-LAST:event_techniqueComboBoxActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel jLabel1; |
||||
private javax.swing.JComboBox techniqueComboBox; |
||||
// End of variables declaration//GEN-END:variables
|
||||
} |
Loading…
Reference in new issue