|
@@ -37,6 +37,7 @@ import com.jme3.gde.core.util.TreeUtil;
|
|
|
import com.jme3.texture.Texture;
|
|
|
import java.awt.Color;
|
|
|
import java.awt.Graphics2D;
|
|
|
+import java.awt.event.MouseEvent;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
@@ -101,6 +102,11 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|
|
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
|
|
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);
|
|
|
|
|
|
imagePreviewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
@@ -115,13 +121,13 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|
|
jPanel2.setLayout(jPanel2Layout);
|
|
|
jPanel2Layout.setHorizontalGroup(
|
|
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
- .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE)
|
|
|
- .addComponent(jScrollPane2, 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, 553, Short.MAX_VALUE)
|
|
|
);
|
|
|
jPanel2Layout.setVerticalGroup(
|
|
|
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
.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)
|
|
|
.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()
|
|
|
.addContainerGap()
|
|
|
.addComponent(cancelButton)
|
|
|
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 358, Short.MAX_VALUE)
|
|
|
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 423, Short.MAX_VALUE)
|
|
|
.addComponent(okButton)
|
|
|
.addContainerGap())
|
|
|
);
|
|
@@ -157,7 +163,7 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|
|
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
|
.addComponent(cancelButton)
|
|
|
.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());
|
|
@@ -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)
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
.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();
|
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
|
|
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
|
|
- setTexture();
|
|
|
- dispose();
|
|
|
+ if (setTexture()) {
|
|
|
+ dispose();
|
|
|
+ }
|
|
|
}//GEN-LAST:event_okButtonActionPerformed
|
|
|
|
|
|
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
|
|
dispose();
|
|
|
}//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();
|
|
|
|
|
|
//Object nodeInfo = node.getUserObject();
|
|
@@ -202,10 +217,11 @@ public class TextureBrowser extends javax.swing.JDialog implements TreeSelection
|
|
|
Texture tex = assetManager.loadTexture(selected);
|
|
|
editor.setValue(tex);
|
|
|
editor.setAsText(selected);
|
|
|
- } else {
|
|
|
- editor.setValue(null);
|
|
|
- editor.setAsText(null);
|
|
|
+ return true;
|
|
|
}
|
|
|
+ return false;
|
|
|
+
|
|
|
+
|
|
|
// if (textureList.getSelectedIndex() > -1) {
|
|
|
// textureList.getSelectedValue();
|
|
|
// String selected = (String) textureList.getSelectedValue();
|