[Pixelle-commit] SF.net SVN: pixelle: [44] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-21 16:43:16
|
Revision: 44
http://pixelle.svn.sourceforge.net/pixelle/?rev=44&view=rev
Author: dbrosius
Date: 2008-06-21 09:43:21 -0700 (Sat, 21 Jun 2008)
Log Message:
-----------
move dialog to new dialog package
Added Paths:
-----------
trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java
Removed Paths:
-------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
Deleted: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java 2008-06-21 16:42:25 UTC (rev 43)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java 2008-06-21 16:43:21 UTC (rev 44)
@@ -1,148 +0,0 @@
-/*
- * pixelle - Graphics algorithmic editor
- * Copyright (C) 2008 Dave Brosius
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-package com.mebigfatguy.pixelle;
-
-import java.awt.BorderLayout;
-import java.awt.Container;
-import java.awt.GridLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.EnumMap;
-import java.util.Map;
-
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JDialog;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-
-import com.mebigfatguy.pixelle.utils.GuiUtils;
-
-public class PixelleExpressionDialog extends JDialog {
- private static final long serialVersionUID = -4549468926608244333L;
-
- private static final int NUM_LABELS = 5;
-
- private final JLabel lhs[] =
- {
- new JLabel(PixelleBundle.getString(PixelleBundle.RED_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA) + " = "),
- new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA) + " = ")
- };
-
- private final JTextField editor[] =
- {
- new JTextField(PixelleBundle.getString(PixelleBundle.RED_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA), 80),
- new JTextField(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA), 80)
- };
-
- private final JLabel labels[] =
- {
- new JLabel(PixelleBundle.getString(PixelleBundle.RED_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_LABEL)),
- new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_LABEL))
- };
-
- JButton ok;
- JButton cancel;
- boolean clickedOK = false;
-
- public PixelleExpressionDialog(PixelleFrame owner) {
- super(owner, PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHMS));
- initComponents();
- initListeners();
- }
-
- public boolean isOK() {
- return clickedOK;
- }
-
- public Map<PixelleComponent, String> getAlgorithms() {
- Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
- algorithms.put(PixelleComponent.RED, editor[0].getText());
- algorithms.put(PixelleComponent.GREEN, editor[1].getText());
- algorithms.put(PixelleComponent.BLUE, editor[2].getText());
- algorithms.put(PixelleComponent.TRANSPARENCY, editor[3].getText());
- algorithms.put(PixelleComponent.SELECTION, editor[4].getText());
- return algorithms;
- }
-
- private void initComponents() {
- Container cp = getContentPane();
- cp.setLayout(new GridLayout(6, 1));
-
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, lhs);
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, editor);
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, labels);
-
- for (int i = 0; i < NUM_LABELS; i++) {
- JPanel p = new JPanel();
- p.setLayout(new BorderLayout(10, 10));
- p.add(lhs[i], BorderLayout.WEST);
- p.add(editor[i], BorderLayout.CENTER);
- p.add(labels[i], BorderLayout.EAST);
- p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
- cp.add(p);
- }
-
- ok = new JButton(PixelleBundle.getString(PixelleBundle.OK));
- cancel = new JButton(PixelleBundle.getString(PixelleBundle.CANCEL));
- GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel});
-
- JPanel p = new JPanel();
- p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
- p.add(Box.createHorizontalGlue());
- p.add(ok);
- p.add(Box.createHorizontalStrut(10));
- p.add(cancel);
- p.add(Box.createHorizontalGlue());
- p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
- cp.add(p);
- pack();
- }
-
- private void initListeners() {
- ok.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- clickedOK = true;
- dispose();
- }
- });
-
- cancel.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- dispose();
- }
- });
-
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- }
-}
Copied: trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java (from rev 43, trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleExpressionDialog.java)
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java (rev 0)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/dialogs/PixelleExpressionDialog.java 2008-06-21 16:43:21 UTC (rev 44)
@@ -0,0 +1,148 @@
+/*
+ * pixelle - Graphics algorithmic editor
+ * Copyright (C) 2008 Dave Brosius
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+package com.mebigfatguy.pixelle;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.EnumMap;
+import java.util.Map;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+
+import com.mebigfatguy.pixelle.utils.GuiUtils;
+
+public class PixelleExpressionDialog extends JDialog {
+ private static final long serialVersionUID = -4549468926608244333L;
+
+ private static final int NUM_LABELS = 5;
+
+ private final JLabel lhs[] =
+ {
+ new JLabel(PixelleBundle.getString(PixelleBundle.RED_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA) + " = "),
+ new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA) + " = ")
+ };
+
+ private final JTextField editor[] =
+ {
+ new JTextField(PixelleBundle.getString(PixelleBundle.RED_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.GREEN_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.BLUE_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_FORMULA), 80),
+ new JTextField(PixelleBundle.getString(PixelleBundle.SELECTION_FORMULA), 80)
+ };
+
+ private final JLabel labels[] =
+ {
+ new JLabel(PixelleBundle.getString(PixelleBundle.RED_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.GREEN_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.BLUE_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.TRANSPARENCY_LABEL)),
+ new JLabel(PixelleBundle.getString(PixelleBundle.SELECTION_LABEL))
+ };
+
+ JButton ok;
+ JButton cancel;
+ boolean clickedOK = false;
+
+ public PixelleExpressionDialog(PixelleFrame owner) {
+ super(owner, PixelleBundle.getString(PixelleBundle.PIXEL_ALGORITHMS));
+ initComponents();
+ initListeners();
+ }
+
+ public boolean isOK() {
+ return clickedOK;
+ }
+
+ public Map<PixelleComponent, String> getAlgorithms() {
+ Map<PixelleComponent, String> algorithms = new EnumMap<PixelleComponent, String>(PixelleComponent.class);
+ algorithms.put(PixelleComponent.RED, editor[0].getText());
+ algorithms.put(PixelleComponent.GREEN, editor[1].getText());
+ algorithms.put(PixelleComponent.BLUE, editor[2].getText());
+ algorithms.put(PixelleComponent.TRANSPARENCY, editor[3].getText());
+ algorithms.put(PixelleComponent.SELECTION, editor[4].getText());
+ return algorithms;
+ }
+
+ private void initComponents() {
+ Container cp = getContentPane();
+ cp.setLayout(new GridLayout(6, 1));
+
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, lhs);
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, editor);
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, labels);
+
+ for (int i = 0; i < NUM_LABELS; i++) {
+ JPanel p = new JPanel();
+ p.setLayout(new BorderLayout(10, 10));
+ p.add(lhs[i], BorderLayout.WEST);
+ p.add(editor[i], BorderLayout.CENTER);
+ p.add(labels[i], BorderLayout.EAST);
+ p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+ cp.add(p);
+ }
+
+ ok = new JButton(PixelleBundle.getString(PixelleBundle.OK));
+ cancel = new JButton(PixelleBundle.getString(PixelleBundle.CANCEL));
+ GuiUtils.sizeUniformly(GuiUtils.Sizing.Both, new JComponent[] {ok, cancel});
+
+ JPanel p = new JPanel();
+ p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
+ p.add(Box.createHorizontalGlue());
+ p.add(ok);
+ p.add(Box.createHorizontalStrut(10));
+ p.add(cancel);
+ p.add(Box.createHorizontalGlue());
+ p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
+ cp.add(p);
+ pack();
+ }
+
+ private void initListeners() {
+ ok.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ clickedOK = true;
+ dispose();
+ }
+ });
+
+ cancel.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent ae) {
+ dispose();
+ }
+ });
+
+ setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|