Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added view button stuff

  • Loading branch information...
commit 4d52063350a8141e5248fa858e356f246f377f57 1 parent 742cf50
@zk authored
View
BIN  bin-groovy/napplelabs/dbssim/ui/MacFrame$_addToolbarButton_closure1.class
Binary file not shown
View
BIN  bin-groovy/napplelabs/dbssim/ui/MacFrame.class
Binary file not shown
View
BIN  bin-groovy/napplelabs/dbssim/ui/SimUI$_closure1.class
Binary file not shown
View
BIN  bin-groovy/napplelabs/dbssim/ui/SimUI$_closure1_closure3.class
Binary file not shown
View
BIN  bin-groovy/napplelabs/dbssim/ui/SimUI$_closure2.class
Binary file not shown
View
BIN  bin-groovy/napplelabs/dbssim/ui/SimUI$_closure2_closure4.class
Binary file not shown
View
BIN  bin-groovy/napplelabs/dbssim/ui/SimUI.class
Binary file not shown
View
9 src/main/java/napplelabs/dbssim/TracePanel.java
@@ -48,6 +48,7 @@ public boolean isDone() {
}
public void run() {
+ done = false;
while(!isDone()) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
@@ -63,4 +64,12 @@ public void run() {
}
}
}
+
+ public void start() {
+ new Thread(this).start();
+ }
+
+ public void stop() {
+ this.done = true;
+ }
}
View
26 src/main/java/napplelabs/dbssim/ui/MacFrame.groovy
@@ -3,7 +3,7 @@
*/
package napplelabs.dbssim.ui
-import javax.swing.JFrame
+import javax.swing.JFrame
import java.awt.Dimension
import javax.swing.SwingUtilities
import java.lang.Runnable
@@ -13,6 +13,7 @@ public class MacFrame{
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
@@ -46,6 +47,29 @@ public class MacFrame{
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)
+
+ frame.visible = true;
+
+ }
+
+ def revalidate() {
+ frame.contentPane.revalidate()
+ }
+
+ def addToolbarComponentRight(JComponent comp) {
+ toolbar.addComponentToRight(comp)
+ }
+
+ def addToolbarComponentCenter(JComponent comp) {
+ toolbar.addComponentToCenter(comp)
+ }
+
+ def addToolbarButton(List<JButton> buttons) {
+
ButtonGroup group = new ButtonGroup();
buttons.eachWithIndex {button, i ->
View
54 src/main/java/napplelabs/dbssim/ui/SimUI.groovy
@@ -1,6 +1,6 @@
package napplelabs.dbssim.ui
-import ddf.minim.Minim
+import ddf.minim.Minim
import ddf.minim.AudioOutput
import napplelabs.dbssim.NeuronSignal
import napplelabs.dbssim.TracePanel
@@ -20,7 +20,8 @@ import ddf.minim.Minim import ddf.minim.AudioOutput import napplelabs.dbssim.Neu
MacFrame mf
public SimUI() {
mf = new MacFrame()
-
+
+ Minim minim = new Minim(null);
AudioOutput out = minim.getLineOut(Minim.MONO);
double one = (float) (Math.PI / 100);
@@ -31,29 +32,40 @@ import ddf.minim.Minim import ddf.minim.AudioOutput import napplelabs.dbssim.Neu
}
NeuronSignal ns = new NeuronSignal(sin, 5, 50);
+
+ out.addSignal(ns);
+ out.addSignal(new PinkNoise(0.1f));
+
+ final TracePanel panel = new TracePanel(out);
+ panel.start()
+
+ mf.content.add(panel, BorderLayout.CENTER)
+
+ AbstractButton playButton =
+ MacButtonFactory.makeUnifiedToolBarButton(
new JButton("Play", new ImageIcon(SimUI.class.getResource(
-
- TracePanel panel = new TracePanel(out);
-
- mf.content.add(panel, BorderLayout.CENTER)
-
- AbstractButton playButton =
- MacButtonFactory.makeUnifiedToolBarButton(
- new JButton("Play", new ImageIcon(SimUI.class.getResource(
- "/napplelabs/resources/dotmac.png"))));
-
- mf.addToolbarComponentRight(playButton)
-
-
- JToggleButton leftButton = new JToggleButton("Control");
-
- leftButton.putClientProperty("JButton.buttonType", "segmentedTextured");
- leftButton.putClientProperty("JButton.segmentPosition", "first");
- leftButton.setFocusable(false);
+ "/napplelabs/resources/dotmac.png"))));
+
+ mf.addToolbarComponentRight(playButton)
+
+ JButton control = new JButton("Control");
+ control.putClientProperty("JButton.buttonType", "segmentedTextured");
+ control.putClientProperty("JButton.segmentPosition", "first");
+ control.setFocusable(false);
+ control.addActionListener({
+ mf.content.remove(panel)
+ SwingUtilities.invokeLater({
+ mf.content.repaint()
+ mf.revalidate()
+ } as Runnable)
+ } as ActionListener);
+
+ JButton trace = new JButton("Trace");
+ trace.putClientProperty("JButton.buttonType", "segmentedTextured");
trace.putClientProperty("JButton.segmentPosition", "last");
trace.setFocusable(false);
trace.addActionListener({
- rightButton.putClientProperty("JButton.segmentPosition", "last");
+ mf.content.add(panel, BorderLayout.CENTER)
SwingUtilities.invokeLater({
mf.content.repaint()
mf.revalidate()
View
BIN  target/classes/napplelabs/dbssim/TracePanel$1.class
Binary file not shown
View
BIN  target/classes/napplelabs/dbssim/TracePanel.class
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.