Created a backdrop image for the ShaderNode editor

experimental
Nehon 10 years ago
parent 06e9618a4b
commit 7c88da9d5c
  1. 302
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/BackdropPanel.form
  2. 470
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/BackdropPanel.java
  3. 6
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Bundle.properties
  4. 19
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/Diagram.java
  5. 3
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatPanel.form
  6. 29
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/MatPanel.java
  7. 11
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/editor/OutBusPanel.java
  8. BIN
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/collapse.png
  9. BIN
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/frontBack.png
  10. BIN
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/pirates.wmv
  11. BIN
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/icons/previewIcons.psd

@ -0,0 +1,302 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<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"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="toolBar">
<Properties>
<Property name="opaque" type="boolean" value="false"/>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="expandButton" min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="bringToFrontButton" min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="sphereButton" min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="boxButton" min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="quadButton" min="-2" pref="16" max="-2" attributes="0"/>
<EmptySpace pref="90" max="32767" attributes="0"/>
<Component id="reloadButton" min="-2" pref="16" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="expandButton" alignment="0" min="-2" pref="16" max="-2" attributes="0"/>
<Component id="reloadButton" alignment="0" min="-2" pref="16" max="-2" attributes="0"/>
<Component id="sphereButton" min="-2" pref="16" max="-2" attributes="0"/>
<Component id="boxButton" min="-2" pref="16" max="-2" attributes="0"/>
<Component id="quadButton" min="-2" pref="16" max="-2" attributes="0"/>
<Component id="bringToFrontButton" alignment="0" min="-2" pref="16" max="-2" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="reloadButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="99" green="99" red="99" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/reload.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="BackdropPanel.reloadButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="borderPainted" type="boolean" value="false"/>
<Property name="contentAreaFilled" type="boolean" value="false"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Curseur par d&#xe9;faut"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="iconTextGap" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="reloadButtonMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="reloadButtonMouseExited"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="reloadButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="expandButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="99" green="99" red="99" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/collapse.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="BackdropPanel.expandButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="borderPainted" type="boolean" value="false"/>
<Property name="contentAreaFilled" type="boolean" value="false"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Curseur par d&#xe9;faut"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="iconTextGap" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="expandButtonMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="expandButtonMouseExited"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="expandButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="sphereButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="99" green="99" red="99" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/Sphere.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="BackdropPanel.sphereButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="borderPainted" type="boolean" value="false"/>
<Property name="contentAreaFilled" type="boolean" value="false"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Curseur par d&#xe9;faut"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="iconTextGap" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="sphereButtonMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="sphereButtonMouseExited"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="sphereButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="boxButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="99" green="99" red="99" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/cube.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="BackdropPanel.boxButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="borderPainted" type="boolean" value="false"/>
<Property name="contentAreaFilled" type="boolean" value="false"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Curseur par d&#xe9;faut"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="iconTextGap" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="boxButtonMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="boxButtonMouseExited"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="boxButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="quadButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="99" green="99" red="99" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/Quad.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="BackdropPanel.quadButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="borderPainted" type="boolean" value="false"/>
<Property name="contentAreaFilled" type="boolean" value="false"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Curseur par d&#xe9;faut"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="iconTextGap" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="quadButtonMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="quadButtonMouseExited"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="quadButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="bringToFrontButton">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="99" green="99" red="99" type="rgb"/>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/frontBack.png"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/materialdefinition/editor/Bundle.properties" key="BackdropPanel.bringToFrontButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/>
</Property>
<Property name="borderPainted" type="boolean" value="false"/>
<Property name="contentAreaFilled" type="boolean" value="false"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Curseur par d&#xe9;faut"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="iconTextGap" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[24, 24]"/>
</Property>
</Properties>
<Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="bringToFrontButtonMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="bringToFrontButtonMouseExited"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bringToFrontButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="previewLabel">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="64" green="64" red="64" type="rgb"/>
</Property>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="64" green="64" red="64" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="iconTextGap" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 100]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 100]"/>
</Property>
<Property name="opaque" type="boolean" value="true"/>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 100]"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Form>

