{"action":"created","issue":{"url":"https://api.github.com/repos/TropicSapling/Vector-World/issues/1","labels_url":"https://api.github.com/repos/TropicSapling/Vector-World/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/TropicSapling/Vector-World/issues/1/comments","events_url":"https://api.github.com/repos/TropicSapling/Vector-World/issues/1/events","html_url":"https://github.com/TropicSapling/Vector-World/issues/1","id":101015358,"number":1,"title":"CloudInit.java not working","user":{"login":"TropicSapling","id":10341800,"avatar_url":"https://avatars.githubusercontent.com/u/10341800?v=3","gravatar_id":"","url":"https://api.github.com/users/TropicSapling","html_url":"https://github.com/TropicSapling","followers_url":"https://api.github.com/users/TropicSapling/followers","following_url":"https://api.github.com/users/TropicSapling/following{/other_user}","gists_url":"https://api.github.com/users/TropicSapling/gists{/gist_id}","starred_url":"https://api.github.com/users/TropicSapling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TropicSapling/subscriptions","organizations_url":"https://api.github.com/users/TropicSapling/orgs","repos_url":"https://api.github.com/users/TropicSapling/repos","events_url":"https://api.github.com/users/TropicSapling/events{/privacy}","received_events_url":"https://api.github.com/users/TropicSapling/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/TropicSapling/Vector-World/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/TropicSapling/Vector-World/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-08-14T13:55:10Z","updated_at":"2015-09-12T12:17:37Z","closed_at":null,"body":"`CloudInit.java` is supposed to set the bg colour and write some text in the window **before** `CloudPainter.java` paints the cloud. However instead of doing that it seems that `CloudInit.java` gets overwritten by `CloudPainter.java` so that neither the bg nor the text ever gets displayed.\r\n\r\nFor those of you who can't find the code:\r\n### CloudInit.java\r\n`package libCR;`\r\n\r\n`import java.awt.Color;`\r\n`import java.awt.Graphics;`\r\n\r\n`import javax.swing.JPanel;`\r\n\r\n`public class CloudInit extends JPanel {`\r\n\t\r\n\tprivate static final long serialVersionUID = 8199065465323472404L;\r\n\t\r\n\tpublic void paintComponent(Graphics g) {\r\n\t\tsuper.paintComponent(g);\r\n\t\tColor sky = new Color(135, 206, 235);\r\n\t\tthis.setBackground(sky);\r\n\t\tg.drawString(\"Rendering Cloud...\", 10, 15);\r\n\t}\r\n\r\n`}`\r\n\r\n### CloudPainter.java\r\n`package libCR;`\r\n\r\n`import java.awt.Color;`\r\n`import java.awt.Graphics;`\r\n\r\n`import javax.swing.JPanel;`\r\n\r\n`public class CloudPainter extends JPanel {`\r\n\r\n\tprivate static final long serialVersionUID = -4664013610056707507L;\r\n\t\r\n\tpublic void clearArea(Graphics g, Color bg, int startX, int startY, int endX, int endY) {\r\n\t\tg.setColor(bg);\r\n\t\tg.fillRect(startX, startY, endX, endY);\r\n\t\tg.setColor(Color.BLACK);\r\n\t}\r\n\r\n\tpublic void paintComponent(Graphics g) {\r\n\t\tsuper.paintComponent(g);\r\n\t\tColor sky = new Color(135, 206, 235);\r\n\t\tint loops = 0;\r\n\t\tint secondaryLoops = 0;\r\n\t\tint xPos = 360 - (Main.cloudSize / 2);\r\n\t\tint yPos = 240 + (Main.cloudSize / 4);\r\n\t\tint colorR = Main.randomWithRange(0, 128), colorG = colorR, colorB = colorR;\r\n\t\tint colorMin = 0;\r\n\t\tint colorMax = 128;\r\n\t\tint firstColor = colorR;\r\n\t\tint rand = Main.randomWithRange(5, 10);\r\n\t\tint firstR = rand;\r\n\t\tint minHeight = 10;\r\n\t\tint maxHeight = Main.cloudSize / 2;\r\n\t\t\r\n\t\twhile(secondaryLoops < Main.cloudSize) {\r\n\t\t\twhile(loops < Main.randomWithRange(minHeight, maxHeight)) {\r\n\t\t\t\tcolorMin = colorR;\r\n\t\t\t\tg.setColor(new Color(colorR, colorG, colorB));\r\n\t\t\t\tg.fillOval(xPos, yPos, rand, rand);\r\n\t\t\t\tyPos -= rand / 2;\r\n\t\t\t\tcolorMax += 128 / ((Main.cloudSize / 2) / rand);\r\n\t\t\t\tif (colorMax > 255) {\r\n\t\t\t\t\tcolorMax = 255;\r\n\t\t\t\t}\r\n\t\t\t\tcolorR += rand;\r\n\t\t\t\tcolorG = colorR;\r\n\t\t\t\tcolorB = colorR;\r\n\t\t\t\tif (colorR > colorMax) {\r\n\t\t\t\t\tcolorR = colorMax;\r\n\t\t\t\t\tcolorG = colorMax;\r\n\t\t\t\t\tcolorB = colorMax;\r\n\t\t\t\t} else if (colorR < colorMin) {\r\n\t\t\t\t\tcolorR = colorMin;\r\n\t\t\t\t\tcolorG = colorMin;\r\n\t\t\t\t\tcolorB = colorMin;\r\n\t\t\t\t}\r\n\t\t\t\tloops += (rand / 2);\r\n\t\t\t\trand = Main.randomWithRange(5 + (5 - (5 * (loops / (Main.cloudSize / 2)))), 10 - (5 * (loops / (Main.cloudSize / 2))));\r\n\t\t\t\tif (rand > 10) {\r\n\t\t\t\t\trand = 10;\r\n\t\t\t\t} else if (rand < 5) {\r\n\t\t\t\t\trand = 5;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\txPos += (firstR / 2);\r\n\t\t\tyPos = 240 + (Main.cloudSize / 4);\r\n\t\t\tcolorMax = 128;\r\n\t\t\tcolorMin = firstColor;\r\n\t\t\tcolorR = colorMin;\r\n\t\t\tcolorG = colorMin;\r\n\t\t\tcolorB = colorMin;\r\n\t\t\tloops = 0;\r\n\t\t\tsecondaryLoops += (firstR / 2);\r\n\t\t}\r\n\t\t\r\n\t\tclearArea(g, sky, 0, 0, 112, 20);\r\n\t\tg.drawString(\"Done!\", 10, 15);\r\n\t}\r\n`}`\r\n\r\n### Main.java\r\n`package libCR;`\r\n\r\n`import javax.swing.ImageIcon;`\r\n`import javax.swing.JFrame;`\r\n`import javax.swing.JOptionPane;`\r\n`import javax.swing.JPanel;`\r\n`import javax.swing.JProgressBar;`\r\n\r\n`public class Main {`\r\n\t\r\n\tpublic static int cloudSize = 0;\r\n\t\r\n\tpublic static int randomWithRange(int min, int max)\r\n\t{\r\n\t   int range = (max - min) + 1;     \r\n\t   return (int) ((Math.random() * range) + min);\r\n\t}\r\n\r\n\tpublic static void main(String[] args) {\r\n\t\tboolean done = false;\r\n\t\tString cloudSizeRaw;\r\n\t\twhile (done == false) {\r\n\t\t\tcloudSizeRaw = JOptionPane.showInputDialog(\"Enter size of cloud (\\\"r\\\" for random)\").toString();\r\n\t\t\tdone = cloudSizeRaw.equals(\"\") ? false : true;\r\n\t\t\tif (cloudSizeRaw.equals(\"r\")) {\r\n\t\t\t\tcloudSize = randomWithRange(240, 720);\r\n\t\t\t} else if(done == true) {\r\n\t\t\t\tcloudSize = Integer.parseInt(cloudSizeRaw);\r\n\t\t\t}\r\n\t\t}\r\n\t\tJFrame window = new JFrame();\r\n\t\twindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tCloudPainter cloud = new CloudPainter();\r\n\t\tCloudInit preOps = new CloudInit();\r\n\t\t\r\n\t\twindow.add(preOps);\r\n\t\twindow.add(cloud);\r\n\t\twindow.setSize(720, 480);\r\n\t\twindow.setVisible(true);\r\n\t\tImageIcon icon = new ImageIcon(\"C:/Users/Ludvig/Pictures/Java/Cloud Renderer/clouds icon.png\");\r\n\t\twindow.setIconImage(icon.getImage());\r\n\t\twindow.setTitle(\"Cloud Renderer (v.1.0)\");\r\n\t\twindow.setLocation(323, 144);\r\n\t}\r\n\r\n`}`\r\n\r\nAnyone who knows how to fix it?\r\n----------------------------------------"},"comment":{"url":"https://api.github.com/repos/TropicSapling/Vector-World/issues/comments/139752887","html_url":"https://github.com/TropicSapling/Vector-World/issues/1#issuecomment-139752887","issue_url":"https://api.github.com/repos/TropicSapling/Vector-World/issues/1","id":139752887,"user":{"login":"TropicSapling","id":10341800,"avatar_url":"https://avatars.githubusercontent.com/u/10341800?v=3","gravatar_id":"","url":"https://api.github.com/users/TropicSapling","html_url":"https://github.com/TropicSapling","followers_url":"https://api.github.com/users/TropicSapling/followers","following_url":"https://api.github.com/users/TropicSapling/following{/other_user}","gists_url":"https://api.github.com/users/TropicSapling/gists{/gist_id}","starred_url":"https://api.github.com/users/TropicSapling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TropicSapling/subscriptions","organizations_url":"https://api.github.com/users/TropicSapling/orgs","repos_url":"https://api.github.com/users/TropicSapling/repos","events_url":"https://api.github.com/users/TropicSapling/events{/privacy}","received_events_url":"https://api.github.com/users/TropicSapling/received_events","type":"User","site_admin":false},"created_at":"2015-09-12T12:17:37Z","updated_at":"2015-09-12T12:17:37Z","body":"@an-OK-squirrel Well atleast about that with the filepath :)"}}