Please prove all 3 full code without output, I need all 3 full code, thank you v
ID: 3825612 • Letter: P
Question
Please prove all 3 full code without output, I need all 3 full code, thank you very much
Take the code for the Bouncing Ball Java Applet and make the ball bigger, but bounce slower!
Paste your source code and output below.
Take the code for the various graphics that were demonstrated and …
Show a triangle, square, rectangle and circle in one frame or panel;
See if you can fill the geometric shapes with color!
Triangle – red
Square – yellow
Rectangle – blue
Circle – green
Draw a house with a tree using Java Graphics (and challenge: the stick figure!). Paste your source code and output below the figure below.
Explanation / Answer
// applet to draw triangle red color
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.geom.Line2D;
public class Triangle extends JApplet {
public void init() {
setBackground(Color.lightGray);
}
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(Color.red);
g2d.draw(new Line2D.Double(50,150,150,150 ));
g2d.draw(new Line2D.Double(50,50,150,150 ));
g2d.draw(new Line2D.Double(50,50,50,150 ));
}
@SuppressWarnings("deprecation")
public static void main(String s[]) {
JFrame frame = new JFrame("Show Triangle");
JApplet applet = new Triangle();
frame.getContentPane().add("Center", applet);
applet.init();
frame.setSize(300, 250);
frame.show();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.