@ -0,0 +1,470 @@
/*
* 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.materials.MaterialPreviewRenderer;
import com.jme3.material.Material;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JScrollPane;
import javax.swing.JViewport;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
/**
*
* @author Nehon
*/
public class BackdropPanel extends javax.swing.JPanel implements MouseListener, ChangeListener {
private final MaterialPreviewRenderer renderer;
private Material mat;
/**
* Creates new form BackdropPanel
*/
@SuppressWarnings("LeakingThisInConstructor")
public BackdropPanel() {
initComponents();
// setBounds(0, 0, 300, 300);
setLayout(null);
toolBar.setVisible(false);
addMouseListener(this);
renderer = new MaterialPreviewRenderer(previewLabel);
recalculateTimer.setRepeats(false);
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
updateComponents(e);
}
@Override
public void componentShown(ComponentEvent e) {
updateComponents(e);
}
@Override
public void componentMoved(ComponentEvent e) {
updateComponents(e);
}
});
previewLabel.setBounds(0, 0, 120, 120);
toolBar.setBounds(0, 0, 120, 16);
repaint();
}
private void updateComponents(ComponentEvent e) {
previewLabel.setBounds(0, 0, e.getComponent().getWidth(), e.getComponent().getHeight());
toolBar.setBounds(0, 0, e.getComponent().getWidth(), toolBar.getHeight());
repaint();
}
public void cleanup() {
renderer.cleanUp();
}
public void showMaterial(Material mat) {
if (isVisible()) {
this.mat = mat;
renderer.showMaterial(mat);
}
}
/**
* 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() {
toolBar = new javax.swing.JPanel();
reloadButton = new javax.swing.JButton();
expandButton = new javax.swing.JButton();
sphereButton = new javax.swing.JButton();
boxButton = new javax.swing.JButton();
quadButton = new javax.swing.JButton();
bringToFrontButton = new javax.swing.JButton();
previewLabel = new javax.swing.JLabel();
toolBar.setOpaque(false);
reloadButton.setBackground(new java.awt.Color(153, 153, 153));
reloadButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/reload.png"))); // NOI18N
reloadButton.setToolTipText(org.openide.util.NbBundle.getMessage(BackdropPanel.class, "BackdropPanel.reloadButton.toolTipText")); // NOI18N
reloadButton.setBorder(null);
reloadButton.setBorderPainted(false);
reloadButton.setContentAreaFilled(false);
reloadButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
reloadButton.setFocusable(false);
reloadButton.setIconTextGap(0);
reloadButton.setMaximumSize(new java.awt.Dimension(24, 24));
reloadButton.setMinimumSize(new java.awt.Dimension(24, 24));
reloadButton.setPreferredSize(new java.awt.Dimension(24, 24));
reloadButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
reloadButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
reloadButtonMouseExited(evt);
}
});
reloadButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
reloadButtonActionPerformed(evt);
}
});
expandButton.setBackground(new java.awt.Color(153, 153, 153));
expandButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/collapse.png"))); // NOI18N
expandButton.setToolTipText(org.openide.util.NbBundle.getMessage(BackdropPanel.class, "BackdropPanel.expandButton.toolTipText")); // NOI18N
expandButton.setBorder(null);
expandButton.setBorderPainted(false);
expandButton.setContentAreaFilled(false);
expandButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
expandButton.setFocusable(false);
expandButton.setIconTextGap(0);
expandButton.setMaximumSize(new java.awt.Dimension(24, 24));
expandButton.setMinimumSize(new java.awt.Dimension(24, 24));
expandButton.setPreferredSize(new java.awt.Dimension(24, 24));
expandButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
expandButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
expandButtonMouseExited(evt);
}
});
expandButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
expandButtonActionPerformed(evt);
}
});
sphereButton.setBackground(new java.awt.Color(153, 153, 153));
sphereButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/Sphere.png"))); // NOI18N
sphereButton.setToolTipText(org.openide.util.NbBundle.getMessage(BackdropPanel.class, "BackdropPanel.sphereButton.toolTipText")); // NOI18N
sphereButton.setBorder(null);
sphereButton.setBorderPainted(false);
sphereButton.setContentAreaFilled(false);
sphereButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
sphereButton.setFocusable(false);
sphereButton.setIconTextGap(0);
sphereButton.setMaximumSize(new java.awt.Dimension(24, 24));
sphereButton.setMinimumSize(new java.awt.Dimension(24, 24));
sphereButton.setPreferredSize(new java.awt.Dimension(24, 24));
sphereButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
sphereButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
sphereButtonMouseExited(evt);
}
});
sphereButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sphereButtonActionPerformed(evt);
}
});
boxButton.setBackground(new java.awt.Color(153, 153, 153));
boxButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/cube.png"))); // NOI18N
boxButton.setToolTipText(org.openide.util.NbBundle.getMessage(BackdropPanel.class, "BackdropPanel.boxButton.toolTipText")); // NOI18N
boxButton.setBorder(null);
boxButton.setBorderPainted(false);
boxButton.setContentAreaFilled(false);
boxButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
boxButton.setFocusable(false);
boxButton.setIconTextGap(0);
boxButton.setMaximumSize(new java.awt.Dimension(24, 24));
boxButton.setMinimumSize(new java.awt.Dimension(24, 24));
boxButton.setPreferredSize(new java.awt.Dimension(24, 24));
boxButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
boxButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
boxButtonMouseExited(evt);
}
});
boxButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
boxButtonActionPerformed(evt);
}
});
quadButton.setBackground(new java.awt.Color(153, 153, 153));
quadButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/Quad.png"))); // NOI18N
quadButton.setToolTipText(org.openide.util.NbBundle.getMessage(BackdropPanel.class, "BackdropPanel.quadButton.toolTipText")); // NOI18N
quadButton.setBorder(null);
quadButton.setBorderPainted(false);
quadButton.setContentAreaFilled(false);
quadButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
quadButton.setFocusable(false);
quadButton.setIconTextGap(0);
quadButton.setMaximumSize(new java.awt.Dimension(24, 24));
quadButton.setMinimumSize(new java.awt.Dimension(24, 24));
quadButton.setPreferredSize(new java.awt.Dimension(24, 24));
quadButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
quadButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
quadButtonMouseExited(evt);
}
});
quadButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
quadButtonActionPerformed(evt);
}
});
bringToFrontButton.setBackground(new java.awt.Color(153, 153, 153));
bringToFrontButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/frontBack.png"))); // NOI18N
bringToFrontButton.setToolTipText(org.openide.util.NbBundle.getMessage(BackdropPanel.class, "BackdropPanel.bringToFrontButton.toolTipText")); // NOI18N
bringToFrontButton.setBorder(null);
bringToFrontButton.setBorderPainted(false);
bringToFrontButton.setContentAreaFilled(false);
bringToFrontButton.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
bringToFrontButton.setFocusable(false);
bringToFrontButton.setIconTextGap(0);
bringToFrontButton.setMaximumSize(new java.awt.Dimension(24, 24));
bringToFrontButton.setMinimumSize(new java.awt.Dimension(24, 24));
bringToFrontButton.setPreferredSize(new java.awt.Dimension(24, 24));
bringToFrontButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
bringToFrontButtonMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
bringToFrontButtonMouseExited(evt);
}
});
bringToFrontButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bringToFrontButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout toolBarLayout = new javax.swing.GroupLayout(toolBar);
toolBar.setLayout(toolBarLayout);
toolBarLayout.setHorizontalGroup(
toolBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(toolBarLayout.createSequentialGroup()
.addComponent(expandButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bringToFrontButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sphereButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(boxButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(quadButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 90, Short.MAX_VALUE)
.addComponent(reloadButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
);
toolBarLayout.setVerticalGroup(
toolBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(expandButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(reloadButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sphereButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(boxButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(quadButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bringToFrontButton, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
);
add(toolBar);
previewLabel.setBackground(new java.awt.Color(100, 100, 100));
previewLabel.setForeground(new java.awt.Color(100, 100, 100));
previewLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
previewLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
previewLabel.setIconTextGap(0);
previewLabel.setMaximumSize(new java.awt.Dimension(100, 100));
previewLabel.setMinimumSize(new java.awt.Dimension(100, 100));
previewLabel.setOpaque(true);
previewLabel.setPreferredSize(new java.awt.Dimension(100, 100));
add(previewLabel);
}// </editor-fold>//GEN-END:initComponents
private void sphereButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sphereButtonMouseEntered
mouseEntered(SwingUtilities.convertMouseEvent(sphereButton, evt, this));
}//GEN-LAST:event_sphereButtonMouseEntered
private void sphereButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_sphereButtonMouseExited
mouseExited(SwingUtilities.convertMouseEvent(sphereButton, evt, this));
}//GEN-LAST:event_sphereButtonMouseExited
private void sphereButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sphereButtonActionPerformed
renderer.switchDisplay(MaterialPreviewRenderer.DisplayType.Sphere);
refresh();
}//GEN-LAST:event_sphereButtonActionPerformed
private void boxButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boxButtonMouseEntered
mouseEntered(SwingUtilities.convertMouseEvent(boxButton, evt, this));
}//GEN-LAST:event_boxButtonMouseEntered
private void boxButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_boxButtonMouseExited
mouseExited(SwingUtilities.convertMouseEvent(boxButton, evt, this));
}//GEN-LAST:event_boxButtonMouseExited
private void boxButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boxButtonActionPerformed
renderer.switchDisplay(MaterialPreviewRenderer.DisplayType.Box);
refresh();
}//GEN-LAST:event_boxButtonActionPerformed
private void reloadButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reloadButtonMouseEntered
mouseEntered(SwingUtilities.convertMouseEvent(reloadButton, evt, this));
}//GEN-LAST:event_reloadButtonMouseEntered
private void reloadButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_reloadButtonMouseExited
mouseExited(SwingUtilities.convertMouseEvent(reloadButton, evt, this));
}//GEN-LAST:event_reloadButtonMouseExited
private void reloadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reloadButtonActionPerformed
refresh();
}//GEN-LAST:event_reloadButtonActionPerformed
private void quadButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_quadButtonMouseEntered
mouseEntered(SwingUtilities.convertMouseEvent(quadButton, evt, this));
}//GEN-LAST:event_quadButtonMouseEntered
private void quadButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_quadButtonMouseExited
mouseExited(SwingUtilities.convertMouseEvent(quadButton, evt, this));
}//GEN-LAST:event_quadButtonMouseExited
private void quadButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quadButtonActionPerformed
renderer.switchDisplay(MaterialPreviewRenderer.DisplayType.Quad);
refresh();
}//GEN-LAST:event_quadButtonActionPerformed
private void expandButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_expandButtonMouseEntered
mouseEntered(SwingUtilities.convertMouseEvent(expandButton, evt, this));
}//GEN-LAST:event_expandButtonMouseEntered
private void expandButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_expandButtonMouseExited
mouseExited(SwingUtilities.convertMouseEvent(expandButton, evt, this));
}//GEN-LAST:event_expandButtonMouseExited
private void expandButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_expandButtonActionPerformed
setVisible(false);
}//GEN-LAST:event_expandButtonActionPerformed
private void bringToFrontButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bringToFrontButtonMouseEntered
mouseEntered(SwingUtilities.convertMouseEvent(bringToFrontButton, evt, this));
}//GEN-LAST:event_bringToFrontButtonMouseEntered
private void bringToFrontButtonMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bringToFrontButtonMouseExited
mouseExited(SwingUtilities.convertMouseEvent(bringToFrontButton, evt, this));
}//GEN-LAST:event_bringToFrontButtonMouseExited
private void bringToFrontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bringToFrontButtonActionPerformed
Diagram diagram = ((Diagram) getParent());
if (diagram.getComponentZOrder(this) > 0) {
diagram.setComponentZOrder(this, 0);
} else {
diagram.setComponentZOrder(this, ((Diagram) getParent()).getComponentCount() - 1);
}
diagram.repaint();
}//GEN-LAST:event_bringToFrontButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton boxButton;
private javax.swing.JButton bringToFrontButton;
private javax.swing.JButton expandButton;
private javax.swing.JLabel previewLabel;
private javax.swing.JButton quadButton;
private javax.swing.JButton reloadButton;
private javax.swing.JButton sphereButton;
private javax.swing.JPanel toolBar;
// End of variables declaration//GEN-END:variables
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
Container c = getParent();
if (c != null) {
((MouseListener) c).mouseReleased(SwingUtilities.convertMouseEvent(this, e, c));
}
}
@Override
public void mouseEntered(MouseEvent e) {
toolBar.setVisible(true);
t.stop();
}
Timer t = new Timer(500, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
toolBar.setVisible(false);
}
});
@Override
public void mouseExited(MouseEvent e) {
t.restart();
}
public void stateChanged(ChangeEvent e) {
JViewport vp = (JViewport) e.getSource();
update(vp);
}
private final Timer recalculateTimer = new Timer(20, new ActionListener() {
public void actionPerformed(ActionEvent e) {
refresh();
}
});
protected void update(JViewport viewPort) {
if (isVisible()) {
JScrollPane pane = (JScrollPane) viewPort.getParent();
int width = viewPort.getWidth();
int height = viewPort.getHeight();
int size = Math.min(width, height) - 25;
setSize(size, size);
setBounds(0, 0, size, size);
setLocation(pane.getHorizontalScrollBar().getValue() + width / 2 - size / 2, pane.getVerticalScrollBar().getValue() + height / 2 - size / 2);
repaint();
if (recalculateTimer.isRunning()) {
recalculateTimer.restart();
} else {
recalculateTimer.start();
}
}
}
private void refresh() {
if (mat != null) {
renderer.showMaterial(mat);
}
}
}

@ -3,3 +3,9 @@ ShaderEditPanel.shaderEditorPane.text=
ShaderEditPanel.closeButton.toolTipText=Close this panel ShaderEditPanel.closeButton.toolTipText=Close this panel
ShaderEditPanel.jToggleButton1.text=jToggleButton1 ShaderEditPanel.jToggleButton1.text=jToggleButton1
ShaderEditPanel.headerText.text=jLabel1 ShaderEditPanel.headerText.text=jLabel1
BackdropPanel.sphereButton.toolTipText=Sphere
BackdropPanel.expandButton.toolTipText=Hide Backdrop
BackdropPanel.quadButton.toolTipText=Quad
BackdropPanel.reloadButton.toolTipText=Refresh
BackdropPanel.boxButton.toolTipText=Cube
BackdropPanel.bringToFrontButton.toolTipText=Toggle back/front

@ -40,6 +40,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.JSeparator; import javax.swing.JSeparator;
import javax.swing.JViewport;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.border.Border; import javax.swing.border.Border;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
@ -56,10 +57,12 @@ public class Diagram extends JPanel implements MouseListener, MouseMotionListene
protected List<Connection> connections = new ArrayList<Connection>(); protected List<Connection> connections = new ArrayList<Connection>();
protected List<NodePanel> nodes = new ArrayList<NodePanel>(); protected List<NodePanel> nodes = new ArrayList<NodePanel>();
protected List<OutBusPanel> outBuses = new ArrayList<OutBusPanel>(); protected List<OutBusPanel> outBuses = new ArrayList<OutBusPanel>();
private MyMenu contextMenu = new MyMenu("Add"); private final MyMenu contextMenu = new MyMenu("Add");
private MatDefEditorlElement parent; private MatDefEditorlElement parent;
private String currentTechniqueName; private String currentTechniqueName;
private final BackdropPanel backDrop = new BackdropPanel();
@SuppressWarnings("LeakingThisInConstructor")
public Diagram() { public Diagram() {
addMouseListener(this); addMouseListener(this);
@ -101,7 +104,21 @@ public class Diagram extends JPanel implements MouseListener, MouseMotionListene
for (OutBusPanel outBusPanel : outBuses) { for (OutBusPanel outBusPanel : outBuses) {
outBusPanel.updatePreview(mat); outBusPanel.updatePreview(mat);
} }
if(backDrop.isVisible()){
backDrop.showMaterial(mat);
}
}
public void displayBackdrop(){
if(backDrop.getParent()== null){
add(backDrop);
((JViewport)getParent()).addChangeListener(backDrop);
}
backDrop.setVisible(true);
backDrop.update(((JViewport)getParent()));
} }
Point clickLoc = new Point(0, 0); Point clickLoc = new Point(0, 0);
@Override @Override

@ -216,7 +216,7 @@
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/expend.png"/> <Image iconType="3" name="/com/jme3/gde/materialdefinition/icons/expend.png"/>
</Property> </Property>
<Property name="toolTipText" type="java.lang.String" value="Expand"/> <Property name="toolTipText" type="java.lang.String" value="Display Backdrop"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="null"/> <Border info="null"/>
</Property> </Property>
@ -240,7 +240,6 @@
<Events> <Events>
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="expandButtonMouseEntered"/> <EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="expandButtonMouseEntered"/>
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="expandButtonMouseExited"/> <EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="expandButtonMouseExited"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="expandButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
</SubComponents> </SubComponents>

@ -20,10 +20,9 @@ import javax.swing.Timer;
* *
* @author Nehon * @author Nehon
*/ */
public class MatPanel extends javax.swing.JPanel implements MouseListener,ComponentListener { public class MatPanel extends javax.swing.JPanel implements MouseListener, ComponentListener {
private final MaterialPreviewRenderer renderer;
private MaterialPreviewRenderer renderer;
private Material mat; private Material mat;
/** /**
* Creates new form PreviewPanel * Creates new form PreviewPanel
@ -36,9 +35,8 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
renderer = new MaterialPreviewRenderer(previewLabel); renderer = new MaterialPreviewRenderer(previewLabel);
} }
public void cleanup(){ public void cleanup() {
renderer.cleanUp(); renderer.cleanUp();
cleanup();
} }
public void showMaterial(Material mat) { public void showMaterial(Material mat) {
@ -46,7 +44,9 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
renderer.showMaterial(mat); renderer.showMaterial(mat);
} }
public void setExpandActionListener(ActionListener action){
expandButton.addActionListener(action);
}
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
@ -176,7 +176,7 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
expandButton.setBackground(new java.awt.Color(153, 153, 153)); expandButton.setBackground(new java.awt.Color(153, 153, 153));
expandButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/expend.png"))); // NOI18N expandButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/jme3/gde/materialdefinition/icons/expend.png"))); // NOI18N
expandButton.setToolTipText("Expand"); expandButton.setToolTipText("Display Backdrop");
expandButton.setBorder(null); expandButton.setBorder(null);
expandButton.setBorderPainted(false); expandButton.setBorderPainted(false);
expandButton.setContentAreaFilled(false); expandButton.setContentAreaFilled(false);
@ -194,11 +194,6 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
expandButtonMouseExited(evt); expandButtonMouseExited(evt);
} }
}); });
expandButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
expandButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout toolBarLayout = new javax.swing.GroupLayout(toolBar); javax.swing.GroupLayout toolBarLayout = new javax.swing.GroupLayout(toolBar);
toolBar.setLayout(toolBarLayout); toolBar.setLayout(toolBarLayout);
@ -246,10 +241,6 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
previewLabel.setBounds(20, 20, 100, 100); previewLabel.setBounds(20, 20, 100, 100);
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void expandButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_expandButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_expandButtonActionPerformed
private void expandButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_expandButtonMouseEntered private void expandButtonMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_expandButtonMouseEntered
mouseEntered(SwingUtilities.convertMouseEvent(expandButton, evt, this)); mouseEntered(SwingUtilities.convertMouseEvent(expandButton, evt, this));
}//GEN-LAST:event_expandButtonMouseEntered }//GEN-LAST:event_expandButtonMouseEntered
@ -347,7 +338,7 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
t.restart(); t.restart();
} }
@Override @Override
public void componentResized(ComponentEvent e) { public void componentResized(ComponentEvent e) {
update(e.getComponent()); update(e.getComponent());
} }
@ -359,7 +350,7 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
@Override @Override
public void componentShown(ComponentEvent e) { public void componentShown(ComponentEvent e) {
update(e.getComponent()); update(e.getComponent());
} }
@Override @Override
@ -371,7 +362,7 @@ public class MatPanel extends javax.swing.JPanel implements MouseListener,Compon
} }
private void refresh() { private void refresh() {
if(mat!=null){ if (mat != null) {
renderer.showMaterial(mat); renderer.showMaterial(mat);
} }
} }

@ -16,6 +16,8 @@ import java.awt.LinearGradientPaint;
import java.awt.Point; import java.awt.Point;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.RenderingHints; import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener; import java.awt.event.ComponentListener;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
@ -81,11 +83,18 @@ public class OutBusPanel extends DraggablePanel implements ComponentListener, Se
} }
@Override @Override
public void setDiagram(Diagram diagram) { public void setDiagram(final Diagram diagram) {
super.setDiagram(diagram); super.setDiagram(diagram);
// preview.setBounds(350,300,128,100); // preview.setBounds(350,300,128,100);
diagram.add(preview); diagram.add(preview);
preview.update(this); preview.update(this);
preview.setExpandActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
diagram.displayBackdrop();
}
});
} }
@Override @Override

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Loading…
Cancel
Save