├── .github └── workflows │ └── release.yml ├── .gitignore ├── LICENSE ├── README.md ├── diagrams ├── UseCase.puml └── UseCase_dark.puml ├── pom.xml ├── resources └── MainView.png └── src └── main ├── java ├── com │ └── example │ │ └── demojavafx │ │ ├── HelloApplication.java │ │ ├── HelloController.java │ │ ├── PasswordGenerator.java │ │ └── PasswordGeneratorImpl.java └── module-info.java └── resources ├── com └── example │ └── demojavafx │ └── hello-view.fxml ├── copy-icon.png └── dice-icon.png /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | # Sequence of patterns matched against refs/tags 4 | tags: 5 | - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 6 | 7 | name: Create Release 8 | 9 | jobs: 10 | build: 11 | name: Create Release 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Checkout code 15 | uses: actions/checkout@master 16 | - name: Create Release 17 | id: create_release 18 | uses: actions/create-release@latest 19 | env: 20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 21 | with: 22 | tag_name: ${{ github.ref }} 23 | release_name: Release ${{ github.ref }} 24 | body: | 25 | **Release Notes: demo-java-fx Password Generator Application** 26 | 27 | We are excited to announce the release of the demo-java-fx password generator application, designed to provide users with a secure and convenient way to create strong, random passwords. This application allows users to generate passwords with a customizable length—up to 16 characters—ensuring optimal security for their accounts. Built with the intuitive JavaFX framework, it features a user-friendly interface that makes password generation simple and efficient. Safeguard your digital presence with strong passwords generated at the click of a button! 28 | draft: false 29 | prerelease: false -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ############################## 2 | ## Java 3 | ############################## 4 | .mtj.tmp/ 5 | *.class 6 | *.jar 7 | *.war 8 | *.ear 9 | *.nar 10 | hs_err_pid* 11 | 12 | ############################## 13 | ## Maven 14 | ############################## 15 | target/ 16 | pom.xml.tag 17 | pom.xml.releaseBackup 18 | pom.xml.versionsBackup 19 | pom.xml.next 20 | pom.xml.bak 21 | release.properties 22 | dependency-reduced-pom.xml 23 | buildNumber.properties 24 | .mvn/timing.properties 25 | .mvn/wrapper/maven-wrapper.jar 26 | 27 | ############################## 28 | ## Gradle 29 | ############################## 30 | bin/ 31 | build/ 32 | .gradle 33 | .gradletasknamecache 34 | gradle-app.setting 35 | !gradle-wrapper.jar 36 | 37 | ############################## 38 | ## IntelliJ 39 | ############################## 40 | out/ 41 | .idea/ 42 | .idea_modules/ 43 | *.iml 44 | *.ipr 45 | *.iws 46 | 47 | ############################## 48 | ## Eclipse 49 | ############################## 50 | .settings/ 51 | bin/ 52 | tmp/ 53 | .metadata 54 | .classpath 55 | .project 56 | *.tmp 57 | *.bak 58 | *.swp 59 | *~.nib 60 | local.properties 61 | .loadpath 62 | .factorypath 63 | 64 | ############################## 65 | ## NetBeans 66 | ############################## 67 | nbproject/private/ 68 | build/ 69 | nbbuild/ 70 | dist/ 71 | nbdist/ 72 | nbactions.xml 73 | nb-configuration.xml 74 | 75 | ############################## 76 | ## Visual Studio Code 77 | ############################## 78 | .vscode/ 79 | .code-workspace 80 | 81 | ############################## 82 | ## OS X 83 | ############################## 84 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Velimir Đurković 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # demo-java-fx 2 | 3 | ## Password Generator Application 4 | 5 | Welcome to the Password Generator Application! This tool is designed to help users effortlessly create secure passwords that are 16 characters long. It will create a unique combination of uppercase letters, lowercase letters, numbers, and special symbols to ensure strong security, making it suitable for protecting sensitive accounts and personal information. The generated password will comply with best practices for complexity and randomness, eliminating the need for users to create their own passwords while enhancing their online safety. Whether you're setting up a new account, enhancing your cybersecurity, or simply in need of a reliable password, this solution has got you covered. No additional options or complex settings are necessary; just generate and use your password with confidence! The code is open-source, inviting contributions and modifications from the community to enhance functionality while keeping safety at the forefront. Start protecting your digital life today with our Password Generator Application! 6 | 7 | ## Use Case Diagram 8 | 9 | A use case diagram for a password generator application illustrates the interactions between users and the system. In this diagram, two primary use cases are highlighted: "Generate Password" and "Copy Password." The "Generate Password" use case allows users to create secure, random passwords. Meanwhile, the "Copy Password" use case enables users to easily transfer generated passwords to their clipboard for seamless pasting into login fields. Together, these use cases enhance user experience by providing straightforward tools for password management and security. 10 | 11 | 12 | 13 | Use Case Diagram 14 | 15 | 16 | ## Main view 17 | 18 | ![Main Frame](resources/MainView.png) 19 | -------------------------------------------------------------------------------- /diagrams/UseCase.puml: -------------------------------------------------------------------------------- 1 | @startuml 2 | left to right direction 3 | 4 | actor "User" as user 5 | 6 | rectangle demo-java-fx { 7 | usecase "Copy Password" as copyPassword 8 | usecase "Generate Password" as generatePassword 9 | } 10 | 11 | user --> generatePassword 12 | user --> copyPassword 13 | @enduml -------------------------------------------------------------------------------- /diagrams/UseCase_dark.puml: -------------------------------------------------------------------------------- 1 | @startuml UseCase 2 | !theme crt-green 3 | !include https://raw.githubusercontent.com/djvelimir/demo-java-fx/main/diagrams/UseCase.puml 4 | @enduml -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.example 8 | demo-java-fx 9 | 1.0-SNAPSHOT 10 | demo-java-fx 11 | 12 | 13 | UTF-8 14 | 5.8.1 15 | 16 | 17 | 18 | 19 | org.openjfx 20 | javafx-controls 21 | 21 22 | 23 | 24 | org.openjfx 25 | javafx-fxml 26 | 21 27 | 28 | 29 | 30 | org.junit.jupiter 31 | junit-jupiter-api 32 | ${junit.version} 33 | test 34 | 35 | 36 | org.junit.jupiter 37 | junit-jupiter-engine 38 | ${junit.version} 39 | test 40 | 41 | 42 | 43 | 44 | 45 | 46 | org.apache.maven.plugins 47 | maven-compiler-plugin 48 | 3.8.1 49 | 50 | 21 51 | 21 52 | 53 | 54 | 55 | org.openjfx 56 | javafx-maven-plugin 57 | 0.0.8 58 | 59 | 60 | 61 | default-cli 62 | 63 | com.example.demojavafx/com.example.demojavafx.HelloApplication 64 | app 65 | app 66 | app 67 | true 68 | true 69 | true 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /resources/MainView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djvelimir/demo-java-fx/5a31fab853690fcb5a453bc70b3dd932843959a1/resources/MainView.png -------------------------------------------------------------------------------- /src/main/java/com/example/demojavafx/HelloApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.demojavafx; 2 | 3 | import javafx.application.Application; 4 | import javafx.fxml.FXMLLoader; 5 | import javafx.scene.Scene; 6 | import javafx.stage.Stage; 7 | 8 | import java.io.IOException; 9 | 10 | public class HelloApplication extends Application { 11 | @Override 12 | public void start(Stage stage) throws IOException { 13 | FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml")); 14 | Scene scene = new Scene(fxmlLoader.load(), 400, 40); 15 | stage.setTitle("demo-java-fx"); 16 | stage.setScene(scene); 17 | stage.show(); 18 | } 19 | 20 | public static void main(String[] args) { 21 | launch(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/main/java/com/example/demojavafx/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.example.demojavafx; 2 | 3 | import javafx.fxml.FXML; 4 | import javafx.scene.control.PasswordField; 5 | import javafx.scene.input.Clipboard; 6 | import javafx.scene.input.ClipboardContent; 7 | 8 | public class HelloController { 9 | @FXML 10 | private PasswordField passwordField; 11 | 12 | private final PasswordGenerator passwordGenerator = new PasswordGeneratorImpl(); 13 | 14 | @FXML 15 | protected void onGeneratePasswordButtonClick() { 16 | String generatedPassword = passwordGenerator.generate(); 17 | passwordField.setText(generatedPassword); 18 | } 19 | 20 | @FXML 21 | protected void onCopyPasswordButtonClick() { 22 | final String copyText = passwordField.getText(); 23 | final Clipboard clipboard = Clipboard.getSystemClipboard(); 24 | final ClipboardContent content = new ClipboardContent(); 25 | content.putString(copyText); 26 | clipboard.setContent(content); 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/com/example/demojavafx/PasswordGenerator.java: -------------------------------------------------------------------------------- 1 | package com.example.demojavafx; 2 | 3 | public interface PasswordGenerator { 4 | String generate(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/example/demojavafx/PasswordGeneratorImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.demojavafx; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.List; 6 | import java.util.Random; 7 | 8 | public class PasswordGeneratorImpl implements PasswordGenerator { 9 | private static final int PASSWORD_LENGTH = 16; 10 | private static final String UPPERCASE_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 11 | private static final String LOWERCASE_CHARACTERS = "abcdefghijklmnopqrstuvwxyz"; 12 | private static final String DIGIT_CHARACTERS = "0123456789"; 13 | private static final String SPECIAL_CHARACTERS = "~`!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?"; 14 | private static final String UNION_OF_ALLOWED_CHARACTERS = UPPERCASE_CHARACTERS 15 | .concat(LOWERCASE_CHARACTERS) 16 | .concat(DIGIT_CHARACTERS) 17 | .concat(SPECIAL_CHARACTERS); 18 | private static final Random RANDOM_OBJECT = new Random(); 19 | 20 | /** 21 | * Generate random password 22 | * Generated password length is 16 23 | * Generated password contains at least one uppercase character 24 | * Generated password contains at least one lowercase character 25 | * Generated password contains at least one digit character 26 | * Generated password contains at least one special character 27 | * 28 | * @return generated password 29 | */ 30 | @Override 31 | public String generate() { 32 | var stringBuilder = new StringBuilder(); 33 | 34 | // generate at least one uppercase character 35 | stringBuilder.append(generateRandomCharacter(UPPERCASE_CHARACTERS)); 36 | 37 | // generate at least one lowercase character 38 | stringBuilder.append(generateRandomCharacter(LOWERCASE_CHARACTERS)); 39 | 40 | // generate at least one digit character 41 | stringBuilder.append(generateRandomCharacter(DIGIT_CHARACTERS)); 42 | 43 | // generate at least one special character 44 | stringBuilder.append(generateRandomCharacter(SPECIAL_CHARACTERS)); 45 | 46 | for (int i = 4; i < PASSWORD_LENGTH; i++) { 47 | // generate random character from union of allowed characters 48 | stringBuilder.append(generateRandomCharacter(UNION_OF_ALLOWED_CHARACTERS)); 49 | } 50 | 51 | // shuffle generated characters 52 | List ch = Arrays.asList(stringBuilder.toString().split("")); 53 | Collections.shuffle(ch); 54 | 55 | // return generated password 56 | return String.join("", ch); 57 | } 58 | 59 | private char generateRandomCharacter(String characters) { 60 | return characters.charAt(RANDOM_OBJECT.nextInt(characters.length())); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/module-info.java: -------------------------------------------------------------------------------- 1 | module com.example.demojavafx { 2 | requires javafx.controls; 3 | requires javafx.fxml; 4 | 5 | 6 | opens com.example.demojavafx to javafx.fxml; 7 | exports com.example.demojavafx; 8 | } -------------------------------------------------------------------------------- /src/main/resources/com/example/demojavafx/hello-view.fxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 26 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/main/resources/copy-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djvelimir/demo-java-fx/5a31fab853690fcb5a453bc70b3dd932843959a1/src/main/resources/copy-icon.png -------------------------------------------------------------------------------- /src/main/resources/dice-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djvelimir/demo-java-fx/5a31fab853690fcb5a453bc70b3dd932843959a1/src/main/resources/dice-icon.png --------------------------------------------------------------------------------