Created
March 24, 2019 16:23
-
-
Save mwibutsa/ed7592e2b0e0441be65999cfe31e1f74 to your computer and use it in GitHub Desktop.
Java Assignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
public class Polygon extends JFrame { | |
public Polygon() { | |
setSize(400, 500); | |
setLayout(null); | |
setVisible(true); | |
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
setTitle("Drawing Polygons"); | |
} | |
public void paint(Graphics g) { | |
int [] x = {200, 400, 450, 400, 200, 150}; | |
int [] y = {50, 50, 150, 250, 250, 150}; | |
g.drawPolygon(x, y, 6); | |
} | |
public static void main (String [] args) { | |
new Polygon(); | |
System.out.println("Hello java"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment