SDK : Changed color panel in material editor to display the color and input the values in separate fields

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7971 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent d722c65280
commit bb4449423d
  1. 10
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/Bundle.properties
  2. 246
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/ColorPanel.form
  3. 328
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/ColorPanel.java
  4. 2
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/ColorRGBADialog.form
  5. 30
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/ColorRGBADialog.java
  6. 25
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/FloatPanel.form
  7. 20
      sdk/jme3-materialeditor/src/com/jme3/gde/materials/multiview/widgets/FloatPanel.java

@ -13,7 +13,6 @@ ColorRGBADialog.alphaLabel.text=Alpha:
# To change this template, choose Tools | Templates # To change this template, choose Tools | Templates
# and open the template in the editor. # and open the template in the editor.
ColorPanel.jLabel1.text=jLabel1 ColorPanel.jLabel1.text=jLabel1
ColorPanel.jTextField1.text=jTextField1
ColorPanel.jButton1.text=select.. ColorPanel.jButton1.text=select..
TexturePanel.jLabel1.text=jLabel1 TexturePanel.jLabel1.text=jLabel1
TexturePanel.jButton1.text=set.. TexturePanel.jButton1.text=set..
@ -38,3 +37,12 @@ MaterialPreviewWidget.sphereButton.toolTipText=Preview material on a sphere
MaterialPreviewWidget.cubeButton.toolTipText=Preview material on a cube MaterialPreviewWidget.cubeButton.toolTipText=Preview material on a cube
MaterialPreviewWidget.planeButton.toolTipText=Preview material on a plane MaterialPreviewWidget.planeButton.toolTipText=Preview material on a plane
MaterialPreviewWidget.previewLabel.text= MaterialPreviewWidget.previewLabel.text=
ColorPanel.colorPreview.text=
ColorPanel.jLabel2.text=\ r :
ColorPanel.jLabel3.text=\ g :
ColorPanel.jLabel4.text=\ b :
ColorPanel.jLabel5.text=\ a :
ColorPanel.rLabel.text=0.2545
ColorPanel.gLabel.text=0.2545
ColorPanel.bLabel.text=0.2545
ColorPanel.aLabel.text=0.2545

@ -5,6 +5,12 @@
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/> <Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property> </Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[32767, 35]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[430, 35]"/>
</Property>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
@ -21,93 +27,257 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar1" alignment="0" pref="248" max="32767" attributes="0"/> <Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jSeparator1" alignment="1" pref="415" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel1" pref="65" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" pref="33" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar1" min="-2" max="-2" attributes="0"/> <Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jLabel1" alignment="0" max="32767" attributes="1"/>
<Component id="jButton1" alignment="0" max="32767" attributes="1"/>
<Component id="jPanel2" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jSeparator1" min="-2" pref="4" max="-2" attributes="0"/>
</Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Container class="javax.swing.JToolBar" name="jToolBar1"> <Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<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="ColorPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 16]"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties> <Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/> <Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property> </Property>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties> </Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> <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="colorPreview" pref="18" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="rLabel" min="-2" pref="46" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="gLabel" min="-2" pref="45" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="bLabel" min="-2" pref="46" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="aLabel" min="-2" pref="46" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="gLabel" alignment="0" pref="20" max="32767" attributes="1"/>
<Component id="bLabel" alignment="0" pref="20" max="32767" attributes="1"/>
<Component id="aLabel" alignment="0" pref="20" max="32767" attributes="1"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="rLabel" alignment="3" pref="20" max="32767" attributes="1"/>
</Group>
<Component id="colorPreview" alignment="0" pref="20" max="32767" attributes="1"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents> <SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1"> <Component class="javax.swing.JTextField" name="rLabel">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <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="ColorPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="ColorPanel.rLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 2147483647]"/>
</Property>
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="gLabel"/>
</Property> </Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 16]"/> <Dimension value="[110, 28]"/>
</Property> </Property>
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
</Properties> </Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="textChanged"/>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="rLabelFocusGained"/>
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="rLabelFocusLost"/>
</Events>
</Component> </Component>
<Container class="javax.swing.JPanel" name="jPanel1"> <Component class="javax.swing.JTextField" name="gLabel">
<Properties> <Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/> <ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="ColorPanel.gLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[0, 0]"/> <Dimension value="[110, 2147483647]"/>
</Property>
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="bLabel"/>
</Property> </Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[10, 0]"/> <Dimension value="[110, 28]"/>
</Property> </Property>
</Properties> </Properties>
<Events>
<Layout> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="gLabeltextChanged"/>
<DimensionLayout dim="0"> <EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="gLabelFocusGained"/>
<Group type="103" groupAlignment="0" attributes="0"> <EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="gLabelFocusLost"/>
<EmptySpace min="0" pref="8" max="32767" attributes="0"/> </Events>
</Group> </Component>
</DimensionLayout> <Component class="javax.swing.JTextField" name="bLabel">
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="28" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JTextField" name="jTextField1">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <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="ColorPanel.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="ColorPanel.bLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 2147483647]"/> <Dimension value="[110, 2147483647]"/>
</Property> </Property>
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="aLabel"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 28]"/> <Dimension value="[110, 28]"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="textChanged"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bLabeltextChanged"/>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="bLabelFocusGained"/>
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="bLabelFocusLost"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JButton" name="jButton1"> <Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<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="ColorPanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <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="ColorPanel.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="ColorPanel.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<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="ColorPanel.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="aLabel">
<Properties>
<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="ColorPanel.aLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Curseur de texte"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 2147483647]"/>
</Property>
<Property name="nextFocusableComponent" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="jButton1"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[110, 28]"/>
</Property> </Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="aLabeltextChanged"/>
<EventHandler event="focusGained" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="aLabelFocusGained"/>
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="aLabelFocusLost"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<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="ColorPanel.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="colorPreview">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="horizontalAlignment" type="int" value="11"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/materials/multiview/widgets/Bundle.properties" key="ColorPanel.colorPreview.text" 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="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder>
<Color PropertyName="color" blue="66" green="66" red="66" type="rgb"/>
</LineBorder>
</Border>
</Property>
<Property name="opaque" type="boolean" value="true"/>
</Properties>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</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="ColorPanel.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="horizontalTextPosition" type="int" value="0"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[43, 15]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[43, 15]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[43, 15]"/>
</Property>
<Property name="verticalTextPosition" type="int" value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

