From 417c93583d20adef7a0c1a3d9e5c03ba3b1c2441 Mon Sep 17 00:00:00 2001 From: ollo Date: Wed, 24 Apr 2019 21:09:41 +0200 Subject: [PATCH] Added brightness scrollbar into the GUI --- .../de/c3ma/ollo/mockup/ui/WS2812Layout.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/simulation/src/de/c3ma/ollo/mockup/ui/WS2812Layout.java b/simulation/src/de/c3ma/ollo/mockup/ui/WS2812Layout.java index ba32513..f836c66 100644 --- a/simulation/src/de/c3ma/ollo/mockup/ui/WS2812Layout.java +++ b/simulation/src/de/c3ma/ollo/mockup/ui/WS2812Layout.java @@ -21,7 +21,10 @@ import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JSlider; import javax.swing.JTextField; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; @@ -42,6 +45,13 @@ public class WS2812Layout extends JFrame { */ private static final long serialVersionUID = -6815557232118826140L; + /** + * Parameter for the ADC brightness control + */ + private static final int ADC_INIT = 512; + private static final int ADC_MIN = 0; + private static final int ADC_MAX = 1024; + private ArrayList mLines = new ArrayList(); private int mColumn = 0; private int mRow = 0; @@ -106,6 +116,19 @@ public class WS2812Layout extends JFrame { } contentPane.add(ledPanel, BorderLayout.CENTER); + JSlider adc = new JSlider(JSlider.VERTICAL, + ADC_MIN, ADC_MAX, ADC_INIT); + adc.addChangeListener(new ChangeListener() { + + @Override + public void stateChanged(ChangeEvent e) { + // TODO Auto-generated method stub + + } + }); + + contentPane.add(adc, BorderLayout.EAST); + JPanel bottomPanel = new JPanel(); final JTextField dateTime = new JTextField("yyyy-mm-dd HH:MM:SS");