sdk :
- You can now select a texture in texture browser by double clicking it git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7986 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
b035d52fa2
commit
d216390a00
@ -55,6 +55,9 @@
|
|||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Component class="javax.swing.JTree" name="jTree1">
|
<Component class="javax.swing.JTree" name="jTree1">
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jTree1MouseClicked"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
@ -70,7 +73,7 @@
|
|||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<Component id="jScrollPane2" pref="412" max="32767" attributes="1"/>
|
<Component id="jScrollPane2" pref="420" max="32767" attributes="1"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="infoLabel" min="-2" pref="19" max="-2" attributes="0"/>
|
<Component id="infoLabel" min="-2" pref="19" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
@ -119,7 +122,7 @@
|
|||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace pref="358" max="32767" attributes="0"/>
|
<EmptySpace pref="423" max="32767" attributes="0"/>
|
||||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
@ -37,6 +37,7 @@ import com.jme3.gde.core.util.TreeUtil;
|
|||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -101,6 +102,11 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
setTitle(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.title")); // NOI18N
|
setTitle(org.openide.util.NbBundle.getMessage(TextureBrowser.class, "TextureBrowser.title")); // NOI18N
|
||||||
|
|
||||||
|
jTree1.addMouseListener(new java.awt.event.MouseAdapter() {
|
||||||
|
public void mouseClicked(java.awt.event.MouseEvent evt) {
|
||||||
|
jTree1MouseClicked(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
jScrollPane3.setViewportView(jTree1);
|
jScrollPane3.setViewportView(jTree1);
|
||||||
|
|
||||||
imagePreviewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
imagePreviewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
@ -115,13 +121,13 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
jPanel2.setLayout(jPanel2Layout);
|
jPanel2.setLayout(jPanel2Layout);
|
||||||
jPanel2Layout.setHorizontalGroup(
|
jPanel2Layout.setHorizontalGroup(
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE)
|
.addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE)
|
||||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE)
|
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 553, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
jPanel2Layout.setVerticalGroup(
|
jPanel2Layout.setVerticalGroup(
|
||||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
|
||||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE)
|
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(infoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(infoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
);
|
);
|
||||||
@ -147,7 +153,7 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
.addGroup(jPanel3Layout.createSequentialGroup()
|
.addGroup(jPanel3Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(cancelButton)
|
.addComponent(cancelButton)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 358, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 423, Short.MAX_VALUE)
|
||||||
.addComponent(okButton)
|
.addComponent(okButton)
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
@ -157,7 +163,7 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(cancelButton)
|
.addComponent(cancelButton)
|
||||||
.addComponent(okButton))
|
.addComponent(okButton))
|
||||||
.addContainerGap(11, Short.MAX_VALUE))
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
@ -177,22 +183,31 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 477, Short.MAX_VALUE)
|
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||||
setTexture();
|
if (setTexture()) {
|
||||||
dispose();
|
dispose();
|
||||||
|
}
|
||||||
}//GEN-LAST:event_okButtonActionPerformed
|
}//GEN-LAST:event_okButtonActionPerformed
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||||
dispose();
|
dispose();
|
||||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||||
|
|
||||||
private void setTexture() {
|
private void jTree1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTree1MouseClicked
|
||||||
|
if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
|
||||||
|
if (setTexture()) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}//GEN-LAST:event_jTree1MouseClicked
|
||||||
|
|
||||||
|
private boolean setTexture() {
|
||||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getLastSelectedPathComponent();
|
DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getLastSelectedPathComponent();
|
||||||
|
|
||||||
//Object nodeInfo = node.getUserObject();
|
//Object nodeInfo = node.getUserObject();
|
||||||
@ -202,10 +217,11 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|||||||
Texture tex = assetManager.loadTexture(selected);
|
Texture tex = assetManager.loadTexture(selected);
|
||||||
editor.setValue(tex);
|
editor.setValue(tex);
|
||||||
editor.setAsText(selected);
|
editor.setAsText(selected);
|
||||||
} else {
|
return true;
|
||||||
editor.setValue(null);
|
|
||||||
editor.setAsText(null);
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
// if (textureList.getSelectedIndex() > -1) {
|
// if (textureList.getSelectedIndex() > -1) {
|
||||||
// textureList.getSelectedValue();
|
// textureList.getSelectedValue();
|
||||||
// String selected = (String) textureList.getSelectedValue();
|
// String selected = (String) textureList.getSelectedValue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user