|
|
|
@ -5,11 +5,18 @@
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
package org.idp.laf.gui;
|
|
|
|
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.netbeans.api.settings.ConvertAsProperties;
|
|
|
|
import org.openide.awt.ActionID;
|
|
|
|
import org.openide.awt.ActionID;
|
|
|
|
import org.openide.awt.ActionReference;
|
|
|
|
import org.openide.awt.ActionReference;
|
|
|
|
import org.openide.windows.TopComponent;
|
|
|
|
import org.openide.windows.TopComponent;
|
|
|
|
import org.openide.util.NbBundle.Messages;
|
|
|
|
import org.openide.util.NbBundle.Messages;
|
|
|
|
|
|
|
|
import sun.swing.PrintColorUIResource;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @author Edward M. Kagan <pagan@idp-crew.com>
|
|
|
|
* @author Edward M. Kagan <pagan@idp-crew.com>
|
|
|
|
@ -59,23 +66,484 @@ public final class ColorEditorTopComponent extends TopComponent {
|
|
|
|
// <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() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
reload_btn = new javax.swing.JButton();
|
|
|
|
|
|
|
|
save_btn = new javax.swing.JButton();
|
|
|
|
|
|
|
|
load_btn = new javax.swing.JButton();
|
|
|
|
|
|
|
|
test_mode = new javax.swing.JToggleButton();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, 234, 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(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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
|
|
|
|
|
|
|
|
.addComponent(color_preview_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
|
|
|
.addComponent(save_btn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
|
|
|
.addComponent(reload_btn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
|
|
|
.addComponent(load_btn, 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))
|
|
|
|
|
|
|
|
.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, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
|
|
|
.addComponent(save_btn)
|
|
|
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
|
|
|
.addComponent(reload_btn)
|
|
|
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
|
|
|
.addComponent(load_btn)
|
|
|
|
|
|
|
|
.addContainerGap())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
.addGap(0, 400, Short.MAX_VALUE)
|
|
|
|
.addGroup(layout.createSequentialGroup()
|
|
|
|
|
|
|
|
.addContainerGap()
|
|
|
|
|
|
|
|
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 636, Short.MAX_VALUE)
|
|
|
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
|
|
|
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
|
|
|
.addContainerGap())
|
|
|
|
);
|
|
|
|
);
|
|
|
|
layout.setVerticalGroup(
|
|
|
|
layout.setVerticalGroup(
|
|
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
.addGap(0, 300, Short.MAX_VALUE)
|
|
|
|
.addGroup(layout.createSequentialGroup()
|
|
|
|
|
|
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
|
|
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
|
|
|
|
|
.addContainerGap()
|
|
|
|
|
|
|
|
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE))
|
|
|
|
|
|
|
|
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE))
|
|
|
|
|
|
|
|
.addContainerGap())
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
}// </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())));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//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.save_btn.setEnabled(false);
|
|
|
|
|
|
|
|
this.load_btn.setEnabled(false);
|
|
|
|
|
|
|
|
this.reload_btn.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.save_btn.setEnabled(true);
|
|
|
|
|
|
|
|
this.load_btn.setEnabled(true);
|
|
|
|
|
|
|
|
this.reload_btn.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
|
|
|
|
|
|
|
|
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
|
|
// 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_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 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
|
|
|
|
// End of variables declaration//GEN-END:variables
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void componentOpened() {
|
|
|
|
public void componentOpened() {
|
|
|
|
// TODO add custom code on component opening
|
|
|
|
reload_list();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void reload_list ()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Color[] colors = Kernel.getColors ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.color_list.setListData(colors);
|
|
|
|
|
|
|
|
this.color_list.setSelectedIndex(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
|