/** call display methods for all components */ public void display(java.awt.Graphics2D brush2D) { body.display(brush2D); bezel.display(brush2D); onButton.display(brush2D); volSlider.display(brush2D); volLevel.display(brush2D); }
/** move the HDTV to the specified x,y location. */ public void setLocation(int x, int y) { xLoc = x; yLoc = y; body.setLocation(x + bodyX, y + bodyY); bezel.setLocation(x + bezelX, y + bezelY); onButton.setLocation(x + onX, y + onY); volSlider.setLocation(x + volSliderX, y + volSliderY); volLevel.setLocation(x + volLevelX, y + volLevelY); }
/** create the graphical objects for the scene */ private void makeScene() { body = new ARectangle(bodyColor); body.setSize(bodyWidth, bodyLength); bezel = new ARectangle(Color.BLACK); bezel.setSize(bezelWidth, bezelLength); bezel.setColor(Color.LIGHT_GRAY); onButton = new AEllipse(Color.BLACK); onButton.setSize(onWidth, onLength); volSlider = new ALine(); volSlider.setColor(Color.BLACK); volSlider.setPoints(volSliderX, volSliderY, volSliderX + volSliderLen, volSliderY); volSlider.setThickness(2); volLevel = new ALine(); volLevel.setColor(Color.magenta); volLevel.setPoints(volLevelX, volLevelY, volLevelX, volLevelY + volLevelLen); volLevel.setThickness(2); }
public void moveBody(int newX, int newY) { body.setX(body.getX() + newX); body.setY(body.getY() + newY); }