- Added a material browser custom editor to pick materials. - refactored the material preview to a widget, with possibility to preview on a sphere a box or a quad. - changed the material editor preview by the new widget git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7960 75d07b2b-3a1a-0410-a2c5-0572b91ccdca3.0
parent
8dba313b4a
commit
2b2daf2090
@ -0,0 +1,162 @@ |
|||||||
|
<?xml version="1.1" encoding="UTF-8" ?> |
||||||
|
|
||||||
|
<Form version="1.4" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> |
||||||
|
<Properties> |
||||||
|
<Property name="defaultCloseOperation" type="int" value="2"/> |
||||||
|
<Property name="title" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/Bundle.properties" key="MaterialBrowser.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
</Properties> |
||||||
|
<SyntheticProperties> |
||||||
|
<SyntheticProperty name="formSizePolicy" type="int" value="2"/> |
||||||
|
</SyntheticProperties> |
||||||
|
<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="false"/> |
||||||
|
<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="jScrollPane1" min="-2" pref="257" max="-2" attributes="0"/> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
<Group type="103" groupAlignment="0" attributes="0"> |
||||||
|
<Component id="jScrollPane2" pref="483" max="32767" attributes="0"/> |
||||||
|
<Component id="jPanel1" max="32767" attributes="0"/> |
||||||
|
<Group type="102" alignment="0" attributes="0"> |
||||||
|
<Component id="jPanel2" max="32767" attributes="0"/> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</Group> |
||||||
|
</Group> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
<DimensionLayout dim="1"> |
||||||
|
<Group type="103" groupAlignment="0" attributes="0"> |
||||||
|
<Group type="102" alignment="0" attributes="0"> |
||||||
|
<Component id="jPanel1" min="-2" max="-2" attributes="0"/> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
<Component id="jScrollPane2" pref="250" max="32767" attributes="0"/> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
<Component id="jPanel2" min="-2" max="-2" attributes="1"/> |
||||||
|
</Group> |
||||||
|
<Component id="jScrollPane1" alignment="0" pref="497" max="32767" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
</Layout> |
||||||
|
<SubComponents> |
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane1"> |
||||||
|
<AuxValues> |
||||||
|
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> |
||||||
|
</AuxValues> |
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> |
||||||
|
<SubComponents> |
||||||
|
<Component class="javax.swing.JTree" name="jTree1"> |
||||||
|
</Component> |
||||||
|
</SubComponents> |
||||||
|
</Container> |
||||||
|
<Container class="javax.swing.JPanel" name="jPanel1"> |
||||||
|
<Properties> |
||||||
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> |
||||||
|
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo"> |
||||||
|
<LineBorder> |
||||||
|
<Color PropertyName="color" blue="99" green="99" red="99" type="rgb"/> |
||||||
|
</LineBorder> |
||||||
|
</Border> |
||||||
|
</Property> |
||||||
|
</Properties> |
||||||
|
|
||||||
|
<Layout> |
||||||
|
<DimensionLayout dim="0"> |
||||||
|
<Group type="103" groupAlignment="0" attributes="0"> |
||||||
|
<Component id="materialPreviewWidget1" alignment="0" pref="481" max="32767" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
<DimensionLayout dim="1"> |
||||||
|
<Group type="103" groupAlignment="0" attributes="0"> |
||||||
|
<Component id="materialPreviewWidget1" min="-2" pref="188" max="-2" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
</Layout> |
||||||
|
<SubComponents> |
||||||
|
<Component class="com.jme3.gde.materials.multiview.widgets.MaterialPreviewWidget" name="materialPreviewWidget1"> |
||||||
|
</Component> |
||||||
|
</SubComponents> |
||||||
|
</Container> |
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane2"> |
||||||
|
<AuxValues> |
||||||
|
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> |
||||||
|
</AuxValues> |
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> |
||||||
|
<SubComponents> |
||||||
|
<Component class="javax.swing.JTextArea" name="materialTextPreview"> |
||||||
|
<Properties> |
||||||
|
<Property name="columns" type="int" value="20"/> |
||||||
|
<Property name="editable" type="boolean" value="false"/> |
||||||
|
<Property name="rows" type="int" value="5"/> |
||||||
|
</Properties> |
||||||
|
</Component> |
||||||
|
</SubComponents> |
||||||
|
</Container> |
||||||
|
<Container class="javax.swing.JPanel" name="jPanel2"> |
||||||
|
|
||||||
|
<Layout> |
||||||
|
<DimensionLayout dim="0"> |
||||||
|
<Group type="103" groupAlignment="0" attributes="0"> |
||||||
|
<Group type="102" alignment="1" attributes="0"> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
<Component id="cancelButton" min="-2" max="-2" attributes="0"/> |
||||||
|
<EmptySpace pref="343" max="32767" attributes="0"/> |
||||||
|
<Component id="okButton" min="-2" max="-2" attributes="0"/> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
<DimensionLayout dim="1"> |
||||||
|
<Group type="103" groupAlignment="0" attributes="0"> |
||||||
|
<Group type="102" attributes="0"> |
||||||
|
<EmptySpace max="32767" attributes="0"/> |
||||||
|
<Group type="103" groupAlignment="3" attributes="0"> |
||||||
|
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/> |
||||||
|
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="1"/> |
||||||
|
</Group> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
</Layout> |
||||||
|
<SubComponents> |
||||||
|
<Component class="javax.swing.JButton" name="okButton"> |
||||||
|
<Properties> |
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/Bundle.properties" key="MaterialBrowser.okButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
</Properties> |
||||||
|
<Events> |
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/> |
||||||
|
</Events> |
||||||
|
</Component> |
||||||
|
<Component class="javax.swing.JButton" name="cancelButton"> |
||||||
|
<Properties> |
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/Bundle.properties" key="MaterialBrowser.cancelButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
</Properties> |
||||||
|
<Events> |
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/> |
||||||
|
</Events> |
||||||
|
</Component> |
||||||
|
</SubComponents> |
||||||
|
</Container> |
||||||
|
</SubComponents> |
||||||
|
</Form> |
@ -0,0 +1,263 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
|
||||||
|
/* |
||||||
|
* MaterialBrowser.java |
||||||
|
* |
||||||
|
* Created on 31 juil. 2011, 12:20:52 |
||||||
|
*/ |
||||||
|
package com.jme3.gde.materials; |
||||||
|
|
||||||
|
import com.jme3.gde.core.assets.ProjectAssetManager; |
||||||
|
import com.jme3.gde.core.util.TreeUtil; |
||||||
|
import com.jme3.material.Material; |
||||||
|
import java.awt.event.WindowEvent; |
||||||
|
import java.awt.event.WindowListener; |
||||||
|
import java.io.FileReader; |
||||||
|
import java.io.IOException; |
||||||
|
import java.util.logging.Logger; |
||||||
|
import javax.swing.event.TreeSelectionEvent; |
||||||
|
import javax.swing.event.TreeSelectionListener; |
||||||
|
import javax.swing.tree.DefaultMutableTreeNode; |
||||||
|
import javax.swing.tree.TreeNode; |
||||||
|
import javax.swing.tree.TreePath; |
||||||
|
import javax.swing.tree.TreeSelectionModel; |
||||||
|
import org.openide.util.Exceptions; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Nehon |
||||||
|
*/ |
||||||
|
public class MaterialBrowser extends javax.swing.JDialog implements TreeSelectionListener, WindowListener { |
||||||
|
|
||||||
|
private ProjectAssetManager assetManager; |
||||||
|
private MaterialPropertyEditor editor; |
||||||
|
|
||||||
|
/** Creates new form MaterialBrowser */ |
||||||
|
public MaterialBrowser(java.awt.Frame parent, boolean modal, ProjectAssetManager assetManager, MaterialPropertyEditor editor) { |
||||||
|
this.assetManager = assetManager; |
||||||
|
this.editor = editor; |
||||||
|
initComponents(); |
||||||
|
loadAvailableMaterials(); |
||||||
|
setSelectedMaterial((Material) editor.getValue()); |
||||||
|
setLocationRelativeTo(null); |
||||||
|
} |
||||||
|
|
||||||
|
private void loadAvailableMaterials() { |
||||||
|
if (assetManager == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
String[] leaves = assetManager.getMaterials(); |
||||||
|
TreeUtil.createTree(jTree1, leaves); |
||||||
|
TreeUtil.expandTree(jTree1, (TreeNode) jTree1.getModel().getRoot(), 1); |
||||||
|
jTree1.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); |
||||||
|
jTree1.addTreeSelectionListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
private void setMaterial() { |
||||||
|
DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getLastSelectedPathComponent(); |
||||||
|
|
||||||
|
if (node != null && node.isLeaf()) { |
||||||
|
String selected = TreeUtil.getPath(node.getUserObjectPath()); |
||||||
|
selected = selected.substring(0, selected.lastIndexOf("/")); |
||||||
|
Material mat = assetManager.loadMaterial(selected); |
||||||
|
editor.setValue(mat); |
||||||
|
editor.setAsText(selected); |
||||||
|
} else { |
||||||
|
editor.setValue(null); |
||||||
|
editor.setAsText(null); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void setSelectedMaterial(Material material) { |
||||||
|
if (material != null) { |
||||||
|
Logger.getLogger(MaterialBrowser.class.getName()).finer("Looking for Texture: " + material.getAssetName()); |
||||||
|
String[] path = ("/" + material.getAssetName()).split("/"); |
||||||
|
TreePath parent = new TreePath((TreeNode) jTree1.getModel().getRoot()); |
||||||
|
jTree1.expandPath(TreeUtil.buildTreePath(jTree1, parent, path, 0, true)); |
||||||
|
jTree1.getSelectionModel().setSelectionPath(TreeUtil.buildTreePath(jTree1, parent, path, 0, false)); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void valueChanged(TreeSelectionEvent e) { |
||||||
|
DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getLastSelectedPathComponent(); |
||||||
|
|
||||||
|
if (node == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
if (node.isLeaf()) { |
||||||
|
String selected = TreeUtil.getPath(node.getUserObjectPath()); |
||||||
|
selected = selected.substring(0, selected.lastIndexOf("/")); |
||||||
|
|
||||||
|
materialPreviewWidget1.showMaterial(assetManager, selected); |
||||||
|
|
||||||
|
try { |
||||||
|
FileReader fr = new FileReader(assetManager.getAbsoluteAssetPath(selected)); |
||||||
|
|
||||||
|
if (fr != null) { |
||||||
|
char[] b = new char[5000];//preview 5000 char
|
||||||
|
fr.read(b); |
||||||
|
materialTextPreview.setText(new String(b).trim()); |
||||||
|
} |
||||||
|
} catch (IOException ex) { |
||||||
|
Exceptions.printStackTrace(ex); |
||||||
|
} |
||||||
|
|
||||||
|
} else { |
||||||
|
materialPreviewWidget1.clear(); |
||||||
|
materialTextPreview.setText(""); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** 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() { |
||||||
|
|
||||||
|
jScrollPane1 = new javax.swing.JScrollPane(); |
||||||
|
jTree1 = new javax.swing.JTree(); |
||||||
|
jPanel1 = new javax.swing.JPanel(); |
||||||
|
materialPreviewWidget1 = new com.jme3.gde.materials.multiview.widgets.MaterialPreviewWidget(); |
||||||
|
jScrollPane2 = new javax.swing.JScrollPane(); |
||||||
|
materialTextPreview = new javax.swing.JTextArea(); |
||||||
|
jPanel2 = new javax.swing.JPanel(); |
||||||
|
okButton = new javax.swing.JButton(); |
||||||
|
cancelButton = new javax.swing.JButton(); |
||||||
|
|
||||||
|
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); |
||||||
|
setTitle(org.openide.util.NbBundle.getMessage(MaterialBrowser.class, "MaterialBrowser.title")); // NOI18N
|
||||||
|
|
||||||
|
jScrollPane1.setViewportView(jTree1); |
||||||
|
|
||||||
|
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); |
||||||
|
|
||||||
|
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); |
||||||
|
jPanel1.setLayout(jPanel1Layout); |
||||||
|
jPanel1Layout.setHorizontalGroup( |
||||||
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addComponent(materialPreviewWidget1, javax.swing.GroupLayout.DEFAULT_SIZE, 481, Short.MAX_VALUE) |
||||||
|
); |
||||||
|
jPanel1Layout.setVerticalGroup( |
||||||
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addComponent(materialPreviewWidget1, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE) |
||||||
|
); |
||||||
|
|
||||||
|
materialTextPreview.setColumns(20); |
||||||
|
materialTextPreview.setEditable(false); |
||||||
|
materialTextPreview.setRows(5); |
||||||
|
jScrollPane2.setViewportView(materialTextPreview); |
||||||
|
|
||||||
|
okButton.setText(org.openide.util.NbBundle.getMessage(MaterialBrowser.class, "MaterialBrowser.okButton.text")); // NOI18N
|
||||||
|
okButton.addActionListener(new java.awt.event.ActionListener() { |
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) { |
||||||
|
okButtonActionPerformed(evt); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
cancelButton.setText(org.openide.util.NbBundle.getMessage(MaterialBrowser.class, "MaterialBrowser.cancelButton.text")); // NOI18N
|
||||||
|
cancelButton.addActionListener(new java.awt.event.ActionListener() { |
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) { |
||||||
|
cancelButtonActionPerformed(evt); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); |
||||||
|
jPanel2.setLayout(jPanel2Layout); |
||||||
|
jPanel2Layout.setHorizontalGroup( |
||||||
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() |
||||||
|
.addContainerGap() |
||||||
|
.addComponent(cancelButton) |
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 343, Short.MAX_VALUE) |
||||||
|
.addComponent(okButton) |
||||||
|
.addContainerGap()) |
||||||
|
); |
||||||
|
jPanel2Layout.setVerticalGroup( |
||||||
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addGroup(jPanel2Layout.createSequentialGroup() |
||||||
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
||||||
|
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
||||||
|
.addComponent(okButton) |
||||||
|
.addComponent(cancelButton)) |
||||||
|
.addContainerGap()) |
||||||
|
); |
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); |
||||||
|
getContentPane().setLayout(layout); |
||||||
|
layout.setHorizontalGroup( |
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addGroup(layout.createSequentialGroup() |
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE) |
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 483, Short.MAX_VALUE) |
||||||
|
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
||||||
|
.addGroup(layout.createSequentialGroup() |
||||||
|
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
||||||
|
.addContainerGap()))) |
||||||
|
); |
||||||
|
layout.setVerticalGroup( |
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addGroup(layout.createSequentialGroup() |
||||||
|
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
||||||
|
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 250, Short.MAX_VALUE) |
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
||||||
|
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) |
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 497, Short.MAX_VALUE) |
||||||
|
); |
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||||
|
setMaterial(); |
||||||
|
dispose(); |
||||||
|
materialPreviewWidget1.cleanUp(); |
||||||
|
}//GEN-LAST:event_okButtonActionPerformed
|
||||||
|
|
||||||
|
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||||
|
dispose(); |
||||||
|
materialPreviewWidget1.cleanUp(); |
||||||
|
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JButton cancelButton; |
||||||
|
private javax.swing.JPanel jPanel1; |
||||||
|
private javax.swing.JPanel jPanel2; |
||||||
|
private javax.swing.JScrollPane jScrollPane1; |
||||||
|
private javax.swing.JScrollPane jScrollPane2; |
||||||
|
private javax.swing.JTree jTree1; |
||||||
|
private com.jme3.gde.materials.multiview.widgets.MaterialPreviewWidget materialPreviewWidget1; |
||||||
|
private javax.swing.JTextArea materialTextPreview; |
||||||
|
private javax.swing.JButton okButton; |
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
public void windowOpened(WindowEvent e) { |
||||||
|
} |
||||||
|
|
||||||
|
public void windowClosing(WindowEvent e) { |
||||||
|
materialPreviewWidget1.cleanUp(); |
||||||
|
} |
||||||
|
|
||||||
|
public void windowClosed(WindowEvent e) { |
||||||
|
} |
||||||
|
|
||||||
|
public void windowIconified(WindowEvent e) { |
||||||
|
} |
||||||
|
|
||||||
|
public void windowDeiconified(WindowEvent e) { |
||||||
|
} |
||||||
|
|
||||||
|
public void windowActivated(WindowEvent e) { |
||||||
|
} |
||||||
|
|
||||||
|
public void windowDeactivated(WindowEvent e) { |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,126 @@ |
|||||||
|
<?xml version="1.1" encoding="UTF-8" ?> |
||||||
|
|
||||||
|
<Form version="1.5" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> |
||||||
|
<NonVisualComponents> |
||||||
|
<Component class="javax.swing.ButtonGroup" name="toggleButtonGroup"> |
||||||
|
</Component> |
||||||
|
</NonVisualComponents> |
||||||
|
<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="false"/> |
||||||
|
<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"> |
||||||
|
<Component id="previewLabel" alignment="0" pref="120" max="32767" attributes="0"/> |
||||||
|
<Component id="jToolBar1" alignment="0" pref="120" max="32767" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
<DimensionLayout dim="1"> |
||||||
|
<Group type="103" groupAlignment="0" attributes="0"> |
||||||
|
<Group type="102" alignment="1" attributes="0"> |
||||||
|
<Component id="previewLabel" pref="120" max="32767" attributes="0"/> |
||||||
|
<EmptySpace max="-2" attributes="0"/> |
||||||
|
<Component id="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/> |
||||||
|
</Group> |
||||||
|
</Group> |
||||||
|
</DimensionLayout> |
||||||
|
</Layout> |
||||||
|
<SubComponents> |
||||||
|
<Component class="javax.swing.JLabel" name="previewLabel"> |
||||||
|
<Properties> |
||||||
|
<Property name="horizontalAlignment" type="int" value="0"/> |
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="MaterialPreviewWidget.previewLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
</Properties> |
||||||
|
</Component> |
||||||
|
<Container class="javax.swing.JToolBar" name="jToolBar1"> |
||||||
|
<Properties> |
||||||
|
<Property name="floatable" type="boolean" value="false"/> |
||||||
|
<Property name="rollover" type="boolean" value="true"/> |
||||||
|
</Properties> |
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> |
||||||
|
<SubComponents> |
||||||
|
<Component class="javax.swing.JToggleButton" name="sphereButton"> |
||||||
|
<Properties> |
||||||
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor"> |
||||||
|
<ComponentRef name="toggleButtonGroup"/> |
||||||
|
</Property> |
||||||
|
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> |
||||||
|
<Image iconType="3" name="/com/jme3/gde/materials/multiview/widgets/icons/sphere.png"/> |
||||||
|
</Property> |
||||||
|
<Property name="selected" type="boolean" value="true"/> |
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="MaterialPreviewWidget.sphereButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="MaterialPreviewWidget.sphereButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
<Property name="focusable" type="boolean" value="false"/> |
||||||
|
<Property name="horizontalAlignment" type="int" value="4"/> |
||||||
|
<Property name="horizontalTextPosition" type="int" value="0"/> |
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/> |
||||||
|
</Properties> |
||||||
|
<Events> |
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sphereButtonActionPerformed"/> |
||||||
|
</Events> |
||||||
|
</Component> |
||||||
|
<Component class="javax.swing.JToggleButton" name="cubeButton"> |
||||||
|
<Properties> |
||||||
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor"> |
||||||
|
<ComponentRef name="toggleButtonGroup"/> |
||||||
|
</Property> |
||||||
|
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> |
||||||
|
<Image iconType="3" name="/com/jme3/gde/materials/multiview/widgets/icons/box.png"/> |
||||||
|
</Property> |
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="MaterialPreviewWidget.cubeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="MaterialPreviewWidget.cubeButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
<Property name="focusable" type="boolean" value="false"/> |
||||||
|
<Property name="horizontalTextPosition" type="int" value="0"/> |
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/> |
||||||
|
</Properties> |
||||||
|
<Events> |
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cubeButtonActionPerformed"/> |
||||||
|
</Events> |
||||||
|
</Component> |
||||||
|
<Component class="javax.swing.JToggleButton" name="planeButton"> |
||||||
|
<Properties> |
||||||
|
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor"> |
||||||
|
<ComponentRef name="toggleButtonGroup"/> |
||||||
|
</Property> |
||||||
|
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> |
||||||
|
<Image iconType="3" name="/com/jme3/gde/materials/multiview/widgets/icons/plane.png"/> |
||||||
|
</Property> |
||||||
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="MaterialPreviewWidget.planeButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> |
||||||
|
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="MaterialPreviewWidget.planeButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> |
||||||
|
</Property> |
||||||
|
<Property name="focusable" type="boolean" value="false"/> |
||||||
|
<Property name="horizontalAlignment" type="int" value="4"/> |
||||||
|
<Property name="horizontalTextPosition" type="int" value="0"/> |
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/> |
||||||
|
</Properties> |
||||||
|
<Events> |
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="planeButtonActionPerformed"/> |
||||||
|
</Events> |
||||||
|
</Component> |
||||||
|
</SubComponents> |
||||||
|
</Container> |
||||||
|
</SubComponents> |
||||||
|
</Form> |
@ -0,0 +1,234 @@ |
|||||||
|
/* |
||||||
|
* To change this template, choose Tools | Templates |
||||||
|
* and open the template in the editor. |
||||||
|
*/ |
||||||
|
|
||||||
|
/* |
||||||
|
* MaterialPreviewWidget.java |
||||||
|
* |
||||||
|
* Created on 1 août 2011, 10:27:05 |
||||||
|
*/ |
||||||
|
package com.jme3.gde.materials.multiview.widgets; |
||||||
|
|
||||||
|
import com.jme3.asset.MaterialKey; |
||||||
|
import com.jme3.gde.core.assets.ProjectAssetManager; |
||||||
|
import com.jme3.gde.core.scene.PreviewRequest; |
||||||
|
import com.jme3.gde.core.scene.SceneApplication; |
||||||
|
import com.jme3.gde.core.scene.SceneListener; |
||||||
|
import com.jme3.gde.core.scene.SceneRequest; |
||||||
|
import com.jme3.material.Material; |
||||||
|
import com.jme3.math.FastMath; |
||||||
|
import com.jme3.math.Quaternion; |
||||||
|
import com.jme3.math.Vector3f; |
||||||
|
import com.jme3.scene.Geometry; |
||||||
|
import com.jme3.scene.shape.Box; |
||||||
|
import com.jme3.scene.shape.Quad; |
||||||
|
import com.jme3.scene.shape.Sphere; |
||||||
|
import com.jme3.util.TangentBinormalGenerator; |
||||||
|
import javax.swing.ImageIcon; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author Nehon |
||||||
|
*/ |
||||||
|
public class MaterialPreviewWidget extends javax.swing.JPanel implements SceneListener { |
||||||
|
|
||||||
|
private Geometry sphere; |
||||||
|
private Geometry box; |
||||||
|
private Geometry quad; |
||||||
|
private Geometry currentGeom; |
||||||
|
private Material currentMaterial; |
||||||
|
private boolean init=false; |
||||||
|
|
||||||
|
/** Creates new form MaterialPreviewWidget */ |
||||||
|
public MaterialPreviewWidget() { |
||||||
|
initComponents(); |
||||||
|
} |
||||||
|
|
||||||
|
private void initWidget() { |
||||||
|
SceneApplication.getApplication().addSceneListener(this); |
||||||
|
Sphere sphMesh = new Sphere(32, 32, 2.5f); |
||||||
|
sphMesh.setTextureMode(Sphere.TextureMode.Projected); |
||||||
|
sphMesh.updateGeometry(32, 32, 2.5f, false, false); |
||||||
|
TangentBinormalGenerator.generate(sphMesh); |
||||||
|
sphere = new Geometry("previewSphere", sphMesh); |
||||||
|
sphere.setLocalRotation(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_X)); |
||||||
|
|
||||||
|
Box boxMesh = new Box(new Vector3f(0, 0, 0), 1.75f, 1.75f, 1.75f); |
||||||
|
TangentBinormalGenerator.generate(boxMesh); |
||||||
|
box = new Geometry("previewBox", boxMesh); |
||||||
|
box.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.DEG_TO_RAD * 30, Vector3f.UNIT_X).multLocal(new Quaternion().fromAngleAxis(FastMath.QUARTER_PI, Vector3f.UNIT_Y))); |
||||||
|
|
||||||
|
Quad quadMesh = new Quad(4.5f, 4.5f); |
||||||
|
TangentBinormalGenerator.generate(quadMesh); |
||||||
|
quad = new Geometry("previewQuad", quadMesh); |
||||||
|
quad.setLocalTranslation(new Vector3f(-2.25f, -2.25f, 0)); |
||||||
|
|
||||||
|
currentGeom = sphere; |
||||||
|
sphereButton.setSelected(true); |
||||||
|
init=true; |
||||||
|
} |
||||||
|
|
||||||
|
@SuppressWarnings("unchecked") |
||||||
|
public void showMaterial(ProjectAssetManager assetManager, String materialFileName) { |
||||||
|
if(!init){ |
||||||
|
initWidget(); |
||||||
|
} |
||||||
|
try { |
||||||
|
MaterialKey key = new MaterialKey(assetManager.getRelativeAssetPath(materialFileName)); |
||||||
|
assetManager.deleteFromCache(key); |
||||||
|
Material mat = (Material) assetManager.loadAsset(key); |
||||||
|
if (mat != null) { |
||||||
|
currentMaterial = mat; |
||||||
|
doShowMaterial(mat); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void doShowMaterial(Material m) { |
||||||
|
|
||||||
|
// geom.setLocalTranslation(-2.5f, -2.5f, 0);
|
||||||
|
// geom.lookAt(new Vector3f(5, 5, 5), Vector3f.UNIT_Y);
|
||||||
|
currentGeom.setMaterial(m); |
||||||
|
if (currentGeom.getMaterial() != null) { |
||||||
|
PreviewRequest request = new PreviewRequest(this, currentGeom); |
||||||
|
request.getCameraRequest().setLocation(new Vector3f(0, 0, 7)); |
||||||
|
request.getCameraRequest().setLookAt(new Vector3f(0, 0, 0), Vector3f.UNIT_Y); |
||||||
|
SceneApplication.getApplication().createPreview(request); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void clear() { |
||||||
|
previewLabel.setIcon(null); |
||||||
|
} |
||||||
|
|
||||||
|
public void sceneRequested(SceneRequest request) { |
||||||
|
} |
||||||
|
|
||||||
|
public boolean sceneClose(SceneRequest request) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public void cleanUp(){ |
||||||
|
SceneApplication.getApplication().removeSceneListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
public void previewRequested(PreviewRequest request) { |
||||||
|
if (request.getRequester() == this) { |
||||||
|
final ImageIcon icon = new ImageIcon(request.getImage()); |
||||||
|
java.awt.EventQueue.invokeLater(new Runnable() { |
||||||
|
|
||||||
|
public void run() { |
||||||
|
previewLabel.setIcon(icon); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** 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() { |
||||||
|
|
||||||
|
toggleButtonGroup = new javax.swing.ButtonGroup(); |
||||||
|
previewLabel = new javax.swing.JLabel(); |
||||||
|
jToolBar1 = new javax.swing.JToolBar(); |
||||||
|
sphereButton = new javax.swing.JToggleButton(); |
||||||
|
cubeButton = new javax.swing.JToggleButton(); |
||||||
|
planeButton = new javax.swing.JToggleButton(); |
||||||
|
|
||||||
|
previewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); |
||||||
|
previewLabel.setText(org.openide.util.NbBundle.getMessage(MaterialPreviewWidget.class, "MaterialPreviewWidget.previewLabel.text")); // NOI18N
|
||||||
|
|
||||||
|
jToolBar1.setFloatable(false); |
||||||
|
jToolBar1.setRollover(true); |
||||||
|
|
||||||
|
toggleButtonGroup.add(sphereButton); |
||||||
|
sphereButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materials/multiview/widgets/icons/sphere.png"))); // NOI18N
|
||||||
|
sphereButton.setSelected(true); |
||||||
|
sphereButton.setText(org.openide.util.NbBundle.getMessage(MaterialPreviewWidget.class, "MaterialPreviewWidget.sphereButton.text")); // NOI18N
|
||||||
|
sphereButton.setToolTipText(org.openide.util.NbBundle.getMessage(MaterialPreviewWidget.class, "MaterialPreviewWidget.sphereButton.toolTipText")); // NOI18N
|
||||||
|
sphereButton.setFocusable(false); |
||||||
|
sphereButton.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||||||
|
sphereButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
||||||
|
sphereButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
||||||
|
sphereButton.addActionListener(new java.awt.event.ActionListener() { |
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) { |
||||||
|
sphereButtonActionPerformed(evt); |
||||||
|
} |
||||||
|
}); |
||||||
|
jToolBar1.add(sphereButton); |
||||||
|
|
||||||
|
toggleButtonGroup.add(cubeButton); |
||||||
|
cubeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materials/multiview/widgets/icons/box.png"))); // NOI18N
|
||||||
|
cubeButton.setText(org.openide.util.NbBundle.getMessage(MaterialPreviewWidget.class, "MaterialPreviewWidget.cubeButton.text")); // NOI18N
|
||||||
|
cubeButton.setToolTipText(org.openide.util.NbBundle.getMessage(MaterialPreviewWidget.class, "MaterialPreviewWidget.cubeButton.toolTipText")); // NOI18N
|
||||||
|
cubeButton.setFocusable(false); |
||||||
|
cubeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
||||||
|
cubeButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
||||||
|
cubeButton.addActionListener(new java.awt.event.ActionListener() { |
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) { |
||||||
|
cubeButtonActionPerformed(evt); |
||||||
|
} |
||||||
|
}); |
||||||
|
jToolBar1.add(cubeButton); |
||||||
|
|
||||||
|
toggleButtonGroup.add(planeButton); |
||||||
|
planeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materials/multiview/widgets/icons/plane.png"))); // NOI18N
|
||||||
|
planeButton.setText(org.openide.util.NbBundle.getMessage(MaterialPreviewWidget.class, "MaterialPreviewWidget.planeButton.text")); // NOI18N
|
||||||
|
planeButton.setToolTipText(org.openide.util.NbBundle.getMessage(MaterialPreviewWidget.class, "MaterialPreviewWidget.planeButton.toolTipText")); // NOI18N
|
||||||
|
planeButton.setFocusable(false); |
||||||
|
planeButton.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
||||||
|
planeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); |
||||||
|
planeButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); |
||||||
|
planeButton.addActionListener(new java.awt.event.ActionListener() { |
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) { |
||||||
|
planeButtonActionPerformed(evt); |
||||||
|
} |
||||||
|
}); |
||||||
|
jToolBar1.add(planeButton); |
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
||||||
|
this.setLayout(layout); |
||||||
|
layout.setHorizontalGroup( |
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addComponent(previewLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) |
||||||
|
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) |
||||||
|
); |
||||||
|
layout.setVerticalGroup( |
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() |
||||||
|
.addComponent(previewLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) |
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
||||||
|
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)) |
||||||
|
); |
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
private void sphereButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sphereButtonActionPerformed
|
||||||
|
currentGeom = sphere; |
||||||
|
doShowMaterial(currentMaterial); |
||||||
|
}//GEN-LAST:event_sphereButtonActionPerformed
|
||||||
|
|
||||||
|
private void cubeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cubeButtonActionPerformed
|
||||||
|
currentGeom = box; |
||||||
|
doShowMaterial(currentMaterial); |
||||||
|
}//GEN-LAST:event_cubeButtonActionPerformed
|
||||||
|
|
||||||
|
private void planeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_planeButtonActionPerformed
|
||||||
|
currentGeom = quad; |
||||||
|
doShowMaterial(currentMaterial); |
||||||
|
}//GEN-LAST:event_planeButtonActionPerformed
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JToggleButton cubeButton; |
||||||
|
private javax.swing.JToolBar jToolBar1; |
||||||
|
private javax.swing.JToggleButton planeButton; |
||||||
|
private javax.swing.JLabel previewLabel; |
||||||
|
private javax.swing.JToggleButton sphereButton; |
||||||
|
private javax.swing.ButtonGroup toggleButtonGroup; |
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
} |
After Width: | Height: | Size: 718 B |
After Width: | Height: | Size: 591 B |
After Width: | Height: | Size: 910 B |
Loading…
Reference in new issue