Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private class MyCanvas extends JComponent {
- public Square[] array;
- public void paint(Graphics g) {
- for (int i = 0; i < array.length; i++) {
- g.drawRect(array[i].x, array[i].y, array[i].length, array[i].length);
- }
- }
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- Assignment5 ass5 = new Assignment5();
- Square[] squares = ass5.solveSquare(0, 0, 13, 13, true);
- JFrame window = new JFrame();
- window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- window.setBounds(30, 30, 300, 300);
- MyCanvas canvas = new MyCanvas();
- canvas.array = squares;
- window.getContentPane().add(canvas);
- window.setVisible(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement