diff --git a/.idea/modules.xml b/.idea/modules.xml index ab96195..1da592d 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -49,6 +49,7 @@ + diff --git a/47-KeyBindings/47-KeyBindings.iml b/47-KeyBindings/47-KeyBindings.iml index e55094a..44e1afd 100644 --- a/47-KeyBindings/47-KeyBindings.iml +++ b/47-KeyBindings/47-KeyBindings.iml @@ -1,7 +1,7 @@ - + diff --git a/48-2DGraphics/48-2DGraphics.iml b/48-2DGraphics/48-2DGraphics.iml new file mode 100644 index 0000000..360af94 --- /dev/null +++ b/48-2DGraphics/48-2DGraphics.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/48-2DGraphics/out/production/Frame.class b/48-2DGraphics/out/production/Frame.class new file mode 100644 index 0000000..88240b9 Binary files /dev/null and b/48-2DGraphics/out/production/Frame.class differ diff --git a/48-2DGraphics/out/production/Main.class b/48-2DGraphics/out/production/Main.class new file mode 100644 index 0000000..0fc9b21 Binary files /dev/null and b/48-2DGraphics/out/production/Main.class differ diff --git a/48-2DGraphics/out/production/Panel.class b/48-2DGraphics/out/production/Panel.class new file mode 100644 index 0000000..6ab8408 Binary files /dev/null and b/48-2DGraphics/out/production/Panel.class differ diff --git a/48-2DGraphics/src/Frame.java b/48-2DGraphics/src/Frame.java new file mode 100644 index 0000000..81b5a4b --- /dev/null +++ b/48-2DGraphics/src/Frame.java @@ -0,0 +1,18 @@ +import javax.swing.*; +import java.awt.*; + +public class Frame extends JFrame { + + Panel panel; + Frame() { + + panel = new Panel(); + + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + this.add(panel); + this.pack(); + this.setLocationRelativeTo(null); + this.setVisible(true); + + } +} diff --git a/48-2DGraphics/src/Main.java b/48-2DGraphics/src/Main.java new file mode 100644 index 0000000..81bff6b --- /dev/null +++ b/48-2DGraphics/src/Main.java @@ -0,0 +1,8 @@ +public class Main { + public static void main(String[] args) { + + + new Frame(); + + } +} diff --git a/48-2DGraphics/src/Panel.java b/48-2DGraphics/src/Panel.java new file mode 100644 index 0000000..09de6cf --- /dev/null +++ b/48-2DGraphics/src/Panel.java @@ -0,0 +1,38 @@ +import javax.swing.*; +import java.awt.*; + +public class Panel extends JPanel { + + Image image; + Panel() { + image = new ImageIcon("Sky.png").getImage(); + this.setPreferredSize(new Dimension(500, 500)); + } + + //This method is invoked automatically, there is no need to call it!!! + public void paint(Graphics g) { + + Graphics2D g2D = (Graphics2D) g; + + g2D.setPaint(Color.red); + //g2D.setStroke(new BasicStroke(5)); + //g2D.drawLine(0, 0, 500, 500); + //g2D.drawRect(0,0, 100, 200); + //g2D.fillRect(0, 0, 100, 200); + //g2D.drawOval(100, 100 , 200, 200); + //g2D.fillOval(100, 100 , 200, 200); + //g2D.drawArc(0, 0, 100, 100, 0, 180); + //g2D.fillArc(0, 0, 100, 100, 0, 180); + //g2D.setPaint(Color.white); + //g2D.fillArc(0, 0, 100, 100, 180, 180); + //int[] xPoints = {150, 250, 350}; + //int[] yPoints = {300, 150, 300}; + //g2D.drawPolygon(xPoints, yPoints, 3); + //g2D.fillPolygon(xPoints, yPoints, 3); + //g2D.setFont(new Font("MV Boli", Font.BOLD, 50)); + //g2D.drawString("Text goes here", 50, 50); + + g2D.drawImage(image, 0, 0, null); + + } +} diff --git a/Sky.png b/Sky.png new file mode 100644 index 0000000..c460b1b Binary files /dev/null and b/Sky.png differ