@ -8,9 +8,10 @@
* *
* Created on 14.06.2010, 16:42:25 * Created on 14.06.2010, 16:42:25
*/ */
package com.jme3.gde.materials.multiview.widgets; package com.jme3.gde.materials.multiview.widgets;
import com.jme3.math.FastMath;
import java.awt.Color;
import javax.swing.JFrame; import javax.swing.JFrame;
/** /**
@ -33,108 +34,337 @@ public class ColorPanel extends MaterialPropertyWidget {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() { private void initComponents() {
jToolBar1 = new javax.swing.JToolBar();
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel();
jTextField1 = new javax.swing.JTextField(); rLabel = new javax.swing.JTextField();
gLabel = new javax.swing.JTextField();
bLabel = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
aLabel = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
colorPreview = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();
jSeparator1 = new javax.swing.JSeparator();
setBackground(new java.awt.Color(204, 204, 204)); setBackground(new java.awt.Color(204, 204, 204));
setMaximumSize(new java.awt.Dimension(32767, 35));
jToolBar1.setBackground(new java.awt.Color(204, 204, 204)); setPreferredSize(new java.awt.Dimension(430, 35));
jToolBar1.setFloatable(false);
jToolBar1.setRollover(true);
jLabel1.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jLabel1.text")); // NOI18N jLabel1.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jLabel1.text")); // NOI18N
jLabel1.setPreferredSize(new java.awt.Dimension(100, 16)); jLabel1.setPreferredSize(new java.awt.Dimension(100, 16));
jToolBar1.add(jLabel1);
jPanel1.setBackground(new java.awt.Color(204, 204, 204)); jPanel2.setBackground(new java.awt.Color(204, 204, 204));
jPanel1.setMinimumSize(new java.awt.Dimension(0, 0));
jPanel1.setPreferredSize(new java.awt.Dimension(10, 0));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); rLabel.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.rLabel.text")); // NOI18N
jPanel1.setLayout(jPanel1Layout); rLabel.setMaximumSize(new java.awt.Dimension(110, 2147483647));
jPanel1Layout.setHorizontalGroup( rLabel.setNextFocusableComponent(gLabel);
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) rLabel.setPreferredSize(new java.awt.Dimension(110, 28));
.addGap(0, 8, Short.MAX_VALUE) rLabel.setVerifyInputWhenFocusTarget(false);
); rLabel.addActionListener(new java.awt.event.ActionListener() {
jPanel1Layout.setVerticalGroup( public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) textChanged(evt);
.addGap(0, 28, Short.MAX_VALUE) }
); });
rLabel.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
rLabelFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
rLabelFocusLost(evt);
}
});
jToolBar1.add(jPanel1); gLabel.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.gLabel.text")); // NOI18N
gLabel.setMaximumSize(new java.awt.Dimension(110, 2147483647));
gLabel.setNextFocusableComponent(bLabel);
gLabel.setPreferredSize(new java.awt.Dimension(110, 28));
gLabel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
gLabeltextChanged(evt);
}
});
gLabel.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
gLabelFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
gLabelFocusLost(evt);
}
});
jTextField1.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jTextField1.text")); // NOI18N bLabel.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.bLabel.text")); // NOI18N
jTextField1.setMaximumSize(new java.awt.Dimension(110, 2147483647)); bLabel.setMaximumSize(new java.awt.Dimension(110, 2147483647));
jTextField1.setPreferredSize(new java.awt.Dimension(110, 28)); bLabel.setNextFocusableComponent(aLabel);
jTextField1.addActionListener(new java.awt.event.ActionListener() { bLabel.setPreferredSize(new java.awt.Dimension(110, 28));
bLabel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
textChanged(evt); bLabeltextChanged(evt);
}
});
bLabel.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
bLabelFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
bLabelFocusLost(evt);
}
});
jLabel2.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jLabel2.text")); // NOI18N
jLabel3.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jLabel3.text")); // NOI18N
jLabel4.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jLabel4.text")); // NOI18N
aLabel.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.aLabel.text")); // NOI18N
aLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
aLabel.setMaximumSize(new java.awt.Dimension(110, 2147483647));
aLabel.setNextFocusableComponent(jButton1);
aLabel.setPreferredSize(new java.awt.Dimension(110, 28));
aLabel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aLabeltextChanged(evt);
}
});
aLabel.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
aLabelFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
aLabelFocusLost(evt);
} }
}); });
jToolBar1.add(jTextField1);
jLabel5.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jLabel5.text")); // NOI18N
colorPreview.setBackground(new java.awt.Color(204, 204, 204));
colorPreview.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
colorPreview.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.colorPreview.text")); // NOI18N
colorPreview.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102)));
colorPreview.setOpaque(true);
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(colorPreview, javax.swing.GroupLayout.DEFAULT_SIZE, 18, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(gLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(aLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(gLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
.addComponent(bLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
.addComponent(aLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel2)
.addComponent(rLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE))
.addComponent(colorPreview, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)
);
jButton1.setBackground(new java.awt.Color(204, 204, 204));
jButton1.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jButton1.text")); // NOI18N jButton1.setText(org.openide.util.NbBundle.getMessage(ColorPanel.class, "ColorPanel.jButton1.text")); // NOI18N
jButton1.setFocusable(false);
jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton1.setMaximumSize(new java.awt.Dimension(43, 15));
jButton1.setMinimumSize(new java.awt.Dimension(43, 15));
jButton1.setPreferredSize(new java.awt.Dimension(43, 15));
jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton1.addActionListener(new java.awt.event.ActionListener() { jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt); jButton1ActionPerformed(evt);
} }
}); });
jToolBar1.add(jButton1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 415, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 65, 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)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 4, javax.swing.GroupLayout.PREFERRED_SIZE))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here: // TODO add your handling code here:
ColorRGBADialog dialog=new ColorRGBADialog(new JFrame(), true); ColorRGBADialog dialog = new ColorRGBADialog(new JFrame(), true);
dialog.setLocationRelativeTo(null); dialog.setLocationRelativeTo(null);
dialog.setColor(getColor(rLabel.getText(), gLabel.getText(), bLabel.getText(), aLabel.getText()));
dialog.setVisible(true); dialog.setVisible(true);
if(dialog.getColor()!=null){ if (dialog.getColorAsText() != null) {
jTextField1.setText(dialog.getColor()); colorPreview.setBackground(dialog.getColor());
property.setValue(jTextField1.getText()); float[] f = new float[4];
dialog.getColor().getRGBComponents(f);
dialog.getColor().getAlpha();
rLabel.setText(f[0] + "");
gLabel.setText(f[1] + "");
bLabel.setText(f[2] + "");
aLabel.setText(f[3] + "");
property.setValue(rLabel.getText() + " " + gLabel.getText() + " " + bLabel.getText() + " " + aLabel.getText());
fireChanged(); fireChanged();
} }
}//GEN-LAST:event_jButton1ActionPerformed }//GEN-LAST:event_jButton1ActionPerformed
private void textChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textChanged private void textChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textChanged
property.setValue(jTextField1.getText()); updateValue();
fireChanged();
}//GEN-LAST:event_textChanged }//GEN-LAST:event_textChanged
private void gLabeltextChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_gLabeltextChanged
updateValue();
}//GEN-LAST:event_gLabeltextChanged
private void bLabeltextChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bLabeltextChanged
updateValue();
}//GEN-LAST:event_bLabeltextChanged
private void aLabeltextChanged(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aLabeltextChanged
updateValue();
}//GEN-LAST:event_aLabeltextChanged
private void rLabelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_rLabelFocusGained
rLabel.setSelectionStart(0);
rLabel.setSelectionEnd(rLabel.getText().length());
}//GEN-LAST:event_rLabelFocusGained
private void gLabelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_gLabelFocusGained
gLabel.setSelectionStart(0);
gLabel.setSelectionEnd(gLabel.getText().length());
}//GEN-LAST:event_gLabelFocusGained
private void bLabelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_bLabelFocusGained
bLabel.setSelectionStart(0);
bLabel.setSelectionEnd(bLabel.getText().length());
}//GEN-LAST:event_bLabelFocusGained
private void aLabelFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_aLabelFocusGained
aLabel.setSelectionStart(0);
aLabel.setSelectionEnd(aLabel.getText().length());
}//GEN-LAST:event_aLabelFocusGained
private void rLabelFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_rLabelFocusLost
updateValue();
}//GEN-LAST:event_rLabelFocusLost
private void gLabelFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_gLabelFocusLost
updateValue();
}//GEN-LAST:event_gLabelFocusLost
private void bLabelFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_bLabelFocusLost
updateValue();
}//GEN-LAST:event_bLabelFocusLost
private void aLabelFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_aLabelFocusLost
updateValue();
}//GEN-LAST:event_aLabelFocusLost
private void updateValue() {
Color c = getColor(rLabel.getText(), gLabel.getText(), bLabel.getText(), aLabel.getText());
if (c != null) {
colorPreview.setBackground(c);
property.setValue(rLabel.getText() + " " + gLabel.getText() + " " + bLabel.getText() + " " + aLabel.getText());
fireChanged();
} else {
colorPreview.setBackground(new Color(204, 204, 204));
}
}
@Override @Override
protected void readProperty() { protected void readProperty() {
java.awt.EventQueue.invokeLater(new Runnable() { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() { public void run() {
jLabel1.setText(property.getName()); jLabel1.setText(property.getName());
jLabel1.setToolTipText(property.getName()); jLabel1.setToolTipText(property.getName());
jTextField1.setText(property.getValue()); System.out.println(property.getValue());
String[] s = property.getValue().split(" ");
if (s.length == 4) {
try {
colorPreview.setBackground(getColor(s[0], s[1], s[2], s[3]));
rLabel.setText(s[0]);
gLabel.setText(s[1]);
bLabel.setText(s[2]);
aLabel.setText(s[3]);
} catch (NumberFormatException e) {
clear();
}
} else {
clear();
}
} }
}); });
} }
private void clear() {
colorPreview.setBackground(new Color(204, 204, 204));
rLabel.setText("");
gLabel.setText("");
bLabel.setText("");
aLabel.setText("");
}
private Color getColor(String r, String g, String b, String a) {
try {
float fr = FastMath.clamp(Float.parseFloat(r), 0, 1);
float fg = FastMath.clamp(Float.parseFloat(g), 0, 1);
float fb = FastMath.clamp(Float.parseFloat(b), 0, 1);
float fa = FastMath.clamp(Float.parseFloat(a), 0, 1);
return new Color(fr, fg, fb, fa);
} catch (NumberFormatException e) {
return null;
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField aLabel;
private javax.swing.JTextField bLabel;
private javax.swing.JLabel colorPreview;
private javax.swing.JTextField gLabel;
private javax.swing.JButton jButton1; private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1; private javax.swing.JLabel jLabel2;
private javax.swing.JTextField jTextField1; private javax.swing.JLabel jLabel3;
private javax.swing.JToolBar jToolBar1; private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel2;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTextField rLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

@ -23,7 +23,7 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<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="jToolBar1" pref="320" max="32767" attributes="0"/> <Component id="jToolBar1" pref="372" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/> <Component id="jButton2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>

@ -44,7 +44,9 @@ import java.awt.Color;
* @author normenhansen * @author normenhansen
*/ */
public class ColorRGBADialog extends javax.swing.JDialog { public class ColorRGBADialog extends javax.swing.JDialog {
private String color;
private String strColor;
private Color color;
/** Creates new form ColorRGBADialog */ /** Creates new form ColorRGBADialog */
public ColorRGBADialog(java.awt.Frame parent, boolean modal) { public ColorRGBADialog(java.awt.Frame parent, boolean modal) {
@ -54,11 +56,12 @@ public class ColorRGBADialog extends javax.swing.JDialog {
} }
private void convertColor() { private void convertColor() {
Color cColor = jColorChooser1.getColor();
float[] floats = new float[4]; float[] floats = new float[4];
cColor.getComponents(floats); jColorChooser1.getColor().getComponents(floats);
String str=new String(floats[0]+" "+ floats[1]+" "+ floats[2]+" "+ ((float)alphaSlider.getValue())/100.0f); color = new Color(floats[0], floats[1], floats[2], ((float) alphaSlider.getValue()) / 100.0f);
color=str; String str = new String(floats[0] + " " + floats[1] + " " + floats[2] + " " + ((float) alphaSlider.getValue()) / 100.0f);
strColor = str;
} }
/** This method is called from within the constructor to /** This method is called from within the constructor to
@ -149,11 +152,22 @@ public class ColorRGBADialog extends javax.swing.JDialog {
/** /**
* @return the color * @return the color
*/ */
public String getColor() { public String getColorAsText() {
return strColor;
}
public void setColorAsText(String color) {
this.strColor = color;
}
public Color getColor() {
return color; return color;
} }
public void setColor(String color){ public void setColor(Color color) {
this.color=color; this.color = color;
jColorChooser1.setColor(color);
alphaSlider.setValue((int) ((float) (color.getAlpha() / 255f) * 100));
} }
} }

@ -21,7 +21,7 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jToolBar1" alignment="0" pref="543" max="32767" attributes="0"/> <Component id="jToolBar1" alignment="0" pref="155" max="32767" attributes="0"/>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
<DimensionLayout dim="1"> <DimensionLayout dim="1">
@ -55,29 +55,6 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="cc" green="cc" red="cc" type="rgb"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[100, 25]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="255" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="25" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
<Component class="javax.swing.JSpinner" name="jSpinner1"> <Component class="javax.swing.JSpinner" name="jSpinner1">
<Properties> <Properties>
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor"> <Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">

@ -35,7 +35,6 @@ public class FloatPanel extends MaterialPropertyWidget {
jToolBar1 = new javax.swing.JToolBar(); jToolBar1 = new javax.swing.JToolBar();
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jSpinner1 = new javax.swing.JSpinner(); jSpinner1 = new javax.swing.JSpinner();
setBackground(new java.awt.Color(204, 204, 204)); setBackground(new java.awt.Color(204, 204, 204));
@ -49,22 +48,6 @@ public class FloatPanel extends MaterialPropertyWidget {
jLabel1.setPreferredSize(new java.awt.Dimension(100, 16)); jLabel1.setPreferredSize(new java.awt.Dimension(100, 16));
jToolBar1.add(jLabel1); jToolBar1.add(jLabel1);
jPanel1.setBackground(new java.awt.Color(204, 204, 204));
jPanel1.setPreferredSize(new java.awt.Dimension(100, 25));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 255, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 25, Short.MAX_VALUE)
);
jToolBar1.add(jPanel1);
jSpinner1.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null, Float.valueOf(1.0f))); jSpinner1.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(0.0f), null, null, Float.valueOf(1.0f)));
jSpinner1.addChangeListener(new javax.swing.event.ChangeListener() { jSpinner1.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) { public void stateChanged(javax.swing.event.ChangeEvent evt) {
@ -77,7 +60,7 @@ public class FloatPanel extends MaterialPropertyWidget {
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE) .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -113,7 +96,6 @@ public class FloatPanel extends MaterialPropertyWidget {
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JSpinner jSpinner1; private javax.swing.JSpinner jSpinner1;
private javax.swing.JToolBar jToolBar1; private javax.swing.JToolBar jToolBar1;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables

Loading…
Cancel
Save