From 6136f9d1e99b6296d7d8a2405fc2f541666d14fa Mon Sep 17 00:00:00 2001 From: "T. van der Zwan" Date: Sun, 17 Nov 2013 21:06:30 +0100 Subject: [PATCH] (re)Added the total led count to the simulation image Former-commit-id: b91b7063d70b33b543bfeaefd334253d9fed4688 --- .../hypercon/gui/LedSimulationComponent.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulationComponent.java b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulationComponent.java index 18ac8274..2ebcd650 100644 --- a/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulationComponent.java +++ b/src/config-tool/ConfigTool/src/org/hyperion/hypercon/gui/LedSimulationComponent.java @@ -3,6 +3,8 @@ package org.hyperion.hypercon.gui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; @@ -59,6 +61,7 @@ public class LedSimulationComponent extends JPanel { private JProgressBar mProgressBar; LedTvComponent mTvComponent; + private int mLedCnt = 0; public LedSimulationComponent(Vector pLeds) { super(); @@ -133,6 +136,7 @@ public class LedSimulationComponent extends JPanel { LedSimulationWorker mWorker = null; public void setLeds(Vector pLeds) { + mLedCnt = pLeds == null? 0 : pLeds.size(); mTvComponent.setLeds(pLeds); synchronized (LedSimulationComponent.this) { @@ -199,6 +203,16 @@ public class LedSimulationComponent extends JPanel { mWorker.execute(); } + @Override + public void paint(Graphics g) { + super.paint(g); + + Graphics2D gCopy = (Graphics2D)g.create(); + gCopy.setXORMode(Color.WHITE); + gCopy.setFont(gCopy.getFont().deriveFont(20.0f)); + String ledCntStr = "Led count: " + mLedCnt; + gCopy.drawString(ledCntStr, getWidth()-150.0f, getHeight()-10.0f); + } public static void main(String[] pArgs) { JFrame frame = new JFrame();