{"id":26709218,"url":"https://github.com/kalbarczykdev/ulam-spiral-java-swing","last_synced_at":"2025-03-27T08:15:30.513Z","repository":{"id":228388906,"uuid":"658304387","full_name":"KalbarczykDev/ulam-spiral-java-swing","owner":"KalbarczykDev","description":"The Ulam Spiral is a graphical representation of prime numbers in a spiral pattern. This program generates the Ulam Spiral and displays it using Java's Swing library.","archived":false,"fork":false,"pushed_at":"2023-06-26T10:52:46.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-22T05:51:15.227Z","etag":null,"topics":["beginer-friendly","beginer-projects","beginner","java","java-awt-swing","java-swing","turorial","ulam-spiral","ulam-spiral-generator","youtube"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KalbarczykDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-25T11:13:46.000Z","updated_at":"2024-09-23T12:35:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"82d866ea-ee82-4439-aeb3-18cbd0137812","html_url":"https://github.com/KalbarczykDev/ulam-spiral-java-swing","commit_stats":null,"previous_names":["okdotdev/ulam-spiral-java-swing","oslint/ulam-spiral-java-swing","kalbarczykdev/ulam-spiral-java-swing"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KalbarczykDev%2Fulam-spiral-java-swing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KalbarczykDev%2Fulam-spiral-java-swing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KalbarczykDev%2Fulam-spiral-java-swing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KalbarczykDev%2Fulam-spiral-java-swing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KalbarczykDev","download_url":"https://codeload.github.com/KalbarczykDev/ulam-spiral-java-swing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245806460,"owners_count":20675298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["beginer-friendly","beginer-projects","beginner","java","java-awt-swing","java-swing","turorial","ulam-spiral","ulam-spiral-generator","youtube"],"created_at":"2025-03-27T08:15:29.768Z","updated_at":"2025-03-27T08:15:30.503Z","avatar_url":"https://github.com/KalbarczykDev.png","language":"Java","readme":"# Ulam Spiral\n\nThis program generates an Ulam Spiral, a visualization of prime numbers in a spiral pattern. It uses Java Swing to create a graphical user interface (GUI) window for displaying the spiral. 🌀\n\n## Usage\n\n1. Run the program. ▶️\n2. A dialog box will prompt you to enter the size of the spiral. 🔢\n3. Enter a positive integer value to determine the size of the spiral. The larger the size, the more prime numbers will be displayed.\n4. The program will open a window titled \"Ulam Spiral\" displaying the generated spiral. 🪐\n5. Each prime number in the spiral is represented by a small square filled in the graphical interface. 🟩\n\n## Prerequisites\n\n- Java Development Kit (JDK) installed ☕\n- Java Swing library\n\n## How it works\n\n1. The program prompts the user to enter the size of the spiral using a dialog box.\n2. The `Main` class extends the `JFrame` class to create a window for the spiral.\n3. The window is centered on the screen and sized according to the user's input.\n4. The `paint` method is overridden to draw the spiral.\n5. The prime numbers are determined using the `isPrime` method, which checks if a number is divisible by any number from 2 up to the square root of the number.\n6. The `Graphics` object is used to draw the prime numbers as small squares on the spiral.\n7. The spiral is generated by moving in a clockwise direction, changing direction at each \"turn\" and incrementing the step size.\n8. The `dx` and `dy` variables control the movement of the spiral in the x and y directions, respectively.\n9. The `angle` variable keeps track of the current angle of movement in degrees.\n10. The loop continues until all the cells in the spiral are processed.\n\u003cimg width=\"494\" alt=\"Ulam Spiral\" src=\"https://github.com/oskalbarczyk/ulam-spiral-java-swing/assets/106467480/8a66b7a0-47e4-4890-9599-1b727ce451c6\"\u003e\n\n## Note\n\n- If the user enters an invalid input or closes the dialog box without entering a value, a default size of 100 is used for the spiral.\n\nFeel free to customize and experiment with the program to explore different sizes and variations of the Ulam Spiral. ✨\n\n## Links\n\n- [GitHub](https://github.com/oskalbarczyk)\n- [YouTube](https://www.youtube.com/@codewithoskar)\n- [Donations](https://tipply.pl/u/oskalbarczyk)\n- [Twitter](https://twitter.com/oskalbarczyk)\n\nDon't forget to check out the GitHub repository for the source code and the YouTube video for a visual demonstration of the program! 🚀\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalbarczykdev%2Fulam-spiral-java-swing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkalbarczykdev%2Fulam-spiral-java-swing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalbarczykdev%2Fulam-spiral-java-swing/lists"}