diff --git a/.idea/misc.xml b/.idea/misc.xml index 5c10972..501b26a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ru/geekbrains/java1/lesson4/TicTacToe.java b/src/ru/geekbrains/java1/lesson4/TicTacToe.java index b7b65ff..abe2e67 100644 --- a/src/ru/geekbrains/java1/lesson4/TicTacToe.java +++ b/src/ru/geekbrains/java1/lesson4/TicTacToe.java @@ -6,14 +6,14 @@ public class TicTacToe { - private static final int SIZE = 5; - private static final int DOTS_TO_WIN = 4; + public static final int SIZE = 3; + private static final int DOTS_TO_WIN = 3; - private static final char DOT_EMPTY = '•'; - private static final char DOT_X = 'X'; - private static final char DOT_O = 'O'; + public static final char DOT_EMPTY = '•'; + public static final char DOT_X = 'X'; + public static final char DOT_O = 'O'; - private static final char[][] map = new char[SIZE][SIZE]; + public static final char[][] map = new char[SIZE][SIZE]; public static void main(String[] args) { @@ -64,11 +64,11 @@ private static boolean isGameMoveWinning(int rowIndex, int colIndex, char symbol return result; } - private static void setCell(int rowIndex, int colIndex, char symbol) { + public static void setCell(int rowIndex, int colIndex, char symbol) { map[rowIndex][colIndex] = symbol; } - private static boolean isMapFull() { + public static boolean isMapFull() { for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { if (map[i][j] == DOT_EMPTY) { @@ -80,7 +80,7 @@ private static boolean isMapFull() { } - private static boolean isWin(char symbol) { + public static boolean isWin(char symbol) { if (checkRowsAndCols(symbol)) { return true; } else { @@ -122,7 +122,7 @@ private static void printMap() { System.out.println(); } - private static void computerTurn() { + public static int[] computerTurn() { int[] cell = getNextCellToWin(DOT_O); if (cell == null) { cell = getNextCellToWin(DOT_X); @@ -134,6 +134,7 @@ private static void computerTurn() { int colIndex = cell[1]; setCell(rowIndex, colIndex, DOT_O); + return cell; } private static int[] getRandomEmptyCell() { @@ -199,7 +200,7 @@ private static void printHeader() { System.out.println(); } - private static void initMap() { + public static void initMap() { for (int i = 0; i < SIZE; i++) { Arrays.fill(map[i], DOT_EMPTY); } diff --git a/src/ru/geekbrains/java1/lesson8/CounterApp.java b/src/ru/geekbrains/java1/lesson8/CounterApp.java new file mode 100644 index 0000000..34dc2f8 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/CounterApp.java @@ -0,0 +1,94 @@ +package ru.geekbrains.java1.lesson8; + +import javax.swing.*; +import javax.swing.text.NumberFormatter; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.text.NumberFormat; + +public class CounterApp extends JFrame { + private int value; + private int step = 1; + + public CounterApp(int initialValue) { + setBounds(500, 500, 300, 120); + setTitle("Simple Counter"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + setAlwaysOnTop(true); + + Font font = new Font("Arial", Font.BOLD, 32); + + JLabel counterValueView = new JLabel(String.valueOf(value)); + counterValueView.setHorizontalAlignment(SwingConstants.CENTER); + counterValueView.setFont(font); + add(counterValueView, BorderLayout.CENTER); + + value = initialValue; + refreshCounterLabel(counterValueView); + + JButton decrementButton = new JButton("<"); + add(decrementButton, BorderLayout.LINE_START); + decrementButton.setFont(font); + + JButton incrementButton = new JButton(">"); + add(incrementButton, BorderLayout.LINE_END); + incrementButton.setFont(font); + + NumberFormat longFormat = NumberFormat.getIntegerInstance(); + + NumberFormatter numberFormatter = new NumberFormatter(longFormat); + numberFormatter.setAllowsInvalid(false); //this is the key!! + + JFormattedTextField stepTextField = new JFormattedTextField(numberFormatter); + stepTextField.setHorizontalAlignment(SwingConstants.CENTER); + stepTextField.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + step = Integer.parseInt(stepTextField.getText()); + } + }); + add(stepTextField, BorderLayout.NORTH); + + decrementButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + value -= step; + refreshCounterLabel(counterValueView); + } + }); + + incrementButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent actionEvent) { + value += step; + refreshCounterLabel(counterValueView); + } + }); + + JButton clearButton = new JButton("Reset"); + clearButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + step = 1; + value = 0; + stepTextField.setValue(step); + refreshCounterLabel(counterValueView); + } + }); + add(clearButton, BorderLayout.SOUTH); + + setVisible(true); + } + + private void refreshCounterLabel(JLabel counterValueView) { + counterValueView.setText(String.valueOf(value)); + } + + public static void main(String[] args) { + new CounterApp(0); + } +} + diff --git a/src/ru/geekbrains/java1/lesson8/TicTacToeGui.java b/src/ru/geekbrains/java1/lesson8/TicTacToeGui.java new file mode 100644 index 0000000..1c439b5 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/TicTacToeGui.java @@ -0,0 +1,146 @@ +package ru.geekbrains.java1.lesson8; + +import ru.geekbrains.java1.lesson4.TicTacToe; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class TicTacToeGui { + + private static final String FRAME_TITLE = "Крестики-Нолики"; + private static final String START_GAME_MSG = "Игра началачь!"; + + private final JLabel[][] gameField = new JLabel[TicTacToe.SIZE][TicTacToe.SIZE]; + + private JLabel gameStateLabel; + private JPanel gamePanel; + private JFrame frame; + + public TicTacToeGui() { + initFrame(); + frame.setVisible(true); + } + + private void initFrame() { + frame = new JFrame(); + frame.setTitle(FRAME_TITLE); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.setLocationRelativeTo(null); + frame.setSize(400, 400); + + gameStateLabel = new JLabel(START_GAME_MSG); + gameStateLabel.setHorizontalAlignment(SwingConstants.CENTER); + frame.add(gameStateLabel, BorderLayout.NORTH); + + JButton restartGameButton = new JButton("Начать заново"); + restartGameButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + startGame(); + } + }); + + frame.add(restartGameButton, BorderLayout.SOUTH); + + gamePanel = new JPanel(); + gamePanel.setLayout(new GridLayout(TicTacToe.SIZE, TicTacToe.SIZE)); + initCells(gamePanel); + frame.add(gamePanel, BorderLayout.CENTER); + } + + private void initCells(JPanel gamePanel) { + Font font = new Font("Arial", Font.BOLD, 32); + for (int i = 0; i < TicTacToe.SIZE; i++) { + for (int j = 0; j < TicTacToe.SIZE; j++) { + JLabel cell = new JLabel(String.valueOf(TicTacToe.DOT_EMPTY)); + cell.setHorizontalAlignment(SwingConstants.CENTER); + cell.setVerticalAlignment(SwingConstants.CENTER); + cell.setFont(font); + cell.setBorder(BorderFactory.createLineBorder(Color.black)); + + final int rowIndex = i; + final int colIndex = j; + cell.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + if (!cell.isEnabled()) { + return; + } + + TicTacToe.setCell(rowIndex, colIndex, TicTacToe.DOT_X); + makeTurn(TicTacToe.DOT_X, cell); + + if (checkEndGameState(TicTacToe.DOT_X, "Игрок")) { + return; + } + + int[] computerCellIndex = TicTacToe.computerTurn(); + JLabel computerCell = gameField[computerCellIndex[0]][computerCellIndex[1]]; + makeTurn(TicTacToe.DOT_O, computerCell); + + checkEndGameState(TicTacToe.DOT_O, "Компьютер"); + } + }); + + gamePanel.add(cell); + gameField[i][j] = cell; + } + } + } + + private void makeTurn(char symbol, JLabel cell) { + cell.setText(String.valueOf(symbol)); + cell.setEnabled(false); + } + + private boolean checkEndGameState(char symbol, String playerName) { + if (TicTacToe.isWin(symbol)) { + setEndGameState(String.format("%s победил!", playerName)); + return true; + } + else if (TicTacToe.isMapFull()) { + setEndGameState("Ничья!"); + return true; + } + + return false; + } + + private void setEndGameState(String messageState) { + setEnabledGameField(false); + gameStateLabel.setText(messageState); + } + + private void startGame() { + setEnabledGameField(true); + gameStateLabel.setText(START_GAME_MSG); + TicTacToe.initMap(); + refreshGameField(); + } + + private void refreshGameField() { + for (int i = 0; i < TicTacToe.SIZE; i++) { + for (int j = 0; j < TicTacToe.SIZE; j++) { + gameField[i][j].setText(String.valueOf(TicTacToe.map[i][j])); + } + } + } + + private void setEnabledGameField(boolean enabled) { + gamePanel.setEnabled(true); + for (int i = 0; i < TicTacToe.SIZE; i++) { + for (int j = 0; j < TicTacToe.SIZE; j++) { + gameField[i][j].setEnabled(enabled); + } + } + } + + public static void main(String[] args) { + TicTacToeGui ticTacToeGui = new TicTacToeGui(); + ticTacToeGui.startGame(); + } +} diff --git a/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout1.java b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout1.java new file mode 100644 index 0000000..3d2745a --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout1.java @@ -0,0 +1,39 @@ +package ru.geekbrains.java1.lesson8.borderlayout; + +import javax.swing.*; +import java.awt.*; + +public class BorderLayout1 { + + static class MyWindow extends JFrame { + public MyWindow() { + setTitle("Test Window"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + setSize(800, 800); + setLocationRelativeTo(null); + + JButton button = new JButton("Button 1 (PAGE_START)"); + add(button, BorderLayout.PAGE_START); + + button = new JButton("Button 2 (CENTER)"); + add(button, BorderLayout.CENTER); + + button = new JButton("Button 3 (LINE_START)"); + button.setSize(new Dimension(200, 200)); + add(button, BorderLayout.LINE_START); + + button = new JButton("Long-Named Button 4 (PAGE_END)"); + add(button, BorderLayout.PAGE_END); + + button = new JButton("5 (LINE_END)"); + add(button, BorderLayout.LINE_END); + + setVisible(true); + } + } + + public static void main(String[] args) { + new MyWindow(); + } + +} \ No newline at end of file diff --git a/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout2.java b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout2.java new file mode 100644 index 0000000..2029fa5 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout2.java @@ -0,0 +1,30 @@ +package ru.geekbrains.java1.lesson8.borderlayout; + +import javax.swing.*; +import java.awt.*; + +public class BorderLayout2 { + + static public class MyWindow extends JFrame { + public MyWindow() { + setBounds(500,500,500,300); + setTitle("BoxLayoutDemo"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + JButton[] jbs = new JButton[10]; +// setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS)); // одну из строк надо закомментировать + setLayout(new BoxLayout(getContentPane(), BoxLayout.X_AXIS)); // одну из строк надо закомментировать + for (int i = 0; i < jbs.length; i++) { + jbs[i] = new JButton("#" + i); +// jbs[i].setAlignmentX(Component.CENTER_ALIGNMENT); + jbs[i].setAlignmentY(Component.CENTER_ALIGNMENT); + add(jbs[i]); + } + setVisible(true); + } + } + + public static void main(String[] args) { + new MyWindow(); + } + +} \ No newline at end of file diff --git a/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout3.java b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout3.java new file mode 100644 index 0000000..7281a11 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout3.java @@ -0,0 +1,28 @@ +package ru.geekbrains.java1.lesson8.borderlayout; + +import javax.swing.*; +import java.awt.*; + +public class BorderLayout3 { + + static public class MyWindow extends JFrame { + public MyWindow() { + setBounds(500, 500, 400, 300); + setTitle("FlowLayoutDemo"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + JButton[] jbs = new JButton[10]; + setLayout(new FlowLayout()); + for (int i = 0; i < jbs.length; i++) { + jbs[i] = new JButton("#" + i); + jbs[i].setPreferredSize(new Dimension(100, 30)); + add(jbs[i]); + } + setVisible(true); + } + } + + public static void main(String[] args) { + new MyWindow(); + } + +} \ No newline at end of file diff --git a/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout4.java b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout4.java new file mode 100644 index 0000000..0d62ef3 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/borderlayout/BorderLayout4.java @@ -0,0 +1,27 @@ +package ru.geekbrains.java1.lesson8.borderlayout; + +import javax.swing.*; +import java.awt.*; + +public class BorderLayout4 { + + static public class MyWindow extends JFrame { + public MyWindow() { + setBounds(500,500,400,300); + setTitle("GridLayoutDemo"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + JButton[] jbs = new JButton[10]; + setLayout(new GridLayout(4, 3)); + for (int i = 0; i < jbs.length; i++) { + jbs[i] = new JButton("#" + i); + add(jbs[i]); + } + setVisible(true); + } + } + + public static void main(String[] args) { + new MyWindow(); + } + +} \ No newline at end of file diff --git a/src/ru/geekbrains/java1/lesson8/events/KeyboardExample.java b/src/ru/geekbrains/java1/lesson8/events/KeyboardExample.java new file mode 100644 index 0000000..0abdeea --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/events/KeyboardExample.java @@ -0,0 +1,57 @@ +package ru.geekbrains.java1.lesson8.events; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +public class KeyboardExample { + + static public class MyWindow extends JFrame { + public MyWindow() { + setBounds(500, 500, 400, 300); + setTitle("Demo"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + JTextField field = new JTextField(); + add(field, BorderLayout.PAGE_START); + field.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("Your message: " + field.getText()); + field.setText(null); + } + }); + + field.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + System.out.println("key pressed"); + } + + @Override + public void keyReleased(KeyEvent e) { + System.out.println("key released"); + } + + @Override + public void keyTyped(KeyEvent e) { + if (e.isShiftDown()) { + System.out.println("Shift down"); + } + System.out.println(e.getKeyChar() + " down"); + } + }); + + setVisible(true); + } + + } + + + public static void main(String[] args) { + new MyWindow(); + } + +} \ No newline at end of file diff --git a/src/ru/geekbrains/java1/lesson8/events/MouseEventExample.java b/src/ru/geekbrains/java1/lesson8/events/MouseEventExample.java new file mode 100644 index 0000000..fa3cc15 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/events/MouseEventExample.java @@ -0,0 +1,37 @@ +package ru.geekbrains.java1.lesson8.events; + +import javax.swing.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class MouseEventExample { + + static public class MyWindow extends JFrame { + public MyWindow() { + setBounds(500, 500, 400, 300); + setTitle("Demo"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + JPanel pan = new JPanel(); + add(pan); + pan.addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + System.out.println("MousePos: " + e.getX() + " " + e.getY()); + } + + @Override + public void mouseExited(MouseEvent e) { + System.out.println("Exited!"); + } + }); + + setVisible(true); + } + } + + + public static void main(String[] args) { + new MyWindow(); + } + +} \ No newline at end of file diff --git a/src/ru/geekbrains/java1/lesson8/examples/Example1.java b/src/ru/geekbrains/java1/lesson8/examples/Example1.java new file mode 100644 index 0000000..66c8a56 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/examples/Example1.java @@ -0,0 +1,41 @@ +package ru.geekbrains.java1.lesson8.examples; + +import javax.swing.*; +import java.awt.*; + +public class Example1 { + + static class MyWindow extends JFrame { + public MyWindow() { + setTitle("Test Window"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + setLocationRelativeTo(null); + setSize(400, 400); + setLocation(300, 150); +// setBounds(2400, 300, 400, 400); + setVisible(true); + } + } + + private static class WindowRunnable implements /* extends */ Runnable { + + @Override + public void run() { + new MyWindow(); + } + } + + public static void main(String[] args) { +// new MyWindow(); +// EventQueue.invokeLater(new WindowRunnable()); + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + new MyWindow(); + } + }); + + } + + +} diff --git a/src/ru/geekbrains/java1/lesson8/examples/Example2.java b/src/ru/geekbrains/java1/lesson8/examples/Example2.java new file mode 100644 index 0000000..e41a3f3 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/examples/Example2.java @@ -0,0 +1,40 @@ +package ru.geekbrains.java1.lesson8.examples; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class Example2 { + + static class MyWindow extends JFrame { + public MyWindow() { + setTitle("Test Window"); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + setBounds(300, 300, 400, 400); + + JButton[] jbs = new JButton[5]; + for (int i = 0; i < 5; i++) { + jbs[i] = new JButton("#" + i); +// jbs[i].addActionListener(new ActionListener() { +// @Override +// public void actionPerformed(ActionEvent e) { +// System.out.println(((JButton)e.getSource()).getText() + " was pressed"); +// } +// }); + } +// setLayout(new BorderLayout()); // выбор компоновщика элементов + add(jbs[0], BorderLayout.EAST); // добавление кнопки на форму + add(jbs[1], BorderLayout.WEST); + add(jbs[2], BorderLayout.SOUTH); + add(jbs[3], BorderLayout.NORTH); + add(jbs[4], BorderLayout.CENTER); + setVisible(true); + } + } + + public static void main(String[] args) { + new MyWindow(); + } + +} diff --git a/src/ru/geekbrains/java1/lesson8/graphics/ButtonDrawExample.java b/src/ru/geekbrains/java1/lesson8/graphics/ButtonDrawExample.java new file mode 100644 index 0000000..7585ad3 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/graphics/ButtonDrawExample.java @@ -0,0 +1,69 @@ +package ru.geekbrains.java1.lesson8.graphics; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class ButtonDrawExample { + static class MyWindow extends JFrame { + + private static final String DRAW_X = "DRAW_X"; + private static final String DRAW_O = "DRAW_O"; + + public MyWindow() { + setSize(800,500); + setDefaultCloseOperation(EXIT_ON_CLOSE); + setLocationRelativeTo(null); + + setLayout(new GridLayout(1, 3)); + add(createButton()); + add(createButton()); + add(createButton()); + + setVisible(true); + } + + private JButton createButton() { + return new JButton() { + + { + setActionCommand(DRAW_O); + addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + String action = getActionCommand().equals(DRAW_O) ? DRAW_X : DRAW_O; + setActionCommand(action); + } + }); + } + + @Override + public void paint(Graphics graphics) { + super.paint(graphics); + + if (getActionCommand().equals(DRAW_O)) { + graphics.drawOval(0, this.getHeight() / 4, getWidth(), getWidth()); + graphics.setColor(Color.RED); + graphics.fillOval(0, this.getHeight() / 4, getWidth(), getWidth()); + } + else { + Graphics2D g2d = (Graphics2D) graphics; + g2d.setStroke(new BasicStroke(10)); + g2d.setColor(Color.BLUE); + g2d.drawLine(0, 0, this.getWidth(), this.getHeight()); + g2d.drawLine(this.getWidth(), 0, 0, this.getHeight()); + } + } + }; + + } + + } + + + public static void main(String[] args){ + new MyWindow(); + } + +} diff --git a/src/ru/geekbrains/java1/lesson8/graphics/DrawingExample.java b/src/ru/geekbrains/java1/lesson8/graphics/DrawingExample.java new file mode 100644 index 0000000..37f8243 --- /dev/null +++ b/src/ru/geekbrains/java1/lesson8/graphics/DrawingExample.java @@ -0,0 +1,50 @@ +package ru.geekbrains.java1.lesson8.graphics; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class DrawingExample extends JFrame { + + public DrawingExample() { + super("Lines Drawing Demo"); + + setSize(680, 600); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setLocationRelativeTo(null); + setAlwaysOnTop(true); + addMouseListener(new MouseAdapter() { + @Override + public void mouseReleased(MouseEvent e) { + System.out.println("MousePos: " + e.getX() + " " + e.getY()); + }}); + } + + @Override + public void paint(Graphics g) { + Graphics2D g2D = (Graphics2D) g; + + super.paint(g); + simpleDrawLines(g); + } + + private void simpleDrawLines(Graphics g2d) { + g2d.drawLine(120, 50, 360, 50); + g2d.setColor(Color.RED); + g2d.drawRect(150, 150, 150, 150); + + g2d.setColor(Color.GREEN); + g2d.fillPolygon(new int[] {400}, new int[] {400}, 1); + g2d.fillRect(151, 151, 149, 75); + + g2d.drawOval(350, 150, 150, 150); + g2d.setColor(Color.RED); + g2d.fillOval(351, 151, 149, 149); +// g2d.clearRect(350, 150, 75, 75); + } + + public static void main(String[] args) { + new DrawingExample().setVisible(true); + } +} \ No newline at end of file