From 41992950fb6750c44442e9aa5dcdcf8236d6161b Mon Sep 17 00:00:00 2001 From: Harald Christian Joachim Wolff Date: Fri, 18 May 2018 11:35:34 +0200 Subject: [PATCH] + JDiagram.setColoredBackgrounds(...) --- src/org/hwo/ui/JDiagram.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/org/hwo/ui/JDiagram.java b/src/org/hwo/ui/JDiagram.java index bfbfb5a..2d68776 100644 --- a/src/org/hwo/ui/JDiagram.java +++ b/src/org/hwo/ui/JDiagram.java @@ -486,8 +486,14 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde Point2D pmin = mapDiagramToMouse(new Point2D.Double(0, bg.getMin())); Point2D pmax = mapDiagramToMouse(new Point2D.Double(0, bg.getMax())); + int x,y,width,height; + width = this.plotWidth; + height = (int)(pmin.getY() - pmax.getY()); + x = getWidth() - this.plotWidth - this.bRight; + y = (int)(pmax.getY()); + g.setColor(bg.getColor()); - g.fillRect(0, (int)pmax.getY(), getWidth(), (int)(pmax.getY() - pmin.getX())); + g.fillRect(0,y,getWidth(),height); } paintOrdinates ((Graphics2D) g); @@ -852,7 +858,7 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde this.num = num; this.colDraw = Color.BLACK; - this.colGrid = Color.LIGHT_GRAY; + this.colGrid = Color.GRAY; this.scaler = new LinearScaler(); } @@ -942,4 +948,8 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde public List getColoredBackgrounds() { return coloredBackgrounds; } + public void setColoredBackgrounds(List backgrounds){ + this.coloredBackgrounds.clear(); + this.coloredBackgrounds.addAll(backgrounds); + } }