aboutsummaryrefslogtreecommitdiff
path: root/src/GUIComponents
diff options
context:
space:
mode:
authorJoshua Rahm <joshua.rahm@colorado.edu>2015-01-30 17:11:48 -0700
committerJoshua Rahm <joshua.rahm@colorado.edu>2015-01-30 17:11:48 -0700
commit1c5e38fe69ac8a6decbdd8abe93112f4e3369315 (patch)
tree926cef8cb76d46862ed2c4ec7028720611e47476 /src/GUIComponents
downloadModulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.gz
Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.bz2
Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.zip
added source
Diffstat (limited to 'src/GUIComponents')
-rw-r--r--src/GUIComponents/GridPanel.java36
-rw-r--r--src/GUIComponents/JOptionPanel.java60
-rw-r--r--src/GUIComponents/MouseClickListener.java44
-rw-r--r--src/GUIComponents/MouseOneClickListener.java34
-rw-r--r--src/GUIComponents/OptionPanel.java58
-rw-r--r--src/GUIComponents/ProgressFrame.java44
-rw-r--r--src/GUIComponents/PushablePanel.java62
-rw-r--r--src/GUIComponents/ThreadRunner.java29
-rw-r--r--src/GUIComponents/ToggleButtonGroup.java51
-rw-r--r--src/GUIComponents/WrapperPanel.java22
10 files changed, 440 insertions, 0 deletions
diff --git a/src/GUIComponents/GridPanel.java b/src/GUIComponents/GridPanel.java
new file mode 100644
index 0000000..dc8d904
--- /dev/null
+++ b/src/GUIComponents/GridPanel.java
@@ -0,0 +1,36 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.Component;
+/* */ import java.awt.FlowLayout;
+/* */ import java.awt.GridLayout;
+/* */ import javax.swing.JPanel;
+/* */
+/* */ public class GridPanel extends JPanel
+/* */ {
+/* */ private JPanel[][] panels;
+/* */
+/* */ public GridPanel(int width, int height, int spacingx, int spacingy)
+/* */ {
+/* 18 */ this.panels = new JPanel[width][height];
+/* 19 */ setLayout(new GridLayout(height, width));
+/* 20 */ int i = 0; for (int a = 0; i < this.panels.length; a++) {
+/* 21 */ for (int j = 0; j < this.panels[0].length; a++)
+/* */ {
+/* 23 */ add(this.panels[i][j] = = new JPanel(new FlowLayout()));
+/* */
+/* 21 */ j++;
+/* */ }
+/* 20 */ i++;
+/* */ }
+/* */ }
+/* */
+/* */ public void add(Component component, int col, int row)
+/* */ {
+/* 30 */ this.panels[col][row].add(component);
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.GridPanel
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/JOptionPanel.java b/src/GUIComponents/JOptionPanel.java
new file mode 100644
index 0000000..08ec6a3
--- /dev/null
+++ b/src/GUIComponents/JOptionPanel.java
@@ -0,0 +1,60 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.BorderLayout;
+/* */ import java.awt.Dimension;
+/* */ import java.awt.GridLayout;
+/* */ import javax.swing.BorderFactory;
+/* */ import javax.swing.JPanel;
+/* */ import javax.swing.border.TitledBorder;
+/* */
+/* */ public class JOptionPanel extends JPanel
+/* */ {
+/* */ private JPanel[] panels;
+/* */
+/* */ public JOptionPanel(String[] titles, JPanel[] p)
+/* */ {
+/* 19 */ setLayout(new GridLayout(getCount(titles), 1));
+/* 20 */ if (p != null) {
+/* 21 */ this.panels = p;
+/* */ }
+/* */ else {
+/* 24 */ this.panels = new JPanel[titles.length];
+/* 25 */ for (int i = 0; i < this.panels.length; i++) {
+/* 26 */ this.panels[i] = new JPanel(new BorderLayout());
+/* 27 */ this.panels[i].setPreferredSize(new Dimension(getWidth(), getHeight() / titles.length));
+/* */ }
+/* */ }
+/* 30 */ for (int i = 0; i < titles.length; i++)
+/* 31 */ if (titles[i] != null) {
+/* 32 */ if (!titles[i].equals("")) {
+/* 33 */ TitledBorder titledBorder = BorderFactory.createTitledBorder(titles[i]);
+/* 34 */ this.panels[i].setBorder(titledBorder);
+/* */
+/* 36 */ if (i == 0) String str1 = "Center";
+/* 37 */ String layout;
+/* 37 */ if (i == 1) layout = "North"; else
+/* 38 */ layout = "South";
+/* */ }
+/* 40 */ add(this.panels[i], i);
+/* */ }
+/* */ }
+/* */
+/* */ public JOptionPanel(String[] titles) {
+/* 45 */ this(titles, null);
+/* */ }
+/* */ public int getCount(Object[] obj) {
+/* 48 */ int i = 0;
+/* 49 */ for (Object x : obj) {
+/* 50 */ if (x != null) i++;
+/* */ }
+/* 52 */ return i;
+/* */ }
+/* */ public JPanel getPanel(int index) {
+/* 55 */ return this.panels[index];
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.JOptionPanel
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/MouseClickListener.java b/src/GUIComponents/MouseClickListener.java
new file mode 100644
index 0000000..12b578f
--- /dev/null
+++ b/src/GUIComponents/MouseClickListener.java
@@ -0,0 +1,44 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.Container;
+/* */ import java.awt.event.MouseEvent;
+/* */ import java.awt.event.MouseListener;
+/* */
+/* */ public abstract class MouseClickListener
+/* */ implements MouseListener
+/* */ {
+/* */ private static Container listener;
+/* */
+/* */ public MouseClickListener(Container listener)
+/* */ {
+/* 10 */ listener = listener;
+/* */ }
+/* */
+/* */ public MouseClickListener()
+/* */ {
+/* */ }
+/* */
+/* */ public abstract void mouseClicked(MouseEvent paramMouseEvent);
+/* */
+/* */ public void mouseEntered(MouseEvent arg0)
+/* */ {
+/* */ }
+/* */
+/* */ public void mouseExited(MouseEvent arg0)
+/* */ {
+/* */ }
+/* */
+/* */ public abstract void mousePressed(MouseEvent paramMouseEvent);
+/* */
+/* */ public abstract void mouseReleased(MouseEvent paramMouseEvent);
+/* */
+/* */ public Container getContainer()
+/* */ {
+/* 36 */ return listener;
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.MouseClickListener
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/MouseOneClickListener.java b/src/GUIComponents/MouseOneClickListener.java
new file mode 100644
index 0000000..1758cea
--- /dev/null
+++ b/src/GUIComponents/MouseOneClickListener.java
@@ -0,0 +1,34 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.Container;
+/* */ import java.awt.event.MouseEvent;
+/* */
+/* */ public class MouseOneClickListener extends MouseClickListener
+/* */ {
+/* */ public MouseOneClickListener(Container listener)
+/* */ {
+/* 16 */ super(listener);
+/* */ }
+/* */
+/* */ public MouseOneClickListener()
+/* */ {
+/* */ }
+/* */
+/* */ public void mouseClicked(MouseEvent arg0)
+/* */ {
+/* */ }
+/* */
+/* */ public void mousePressed(MouseEvent arg0)
+/* */ {
+/* */ }
+/* */
+/* */ public void mouseReleased(MouseEvent arg0)
+/* */ {
+/* 47 */ getContainer().removeMouseListener(this);
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.MouseOneClickListener
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/OptionPanel.java b/src/GUIComponents/OptionPanel.java
new file mode 100644
index 0000000..7f03487
--- /dev/null
+++ b/src/GUIComponents/OptionPanel.java
@@ -0,0 +1,58 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.Dimension;
+/* */ import java.awt.GridLayout;
+/* */ import javax.swing.JPanel;
+/* */
+/* */ public class OptionPanel extends JPanel
+/* */ {
+/* */ private JOptionPanel[] outerPanels;
+/* */
+/* */ public OptionPanel(String[] titles, JPanel[] panels)
+/* */ {
+/* 21 */ this.outerPanels = new JOptionPanel[(int)Math.ceil(titles.length / 3.0D)];
+/* 22 */ setLayout(new GridLayout(1, this.outerPanels.length));
+/* 23 */ int i = 0; for (int count = 0; i < this.outerPanels.length; i++) {
+/* 24 */ count += 3;
+/* 25 */ int max = titles.length < count ? titles.length : count;
+/* 26 */ if (panels == null)
+/* 27 */ this.outerPanels[i] = new JOptionPanel(split(titles, count - 3, max));
+/* */ else
+/* 29 */ this.outerPanels[i] = new JOptionPanel(split(titles, count - 3, max), split(panels, count - 3, max));
+/* 30 */ this.outerPanels[i].setPreferredSize(new Dimension(getWidth() / this.outerPanels.length, getHeight()));
+/* */ String layout;
+/* */ String layout;
+/* 32 */ if (i == 0) { layout = "Center"; }
+/* */ else
+/* */ {
+/* 33 */ String layout;
+/* 33 */ if (i == 1) layout = "West"; else
+/* 34 */ layout = "East";
+/* */ }
+/* 36 */ add(this.outerPanels[i], i);
+/* */ }
+/* */ }
+/* */
+/* */ public JPanel getPanel(int index) {
+/* 41 */ return this.outerPanels[index];
+/* */ }
+/* */ private String[] split(String[] other, int min, int max) {
+/* 44 */ String[] ret = new String[max - min];
+/* 45 */ for (int i = min; i < max; i++) {
+/* 46 */ ret[(i - min)] = other[i];
+/* */ }
+/* 48 */ return ret;
+/* */ }
+/* */ private JPanel[] split(JPanel[] other, int min, int max) {
+/* 51 */ JPanel[] ret = new JPanel[max - min];
+/* 52 */ for (int i = min; i < max; i++) {
+/* 53 */ ret[(i - min)] = other[i];
+/* */ }
+/* 55 */ return ret;
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.OptionPanel
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/ProgressFrame.java b/src/GUIComponents/ProgressFrame.java
new file mode 100644
index 0000000..b95c8e7
--- /dev/null
+++ b/src/GUIComponents/ProgressFrame.java
@@ -0,0 +1,44 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.BorderLayout;
+/* */ import java.awt.FlowLayout;
+/* */ import javax.swing.JDialog;
+/* */ import javax.swing.JFrame;
+/* */ import javax.swing.JPanel;
+/* */ import javax.swing.JProgressBar;
+/* */
+/* */ public class ProgressFrame extends JDialog
+/* */ {
+/* */ private JProgressBar progress;
+/* */ private JPanel panelHolder;
+/* */ private double prog;
+/* */
+/* */ public ProgressFrame(int min, int max, JFrame parent)
+/* */ {
+/* 17 */ super(parent);
+/* 18 */ this.prog = 0.0D;
+/* 19 */ setLayout(new BorderLayout());
+/* 20 */ this.panelHolder = new JPanel(new FlowLayout());
+/* 21 */ add(this.panelHolder, "North");
+/* 22 */ this.progress = new JProgressBar(min, max);
+/* 23 */ this.progress.setSize(200, 50);
+/* 24 */ this.panelHolder.add(this.progress);
+/* 25 */ pack();
+/* */ }
+/* */ public void incrementProgress(double amt) {
+/* 28 */ this.prog += amt;
+/* 29 */ this.progress.setValue((int)this.prog);
+/* */ }
+/* */ public void setValue(double amt) {
+/* 32 */ this.prog = amt;
+/* 33 */ this.progress.setValue((int)this.prog);
+/* */ }
+/* */ public void flagEnd() {
+/* 36 */ setVisible(false);
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.ProgressFrame
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/PushablePanel.java b/src/GUIComponents/PushablePanel.java
new file mode 100644
index 0000000..3d67de1
--- /dev/null
+++ b/src/GUIComponents/PushablePanel.java
@@ -0,0 +1,62 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.Dimension;
+/* */ import java.awt.GridLayout;
+/* */ import java.util.ArrayList;
+/* */ import javax.swing.BoxLayout;
+/* */ import javax.swing.JComponent;
+/* */ import javax.swing.JPanel;
+/* */ import javax.swing.JScrollPane;
+/* */ import javax.swing.JViewport;
+/* */
+/* */ public class PushablePanel extends JPanel
+/* */ {
+/* */ private JScrollPane scroll;
+/* */ private ArrayList<JComponent> panels;
+/* */ private JPanel holdingPanel;
+/* */
+/* */ public PushablePanel(int height, int width, ArrayList<JComponent> start)
+/* */ {
+/* 24 */ setLayout(new GridLayout(1, 1));
+/* 25 */ this.panels = start;
+/* 26 */ this.scroll = new JScrollPane(22, 32);
+/* 27 */ this.holdingPanel = new JPanel();
+/* 28 */ this.holdingPanel.setLayout(new BoxLayout(this.holdingPanel, 1));
+/* */
+/* 31 */ for (JComponent p : this.panels) {
+/* 32 */ this.holdingPanel.add(p);
+/* */ }
+/* 34 */ this.scroll.getViewport().add(this.holdingPanel);
+/* 35 */ add(this.scroll);
+/* */ }
+/* */ public PushablePanel() {
+/* 38 */ this(150, 50, new ArrayList());
+/* */ }
+/* */
+/* */ public void pushComponent(JComponent panel) {
+/* 42 */ this.panels.add(panel);
+/* 43 */ this.holdingPanel.add(panel);
+/* 44 */ updateUI();
+/* */ }
+/* */ public void removeComponent(JComponent panel) {
+/* 47 */ this.panels.remove(panel);
+/* 48 */ this.holdingPanel.remove(panel);
+/* 49 */ updateUI();
+/* */ }
+/* */ public ArrayList<JComponent> getPushedComponents() {
+/* 52 */ return this.panels;
+/* */ }
+/* */ public void setPreferredSize(Dimension x) {
+/* 55 */ super.setPreferredSize(x);
+/* 56 */ this.scroll.setPreferredSize(x);
+/* */ }
+/* */ public void removeAllComponents() {
+/* 59 */ while (this.panels.size() > 0)
+/* 60 */ removeComponent((JComponent)this.panels.get(0));
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.PushablePanel
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/ThreadRunner.java b/src/GUIComponents/ThreadRunner.java
new file mode 100644
index 0000000..d3043ca
--- /dev/null
+++ b/src/GUIComponents/ThreadRunner.java
@@ -0,0 +1,29 @@
+/* */ package GUIComponents;
+/* */
+/* */ import javax.swing.JFrame;
+/* */
+/* */ public class ThreadRunner extends Thread
+/* */ {
+/* */ private ProgressFrame progress;
+/* */
+/* */ public ThreadRunner(JFrame parent)
+/* */ {
+/* 15 */ super(new ThreadGroup(Thread.currentThread().getThreadGroup().getParent(), "Loading"), "Bar");
+/* 16 */ this.progress = new ProgressFrame(0, 100, parent);
+/* 17 */ setPriority(1);
+/* */ }
+/* */ public void increment(double amt) {
+/* 20 */ this.progress.incrementProgress(amt);
+/* */ }
+/* */ public void flagEnd() {
+/* 23 */ this.progress.setVisible(false);
+/* */ }
+/* */ public void run() {
+/* 26 */ this.progress.setVisible(true);
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.ThreadRunner
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/ToggleButtonGroup.java b/src/GUIComponents/ToggleButtonGroup.java
new file mode 100644
index 0000000..a2c8ad6
--- /dev/null
+++ b/src/GUIComponents/ToggleButtonGroup.java
@@ -0,0 +1,51 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.event.ActionEvent;
+/* */ import java.awt.event.ActionListener;
+/* */ import java.util.ArrayList;
+/* */ import javax.swing.JToggleButton;
+/* */
+/* */ public class ToggleButtonGroup
+/* */ implements ActionListener
+/* */ {
+/* */ private ArrayList<JToggleButton> toggleButtons;
+/* */
+/* */ public ToggleButtonGroup()
+/* */ {
+/* 12 */ this.toggleButtons = new ArrayList();
+/* */ }
+/* */ public void addToggleButton(JToggleButton button) {
+/* 15 */ this.toggleButtons.add(button);
+/* 16 */ button.addActionListener(this);
+/* */ }
+/* */ public void removeToggleButton(JToggleButton button) {
+/* 19 */ this.toggleButtons.remove(button);
+/* 20 */ button.removeActionListener(this);
+/* */ }
+/* */ public JToggleButton getSelectedButton() {
+/* 23 */ for (int i = 0; i < this.toggleButtons.size(); i++) if (((JToggleButton)this.toggleButtons.get(i)).isSelected()) return (JToggleButton)this.toggleButtons.get(i);
+/* 24 */ return null;
+/* */ }
+/* */ public int getSelectedIndex() {
+/* 27 */ for (int i = 0; i < this.toggleButtons.size(); i++) if (((JToggleButton)this.toggleButtons.get(i)).isSelected()) return i;
+/* 28 */ return -1;
+/* */ }
+/* */ public void setSelectedIndex(int index) {
+/* 31 */ clear();
+/* 32 */ ((JToggleButton)this.toggleButtons.get(index)).setSelected(true);
+/* */ }
+/* */ private void clear() {
+/* 35 */ for (int i = 0; i < this.toggleButtons.size(); i++) ((JToggleButton)this.toggleButtons.get(i)).setSelected(false);
+/* */ }
+/* */
+/* */ public void actionPerformed(ActionEvent e)
+/* */ {
+/* 39 */ clear();
+/* 40 */ ((JToggleButton)e.getSource()).setSelected(true);
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.ToggleButtonGroup
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file
diff --git a/src/GUIComponents/WrapperPanel.java b/src/GUIComponents/WrapperPanel.java
new file mode 100644
index 0000000..c41c628
--- /dev/null
+++ b/src/GUIComponents/WrapperPanel.java
@@ -0,0 +1,22 @@
+/* */ package GUIComponents;
+/* */
+/* */ import java.awt.Component;
+/* */ import java.awt.FlowLayout;
+/* */ import javax.swing.JPanel;
+/* */
+/* */ public class WrapperPanel extends JPanel
+/* */ {
+/* */ public WrapperPanel(Component t)
+/* */ {
+/* 10 */ add(t);
+/* */ }
+/* */ public WrapperPanel(Component[] cArr) {
+/* 13 */ super(new FlowLayout());
+/* 14 */ for (Component x : cArr) add(x);
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: GUIComponents.WrapperPanel
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file