From 84e220b332bfffb0f2dcc39b9697a6fd6691d265 Mon Sep 17 00:00:00 2001 From: Leonard Kugis Date: Mon, 25 Apr 2022 18:36:30 +0200 Subject: Initial commit --- src/function/Display.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 src/function/Display.java (limited to 'src/function/Display.java') diff --git a/src/function/Display.java b/src/function/Display.java new file mode 100755 index 0000000..3241c5c --- /dev/null +++ b/src/function/Display.java @@ -0,0 +1,45 @@ +package function; +import java.awt.Color; +import java.awt.Graphics; +import java.util.ArrayList; + + +public class Display { + + private int x, y, width, height, xMin, xMax, yMin, yMax; + private ArrayList functions; + + public Display(int x, int y, int width, int height, int xMin, int xMax, int yMin, int yMax, ArrayList functions) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.xMin = xMin; + this.xMax = xMax; + this.yMin = yMin; + this.yMax = yMax; + this.functions = functions; + } + + public Display(int x, int y, int width, int height, int xMin, int xMax, int yMin, int yMax) { + this(x, y, width, height, xMin, xMax, yMin, yMax, new ArrayList()); + } + + public void draw(Graphics g) { + for(int i = 0, size = functions.size(); i= 0 && y1 <= height && y2 >= 0 && y2 <= height) + g.drawLine(this.x+x, this.y+y1, this.x+x+1, this.y+y2); + } + } + g.setColor(Color.BLACK); + g.drawRect(x, y, width, height); + } + + public void addFunction(Function f) { + functions.add(f); + } + +} -- cgit v1.2.1