Answer to Question #6691 in Java | JSP | JSF for Joe
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.util.Scanner;
import javax.swing.JFrame;
import acm.graphics.GCanvas;
import acm.graphics.GRect;
/**
public class GRectDemo {
static final int BAR_WIDTH = 40;
public static void main(String[] args) {
// Start by building the rectangle
GRect bar = new GRect(0,460, BAR_WIDTH, 8);
bar.setColor(Color.DARK_GRAY);
bar.setFilled(true);
// Then build a canvas to hold the rectangle
GCanvas gc = new GCanvas();
gc.setPreferredSize(new Dimension(BAR_WIDTH, 40));
gc.add(bar);
why does rectangle flip to top of screen?
1
2012-02-23T10:05:55-0500
Here in this code you wrote:
GRect bar = new GRect(0,460, BAR_WIDTH, 8);
bar.setColor(Color.DARK_GRAY);
bar.setFilled(true);
this parameter (0,460)- flips rectangle to top of screen.
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF
Comments
Leave a comment