Answer to Question #6691 in Java | JSP | JSF for Joe

Question #6691
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?
Expert's answer
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal