Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Switched MacFrame over to java, switching SimUI over to java

  • Loading branch information...
commit b246439ea27d472e1fae6aa61fee558aec0594ea 1 parent aed016c
Zachary Kim authored
View
4 neurons
@@ -9,8 +9,8 @@
</color>
<mediaFile>./neuron_media_files/thalamus.wav</mediaFile>
<location class="java.awt.geom.Point2D$Double">
- <x>45.0</x>
- <y>-113.5</y>
+ <x>54.82310182985435</x>
+ <y>-166.9813321847627</y>
</location>
</napplelabs.dbssim.neuron.NeuronPathRep>
</list>
View
138 src/main/groovy/napplelabs/dbssim/ui/MacFrame.groovy
@@ -1,138 +0,0 @@
-/*
- MockDBS: Deep Brain Stimulation Simulator
- Copyright (C) 2009 Zachary Kim
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program 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 General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-package napplelabs.dbssim.ui
-
-import javax.swing.JFrame
-import java.awt.Dimension
-import javax.swing.SwingUtilities
-import java.lang.Runnable
-import com.explodingpixels.macwidgets.MacWidgetFactory
-import com.explodingpixels.macwidgets.TriAreaComponent
-import java.awt.BorderLayout
-import com.explodingpixels.macwidgets.BottomBarSize
-import javax.swing.JLabel
-import javax.swing.JPanel
-import javax.swing.JButton
-import ddf.minim.Minim
-import napplelabs.dbssim.NeuronSignal
-import ddf.minim.signals.PinkNoise
-import ddf.minim.AudioOutput
-import javax.swing.AbstractButton
-import javax.swing.JComponent
-import java.util.List
-import javax.swing.ButtonGroup
-import com.explodingpixels.macwidgets.LabeledComponentGroup
-
-/**
- *
- * MacFrame takes responsibility for creating the wrapping jframe,
- * a navigation bar, and a bottom bar. It also provides a convience method, addToolbarButton,
- * which allows you to create a center toolbar button group w/o having to concern yourself
- * with the setup & teardown.
- *
- * |-----------------------------|
- * | a |
- * |-----------------------------|
- * | |
- * | |
- * | |
- * | |
- * | |
- * | |
- * | |
- * | |
- * | |
- * |-----------------------------|
- * | b |
- * |-----------------------------|
- *
- *
- * @author zkim
- *
- */
-public class MacFrame{
-
- JFrame frame
- TriAreaComponent toolbar
- TriAreaComponent bottombar
- JPanel content;
- List<JButton> toolbarButtons = []
-
- boolean visible = false
-
- public MacFrame(int width, int height) {
- frame = new JFrame("MockDBS")
- frame.defaultCloseOperation = JFrame.EXIT_ON_CLOSE
- frame.size = new Dimension(width, height)
-
- toolbar = MacWidgetFactory.createUnifiedToolBar()
- frame.contentPane.add(toolbar.component, BorderLayout.NORTH)
-
- bottombar = MacWidgetFactory.createBottomBar(BottomBarSize.LARGE);
- frame.contentPane.add(bottombar.component, BorderLayout.SOUTH)
- content = new JPanel()
- content.layout = new BorderLayout()
- frame.contentPane.add(content, BorderLayout.CENTER)
-
- }
-
- public void setVisisble(boolean vis) {
- frame.visible = vis
- }
-
- public boolean getVisible() {
- return frame.visible
- }
-
- def revalidate() {
- frame.contentPane.revalidate()
- }
-
- def addToolbarComponentRight(JComponent comp) {
- toolbar.addComponentToRight(comp)
- }
-
- def addToolbarComponentCenter(JComponent comp) {
- toolbar.addComponentToCenter(comp)
- }
-
- def addToolbarComponentLeft(JComponent comp) {
- toolbar.addComponentToLeft(comp)
- }
-
- def addToolbarButton(List<JButton> buttons) {
-
- ButtonGroup group = new ButtonGroup();
-
- buttons.eachWithIndex {button, i ->
- button.putClientProperty("JButton.buttonType", "segmentedTextured");
- if(i == 0) {
- button.putClientProperty("JButton.segmentPosition", "first");
- } else if(i == buttons.size()-1) {
- button.putClientProperty("JButton.segmentPosition", "last");
- } else {
- button.putClientProperty("JButton.segmentPosition", "middle");
- }
-
- group.add(button)
- button.setFocusable(false);
- };
-
- LabeledComponentGroup viewButtons = new LabeledComponentGroup(null, buttons);
View
121 src/main/groovy/napplelabs/dbssim/ui/MacFrame.java
@@ -0,0 +1,121 @@
+package napplelabs.dbssim.ui;
+
+import java.awt.BorderLayout;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import com.explodingpixels.macwidgets.BottomBarSize;
+import com.explodingpixels.macwidgets.LabeledComponentGroup;
+import com.explodingpixels.macwidgets.MacWidgetFactory;
+import com.explodingpixels.macwidgets.TriAreaComponent;
+
+/**
+ *
+ * MacFrame takes responsibility for creating the wrapping jframe,
+ * a navigation bar, and a bottom bar. It also provides a convience method, addToolbarButton,
+ * which allows you to create a center toolbar button group w/o having to concern yourself
+ * with the setup & teardown.
+ *
+ * |-----------------------------|
+ * | a |
+ * |-----------------------------|
+ * | |
+ * | |
+ * | |
+ * | |
+ * | |
+ * | |
+ * | |
+ * | |
+ * | |
+ * |-----------------------------|
+ * | b |
+ * |-----------------------------|
+ *
+ *
+ * @author zkim
+ *
+ */
+
+public class MacFrame {
+ private JFrame frame;
+ private TriAreaComponent toolbar;
+ private TriAreaComponent bottombar;
+ private JPanel content;
+ private List<JButton> toolbarButtons = new ArrayList<JButton>();
+
+ public MacFrame(int width, int height) {
+ frame = new JFrame("MockDBS");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ frame.setSize(width, height);
+ frame.setLocationRelativeTo(null);
+
+ toolbar = MacWidgetFactory.createUnifiedToolBar();
+ frame.getContentPane().add(toolbar.getComponent(), BorderLayout.NORTH);
+
+ bottombar = MacWidgetFactory.createBottomBar(BottomBarSize.LARGE);
+ frame.getContentPane().add(bottombar.getComponent(), BorderLayout.SOUTH);
+ content = new JPanel();
+ content.setLayout(new BorderLayout());
+ frame.getContentPane().add(content, BorderLayout.CENTER);
+
+ }
+
+ public void setVisisble(boolean vis) {
+ frame.setVisible(vis);
+ }
+
+ public boolean getVisible() {
+ return frame.isVisible();
+ }
+
+ public void addToolbarComponentRight(JComponent comp) {
+ toolbar.addComponentToRight(comp);
+ }
+
+ public void addToolbarComponentCenter(JComponent comp) {
+ toolbar.addComponentToCenter(comp);
+ }
+
+ public void addToolbarComponentLeft(JComponent comp) {
+ toolbar.addComponentToLeft(comp);
+ }
+
+ public void addToolbarButton(List<JButton> buttons) {
+
+ ButtonGroup group = new ButtonGroup();
+
+ for(int i=0; i < buttons.size(); i++) {
+ JButton button = buttons.get(i);
+ button.putClientProperty("JButton.buttonType", "segmentedTextured");
+ if(i == 0) {
+ button.putClientProperty("JButton.segmentPosition", "first");
+ } else if(i == buttons.size()-1) {
+ button.putClientProperty("JButton.segmentPosition", "last");
+ } else {
+ button.putClientProperty("JButton.segmentPosition", "middle");
+ }
+
+ group.add(button);
+ button.setFocusable(false);
+ }
+
+ //LabeledComponentGroup viewButtons = new LabeledComponentGroup(null, );
+ //addToolbarComponentCenter(viewButtons.component)
+ }
+
+ public void addBottombarComponentCenter(JComponent comp) {
+ bottombar.addComponentToCenter(comp);
+ }
+
+ public void addBottombarComponentRight(JComponent comp) {
+ bottombar.addComponentToRight(comp);
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.