├── .github └── workflows │ └── maven.yml ├── LICENSE ├── README.md ├── checkstyle.xml ├── pom-central.xml ├── pom.xml ├── qrcode-1.1.jar ├── qrcode.png ├── src └── main │ └── java │ └── com │ └── github │ └── qrcode │ ├── QrcodeGenerator.form │ └── QrcodeGenerator.java └── start.cmd /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Set up JDK 17 17 | uses: actions/setup-java@v3 18 | with: 19 | java-version: '17' 20 | distribution: 'temurin' 21 | cache: maven 22 | - name: Build with Maven 23 | run: mvn -B package --file pom.xml 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | qrcode-generator 2 | ================ 3 | 4 | [![Maven Central](https://img.shields.io/maven-central/v/com.github.javadev/qrcode-generator.svg)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.github.javadev%22%20AND%20a%3A%22qrcode-generator%22) 5 | [![Java CI](https://github.com/javadev/qrcode-generator/actions/workflows/maven.yml/badge.svg)](https://github.com/javadev/qrcode-generator/actions/workflows/maven.yml) 6 | 7 | The java/swing application to generate QR codes 8 | 9 | [![Screen short](https://raw.github.com/javadev/qrcode-generator/master/qrcode.png)](https://github.com/javadev/qrcode-generator/) 10 | -------------------------------------------------------------------------------- /checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 96 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 233 | 234 | 235 | 236 | 237 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | -------------------------------------------------------------------------------- /pom-central.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | com.github.javadev 6 | qrcode-generator 7 | jar 8 | 1.1 9 | qrcode 10 | The swing applicationn to generate QR codes 11 | https://github.com/javadev/qrcode-generator 12 | 13 | 14 | 15 | Valentyn Kolesnikov 16 | 17 | 18 | 19 | 20 | 21 | Apache License, Version 2.0 22 | http://www.apache.org/licenses/LICENSE-2.0.txt 23 | repo 24 | 25 | 26 | 27 | 28 | scm:git:git://github.com/javadev/qrcode-generator.git 29 | scm:git:git://github.com/javadev/qrcode-generator.git 30 | https://github.com/javadev/qrcode-generator 31 | 32 | 33 | 34 | UTF-8 35 | 36 | 37 | 38 | Travis CI 39 | https://travis-ci.org/javadev/qrcode-generator 40 | 41 | 42 | 43 | GitHub Issues 44 | https://github.com/javadev/qrcode-generator 45 | 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-jar-plugin 52 | 2.4 53 | 54 | 55 | 56 | com.github.qrcode.QrcodeGenerator 57 | 58 | 59 | 60 | 61 | 62 | org.apache.maven.plugins 63 | maven-source-plugin 64 | 65 | 66 | attach-sources 67 | 68 | jar 69 | 70 | 71 | 72 | 73 | 74 | org.apache.maven.plugins 75 | maven-javadoc-plugin 76 | 3.0.0 77 | 78 | 79 | attach-sources 80 | 81 | jar 82 | 83 | 84 | 85 | 86 | 87 | org.apache.maven.plugins 88 | maven-gpg-plugin 89 | 1.4 90 | 91 | 92 | sign-artifacts 93 | verify 94 | 95 | sign 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | net.java.dev.swing-layout 105 | swing-layout 106 | 1.0.2 107 | 108 | 109 | com.google.zxing 110 | core 111 | 3.3.2 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.0 4 | 5 | com.github 6 | qrcode-generator 7 | jar 8 | 1.1 9 | qrcode 10 | The swing applicationn to generate QR codes 11 | 12 | 13 | ${project.name}-${project.version} 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-compiler-plugin 18 | 3.11.0 19 | 20 | 11 21 | 11 22 | UTF-8 23 | 24 | 25 | 26 | org.apache.maven.plugins 27 | maven-jar-plugin 28 | 2.4 29 | 30 | 31 | 32 | com.github.qrcode.QrcodeGenerator 33 | 34 | 35 | 36 | 37 | 38 | org.codehaus.mojo 39 | exec-maven-plugin 40 | 1.1 41 | 42 | 43 | 44 | java 45 | 46 | 47 | 48 | 49 | com.github.qrcode.QrcodeGenerator 50 | 51 | 52 | 53 | org.apache.maven.plugins 54 | maven-shade-plugin 55 | 1.4 56 | 57 | 58 | package 59 | 60 | shade 61 | 62 | 63 | 64 | 65 | *:* 66 | 67 | META-INF/maven/** 68 | META-INF/services/** 69 | META-INF/COPYRIGHT.html 70 | META-INF/LICENSE* 71 | META-INF/NOTICE* 72 | META-INF/README.txt 73 | META-INF/DEPENDENCIES* 74 | LICENSE.txt 75 | rhinoDiff.txt 76 | license/** 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | org.apache.maven.plugins 86 | maven-site-plugin 87 | 3.6 88 | 89 | 90 | 91 | 92 | 93 | 94 | org.codehaus.mojo 95 | cobertura-maven-plugin 96 | 2.6 97 | 98 | 99 | org.apache.maven.plugins 100 | maven-surefire-report-plugin 101 | 2.3 102 | 103 | 104 | org.apache.maven.plugins 105 | maven-jxr-plugin 106 | 2.1 107 | 108 | 109 | org.apache.maven.plugins 110 | maven-pmd-plugin 111 | 3.0.1 112 | 113 | 1.5 114 | 115 | rulesets/java/basic.xml 116 | rulesets/java/design.xml 117 | rulesets/java/junit.xml 118 | rulesets/java/finalizers.xml 119 | rulesets/java/clone.xml 120 | rulesets/java/unusedcode.xml 121 | rulesets/java/imports.xml 122 | rulesets/java/strings.xml 123 | rulesets/java/braces.xml 124 | rulesets/java/codesize.xml 125 | rulesets/java/coupling.xml 126 | rulesets/java/strictexception.xml 127 | 128 | 129 | 130 | 131 | org.codehaus.mojo 132 | taglist-maven-plugin 133 | 2.0 134 | 135 | 136 | 137 | 138 | 139 | org.swinglabs 140 | swing-layout 141 | 1.0.3 142 | 143 | 144 | com.google.zxing 145 | core 146 | 3.5.1 147 | 148 | 149 | 150 | -------------------------------------------------------------------------------- /qrcode-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javadev/qrcode-generator/c425716c4eb4f66796684a166d8a97cd76a66972/qrcode-1.1.jar -------------------------------------------------------------------------------- /qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/javadev/qrcode-generator/c425716c4eb4f66796684a166d8a97cd76a66972/qrcode.png -------------------------------------------------------------------------------- /src/main/java/com/github/qrcode/QrcodeGenerator.form: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | -------------------------------------------------------------------------------- /src/main/java/com/github/qrcode/QrcodeGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | * 4 | * Copyright 2013 Valentyn Kolesnikov 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package com.github.qrcode; 19 | 20 | import com.google.zxing.BarcodeFormat; 21 | import com.google.zxing.EncodeHintType; 22 | import com.google.zxing.WriterException; 23 | import com.google.zxing.common.BitMatrix; 24 | import com.google.zxing.qrcode.QRCodeWriter; 25 | import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; 26 | import java.awt.Color; 27 | import java.awt.Dimension; 28 | import java.awt.Graphics; 29 | import java.awt.Graphics2D; 30 | import java.awt.Toolkit; 31 | import java.awt.datatransfer.Clipboard; 32 | import java.awt.datatransfer.ClipboardOwner; 33 | import java.awt.datatransfer.DataFlavor; 34 | import java.awt.datatransfer.Transferable; 35 | import java.awt.datatransfer.UnsupportedFlavorException; 36 | import java.awt.event.WindowEvent; 37 | import java.awt.image.BufferedImage; 38 | import java.beans.XMLDecoder; 39 | import java.beans.XMLEncoder; 40 | import java.io.BufferedInputStream; 41 | import java.io.BufferedOutputStream; 42 | import java.io.File; 43 | import java.io.FileInputStream; 44 | import java.io.FileNotFoundException; 45 | import java.io.FileOutputStream; 46 | import java.io.IOException; 47 | import java.util.Hashtable; 48 | import java.util.logging.Level; 49 | import java.util.logging.Logger; 50 | import javax.imageio.ImageIO; 51 | import javax.swing.JFileChooser; 52 | import javax.swing.UIManager; 53 | import javax.swing.UnsupportedLookAndFeelException; 54 | 55 | /** 56 | * QR code generator. 57 | * 58 | * @author javadev 59 | * @version $Revision$ $Date$ 60 | */ 61 | public class QrcodeGenerator extends javax.swing.JFrame { 62 | 63 | private static final String ADDRESS_TEMPLATE = 64 | "BEGIN:VCARD\n" 65 | + "VERSION:3.0\n" 66 | + "N:{LN};{FN};\n" 67 | + "FN:{FN} {LN}\n" 68 | + "TITLE:{TITLE}/{COMPANYNAME}\n" 69 | + "TEL;TYPE=WORK;VOICE:{PHONE}\n" 70 | + "EMAIL;TYPE=WORK:{EMAIL}\n" 71 | + "ADR;TYPE=INTL,POSTAL,WORK:;;{STREET};{CITY};{STATE};{ZIP};{COUNTRY}\n" 72 | + "URL;TYPE=WORK:{WEBSITE}\n" 73 | + "END:VCARD"; 74 | 75 | private BufferedImage image; 76 | private JFileChooser chooser1 = new JFileChooser(); 77 | private class QRCodePanel extends javax.swing.JPanel { 78 | 79 | @Override 80 | protected void paintComponent(Graphics grphcs) { 81 | super.paintComponent(grphcs); 82 | if (image != null) { 83 | grphcs.drawImage(image, 0, 0, null); 84 | } 85 | } 86 | } 87 | 88 | private class FilterPNG extends javax.swing.filechooser.FileFilter { 89 | public String getDescription() { 90 | return "PNG files"; 91 | } 92 | 93 | public boolean accept(File file) { 94 | if (file.isDirectory()) { 95 | return true; 96 | } 97 | String name = file.getName(); 98 | name = name.toLowerCase(); 99 | return name.endsWith(".png"); 100 | } 101 | } 102 | 103 | private class TransferableImage implements Transferable { 104 | 105 | private final java.awt.Image image; 106 | 107 | public TransferableImage(java.awt.Image image) { 108 | this.image = image; 109 | } 110 | 111 | public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { 112 | if (flavor.equals( DataFlavor.imageFlavor) && image != null) { 113 | return image; 114 | } else { 115 | throw new UnsupportedFlavorException(flavor); 116 | } 117 | } 118 | 119 | public DataFlavor[] getTransferDataFlavors() { 120 | DataFlavor[] flavors = new DataFlavor[1]; 121 | flavors[0] = DataFlavor.imageFlavor; 122 | return flavors; 123 | } 124 | 125 | public boolean isDataFlavorSupported( DataFlavor flavor) { 126 | DataFlavor[] flavors = getTransferDataFlavors(); 127 | for (int i = 0; i < flavors.length; i++) { 128 | if (flavor.equals(flavors[i])) { 129 | return true; 130 | } 131 | } 132 | 133 | return false; 134 | } 135 | } 136 | 137 | /** Creates new form */ 138 | public QrcodeGenerator() { 139 | initComponents(); 140 | XMLDecoder d; 141 | String x = null; 142 | String y = null; 143 | String height = null; 144 | String width = null; 145 | String index = null; 146 | try { 147 | d = new XMLDecoder(new BufferedInputStream(new FileInputStream("qrcode.xml"))); 148 | jTextField1.setText((String) d.readObject()); 149 | jTextField2.setText((String) d.readObject()); 150 | jTextField3.setText((String) d.readObject()); 151 | jTextField4.setText((String) d.readObject()); 152 | jTextField5.setText((String) d.readObject()); 153 | jTextField6.setText((String) d.readObject()); 154 | jTextField7.setText((String) d.readObject()); 155 | jTextField8.setText((String) d.readObject()); 156 | jTextField9.setText((String) d.readObject()); 157 | jTextField10.setText((String) d.readObject()); 158 | jTextField11.setText((String) d.readObject()); 159 | jTextField12.setText((String) d.readObject()); 160 | jTextField13.setText((String) d.readObject()); 161 | jTextField14.setText((String) d.readObject()); 162 | jTextField15.setText((String) d.readObject()); 163 | jTextArea1.setText((String) d.readObject()); 164 | jTextArea2.setText((String) d.readObject()); 165 | x = (String) d.readObject(); 166 | y = (String) d.readObject(); 167 | height = (String) d.readObject(); 168 | width = (String) d.readObject(); 169 | index = (String) d.readObject(); 170 | d.close(); 171 | } catch (Exception ex) { 172 | ex.getMessage(); 173 | } 174 | 175 | addWindowListener(new java.awt.event.WindowAdapter() { 176 | @Override 177 | public void windowClosing(WindowEvent winEvt) { 178 | XMLEncoder e; 179 | try { 180 | e = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("qrcode.xml"))); 181 | e.writeObject(jTextField1.getText()); 182 | e.writeObject(jTextField2.getText()); 183 | e.writeObject(jTextField3.getText()); 184 | e.writeObject(jTextField4.getText()); 185 | e.writeObject(jTextField5.getText()); 186 | e.writeObject(jTextField6.getText()); 187 | e.writeObject(jTextField7.getText()); 188 | e.writeObject(jTextField8.getText()); 189 | e.writeObject(jTextField9.getText()); 190 | e.writeObject(jTextField10.getText()); 191 | e.writeObject(jTextField11.getText()); 192 | e.writeObject(jTextField12.getText()); 193 | e.writeObject(jTextField13.getText()); 194 | e.writeObject(jTextField14.getText()); 195 | e.writeObject(jTextField15.getText()); 196 | e.writeObject(jTextArea1.getText()); 197 | e.writeObject(jTextArea2.getText()); 198 | e.writeObject("" + getLocation().x); 199 | e.writeObject("" + getLocation().y); 200 | e.writeObject("" + getSize().height); 201 | e.writeObject("" + getSize().width); 202 | e.writeObject("" + jTabbedPane6.getSelectedIndex()); 203 | e.close(); 204 | } catch (FileNotFoundException ex) { 205 | Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.SEVERE, null, ex); 206 | } 207 | System.exit(0); 208 | } 209 | }); 210 | chooser1.addChoosableFileFilter(new FilterPNG()); 211 | chooser1.setDialogTitle("Select PNG file"); 212 | chooser1.setCurrentDirectory(new File(".")); 213 | final java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); 214 | if (x == null) { 215 | x = "" + ((screenSize.width - getWidth()) / 2); 216 | } 217 | if (y == null) { 218 | y = "" + ((screenSize.height - getHeight()) / 2); 219 | } 220 | if (height == null) { 221 | height = "" + getPreferredSize().height; 222 | } 223 | if (width == null) { 224 | width = "" + getPreferredSize().width; 225 | } 226 | if (index == null) { 227 | index = "" + jTabbedPane6.getSelectedIndex(); 228 | } 229 | setLocation(Integer.valueOf(x), Integer.valueOf(y)); 230 | setSize(new Dimension(Integer.valueOf(width), Integer.valueOf(height))); 231 | jTabbedPane6.setSelectedIndex(Integer.valueOf(index)); 232 | } 233 | 234 | 235 | /** This method is called from within the constructor to 236 | * initialize the form. 237 | * WARNING: Do NOT modify this code. The content of this method is 238 | * always regenerated by the Form Editor. 239 | */ 240 | // //GEN-BEGIN:initComponents 241 | private void initComponents() { 242 | 243 | jPanel1 = new javax.swing.JPanel(); 244 | jPanel3 = new QRCodePanel(); 245 | jTabbedPane6 = new javax.swing.JTabbedPane(); 246 | jPanel4 = new javax.swing.JPanel(); 247 | jTextField2 = new javax.swing.JTextField(); 248 | jPanel5 = new javax.swing.JPanel(); 249 | jScrollPane1 = new javax.swing.JScrollPane(); 250 | jTextArea1 = new javax.swing.JTextArea(); 251 | jLabel1 = new javax.swing.JLabel(); 252 | jPanel6 = new javax.swing.JPanel(); 253 | jTextField1 = new javax.swing.JTextField(); 254 | jPanel7 = new javax.swing.JPanel(); 255 | jLabel2 = new javax.swing.JLabel(); 256 | jTextField3 = new javax.swing.JTextField(); 257 | jLabel3 = new javax.swing.JLabel(); 258 | jScrollPane2 = new javax.swing.JScrollPane(); 259 | jTextArea2 = new javax.swing.JTextArea(); 260 | jLabel4 = new javax.swing.JLabel(); 261 | jScrollPane3 = new javax.swing.JScrollPane(); 262 | jPanel8 = new javax.swing.JPanel(); 263 | jLabel5 = new javax.swing.JLabel(); 264 | jTextField4 = new javax.swing.JTextField(); 265 | jLabel6 = new javax.swing.JLabel(); 266 | jTextField5 = new javax.swing.JTextField(); 267 | jLabel7 = new javax.swing.JLabel(); 268 | jLabel8 = new javax.swing.JLabel(); 269 | jTextField6 = new javax.swing.JTextField(); 270 | jTextField7 = new javax.swing.JTextField(); 271 | jLabel9 = new javax.swing.JLabel(); 272 | jTextField8 = new javax.swing.JTextField(); 273 | jSeparator1 = new javax.swing.JSeparator(); 274 | jLabel10 = new javax.swing.JLabel(); 275 | jLabel11 = new javax.swing.JLabel(); 276 | jLabel12 = new javax.swing.JLabel(); 277 | jTextField9 = new javax.swing.JTextField(); 278 | jTextField10 = new javax.swing.JTextField(); 279 | jSeparator2 = new javax.swing.JSeparator(); 280 | jLabel13 = new javax.swing.JLabel(); 281 | jLabel14 = new javax.swing.JLabel(); 282 | jTextField11 = new javax.swing.JTextField(); 283 | jLabel15 = new javax.swing.JLabel(); 284 | jTextField12 = new javax.swing.JTextField(); 285 | jLabel16 = new javax.swing.JLabel(); 286 | jTextField13 = new javax.swing.JTextField(); 287 | jLabel17 = new javax.swing.JLabel(); 288 | jTextField14 = new javax.swing.JTextField(); 289 | jLabel18 = new javax.swing.JLabel(); 290 | jTextField15 = new javax.swing.JTextField(); 291 | jButton2 = new javax.swing.JButton(); 292 | jButton1 = new javax.swing.JButton(); 293 | 294 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 295 | setTitle("QR code generator"); 296 | 297 | jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); 298 | jPanel3.setPreferredSize(new java.awt.Dimension(212, 212)); 299 | 300 | org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3); 301 | jPanel3.setLayout(jPanel3Layout); 302 | jPanel3Layout.setHorizontalGroup( 303 | jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 304 | .add(0, 208, Short.MAX_VALUE) 305 | ); 306 | jPanel3Layout.setVerticalGroup( 307 | jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 308 | .add(0, 208, Short.MAX_VALUE) 309 | ); 310 | 311 | jTabbedPane6.addChangeListener(new javax.swing.event.ChangeListener() { 312 | public void stateChanged(javax.swing.event.ChangeEvent evt) { 313 | jTabbedPane6StateChanged(evt); 314 | } 315 | }); 316 | 317 | jTextField2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 318 | jTextField2.setText("http://"); 319 | jTextField2.addKeyListener(new java.awt.event.KeyAdapter() { 320 | public void keyReleased(java.awt.event.KeyEvent evt) { 321 | jTextField2KeyReleased(evt); 322 | } 323 | }); 324 | 325 | org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4); 326 | jPanel4.setLayout(jPanel4Layout); 327 | jPanel4Layout.setHorizontalGroup( 328 | jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 329 | .add(jPanel4Layout.createSequentialGroup() 330 | .addContainerGap() 331 | .add(jTextField2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE) 332 | .addContainerGap()) 333 | ); 334 | jPanel4Layout.setVerticalGroup( 335 | jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 336 | .add(jPanel4Layout.createSequentialGroup() 337 | .addContainerGap() 338 | .add(jTextField2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 339 | .addContainerGap(490, Short.MAX_VALUE)) 340 | ); 341 | 342 | jTabbedPane6.addTab("URL", jPanel4); 343 | 344 | jTextArea1.setColumns(20); 345 | jTextArea1.setFont(new java.awt.Font("Monospaced", 0, 18)); // NOI18N 346 | jTextArea1.setRows(5); 347 | jTextArea1.addKeyListener(new java.awt.event.KeyAdapter() { 348 | public void keyReleased(java.awt.event.KeyEvent evt) { 349 | jTextArea1KeyReleased(evt); 350 | } 351 | }); 352 | jScrollPane1.setViewportView(jTextArea1); 353 | 354 | jLabel1.setText("160 characters"); 355 | 356 | org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5); 357 | jPanel5.setLayout(jPanel5Layout); 358 | jPanel5Layout.setHorizontalGroup( 359 | jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 360 | .add(jPanel5Layout.createSequentialGroup() 361 | .addContainerGap() 362 | .add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 363 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE) 364 | .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel5Layout.createSequentialGroup() 365 | .add(0, 452, Short.MAX_VALUE) 366 | .add(jLabel1))) 367 | .addContainerGap()) 368 | ); 369 | jPanel5Layout.setVerticalGroup( 370 | jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 371 | .add(jPanel5Layout.createSequentialGroup() 372 | .addContainerGap() 373 | .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 264, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 374 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 375 | .add(jLabel1) 376 | .addContainerGap(234, Short.MAX_VALUE)) 377 | ); 378 | 379 | jTabbedPane6.addTab("Text", jPanel5); 380 | 381 | jTextField1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 382 | jTextField1.addKeyListener(new java.awt.event.KeyAdapter() { 383 | public void keyReleased(java.awt.event.KeyEvent evt) { 384 | jTextField1KeyReleased(evt); 385 | } 386 | }); 387 | 388 | org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6); 389 | jPanel6.setLayout(jPanel6Layout); 390 | jPanel6Layout.setHorizontalGroup( 391 | jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 392 | .add(jPanel6Layout.createSequentialGroup() 393 | .addContainerGap() 394 | .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE) 395 | .addContainerGap()) 396 | ); 397 | jPanel6Layout.setVerticalGroup( 398 | jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 399 | .add(jPanel6Layout.createSequentialGroup() 400 | .addContainerGap() 401 | .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 402 | .addContainerGap(490, Short.MAX_VALUE)) 403 | ); 404 | 405 | jTabbedPane6.addTab("Phone Number", jPanel6); 406 | 407 | jLabel2.setText("Number:"); 408 | 409 | jTextField3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 410 | jTextField3.addKeyListener(new java.awt.event.KeyAdapter() { 411 | public void keyTyped(java.awt.event.KeyEvent evt) { 412 | jTextField3KeyTyped(evt); 413 | } 414 | }); 415 | 416 | jLabel3.setText("Message:"); 417 | 418 | jTextArea2.setColumns(20); 419 | jTextArea2.setFont(new java.awt.Font("Monospaced", 0, 18)); // NOI18N 420 | jTextArea2.setRows(4); 421 | jTextArea2.addKeyListener(new java.awt.event.KeyAdapter() { 422 | public void keyTyped(java.awt.event.KeyEvent evt) { 423 | jTextArea2KeyTyped(evt); 424 | } 425 | }); 426 | jScrollPane2.setViewportView(jTextArea2); 427 | 428 | jLabel4.setText("140 characters"); 429 | 430 | org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7); 431 | jPanel7.setLayout(jPanel7Layout); 432 | jPanel7Layout.setHorizontalGroup( 433 | jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 434 | .add(jPanel7Layout.createSequentialGroup() 435 | .addContainerGap() 436 | .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 437 | .add(org.jdesktop.layout.GroupLayout.TRAILING, jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE) 438 | .add(jTextField3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE) 439 | .add(jPanel7Layout.createSequentialGroup() 440 | .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 441 | .add(jLabel2) 442 | .add(jLabel3)) 443 | .add(0, 478, Short.MAX_VALUE)) 444 | .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup() 445 | .add(0, 452, Short.MAX_VALUE) 446 | .add(jLabel4))) 447 | .addContainerGap()) 448 | ); 449 | jPanel7Layout.setVerticalGroup( 450 | jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 451 | .add(jPanel7Layout.createSequentialGroup() 452 | .addContainerGap() 453 | .add(jLabel2) 454 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 455 | .add(jTextField3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 456 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 457 | .add(jLabel3) 458 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 459 | .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 122, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 460 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 461 | .add(jLabel4) 462 | .addContainerGap(302, Short.MAX_VALUE)) 463 | ); 464 | 465 | jTabbedPane6.addTab("SMS", jPanel7); 466 | 467 | jScrollPane3.setBorder(null); 468 | jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); 469 | 470 | jLabel5.setText("First Name"); 471 | 472 | jTextField4.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 473 | jTextField4.addKeyListener(new java.awt.event.KeyAdapter() { 474 | public void keyReleased(java.awt.event.KeyEvent evt) { 475 | jTextField4KeyReleased(evt); 476 | } 477 | }); 478 | 479 | jLabel6.setText("Family Name"); 480 | 481 | jTextField5.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 482 | jTextField5.addKeyListener(new java.awt.event.KeyAdapter() { 483 | public void keyReleased(java.awt.event.KeyEvent evt) { 484 | jTextField4KeyReleased(evt); 485 | } 486 | }); 487 | 488 | jLabel7.setText("Phone Number"); 489 | 490 | jLabel8.setText("Email"); 491 | 492 | jTextField6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 493 | jTextField6.addKeyListener(new java.awt.event.KeyAdapter() { 494 | public void keyReleased(java.awt.event.KeyEvent evt) { 495 | jTextField4KeyReleased(evt); 496 | } 497 | }); 498 | 499 | jTextField7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 500 | jTextField7.addKeyListener(new java.awt.event.KeyAdapter() { 501 | public void keyReleased(java.awt.event.KeyEvent evt) { 502 | jTextField4KeyReleased(evt); 503 | } 504 | }); 505 | 506 | jLabel9.setText("Website"); 507 | 508 | jTextField8.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 509 | jTextField8.addKeyListener(new java.awt.event.KeyAdapter() { 510 | public void keyReleased(java.awt.event.KeyEvent evt) { 511 | jTextField4KeyReleased(evt); 512 | } 513 | }); 514 | 515 | jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); 516 | jLabel10.setText("Add Organization"); 517 | 518 | jLabel11.setText("Company Name"); 519 | 520 | jLabel12.setText("Title within Company"); 521 | 522 | jTextField9.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 523 | jTextField9.addKeyListener(new java.awt.event.KeyAdapter() { 524 | public void keyReleased(java.awt.event.KeyEvent evt) { 525 | jTextField4KeyReleased(evt); 526 | } 527 | }); 528 | 529 | jTextField10.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 530 | jTextField10.addKeyListener(new java.awt.event.KeyAdapter() { 531 | public void keyReleased(java.awt.event.KeyEvent evt) { 532 | jTextField4KeyReleased(evt); 533 | } 534 | }); 535 | 536 | jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); 537 | jLabel13.setText("Address"); 538 | 539 | jLabel14.setText("Street"); 540 | 541 | jTextField11.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 542 | jTextField11.addKeyListener(new java.awt.event.KeyAdapter() { 543 | public void keyReleased(java.awt.event.KeyEvent evt) { 544 | jTextField4KeyReleased(evt); 545 | } 546 | }); 547 | 548 | jLabel15.setText("City"); 549 | 550 | jTextField12.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 551 | jTextField12.addKeyListener(new java.awt.event.KeyAdapter() { 552 | public void keyReleased(java.awt.event.KeyEvent evt) { 553 | jTextField4KeyReleased(evt); 554 | } 555 | }); 556 | 557 | jLabel16.setText("State"); 558 | 559 | jTextField13.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 560 | jTextField13.addKeyListener(new java.awt.event.KeyAdapter() { 561 | public void keyReleased(java.awt.event.KeyEvent evt) { 562 | jTextField4KeyReleased(evt); 563 | } 564 | }); 565 | 566 | jLabel17.setText("Zip"); 567 | 568 | jTextField14.setFont(new java.awt.Font("Tahoma", 0, 18)); 569 | jTextField14.addKeyListener(new java.awt.event.KeyAdapter() { 570 | public void keyReleased(java.awt.event.KeyEvent evt) { 571 | jTextField4KeyReleased(evt); 572 | } 573 | }); 574 | 575 | jLabel18.setText("Country"); 576 | 577 | jTextField15.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N 578 | jTextField15.addKeyListener(new java.awt.event.KeyAdapter() { 579 | public void keyReleased(java.awt.event.KeyEvent evt) { 580 | jTextField4KeyReleased(evt); 581 | } 582 | }); 583 | 584 | org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8); 585 | jPanel8.setLayout(jPanel8Layout); 586 | jPanel8Layout.setHorizontalGroup( 587 | jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 588 | .add(jPanel8Layout.createSequentialGroup() 589 | .addContainerGap() 590 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 591 | .add(jPanel8Layout.createSequentialGroup() 592 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 593 | .add(jTextField9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 594 | .add(jLabel11)) 595 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 596 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 597 | .add(jPanel8Layout.createSequentialGroup() 598 | .add(jLabel12) 599 | .add(0, 195, Short.MAX_VALUE)) 600 | .add(jTextField10, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE))) 601 | .add(jPanel8Layout.createSequentialGroup() 602 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 603 | .add(jTextField4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 604 | .add(jLabel5) 605 | .add(jLabel7)) 606 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 607 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 608 | .add(jTextField5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE) 609 | .add(jPanel8Layout.createSequentialGroup() 610 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 611 | .add(jLabel8) 612 | .add(jLabel6)) 613 | .add(0, 234, Short.MAX_VALUE)))) 614 | .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup() 615 | .add(jTextField6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 616 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 617 | .add(jTextField7, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)) 618 | .add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE) 619 | .add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE) 620 | .add(jPanel8Layout.createSequentialGroup() 621 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 622 | .add(jTextField13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 623 | .add(jLabel16)) 624 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 625 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 626 | .add(jPanel8Layout.createSequentialGroup() 627 | .add(jLabel17) 628 | .add(0, 280, Short.MAX_VALUE)) 629 | .add(jTextField14, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE))) 630 | .add(jPanel8Layout.createSequentialGroup() 631 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 632 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 633 | .add(jLabel9) 634 | .add(org.jdesktop.layout.GroupLayout.TRAILING, jTextField8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 635 | .add(jLabel10) 636 | .add(jLabel13) 637 | .add(jTextField11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 638 | .add(jLabel14) 639 | .add(jTextField12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 640 | .add(jLabel15) 641 | .add(jTextField15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 224, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 642 | .add(jLabel18)) 643 | .add(0, 300, Short.MAX_VALUE))) 644 | .addContainerGap()) 645 | ); 646 | jPanel8Layout.setVerticalGroup( 647 | jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 648 | .add(jPanel8Layout.createSequentialGroup() 649 | .addContainerGap() 650 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 651 | .add(jLabel5) 652 | .add(jLabel6)) 653 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 654 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 655 | .add(jTextField4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 656 | .add(jTextField5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 657 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 658 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 659 | .add(jLabel7) 660 | .add(jLabel8)) 661 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 662 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 663 | .add(jTextField6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 664 | .add(jTextField7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 665 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 666 | .add(jLabel9) 667 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 668 | .add(jTextField8, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 669 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 670 | .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 671 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 672 | .add(jLabel10) 673 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 674 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 675 | .add(jLabel12) 676 | .add(jLabel11)) 677 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 678 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 679 | .add(jTextField9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 680 | .add(jTextField10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 681 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 682 | .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 683 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 684 | .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) 685 | .add(jPanel8Layout.createSequentialGroup() 686 | .add(jLabel13) 687 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 688 | .add(jLabel14) 689 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 690 | .add(jTextField11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 691 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 692 | .add(jLabel15) 693 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 694 | .add(jTextField12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 695 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 696 | .add(jLabel16) 697 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 698 | .add(jTextField13, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 699 | .add(jPanel8Layout.createSequentialGroup() 700 | .add(jLabel17) 701 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 702 | .add(jTextField14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) 703 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 704 | .add(jLabel18) 705 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 706 | .add(jTextField15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 707 | .addContainerGap()) 708 | ); 709 | 710 | jScrollPane3.setViewportView(jPanel8); 711 | 712 | jTabbedPane6.addTab("Contact", jScrollPane3); 713 | 714 | jButton2.setText("Save to disk"); 715 | jButton2.addActionListener(new java.awt.event.ActionListener() { 716 | public void actionPerformed(java.awt.event.ActionEvent evt) { 717 | jButton2ActionPerformed(evt); 718 | } 719 | }); 720 | 721 | jButton1.setText("Copy"); 722 | jButton1.addActionListener(new java.awt.event.ActionListener() { 723 | public void actionPerformed(java.awt.event.ActionEvent evt) { 724 | jButton1ActionPerformed(evt); 725 | } 726 | }); 727 | 728 | org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); 729 | jPanel1.setLayout(jPanel1Layout); 730 | jPanel1Layout.setHorizontalGroup( 731 | jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 732 | .add(jPanel1Layout.createSequentialGroup() 733 | .addContainerGap() 734 | .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 735 | .add(jPanel1Layout.createSequentialGroup() 736 | .add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE) 737 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 738 | .add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 124, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 739 | .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 740 | .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 741 | .add(jTabbedPane6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 549, Short.MAX_VALUE) 742 | .addContainerGap()) 743 | ); 744 | jPanel1Layout.setVerticalGroup( 745 | jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 746 | .add(jPanel1Layout.createSequentialGroup() 747 | .addContainerGap() 748 | .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 749 | .add(jTabbedPane6) 750 | .add(jPanel1Layout.createSequentialGroup() 751 | .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 752 | .add(11, 11, 11) 753 | .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 754 | .add(jButton2) 755 | .add(jButton1)) 756 | .add(0, 308, Short.MAX_VALUE))) 757 | .addContainerGap()) 758 | ); 759 | 760 | org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); 761 | getContentPane().setLayout(layout); 762 | layout.setHorizontalGroup( 763 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 764 | .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 765 | ); 766 | layout.setVerticalGroup( 767 | layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 768 | .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 769 | ); 770 | 771 | pack(); 772 | }// //GEN-END:initComponents 773 | 774 | private void jTextArea1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea1KeyReleased 775 | String text = jTextArea1.getText(); 776 | int length = text.length(); 777 | jLabel1.setText("" + length + " character" + (length <= 1 ? "" : "s")); 778 | generateQrCode(text); 779 | }//GEN-LAST:event_jTextArea1KeyReleased 780 | 781 | private void jTextField2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyReleased 782 | generateQrCode(jTextField2.getText()); 783 | }//GEN-LAST:event_jTextField2KeyReleased 784 | 785 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed 786 | if (chooser1.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) { 787 | return; 788 | } 789 | String fileName = chooser1.getSelectedFile().getPath().replaceFirst("(.*?)(\\.\\w{3,4})*$", "$1.png"); 790 | try { 791 | ImageIO.write(image, "png", new File(fileName)); 792 | } catch (IOException ex) { 793 | Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.SEVERE, null, ex); 794 | } 795 | }//GEN-LAST:event_jButton2ActionPerformed 796 | 797 | private void jTabbedPane6StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane6StateChanged 798 | javax.swing.JTabbedPane jt = (javax.swing.JTabbedPane) evt.getSource(); 799 | switch(jt.getSelectedIndex()) { 800 | case 0: 801 | generateQrCode(jTextField2.getText()); 802 | break; 803 | case 1: 804 | String text = jTextArea1.getText(); 805 | int length = text.length(); 806 | jLabel1.setText("" + length + " character" + (length <= 1 ? "" : "s")); 807 | generateQrCode(text); 808 | break; 809 | case 2: 810 | generateQrCode("tel:" + jTextField1.getText()); 811 | break; 812 | case 3: 813 | String text2 = jTextArea2.getText(); 814 | int length2 = text2.length(); 815 | jLabel4.setText("" + length2 + " character" + (length2 <= 1 ? "" : "s")); 816 | generateQrCode("sms:" + jTextField3.getText() + ":" + text2); 817 | break; 818 | case 4: 819 | generateQrCode(ADDRESS_TEMPLATE.replace("{FN}", jTextField4.getText()) 820 | .replace("{LN}", jTextField5.getText()) 821 | .replace("{PHONE}", jTextField6.getText()) 822 | .replace("{EMAIL}", jTextField7.getText()) 823 | .replace("{WEBSITE}", jTextField8.getText()) 824 | .replace("{COMPANYNAME}", jTextField9.getText()) 825 | .replace("{TITLE}", jTextField10.getText()) 826 | .replace("{STREET}", jTextField11.getText()) 827 | .replace("{CITY}", jTextField12.getText()) 828 | .replace("{STATE}", jTextField13.getText()) 829 | .replace("{ZIP}", jTextField14.getText()) 830 | .replace("{COUNTRY}", jTextField15.getText()) 831 | ); 832 | break; 833 | } 834 | }//GEN-LAST:event_jTabbedPane6StateChanged 835 | 836 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed 837 | TransferableImage trans = new TransferableImage(image); 838 | Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); 839 | clipboard.setContents(trans, new ClipboardOwner() { 840 | public void lostOwnership(Clipboard clpbrd, Transferable t) { 841 | // Ignore 842 | } 843 | } ); 844 | }//GEN-LAST:event_jButton1ActionPerformed 845 | 846 | private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased 847 | generateQrCode("tel:" + jTextField1.getText()); 848 | }//GEN-LAST:event_jTextField1KeyReleased 849 | 850 | private void jTextField3KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField3KeyTyped 851 | generateQrCode("sms:" + jTextField3.getText() + ":" + jTextArea2.getText()); 852 | }//GEN-LAST:event_jTextField3KeyTyped 853 | 854 | private void jTextArea2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextArea2KeyTyped 855 | String text = jTextArea2.getText(); 856 | int length = text.length(); 857 | jLabel4.setText("" + length + " character" + (length <= 1 ? "" : "s")); 858 | generateQrCode("sms:" + jTextField3.getText() + ":" + text); 859 | }//GEN-LAST:event_jTextArea2KeyTyped 860 | 861 | private void jTextField4KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField4KeyReleased 862 | generateQrCode(ADDRESS_TEMPLATE.replace("{FN}", jTextField4.getText()) 863 | .replace("{LN}", jTextField5.getText()) 864 | .replace("{PHONE}", jTextField6.getText()) 865 | .replace("{EMAIL}", jTextField7.getText()) 866 | .replace("{WEBSITE}", jTextField8.getText()) 867 | .replace("{COMPANYNAME}", jTextField9.getText()) 868 | .replace("{TITLE}", jTextField10.getText()) 869 | .replace("{STREET}", jTextField11.getText()) 870 | .replace("{CITY}", jTextField12.getText()) 871 | .replace("{STATE}", jTextField13.getText()) 872 | .replace("{ZIP}", jTextField14.getText()) 873 | .replace("{COUNTRY}", jTextField15.getText()) 874 | ); 875 | }//GEN-LAST:event_jTextField4KeyReleased 876 | 877 | 878 | private static void setLookAndFeel() 879 | throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException 880 | { 881 | javax.swing.UIManager.LookAndFeelInfo infos[] = UIManager.getInstalledLookAndFeels(); 882 | String firstFoundClass = null; 883 | for (javax.swing.UIManager.LookAndFeelInfo info : infos) { 884 | String foundClass = info.getClassName(); 885 | if ("Nimbus".equals(info.getName())) { 886 | firstFoundClass = foundClass; 887 | break; 888 | } 889 | if (null == firstFoundClass) { 890 | firstFoundClass = foundClass; 891 | } 892 | } 893 | 894 | if(null == firstFoundClass) { 895 | throw new IllegalArgumentException("No suitable Swing looks and feels"); 896 | } else { 897 | UIManager.setLookAndFeel(firstFoundClass); 898 | } 899 | } 900 | 901 | /** 902 | * @param args the command line arguments 903 | */ 904 | public static void main(String args[]) throws Exception { 905 | setLookAndFeel(); 906 | java.awt.EventQueue.invokeLater(new Runnable() { 907 | public void run() { 908 | new QrcodeGenerator().setVisible(true); 909 | } 910 | }); 911 | } 912 | 913 | // Variables declaration - do not modify//GEN-BEGIN:variables 914 | private javax.swing.JButton jButton1; 915 | private javax.swing.JButton jButton2; 916 | private javax.swing.JLabel jLabel1; 917 | private javax.swing.JLabel jLabel10; 918 | private javax.swing.JLabel jLabel11; 919 | private javax.swing.JLabel jLabel12; 920 | private javax.swing.JLabel jLabel13; 921 | private javax.swing.JLabel jLabel14; 922 | private javax.swing.JLabel jLabel15; 923 | private javax.swing.JLabel jLabel16; 924 | private javax.swing.JLabel jLabel17; 925 | private javax.swing.JLabel jLabel18; 926 | private javax.swing.JLabel jLabel2; 927 | private javax.swing.JLabel jLabel3; 928 | private javax.swing.JLabel jLabel4; 929 | private javax.swing.JLabel jLabel5; 930 | private javax.swing.JLabel jLabel6; 931 | private javax.swing.JLabel jLabel7; 932 | private javax.swing.JLabel jLabel8; 933 | private javax.swing.JLabel jLabel9; 934 | private javax.swing.JPanel jPanel1; 935 | private javax.swing.JPanel jPanel3; 936 | private javax.swing.JPanel jPanel4; 937 | private javax.swing.JPanel jPanel5; 938 | private javax.swing.JPanel jPanel6; 939 | private javax.swing.JPanel jPanel7; 940 | private javax.swing.JPanel jPanel8; 941 | private javax.swing.JScrollPane jScrollPane1; 942 | private javax.swing.JScrollPane jScrollPane2; 943 | private javax.swing.JScrollPane jScrollPane3; 944 | private javax.swing.JSeparator jSeparator1; 945 | private javax.swing.JSeparator jSeparator2; 946 | private javax.swing.JTabbedPane jTabbedPane6; 947 | private javax.swing.JTextArea jTextArea1; 948 | private javax.swing.JTextArea jTextArea2; 949 | private javax.swing.JTextField jTextField1; 950 | private javax.swing.JTextField jTextField10; 951 | private javax.swing.JTextField jTextField11; 952 | private javax.swing.JTextField jTextField12; 953 | private javax.swing.JTextField jTextField13; 954 | private javax.swing.JTextField jTextField14; 955 | private javax.swing.JTextField jTextField15; 956 | private javax.swing.JTextField jTextField2; 957 | private javax.swing.JTextField jTextField3; 958 | private javax.swing.JTextField jTextField4; 959 | private javax.swing.JTextField jTextField5; 960 | private javax.swing.JTextField jTextField6; 961 | private javax.swing.JTextField jTextField7; 962 | private javax.swing.JTextField jTextField8; 963 | private javax.swing.JTextField jTextField9; 964 | // End of variables declaration//GEN-END:variables 965 | 966 | private void generateQrCode(String messsage) { 967 | Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.INFO, messsage); 968 | if (messsage == null || messsage.isEmpty()) { 969 | image = null; 970 | return; 971 | } 972 | try { 973 | Hashtable hintMap = new Hashtable(); 974 | hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L); 975 | hintMap.put(EncodeHintType.CHARACTER_SET, "UTF-8"); 976 | QRCodeWriter qrCodeWriter = new QRCodeWriter(); 977 | BitMatrix byteMatrix = qrCodeWriter.encode(messsage, 978 | BarcodeFormat.QR_CODE, jPanel3.getPreferredSize().width, jPanel3.getPreferredSize().height, hintMap); 979 | int CrunchifyWidth = byteMatrix.getWidth(); 980 | image = new BufferedImage(CrunchifyWidth, CrunchifyWidth, 981 | BufferedImage.TYPE_INT_RGB); 982 | image.createGraphics(); 983 | Graphics2D graphics=(Graphics2D)image.getGraphics(); 984 | graphics.setColor(Color.WHITE); 985 | graphics.fillRect(0, 0, CrunchifyWidth, CrunchifyWidth); 986 | graphics.setColor(Color.BLACK); 987 | for (int i = 0; i < CrunchifyWidth; i++) { 988 | for (int j = 0; j < CrunchifyWidth; j++) { 989 | if (byteMatrix.get(i, j)) { 990 | graphics.fillRect(i, j, 1, 1); 991 | } 992 | } 993 | } 994 | jPanel3.repaint(); 995 | } catch (WriterException ex) { 996 | Logger.getLogger(QrcodeGenerator.class.getName()).log(Level.SEVERE, null, ex); 997 | } 998 | } 999 | 1000 | } 1001 | -------------------------------------------------------------------------------- /start.cmd: -------------------------------------------------------------------------------- 1 | mvn exec:java -Dexec.args="%*" --------------------------------------------------------------------------------