Mr. Truncale - Robert E. Lee High School
  • Home
  • Digital Media
    • HTML
  • Video Game Design
  • Comp. Programming I
  • Comp. Programming II
  • AP Computer Science
  • 3D Printing
  • Teacher Resources
  • Contact Me

Java Drawing Lab 2


In this lab you will be creating arcs, custom colors and fonts.
Add this code to DrawingBasics From drawing Lab 1
import java.awt.*;
import javax.swing.*;

public class DrawingBasics extends JPanel{

   public void paint(Graphics g) {
      super.paint(g);
      Graphics2D g2d = (Graphics2D) g;
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,                                           RenderingHints.VALUE_ANTIALIAS_ON);



   }

}
Now create a new class called DrawingLab2. Using the code above create the picture below.

Make these changes DrawingRunner.
import javax.swing.*;

public class DrawingRunner {

   public static void main(String args[]){
      JFrame frame = new JFrame("Drawing Lab 2");
      DrawingLab2 game = new  DrawingLab2();
      frame.add(game);
      frame.setSize(400, 420);
      frame.setVisible(true);
      frame.setResizable(false);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }
}
Picture

    Turn in DrawingLab2.java

    Max file size: 20MB
Submit
Powered by Create your own unique website with customizable templates.