Editor wiped out
parent
415e71b033
commit
5610764036
@ -1,21 +0,0 @@
|
||||
# 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.
|
||||
|
||||
Editor.title=[idp!] Color Editor
|
||||
ColorEditorTopComponent.jTextField1.text=jTextField1
|
||||
ColorEditorTopComponent.jPanel2.border.title=Color List
|
||||
ColorEditorTopComponent.jPanel4.border.title=Color Settings
|
||||
ColorEditorTopComponent.jLabel1.text=HEX:
|
||||
ColorEditorTopComponent.jLabel2.text=RED:
|
||||
ColorEditorTopComponent.jLabel3.text=GREEN:
|
||||
ColorEditorTopComponent.jLabel4.text=BLUE:
|
||||
ColorEditorTopComponent.color_hex.text_1=jTextField1
|
||||
ColorEditorTopComponent.color_R.text=jTextField2
|
||||
ColorEditorTopComponent.color_G.text=jTextField3
|
||||
ColorEditorTopComponent.color_B.text=jTextField4
|
||||
ColorEditorTopComponent.test_mode.text=Pink Daemon Mode
|
||||
ColorEditorTopComponent.save_btn.text=Write Scheme
|
||||
ColorEditorTopComponent.reload_btn.text=Reload Scheme
|
||||
ColorEditorTopComponent.load_btn.text=Load Scheme from File
|
||||
ColorEditorTopComponent.color_desc.text_1=jTextField1
|
||||
@ -1,44 +0,0 @@
|
||||
/* Copyright (C) Edward M. Kagan - All Rights Reserved
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
* Proprietary and confidential
|
||||
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015
|
||||
*/
|
||||
package org.idp.laf.gui;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.awt.ActionRegistration;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.windows.WindowManager;
|
||||
|
||||
/**
|
||||
* @author Edward M. Kagan <pagan@idp-crew.com>
|
||||
*/
|
||||
|
||||
@ActionID(
|
||||
category = "File",
|
||||
id = "org.idp.laf.ColorEditorActionListener"
|
||||
)
|
||||
@ActionRegistration(
|
||||
iconBase = "org/idp/laf/gui/wh.png",
|
||||
displayName = "#CTL_ColorEditorActionListener"
|
||||
)
|
||||
@ActionReference(path = "Toolbars/File", position = -100)
|
||||
@Messages("CTL_ColorEditorActionListener=[idp!] Color Editor")
|
||||
public final class ColorEditorActionListener implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ColorEditorTopComponent editor = (ColorEditorTopComponent) WindowManager.getDefault().findTopComponent("ColorEditorTopComponent");
|
||||
if (editor.isOpened())
|
||||
{
|
||||
editor.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
editor.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,308 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.4" 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"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel2" pref="624" max="32767" attributes="0"/>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Component id="jPanel4" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel4" pref="517" max="32767" attributes="0"/>
|
||||
<Component id="jPanel2" pref="517" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel2">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Color List">
|
||||
<ResourceString PropertyName="titleX" bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.jPanel2.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JList" name="color_list">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
||||
<StringArray count="5">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
<StringItem index="4" value="Item 5"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
<Property name="selectionMode" type="int" value="0"/>
|
||||
<Property name="name" type="java.lang.String" value="color_list" noResource="true"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="color_listValueChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel4">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
|
||||
<TitledBorder title="Color Settings">
|
||||
<ResourceString PropertyName="titleX" bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.jPanel4.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</TitledBorder>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[270, 32767]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[270, 100]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[270, 253]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="color_desc" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="color_preview_panel" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="test_mode" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel3" alignment="0" pref="236" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="color_preview_panel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="test_mode" min="-2" pref="45" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" pref="97" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="color_desc" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="color_preview_panel">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
||||
<LineBorder roundedCorners="true"/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="159" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="2"/>
|
||||
<Property name="horizontalGap" type="int" value="5"/>
|
||||
<Property name="rows" type="int" value="4"/>
|
||||
<Property name="verticalGap" type="int" value="5"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="color_hex">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.color_hex.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="color_hexFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="color_hexActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="color_R">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.color_R.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="color_RFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="color_RActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="color_G">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.color_G.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="color_GFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="color_GActionPerformed"/>
|
||||
</Events>
|
||||
</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="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="color_B">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.color_B.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="color_BFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="color_BActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JToggleButton" name="test_mode">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.test_mode.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="test_modeStateChanged"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="color_desc">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.color_desc.text_1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="focusLost" listener="java.awt.event.FocusListener" parameters="java.awt.event.FocusEvent" handler="color_descFocusLost"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="color_descActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
|
||||
<Property name="columns" type="int" value="0"/>
|
||||
<Property name="rows" type="int" value="3"/>
|
||||
<Property name="verticalGap" type="int" value="5"/>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="load_btn">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.load_btn.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="load_btnActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="reload_btn">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.reload_btn.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="reload_btnActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="save_btn">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/idp/laf/gui/Bundle.properties" key="ColorEditorTopComponent.save_btn.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="save_btnActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
@ -1,636 +0,0 @@
|
||||
/* Copyright (C) Edward M. Kagan - All Rights Reserved
|
||||
* Unauthorized copying of this file, via any medium is strictly prohibited
|
||||
* Proprietary and confidential
|
||||
* Written by Edward M. Kagan <pagan@idp-crew.com>, 2015
|
||||
*/
|
||||
package org.idp.laf.gui;
|
||||
|
||||
import java.io.File;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import org.idp.laf.Color;
|
||||
import org.idp.laf.Kernel;
|
||||
import org.netbeans.api.settings.ConvertAsProperties;
|
||||
import org.openide.awt.ActionID;
|
||||
import org.openide.awt.ActionReference;
|
||||
import org.openide.windows.TopComponent;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
|
||||
/**
|
||||
* @author Edward M. Kagan <pagan@idp-crew.com>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Top component which displays something.
|
||||
*/
|
||||
@ConvertAsProperties(
|
||||
dtd = "-//org.idp.laf.gui//ColorEditor//EN",
|
||||
autostore = false
|
||||
)
|
||||
@TopComponent.Description(
|
||||
preferredID = "ColorEditorTopComponent",
|
||||
iconBase = "org/idp/laf/gui/wh.png",
|
||||
persistenceType = TopComponent.PERSISTENCE_ALWAYS
|
||||
)
|
||||
@TopComponent.Registration(mode = "editor", openAtStartup = false)
|
||||
@ActionID(category = "Window", id = "org.idp.laf.gui.ColorEditorTopComponent")
|
||||
@ActionReference(path = "Menu/Window" /*, position = 333 */)
|
||||
@TopComponent.OpenActionRegistration(
|
||||
displayName = "#CTL_ColorEditorAction",
|
||||
preferredID = "ColorEditorTopComponent"
|
||||
)
|
||||
@Messages({
|
||||
"CTL_ColorEditorAction=ColorEditor",
|
||||
"CTL_ColorEditorTopComponent=ColorEditor Window",
|
||||
"HINT_ColorEditorTopComponent=This is a ColorEditor window"
|
||||
})
|
||||
|
||||
public final class ColorEditorTopComponent extends TopComponent {
|
||||
|
||||
public ColorEditorTopComponent() {
|
||||
initComponents();
|
||||
setName(Bundle.CTL_ColorEditorTopComponent());
|
||||
setToolTipText(Bundle.HINT_ColorEditorTopComponent());
|
||||
putClientProperty(TopComponent.PROP_CLOSING_DISABLED, Boolean.TRUE);
|
||||
putClientProperty(TopComponent.PROP_DRAGGING_DISABLED, Boolean.TRUE);
|
||||
putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED, Boolean.TRUE);
|
||||
putClientProperty(TopComponent.PROP_UNDOCKING_DISABLED, Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
color_list = new javax.swing.JList();
|
||||
jPanel4 = new javax.swing.JPanel();
|
||||
color_preview_panel = new javax.swing.JPanel();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
color_hex = new javax.swing.JTextField();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
color_R = new javax.swing.JTextField();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
color_G = new javax.swing.JTextField();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
color_B = new javax.swing.JTextField();
|
||||
test_mode = new javax.swing.JToggleButton();
|
||||
color_desc = new javax.swing.JTextField();
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
load_btn = new javax.swing.JButton();
|
||||
reload_btn = new javax.swing.JButton();
|
||||
save_btn = new javax.swing.JButton();
|
||||
|
||||
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.jPanel2.border.title"))); // NOI18N
|
||||
jPanel2.setLayout(new javax.swing.BoxLayout(jPanel2, javax.swing.BoxLayout.LINE_AXIS));
|
||||
|
||||
color_list.setModel(new javax.swing.AbstractListModel() {
|
||||
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
|
||||
public int getSize() { return strings.length; }
|
||||
public Object getElementAt(int i) { return strings[i]; }
|
||||
});
|
||||
color_list.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
color_list.setName("color_list"); // NOI18N
|
||||
color_list.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
||||
color_listValueChanged(evt);
|
||||
}
|
||||
});
|
||||
jScrollPane1.setViewportView(color_list);
|
||||
|
||||
jPanel2.add(jScrollPane1);
|
||||
|
||||
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.jPanel4.border.title"))); // NOI18N
|
||||
jPanel4.setMaximumSize(new java.awt.Dimension(270, 32767));
|
||||
jPanel4.setMinimumSize(new java.awt.Dimension(270, 100));
|
||||
jPanel4.setPreferredSize(new java.awt.Dimension(270, 253));
|
||||
|
||||
color_preview_panel.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));
|
||||
|
||||
javax.swing.GroupLayout color_preview_panelLayout = new javax.swing.GroupLayout(color_preview_panel);
|
||||
color_preview_panel.setLayout(color_preview_panelLayout);
|
||||
color_preview_panelLayout.setHorizontalGroup(
|
||||
color_preview_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
);
|
||||
color_preview_panelLayout.setVerticalGroup(
|
||||
color_preview_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 159, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jPanel1.setLayout(new java.awt.GridLayout(4, 2, 5, 5));
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.jLabel1.text")); // NOI18N
|
||||
jPanel1.add(jLabel1);
|
||||
|
||||
color_hex.setText(org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.color_hex.text_1")); // NOI18N
|
||||
color_hex.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
color_hexFocusLost(evt);
|
||||
}
|
||||
});
|
||||
color_hex.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
color_hexActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(color_hex);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.jLabel2.text")); // NOI18N
|
||||
jPanel1.add(jLabel2);
|
||||
|
||||
color_R.setText(org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.color_R.text")); // NOI18N
|
||||
color_R.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
color_RFocusLost(evt);
|
||||
}
|
||||
});
|
||||
color_R.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
color_RActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(color_R);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.jLabel3.text")); // NOI18N
|
||||
jPanel1.add(jLabel3);
|
||||
|
||||
color_G.setText(org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.color_G.text")); // NOI18N
|
||||
color_G.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
color_GFocusLost(evt);
|
||||
}
|
||||
});
|
||||
color_G.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
color_GActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(color_G);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.jLabel4.text")); // NOI18N
|
||||
jPanel1.add(jLabel4);
|
||||
|
||||
color_B.setText(org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.color_B.text")); // NOI18N
|
||||
color_B.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
color_BFocusLost(evt);
|
||||
}
|
||||
});
|
||||
color_B.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
color_BActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel1.add(color_B);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(test_mode, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.test_mode.text")); // NOI18N
|
||||
test_mode.addChangeListener(new javax.swing.event.ChangeListener() {
|
||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
||||
test_modeStateChanged(evt);
|
||||
}
|
||||
});
|
||||
|
||||
color_desc.setText(org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.color_desc.text_1")); // NOI18N
|
||||
color_desc.addFocusListener(new java.awt.event.FocusAdapter() {
|
||||
public void focusLost(java.awt.event.FocusEvent evt) {
|
||||
color_descFocusLost(evt);
|
||||
}
|
||||
});
|
||||
color_desc.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
color_descActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jPanel3.setLayout(new java.awt.GridLayout(3, 0, 0, 5));
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(load_btn, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.load_btn.text")); // NOI18N
|
||||
load_btn.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
load_btnActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(load_btn);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(reload_btn, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.reload_btn.text")); // NOI18N
|
||||
reload_btn.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
reload_btnActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(reload_btn);
|
||||
|
||||
org.openide.awt.Mnemonics.setLocalizedText(save_btn, org.openide.util.NbBundle.getMessage(ColorEditorTopComponent.class, "ColorEditorTopComponent.save_btn.text")); // NOI18N
|
||||
save_btn.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
save_btnActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jPanel3.add(save_btn);
|
||||
|
||||
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
||||
jPanel4.setLayout(jPanel4Layout);
|
||||
jPanel4Layout.setHorizontalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(color_desc, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(color_preview_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(test_mode, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel4Layout.setVerticalGroup(
|
||||
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel4Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(color_preview_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(test_mode, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(color_desc)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 624, Short.MAX_VALUE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE)
|
||||
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 517, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void color_listValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_color_listValueChanged
|
||||
|
||||
Color sel_col = (Color) this.color_list.getSelectedValue();
|
||||
if (sel_col != null)
|
||||
{
|
||||
if (sel_col.getObject().getClass() == ColorUIResource.class)
|
||||
{
|
||||
ColorUIResource col = (ColorUIResource) sel_col.getObject();
|
||||
update_preview (col);
|
||||
this.color_R.setText(String.valueOf (col.getRed()));
|
||||
this.color_G.setText(String.valueOf (col.getGreen()));
|
||||
this.color_B.setText(String.valueOf (col.getBlue()));
|
||||
this.color_hex.setText(String.format("#%06X", (0xFFFFFF & col.getRGB())));
|
||||
}
|
||||
else
|
||||
{
|
||||
java.awt.Color col = (java.awt.Color) sel_col.getObject();
|
||||
update_preview (col);
|
||||
this.color_R.setText(String.valueOf (col.getRed()));
|
||||
this.color_G.setText(String.valueOf (col.getGreen()));
|
||||
this.color_B.setText(String.valueOf (col.getBlue()));
|
||||
this.color_hex.setText(String.format("#%06X", (0xFFFFFF & col.getRGB())));
|
||||
}
|
||||
this.color_desc.setText(sel_col.getDescription());
|
||||
}
|
||||
|
||||
}//GEN-LAST:event_color_listValueChanged
|
||||
|
||||
private void update_preview (java.awt.Color col)
|
||||
{
|
||||
this.color_preview_panel.setBackground(col);
|
||||
this.color_preview_panel.repaint();
|
||||
}
|
||||
|
||||
private void color_hexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_color_hexActionPerformed
|
||||
|
||||
try
|
||||
{
|
||||
Color sel_col = (Color) this.color_list.getSelectedValue();
|
||||
java.awt.Color tmp = java.awt.Color.decode(this.color_hex.getText());
|
||||
sel_col.setR(tmp.getRed());
|
||||
sel_col.setG(tmp.getGreen());
|
||||
sel_col.setB(tmp.getBlue());
|
||||
color_listValueChanged (null);
|
||||
Kernel.reloadUI();
|
||||
update_preview ((java.awt.Color) sel_col.getObject());
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
||||
}
|
||||
}//GEN-LAST:event_color_hexActionPerformed
|
||||
|
||||
private void color_RActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_color_RActionPerformed
|
||||
try
|
||||
{
|
||||
int newP = Integer.parseInt(this.color_R.getText());
|
||||
Color sel_col = (Color) this.color_list.getSelectedValue();
|
||||
if (newP > 255)
|
||||
{
|
||||
this.color_R.setText("255");
|
||||
newP = 255;
|
||||
}
|
||||
if (newP < 0)
|
||||
{
|
||||
this.color_R.setText("0");
|
||||
newP = 0;
|
||||
}
|
||||
|
||||
sel_col.setR(newP);
|
||||
color_listValueChanged (null);
|
||||
Kernel.reloadUI();
|
||||
update_preview ((java.awt.Color) sel_col.getObject());
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
||||
}
|
||||
}//GEN-LAST:event_color_RActionPerformed
|
||||
|
||||
private void color_GActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_color_GActionPerformed
|
||||
try
|
||||
{
|
||||
int newP = Integer.parseInt(this.color_G.getText());
|
||||
if (newP > 255)
|
||||
{
|
||||
this.color_G.setText("255");
|
||||
newP = 255;
|
||||
}
|
||||
if (newP < 0)
|
||||
{
|
||||
this.color_G.setText("0");
|
||||
newP = 0;
|
||||
}
|
||||
Color sel_col = (Color) this.color_list.getSelectedValue();
|
||||
sel_col.setG(newP);
|
||||
color_listValueChanged (null);
|
||||
Kernel.reloadUI();
|
||||
update_preview ((java.awt.Color) sel_col.getObject());
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
||||
}
|
||||
}//GEN-LAST:event_color_GActionPerformed
|
||||
|
||||
private void color_BActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_color_BActionPerformed
|
||||
try
|
||||
{
|
||||
int newP = Integer.parseInt(this.color_B.getText());
|
||||
if (newP > 255)
|
||||
{
|
||||
this.color_B.setText("255");
|
||||
newP = 255;
|
||||
}
|
||||
if (newP < 0)
|
||||
{
|
||||
this.color_B.setText("0");
|
||||
newP = 0;
|
||||
}
|
||||
Color sel_col = (Color) this.color_list.getSelectedValue();
|
||||
sel_col.setB(newP);
|
||||
color_listValueChanged (null);
|
||||
Kernel.reloadUI();
|
||||
update_preview ((java.awt.Color) sel_col.getObject());
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
|
||||
}
|
||||
}//GEN-LAST:event_color_BActionPerformed
|
||||
|
||||
private final Color test_color = new Color(new ColorUIResource(java.awt.Color.PINK));
|
||||
|
||||
private void test_modeStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_test_modeStateChanged
|
||||
if (this.test_mode.isSelected())
|
||||
{
|
||||
this.color_list.setEnabled(false);
|
||||
|
||||
this.color_hex.setEnabled(false);
|
||||
this.color_R.setEnabled(false);
|
||||
this.color_G.setEnabled(false);
|
||||
this.color_B.setEnabled(false);
|
||||
this.color_desc.setEnabled(false);
|
||||
|
||||
this.save_btn.setEnabled(false);
|
||||
this.load_btn.setEnabled(false);
|
||||
this.reload_btn.setEnabled(false);
|
||||
this.color_desc.setEnabled(false);
|
||||
|
||||
|
||||
Color real = (Color) this.color_list.getSelectedValue();
|
||||
java.awt.Color cc = (java.awt.Color) real.getObject();
|
||||
java.awt.Color test = (java.awt.Color) test_color.getObject();
|
||||
|
||||
real.setObject(test);
|
||||
test_color.setObject(cc);
|
||||
color_listValueChanged (null);
|
||||
Kernel.reloadUI();
|
||||
update_preview ((java.awt.Color) real.getObject());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.color_list.setEnabled(true);
|
||||
|
||||
this.color_hex.setEnabled(true);
|
||||
this.color_R.setEnabled(true);
|
||||
this.color_G.setEnabled(true);
|
||||
this.color_B.setEnabled(true);
|
||||
this.color_desc.setEnabled(true);
|
||||
|
||||
this.save_btn.setEnabled(true);
|
||||
this.load_btn.setEnabled(true);
|
||||
this.reload_btn.setEnabled(true);
|
||||
this.color_desc.setEnabled(true);
|
||||
|
||||
Color real = (Color) this.color_list.getSelectedValue();
|
||||
java.awt.Color cc = (java.awt.Color) real.getObject();
|
||||
java.awt.Color test = (java.awt.Color) test_color.getObject();
|
||||
|
||||
real.setObject(test);
|
||||
test_color.setObject(cc);
|
||||
color_listValueChanged (null);
|
||||
Kernel.reloadUI();
|
||||
update_preview ((java.awt.Color) real.getObject());
|
||||
|
||||
}
|
||||
}//GEN-LAST:event_test_modeStateChanged
|
||||
|
||||
private void color_hexFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_color_hexFocusLost
|
||||
color_hexActionPerformed (null);
|
||||
}//GEN-LAST:event_color_hexFocusLost
|
||||
|
||||
private void color_RFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_color_RFocusLost
|
||||
color_RActionPerformed (null);
|
||||
}//GEN-LAST:event_color_RFocusLost
|
||||
|
||||
private void color_GFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_color_GFocusLost
|
||||
color_GActionPerformed (null);
|
||||
}//GEN-LAST:event_color_GFocusLost
|
||||
|
||||
private void color_BFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_color_BFocusLost
|
||||
color_BActionPerformed (null);
|
||||
}//GEN-LAST:event_color_BFocusLost
|
||||
|
||||
private void save_btnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_btnActionPerformed
|
||||
Kernel.save();
|
||||
}//GEN-LAST:event_save_btnActionPerformed
|
||||
|
||||
private void reload_btnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reload_btnActionPerformed
|
||||
Kernel.reload();
|
||||
reload_list();
|
||||
}//GEN-LAST:event_reload_btnActionPerformed
|
||||
|
||||
private void load_btnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_load_btnActionPerformed
|
||||
|
||||
JFileChooser loadFile = new JFileChooser();//new dialog
|
||||
loadFile.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
loadFile.setFileFilter(new FileFilter() {
|
||||
|
||||
@Override
|
||||
public boolean accept(File file) {
|
||||
return file.getName().toLowerCase().endsWith("idp_scheme");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return ("[idP!] Crew Netbeans Color Scheme File");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (loadFile.showOpenDialog(this)==JFileChooser.APPROVE_OPTION)
|
||||
{
|
||||
if (loadFile.getSelectedFile() != null)
|
||||
{
|
||||
File scheme_file = loadFile.getSelectedFile();
|
||||
Kernel.load(scheme_file.getAbsolutePath());
|
||||
reload_list();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_load_btnActionPerformed
|
||||
|
||||
private void color_descActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_color_descActionPerformed
|
||||
Color sel_col = (Color) this.color_list.getSelectedValue();
|
||||
sel_col.setDescription(this.color_desc.getText());
|
||||
}//GEN-LAST:event_color_descActionPerformed
|
||||
|
||||
private void color_descFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_color_descFocusLost
|
||||
color_descActionPerformed (null);
|
||||
}//GEN-LAST:event_color_descFocusLost
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JTextField color_B;
|
||||
private javax.swing.JTextField color_G;
|
||||
private javax.swing.JTextField color_R;
|
||||
private javax.swing.JTextField color_desc;
|
||||
private javax.swing.JTextField color_hex;
|
||||
private javax.swing.JList color_list;
|
||||
private javax.swing.JPanel color_preview_panel;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JPanel jPanel4;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JButton load_btn;
|
||||
private javax.swing.JButton reload_btn;
|
||||
private javax.swing.JButton save_btn;
|
||||
private javax.swing.JToggleButton test_mode;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
@Override
|
||||
public void componentOpened() {
|
||||
reload_list();
|
||||
}
|
||||
|
||||
private void reload_list ()
|
||||
{
|
||||
Color[] colors = Kernel.getColors ();
|
||||
|
||||
this.color_list.setListData(colors);
|
||||
|
||||
if (colors.length == 0)
|
||||
{
|
||||
this.color_list.setEnabled(false);
|
||||
|
||||
this.color_hex.setEnabled(false);
|
||||
this.color_R.setEnabled(false);
|
||||
this.color_G.setEnabled(false);
|
||||
this.color_B.setEnabled(false);
|
||||
this.color_desc.setEnabled(false);
|
||||
|
||||
this.color_hex.setText("");
|
||||
this.color_R.setText("");
|
||||
this.color_G.setText("");
|
||||
this.color_B.setText("");
|
||||
this.color_desc.setText("");
|
||||
|
||||
this.save_btn.setEnabled(false);
|
||||
this.load_btn.setEnabled(false);
|
||||
this.reload_btn.setEnabled(false);
|
||||
this.color_desc.setEnabled(false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
this.color_list.setSelectedIndex(0);
|
||||
this.color_list.setEnabled(true);
|
||||
|
||||
this.color_hex.setEnabled(true);
|
||||
this.color_R.setEnabled(true);
|
||||
this.color_G.setEnabled(true);
|
||||
this.color_B.setEnabled(true);
|
||||
|
||||
this.save_btn.setEnabled(true);
|
||||
this.load_btn.setEnabled(true);
|
||||
this.reload_btn.setEnabled(true);
|
||||
this.color_desc.setEnabled(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentClosed() {
|
||||
// TODO add custom code on component closing
|
||||
}
|
||||
|
||||
void writeProperties(java.util.Properties p) {
|
||||
// better to version settings since initial version as advocated at
|
||||
// http://wiki.apidesign.org/wiki/PropertyFiles
|
||||
p.setProperty("version", "1.0");
|
||||
// TODO store your settings
|
||||
}
|
||||
|
||||
void readProperties(java.util.Properties p) {
|
||||
String version = p.getProperty("version");
|
||||
// TODO read your settings according to their version
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 KiB |
Loading…
Reference in New Issue