├── CODE_OF_CONDUCT.md
├── LICENSE.md
├── README.md
├── SECURITY.md
├── screenshots
├── error.png
├── flsm.png
├── ip.png
├── ip2.png
├── net.png
├── net2.png
└── vlsm.png
└── subnetting
├── doc
└── doc.zip
├── out
└── artifacts
│ └── subnetting_jar
│ └── subnetting.jar
├── pom.xml
├── src
└── main
│ ├── java
│ └── org
│ │ └── subnetting
│ │ ├── AnimatedButton.java
│ │ ├── AnimatedLabel.java
│ │ ├── AnimatedModal.java
│ │ ├── AnimatedOpacityPanel.java
│ │ ├── AnimatedRoundedLabel.java
│ │ ├── AnimatedSVG.java
│ │ ├── CalcFLSM.java
│ │ ├── CalcIP.java
│ │ ├── CalcManager.java
│ │ ├── CalcNetIDs.java
│ │ ├── CalcVLSM.java
│ │ ├── LayoutTable.java
│ │ ├── Main.java
│ │ ├── ObjIP.java
│ │ ├── ObjNetIDs.java
│ │ ├── ObjSM.java
│ │ ├── RoundedButton.java
│ │ ├── RoundedLabel.java
│ │ ├── RoundedPanel.java
│ │ ├── RoundedPanelApp.java
│ │ └── RoundedTextField.java
│ └── resources
│ ├── META-INF
│ └── MANIFEST.MF
│ └── assets
│ ├── github-primary.svg
│ ├── github.svg
│ └── x-circle.svg
└── target
└── classes
├── META-INF
└── MANIFEST.MF
├── assets
├── github-primary.svg
├── github.svg
└── x-circle.svg
└── org
└── subnetting
├── AnimatedButton$1.class
├── AnimatedButton$2.class
├── AnimatedButton.class
├── AnimatedLabel$1.class
├── AnimatedLabel$2.class
├── AnimatedLabel$3.class
├── AnimatedLabel$4.class
├── AnimatedLabel$5.class
├── AnimatedLabel.class
├── AnimatedModal$1.class
├── AnimatedModal$2.class
├── AnimatedModal$3.class
├── AnimatedModal.class
├── AnimatedOpacityPanel$1.class
├── AnimatedOpacityPanel.class
├── AnimatedRoundedLabel$1.class
├── AnimatedRoundedLabel$2.class
├── AnimatedRoundedLabel$3.class
├── AnimatedRoundedLabel.class
├── AnimatedSVG$1.class
├── AnimatedSVG$2.class
├── AnimatedSVG$3.class
├── AnimatedSVG$4.class
├── AnimatedSVG$5.class
├── AnimatedSVG.class
├── CalcFLSM.class
├── CalcIP.class
├── CalcManager.class
├── CalcNetIDs.class
├── CalcVLSM$1.class
├── CalcVLSM.class
├── LayoutTable$1.class
├── LayoutTable$CustomHeaderRenderer.class
├── LayoutTable.class
├── Main$1.class
├── Main$10.class
├── Main$11.class
├── Main$12.class
├── Main$2.class
├── Main$3.class
├── Main$4.class
├── Main$5$1.class
├── Main$5.class
├── Main$6.class
├── Main$7$1.class
├── Main$7.class
├── Main$8.class
├── Main$9.class
├── Main.class
├── ObjIP.class
├── ObjNetIDs.class
├── ObjSM.class
├── RoundedButton.class
├── RoundedLabel.class
├── RoundedPanel.class
├── RoundedPanelApp.class
└── RoundedTextField.class
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # GNU GENERAL PUBLIC LICENSE
2 |
3 | Version 3, 29 June 2007
4 |
5 | Copyright (C) 2007 Free Software Foundation, Inc.
6 |
7 |
8 | Everyone is permitted to copy and distribute verbatim copies of this
9 | license document, but changing it is not allowed.
10 |
11 | ## Preamble
12 |
13 | The GNU General Public License is a free, copyleft license for
14 | software and other kinds of works.
15 |
16 | The licenses for most software and other practical works are designed
17 | to take away your freedom to share and change the works. By contrast,
18 | the GNU General Public License is intended to guarantee your freedom
19 | to share and change all versions of a program--to make sure it remains
20 | free software for all its users. We, the Free Software Foundation, use
21 | the GNU General Public License for most of our software; it applies
22 | also to any other work released this way by its authors. You can apply
23 | it to your programs, too.
24 |
25 | When we speak of free software, we are referring to freedom, not
26 | price. Our General Public Licenses are designed to make sure that you
27 | have the freedom to distribute copies of free software (and charge for
28 | them if you wish), that you receive source code or can get it if you
29 | want it, that you can change the software or use pieces of it in new
30 | free programs, and that you know you can do these things.
31 |
32 | To protect your rights, we need to prevent others from denying you
33 | these rights or asking you to surrender the rights. Therefore, you
34 | have certain responsibilities if you distribute copies of the
35 | software, or if you modify it: responsibilities to respect the freedom
36 | of others.
37 |
38 | For example, if you distribute copies of such a program, whether
39 | gratis or for a fee, you must pass on to the recipients the same
40 | freedoms that you received. You must make sure that they, too, receive
41 | or can get the source code. And you must show them these terms so they
42 | know their rights.
43 |
44 | Developers that use the GNU GPL protect your rights with two steps:
45 | (1) assert copyright on the software, and (2) offer you this License
46 | giving you legal permission to copy, distribute and/or modify it.
47 |
48 | For the developers' and authors' protection, the GPL clearly explains
49 | that there is no warranty for this free software. For both users' and
50 | authors' sake, the GPL requires that modified versions be marked as
51 | changed, so that their problems will not be attributed erroneously to
52 | authors of previous versions.
53 |
54 | Some devices are designed to deny users access to install or run
55 | modified versions of the software inside them, although the
56 | manufacturer can do so. This is fundamentally incompatible with the
57 | aim of protecting users' freedom to change the software. The
58 | systematic pattern of such abuse occurs in the area of products for
59 | individuals to use, which is precisely where it is most unacceptable.
60 | Therefore, we have designed this version of the GPL to prohibit the
61 | practice for those products. If such problems arise substantially in
62 | other domains, we stand ready to extend this provision to those
63 | domains in future versions of the GPL, as needed to protect the
64 | freedom of users.
65 |
66 | Finally, every program is threatened constantly by software patents.
67 | States should not allow patents to restrict development and use of
68 | software on general-purpose computers, but in those that do, we wish
69 | to avoid the special danger that patents applied to a free program
70 | could make it effectively proprietary. To prevent this, the GPL
71 | assures that patents cannot be used to render the program non-free.
72 |
73 | The precise terms and conditions for copying, distribution and
74 | modification follow.
75 |
76 | ## TERMS AND CONDITIONS
77 |
78 | ### 0. Definitions.
79 |
80 | "This License" refers to version 3 of the GNU General Public License.
81 |
82 | "Copyright" also means copyright-like laws that apply to other kinds
83 | of works, such as semiconductor masks.
84 |
85 | "The Program" refers to any copyrightable work licensed under this
86 | License. Each licensee is addressed as "you". "Licensees" and
87 | "recipients" may be individuals or organizations.
88 |
89 | To "modify" a work means to copy from or adapt all or part of the work
90 | in a fashion requiring copyright permission, other than the making of
91 | an exact copy. The resulting work is called a "modified version" of
92 | the earlier work or a work "based on" the earlier work.
93 |
94 | A "covered work" means either the unmodified Program or a work based
95 | on the Program.
96 |
97 | To "propagate" a work means to do anything with it that, without
98 | permission, would make you directly or secondarily liable for
99 | infringement under applicable copyright law, except executing it on a
100 | computer or modifying a private copy. Propagation includes copying,
101 | distribution (with or without modification), making available to the
102 | public, and in some countries other activities as well.
103 |
104 | To "convey" a work means any kind of propagation that enables other
105 | parties to make or receive copies. Mere interaction with a user
106 | through a computer network, with no transfer of a copy, is not
107 | conveying.
108 |
109 | An interactive user interface displays "Appropriate Legal Notices" to
110 | the extent that it includes a convenient and prominently visible
111 | feature that (1) displays an appropriate copyright notice, and (2)
112 | tells the user that there is no warranty for the work (except to the
113 | extent that warranties are provided), that licensees may convey the
114 | work under this License, and how to view a copy of this License. If
115 | the interface presents a list of user commands or options, such as a
116 | menu, a prominent item in the list meets this criterion.
117 |
118 | ### 1. Source Code.
119 |
120 | The "source code" for a work means the preferred form of the work for
121 | making modifications to it. "Object code" means any non-source form of
122 | a work.
123 |
124 | A "Standard Interface" means an interface that either is an official
125 | standard defined by a recognized standards body, or, in the case of
126 | interfaces specified for a particular programming language, one that
127 | is widely used among developers working in that language.
128 |
129 | The "System Libraries" of an executable work include anything, other
130 | than the work as a whole, that (a) is included in the normal form of
131 | packaging a Major Component, but which is not part of that Major
132 | Component, and (b) serves only to enable use of the work with that
133 | Major Component, or to implement a Standard Interface for which an
134 | implementation is available to the public in source code form. A
135 | "Major Component", in this context, means a major essential component
136 | (kernel, window system, and so on) of the specific operating system
137 | (if any) on which the executable work runs, or a compiler used to
138 | produce the work, or an object code interpreter used to run it.
139 |
140 | The "Corresponding Source" for a work in object code form means all
141 | the source code needed to generate, install, and (for an executable
142 | work) run the object code and to modify the work, including scripts to
143 | control those activities. However, it does not include the work's
144 | System Libraries, or general-purpose tools or generally available free
145 | programs which are used unmodified in performing those activities but
146 | which are not part of the work. For example, Corresponding Source
147 | includes interface definition files associated with source files for
148 | the work, and the source code for shared libraries and dynamically
149 | linked subprograms that the work is specifically designed to require,
150 | such as by intimate data communication or control flow between those
151 | subprograms and other parts of the work.
152 |
153 | The Corresponding Source need not include anything that users can
154 | regenerate automatically from other parts of the Corresponding Source.
155 |
156 | The Corresponding Source for a work in source code form is that same
157 | work.
158 |
159 | ### 2. Basic Permissions.
160 |
161 | All rights granted under this License are granted for the term of
162 | copyright on the Program, and are irrevocable provided the stated
163 | conditions are met. This License explicitly affirms your unlimited
164 | permission to run the unmodified Program. The output from running a
165 | covered work is covered by this License only if the output, given its
166 | content, constitutes a covered work. This License acknowledges your
167 | rights of fair use or other equivalent, as provided by copyright law.
168 |
169 | You may make, run and propagate covered works that you do not convey,
170 | without conditions so long as your license otherwise remains in force.
171 | You may convey covered works to others for the sole purpose of having
172 | them make modifications exclusively for you, or provide you with
173 | facilities for running those works, provided that you comply with the
174 | terms of this License in conveying all material for which you do not
175 | control copyright. Those thus making or running the covered works for
176 | you must do so exclusively on your behalf, under your direction and
177 | control, on terms that prohibit them from making any copies of your
178 | copyrighted material outside their relationship with you.
179 |
180 | Conveying under any other circumstances is permitted solely under the
181 | conditions stated below. Sublicensing is not allowed; section 10 makes
182 | it unnecessary.
183 |
184 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
185 |
186 | No covered work shall be deemed part of an effective technological
187 | measure under any applicable law fulfilling obligations under article
188 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
189 | similar laws prohibiting or restricting circumvention of such
190 | measures.
191 |
192 | When you convey a covered work, you waive any legal power to forbid
193 | circumvention of technological measures to the extent such
194 | circumvention is effected by exercising rights under this License with
195 | respect to the covered work, and you disclaim any intention to limit
196 | operation or modification of the work as a means of enforcing, against
197 | the work's users, your or third parties' legal rights to forbid
198 | circumvention of technological measures.
199 |
200 | ### 4. Conveying Verbatim Copies.
201 |
202 | You may convey verbatim copies of the Program's source code as you
203 | receive it, in any medium, provided that you conspicuously and
204 | appropriately publish on each copy an appropriate copyright notice;
205 | keep intact all notices stating that this License and any
206 | non-permissive terms added in accord with section 7 apply to the code;
207 | keep intact all notices of the absence of any warranty; and give all
208 | recipients a copy of this License along with the Program.
209 |
210 | You may charge any price or no price for each copy that you convey,
211 | and you may offer support or warranty protection for a fee.
212 |
213 | ### 5. Conveying Modified Source Versions.
214 |
215 | You may convey a work based on the Program, or the modifications to
216 | produce it from the Program, in the form of source code under the
217 | terms of section 4, provided that you also meet all of these
218 | conditions:
219 |
220 | - a) The work must carry prominent notices stating that you modified
221 | it, and giving a relevant date.
222 | - b) The work must carry prominent notices stating that it is
223 | released under this License and any conditions added under
224 | section 7. This requirement modifies the requirement in section 4
225 | to "keep intact all notices".
226 | - c) You must license the entire work, as a whole, under this
227 | License to anyone who comes into possession of a copy. This
228 | License will therefore apply, along with any applicable section 7
229 | additional terms, to the whole of the work, and all its parts,
230 | regardless of how they are packaged. This License gives no
231 | permission to license the work in any other way, but it does not
232 | invalidate such permission if you have separately received it.
233 | - d) If the work has interactive user interfaces, each must display
234 | Appropriate Legal Notices; however, if the Program has interactive
235 | interfaces that do not display Appropriate Legal Notices, your
236 | work need not make them do so.
237 |
238 | A compilation of a covered work with other separate and independent
239 | works, which are not by their nature extensions of the covered work,
240 | and which are not combined with it such as to form a larger program,
241 | in or on a volume of a storage or distribution medium, is called an
242 | "aggregate" if the compilation and its resulting copyright are not
243 | used to limit the access or legal rights of the compilation's users
244 | beyond what the individual works permit. Inclusion of a covered work
245 | in an aggregate does not cause this License to apply to the other
246 | parts of the aggregate.
247 |
248 | ### 6. Conveying Non-Source Forms.
249 |
250 | You may convey a covered work in object code form under the terms of
251 | sections 4 and 5, provided that you also convey the machine-readable
252 | Corresponding Source under the terms of this License, in one of these
253 | ways:
254 |
255 | - a) Convey the object code in, or embodied in, a physical product
256 | (including a physical distribution medium), accompanied by the
257 | Corresponding Source fixed on a durable physical medium
258 | customarily used for software interchange.
259 | - b) Convey the object code in, or embodied in, a physical product
260 | (including a physical distribution medium), accompanied by a
261 | written offer, valid for at least three years and valid for as
262 | long as you offer spare parts or customer support for that product
263 | model, to give anyone who possesses the object code either (1) a
264 | copy of the Corresponding Source for all the software in the
265 | product that is covered by this License, on a durable physical
266 | medium customarily used for software interchange, for a price no
267 | more than your reasonable cost of physically performing this
268 | conveying of source, or (2) access to copy the Corresponding
269 | Source from a network server at no charge.
270 | - c) Convey individual copies of the object code with a copy of the
271 | written offer to provide the Corresponding Source. This
272 | alternative is allowed only occasionally and noncommercially, and
273 | only if you received the object code with such an offer, in accord
274 | with subsection 6b.
275 | - d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 | - e) Convey the object code using peer-to-peer transmission,
288 | provided you inform other peers where the object code and
289 | Corresponding Source of the work are being offered to the general
290 | public at no charge under subsection 6d.
291 |
292 | A separable portion of the object code, whose source code is excluded
293 | from the Corresponding Source as a System Library, need not be
294 | included in conveying the object code work.
295 |
296 | A "User Product" is either (1) a "consumer product", which means any
297 | tangible personal property which is normally used for personal,
298 | family, or household purposes, or (2) anything designed or sold for
299 | incorporation into a dwelling. In determining whether a product is a
300 | consumer product, doubtful cases shall be resolved in favor of
301 | coverage. For a particular product received by a particular user,
302 | "normally used" refers to a typical or common use of that class of
303 | product, regardless of the status of the particular user or of the way
304 | in which the particular user actually uses, or expects or is expected
305 | to use, the product. A product is a consumer product regardless of
306 | whether the product has substantial commercial, industrial or
307 | non-consumer uses, unless such uses represent the only significant
308 | mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to
312 | install and execute modified versions of a covered work in that User
313 | Product from a modified version of its Corresponding Source. The
314 | information must suffice to ensure that the continued functioning of
315 | the modified object code is in no case prevented or interfered with
316 | solely because modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or
331 | updates for a work that has been modified or installed by the
332 | recipient, or for the User Product in which it has been modified or
333 | installed. Access to a network may be denied when the modification
334 | itself materially and adversely affects the operation of the network
335 | or violates the rules and protocols for communication across the
336 | network.
337 |
338 | Corresponding Source conveyed, and Installation Information provided,
339 | in accord with this section must be in a format that is publicly
340 | documented (and with an implementation available to the public in
341 | source code form), and must require no special password or key for
342 | unpacking, reading or copying.
343 |
344 | ### 7. Additional Terms.
345 |
346 | "Additional permissions" are terms that supplement the terms of this
347 | License by making exceptions from one or more of its conditions.
348 | Additional permissions that are applicable to the entire Program shall
349 | be treated as though they were included in this License, to the extent
350 | that they are valid under applicable law. If additional permissions
351 | apply only to part of the Program, that part may be used separately
352 | under those permissions, but the entire Program remains governed by
353 | this License without regard to the additional permissions.
354 |
355 | When you convey a copy of a covered work, you may at your option
356 | remove any additional permissions from that copy, or from any part of
357 | it. (Additional permissions may be written to require their own
358 | removal in certain cases when you modify the work.) You may place
359 | additional permissions on material, added by you to a covered work,
360 | for which you have or can give appropriate copyright permission.
361 |
362 | Notwithstanding any other provision of this License, for material you
363 | add to a covered work, you may (if authorized by the copyright holders
364 | of that material) supplement the terms of this License with terms:
365 |
366 | - a) Disclaiming warranty or limiting liability differently from the
367 | terms of sections 15 and 16 of this License; or
368 | - b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 | - c) Prohibiting misrepresentation of the origin of that material,
372 | or requiring that modified versions of such material be marked in
373 | reasonable ways as different from the original version; or
374 | - d) Limiting the use for publicity purposes of names of licensors
375 | or authors of the material; or
376 | - e) Declining to grant rights under trademark law for use of some
377 | trade names, trademarks, or service marks; or
378 | - f) Requiring indemnification of licensors and authors of that
379 | material by anyone who conveys the material (or modified versions
380 | of it) with contractual assumptions of liability to the recipient,
381 | for any liability that these contractual assumptions directly
382 | impose on those licensors and authors.
383 |
384 | All other non-permissive additional terms are considered "further
385 | restrictions" within the meaning of section 10. If the Program as you
386 | received it, or any part of it, contains a notice stating that it is
387 | governed by this License along with a term that is a further
388 | restriction, you may remove that term. If a license document contains
389 | a further restriction but permits relicensing or conveying under this
390 | License, you may add to a covered work material governed by the terms
391 | of that license document, provided that the further restriction does
392 | not survive such relicensing or conveying.
393 |
394 | If you add terms to a covered work in accord with this section, you
395 | must place, in the relevant source files, a statement of the
396 | additional terms that apply to those files, or a notice indicating
397 | where to find the applicable terms.
398 |
399 | Additional terms, permissive or non-permissive, may be stated in the
400 | form of a separately written license, or stated as exceptions; the
401 | above requirements apply either way.
402 |
403 | ### 8. Termination.
404 |
405 | You may not propagate or modify a covered work except as expressly
406 | provided under this License. Any attempt otherwise to propagate or
407 | modify it is void, and will automatically terminate your rights under
408 | this License (including any patent licenses granted under the third
409 | paragraph of section 11).
410 |
411 | However, if you cease all violation of this License, then your license
412 | from a particular copyright holder is reinstated (a) provisionally,
413 | unless and until the copyright holder explicitly and finally
414 | terminates your license, and (b) permanently, if the copyright holder
415 | fails to notify you of the violation by some reasonable means prior to
416 | 60 days after the cessation.
417 |
418 | Moreover, your license from a particular copyright holder is
419 | reinstated permanently if the copyright holder notifies you of the
420 | violation by some reasonable means, this is the first time you have
421 | received notice of violation of this License (for any work) from that
422 | copyright holder, and you cure the violation prior to 30 days after
423 | your receipt of the notice.
424 |
425 | Termination of your rights under this section does not terminate the
426 | licenses of parties who have received copies or rights from you under
427 | this License. If your rights have been terminated and not permanently
428 | reinstated, you do not qualify to receive new licenses for the same
429 | material under section 10.
430 |
431 | ### 9. Acceptance Not Required for Having Copies.
432 |
433 | You are not required to accept this License in order to receive or run
434 | a copy of the Program. Ancillary propagation of a covered work
435 | occurring solely as a consequence of using peer-to-peer transmission
436 | to receive a copy likewise does not require acceptance. However,
437 | nothing other than this License grants you permission to propagate or
438 | modify any covered work. These actions infringe copyright if you do
439 | not accept this License. Therefore, by modifying or propagating a
440 | covered work, you indicate your acceptance of this License to do so.
441 |
442 | ### 10. Automatic Licensing of Downstream Recipients.
443 |
444 | Each time you convey a covered work, the recipient automatically
445 | receives a license from the original licensors, to run, modify and
446 | propagate that work, subject to this License. You are not responsible
447 | for enforcing compliance by third parties with this License.
448 |
449 | An "entity transaction" is a transaction transferring control of an
450 | organization, or substantially all assets of one, or subdividing an
451 | organization, or merging organizations. If propagation of a covered
452 | work results from an entity transaction, each party to that
453 | transaction who receives a copy of the work also receives whatever
454 | licenses to the work the party's predecessor in interest had or could
455 | give under the previous paragraph, plus a right to possession of the
456 | Corresponding Source of the work from the predecessor in interest, if
457 | the predecessor has it or can get it with reasonable efforts.
458 |
459 | You may not impose any further restrictions on the exercise of the
460 | rights granted or affirmed under this License. For example, you may
461 | not impose a license fee, royalty, or other charge for exercise of
462 | rights granted under this License, and you may not initiate litigation
463 | (including a cross-claim or counterclaim in a lawsuit) alleging that
464 | any patent claim is infringed by making, using, selling, offering for
465 | sale, or importing the Program or any portion of it.
466 |
467 | ### 11. Patents.
468 |
469 | A "contributor" is a copyright holder who authorizes use under this
470 | License of the Program or a work on which the Program is based. The
471 | work thus licensed is called the contributor's "contributor version".
472 |
473 | A contributor's "essential patent claims" are all patent claims owned
474 | or controlled by the contributor, whether already acquired or
475 | hereafter acquired, that would be infringed by some manner, permitted
476 | by this License, of making, using, or selling its contributor version,
477 | but do not include claims that would be infringed only as a
478 | consequence of further modification of the contributor version. For
479 | purposes of this definition, "control" includes the right to grant
480 | patent sublicenses in a manner consistent with the requirements of
481 | this License.
482 |
483 | Each contributor grants you a non-exclusive, worldwide, royalty-free
484 | patent license under the contributor's essential patent claims, to
485 | make, use, sell, offer for sale, import and otherwise run, modify and
486 | propagate the contents of its contributor version.
487 |
488 | In the following three paragraphs, a "patent license" is any express
489 | agreement or commitment, however denominated, not to enforce a patent
490 | (such as an express permission to practice a patent or covenant not to
491 | sue for patent infringement). To "grant" such a patent license to a
492 | party means to make such an agreement or commitment not to enforce a
493 | patent against the party.
494 |
495 | If you convey a covered work, knowingly relying on a patent license,
496 | and the Corresponding Source of the work is not available for anyone
497 | to copy, free of charge and under the terms of this License, through a
498 | publicly available network server or other readily accessible means,
499 | then you must either (1) cause the Corresponding Source to be so
500 | available, or (2) arrange to deprive yourself of the benefit of the
501 | patent license for this particular work, or (3) arrange, in a manner
502 | consistent with the requirements of this License, to extend the patent
503 | license to downstream recipients. "Knowingly relying" means you have
504 | actual knowledge that, but for the patent license, your conveying the
505 | covered work in a country, or your recipient's use of the covered work
506 | in a country, would infringe one or more identifiable patents in that
507 | country that you have reason to believe are valid.
508 |
509 | If, pursuant to or in connection with a single transaction or
510 | arrangement, you convey, or propagate by procuring conveyance of, a
511 | covered work, and grant a patent license to some of the parties
512 | receiving the covered work authorizing them to use, propagate, modify
513 | or convey a specific copy of the covered work, then the patent license
514 | you grant is automatically extended to all recipients of the covered
515 | work and works based on it.
516 |
517 | A patent license is "discriminatory" if it does not include within the
518 | scope of its coverage, prohibits the exercise of, or is conditioned on
519 | the non-exercise of one or more of the rights that are specifically
520 | granted under this License. You may not convey a covered work if you
521 | are a party to an arrangement with a third party that is in the
522 | business of distributing software, under which you make payment to the
523 | third party based on the extent of your activity of conveying the
524 | work, and under which the third party grants, to any of the parties
525 | who would receive the covered work from you, a discriminatory patent
526 | license (a) in connection with copies of the covered work conveyed by
527 | you (or copies made from those copies), or (b) primarily for and in
528 | connection with specific products or compilations that contain the
529 | covered work, unless you entered into that arrangement, or that patent
530 | license was granted, prior to 28 March 2007.
531 |
532 | Nothing in this License shall be construed as excluding or limiting
533 | any implied license or other defenses to infringement that may
534 | otherwise be available to you under applicable patent law.
535 |
536 | ### 12. No Surrender of Others' Freedom.
537 |
538 | If conditions are imposed on you (whether by court order, agreement or
539 | otherwise) that contradict the conditions of this License, they do not
540 | excuse you from the conditions of this License. If you cannot convey a
541 | covered work so as to satisfy simultaneously your obligations under
542 | this License and any other pertinent obligations, then as a
543 | consequence you may not convey it at all. For example, if you agree to
544 | terms that obligate you to collect a royalty for further conveying
545 | from those to whom you convey the Program, the only way you could
546 | satisfy both those terms and this License would be to refrain entirely
547 | from conveying the Program.
548 |
549 | ### 13. Use with the GNU Affero General Public License.
550 |
551 | Notwithstanding any other provision of this License, you have
552 | permission to link or combine any covered work with a work licensed
553 | under version 3 of the GNU Affero General Public License into a single
554 | combined work, and to convey the resulting work. The terms of this
555 | License will continue to apply to the part which is the covered work,
556 | but the special requirements of the GNU Affero General Public License,
557 | section 13, concerning interaction through a network will apply to the
558 | combination as such.
559 |
560 | ### 14. Revised Versions of this License.
561 |
562 | The Free Software Foundation may publish revised and/or new versions
563 | of the GNU General Public License from time to time. Such new versions
564 | will be similar in spirit to the present version, but may differ in
565 | detail to address new problems or concerns.
566 |
567 | Each version is given a distinguishing version number. If the Program
568 | specifies that a certain numbered version of the GNU General Public
569 | License "or any later version" applies to it, you have the option of
570 | following the terms and conditions either of that numbered version or
571 | of any later version published by the Free Software Foundation. If the
572 | Program does not specify a version number of the GNU General Public
573 | License, you may choose any version ever published by the Free
574 | Software Foundation.
575 |
576 | If the Program specifies that a proxy can decide which future versions
577 | of the GNU General Public License can be used, that proxy's public
578 | statement of acceptance of a version permanently authorizes you to
579 | choose that version for the Program.
580 |
581 | Later license versions may give you additional or different
582 | permissions. However, no additional obligations are imposed on any
583 | author or copyright holder as a result of your choosing to follow a
584 | later version.
585 |
586 | ### 15. Disclaimer of Warranty.
587 |
588 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
589 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
590 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
591 | WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
592 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
593 | A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
594 | PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
595 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
596 | CORRECTION.
597 |
598 | ### 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
602 | CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
603 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
604 | ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
605 | NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
606 | LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
607 | TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
608 | PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
609 |
610 | ### 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | ## How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these
626 | terms.
627 |
628 | To do so, attach the following notices to the program. It is safest to
629 | attach them to the start of each source file to most effectively state
630 | the exclusion of warranty; and each file should have at least the
631 | "copyright" line and a pointer to where the full notice is found.
632 |
633 |
634 | Copyright (C)
635 |
636 | This program is free software: you can redistribute it and/or modify
637 | it under the terms of the GNU General Public License as published by
638 | the Free Software Foundation, either version 3 of the License, or
639 | (at your option) any later version.
640 |
641 | This program is distributed in the hope that it will be useful,
642 | but WITHOUT ANY WARRANTY; without even the implied warranty of
643 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
644 | GNU General Public License for more details.
645 |
646 | You should have received a copy of the GNU General Public License
647 | along with this program. If not, see .
648 |
649 | Also add information on how to contact you by electronic and paper
650 | mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands \`show w' and \`show c' should show the
661 | appropriate parts of the General Public License. Of course, your
662 | program's commands might be different; for a GUI interface, you would
663 | use an "about box".
664 |
665 | You should also get your employer (if you work as a programmer) or
666 | school, if any, to sign a "copyright disclaimer" for the program, if
667 | necessary. For more information on this, and how to apply and follow
668 | the GNU GPL, see .
669 |
670 | The GNU General Public License does not permit incorporating your
671 | program into proprietary programs. If your program is a subroutine
672 | library, you may consider it more useful to permit linking proprietary
673 | applications with the library. If this is what you want to do, use the
674 | GNU Lesser General Public License instead of this License. But first,
675 | please read .
676 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Subnetting Java
2 |
3 | Soluzione software per la risoluzione degli esercizi sulle reti.
4 |
5 | > [!NOTE]
6 | > Software responsive con schermata Small e Large
7 |
8 |
9 |
10 | > [!WARNING]
11 | > Correttezza VLSM non garantita
12 |
13 | ---
14 |
15 | ## Indice
16 |
17 | - [Funzioni](#funzioni)
18 | - [Ispirazione](#ispirazione)
19 | - [Javadoc](#javadoc)
20 | - [Preview](#preview)
21 | - [Screenshots](#screenshots)
22 | - [Distribuzione](#distribuzione)
23 | - [Albero di Path](#albero-di-path)
24 | - [Crediti](#crediti)
25 | - [Licenze](#licenze)
26 |
27 | ## Funzioni
28 |
29 | - Identifica IP
30 | - Verifica Stessa Rete
31 | - Subnet a Maschera Fissa - FLSM
32 | - Subnet a Maschera Variabile - VLSM
33 |
34 | ## Ispirazione
35 |
36 | La grafica del software è stata ispirata e **sviluppata indipendentemente** riproponendo l'interfaccia utente offerta da [Scheduling Solver](https://process-scheduling-solver.boonsuen.com/)
37 |
38 | ## Javadoc
39 |
40 | Link al javadoc [(link)](https://vittoriopiotti.altervista.org/SubnettingJava/org/subnetting/package-summary.html)
41 |
42 | ## Preview
43 |
44 | Video di Test [(link)](https://drive.google.com/file/d/17XctjTlS7LYgrnKikc7BHBkw4H3vvMtA/view?usp=sharing)
45 |
46 |
47 | ---
48 |
49 |
50 |
51 |
52 | ## Screenshots
53 |
54 |
55 | | | |
56 | |-|-|
57 | |||
58 |
59 |
60 | ## Distribuzione
61 |
62 | - Mac o Windows
63 | - openjdk `v.21.0.3`
64 | - Avviare il file `.jar`
65 |
66 |
67 | ## Albero di Path
68 |
69 |
70 | ```bash
71 | $ tree
72 | .
73 | ├── assets * contiene file.svg
74 | ├── bin * contiene i file binari
75 | ├── lib
76 | │ ├── batik-all-1.17.jar
77 | │ ├── flatlaf-3.2.5.jar
78 | │ ├── xml-apis-ext-1.3.04.jar
79 | │ └── xmlgraphics-commons-2.9.jar
80 | ├── src
81 | │ ├── AnimatedButton.java
82 | │ ├── AnimatedLabel.java
83 | │ ├── AnimatedModal.java
84 | │ ├── AnimatedOpacityPanel.java
85 | │ ├── AnimatedRoundedLabel.java
86 | │ ├── AnimatedSVG.java
87 | │ ├── CalcFLSM.java
88 | │ ├── CalcIP.java
89 | │ ├── CalcManager.java
90 | │ ├── CalcNetIDs.java
91 | │ ├── CalcVLSM.java
92 | │ ├── GUI.java * main del progetto
93 | │ ├── LayoutTable.java
94 | │ ├── ObjIP.java
95 | │ ├── ObjNetIDs.java
96 | │ ├── ObjSM.java
97 | │ ├── RoundedButton.java
98 | │ ├── RoundedLabel.java
99 | │ ├── RoundedPanel.java
100 | │ ├── RoundedPanelApp.java
101 | │ └── RoundedTextField.java
102 | └── SubnetSolver.jar * eseguibile
103 |
104 | ```
105 |
106 | ## Crediti
107 |
108 | [Reda Karimi](https://github.com/RedaKarimi):
109 | - Correzzione errore caricamento SVG su Windows
110 | - Caricamento delle dipendenze da pom.xml anzichè da import diretto
111 |
112 | ## Licenze
113 |
114 |
115 | > [!NOTE]
116 | > Di **Bootstrap** sono state utilizzate solo le icone
117 |
118 |
119 |
120 | ---
121 |
122 | ### Subnet Solver
123 |
124 | **Copyright** 2024 Vittorio Piotti [(GitHub page)](https://github.com/vittorioPiotti) [(Personal page)](https://vittoriopiotti.altervista.org/)
125 |
126 | **Version** [v1.0.0](https://github.com/vittorioPiotti/SubnettingSolver-Java/releases/tag/1.0.0)
127 |
128 | **License** [GPL-3.0 License](https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
129 |
130 | ---
131 |
132 | ### batik-all
133 |
134 | **Copyright** 2024 The Apache Software Foundation
135 |
136 | **Version** [v1.17](https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-all/1.17)
137 |
138 | **License** [Apache License 2.0](https://xmlgraphics.apache.org/batik/license.html)
139 |
140 | ---
141 |
142 | ### FlatLaf
143 |
144 | **Copyright** 2024 JFormDesigner GmbH
145 |
146 | **Version** [v3.2.5](https://mvnrepository.com/artifact/com.formdev/flatlaf/3.2.5)
147 |
148 | **License** [Apache License 2.0](https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
149 |
150 | ---
151 |
152 | ### xml-apis-ext
153 |
154 | **Copyright** 2024 The Apache Software Foundation
155 |
156 | **Version** [v1.3.04](https://mvnrepository.com/artifact/xml-apis/xml-apis-ext/1.3.04)
157 |
158 | **License** [Apache License 2.0](https://xmlgraphics.apache.org/batik/license.html)
159 |
160 | ---
161 |
162 | ### xmlgraphics-commons
163 |
164 | **Copyright** 2024 The Apache Software Foundation
165 |
166 | **Version** [v2.9](https://mvnrepository.com/artifact/org.apache.xmlgraphics/xmlgraphics-commons/2.9)
167 |
168 | **License** [Apache License 2.0](https://xmlgraphics.apache.org/batik/license.html)
169 |
170 | ---
171 |
172 | ### Bootstrap Icons
173 |
174 | **Copyright** 2011-2018 The Bootstrap Authors
175 |
176 | **Version** [v1.11.0](https://blog.getbootstrap.com/2023/09/12/bootstrap-icons-1-11-0/)
177 |
178 | **License** [MIT](https://github.com/twbs/icons/blob/main/LICENSE)
179 |
180 |
181 |
182 |
183 |
184 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/screenshots/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/screenshots/error.png
--------------------------------------------------------------------------------
/screenshots/flsm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/screenshots/flsm.png
--------------------------------------------------------------------------------
/screenshots/ip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/screenshots/ip.png
--------------------------------------------------------------------------------
/screenshots/ip2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/screenshots/ip2.png
--------------------------------------------------------------------------------
/screenshots/net.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/screenshots/net.png
--------------------------------------------------------------------------------
/screenshots/net2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/screenshots/net2.png
--------------------------------------------------------------------------------
/screenshots/vlsm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/screenshots/vlsm.png
--------------------------------------------------------------------------------
/subnetting/doc/doc.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/doc/doc.zip
--------------------------------------------------------------------------------
/subnetting/out/artifacts/subnetting_jar/subnetting.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/out/artifacts/subnetting_jar/subnetting.jar
--------------------------------------------------------------------------------
/subnetting/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.subnetting
8 | subnetting
9 | 1.0-SNAPSHOT
10 |
11 |
12 |
13 | org.apache.xmlgraphics
14 | batik-all
15 | 1.17
16 |
17 |
18 | com.formdev
19 | flatlaf
20 | 3.5.1
21 |
22 |
23 |
24 |
25 | 21
26 | 21
27 | UTF-8
28 |
29 |
30 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/AnimatedButton.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 |
41 | import java.awt.Color;
42 | import java.awt.Dimension;
43 | import java.awt.Font;
44 | import java.awt.Graphics;
45 | import java.awt.Graphics2D;
46 | import java.awt.RenderingHints;
47 | import java.awt.event.ActionEvent;
48 | import java.awt.event.ActionListener;
49 |
50 | import javax.swing.JButton;
51 | import javax.swing.Timer;
52 | import javax.swing.border.EmptyBorder;
53 |
54 | /**
55 | * Un componente JButton personalizzato che supporta transizioni di animazione tramite scaling.
56 | * Il pulsante si espande o si contrae quando viene attivato, creando un effetto visivo accattivante.
57 | */
58 | public class AnimatedButton extends JButton {
59 |
60 | private float scale = 0.0f; // Initial scale for animation
61 | private Timer animationTimer;
62 | private int ch;
63 | private int cornerRadius; // Radius for rounded corners
64 |
65 | /**
66 | * Crea un'istanza di {@code AnimatedButton} con il testo specificato e l'offset orizzontale.
67 | *
68 | * @param text Il testo da visualizzare sul pulsante.
69 | * @param ch L'offset orizzontale per regolare il posizionamento del testo sul pulsante.
70 | */
71 | public AnimatedButton(String text, int ch) {
72 | super(text);
73 | setOpaque(false); // Make the button transparent
74 | setHorizontalAlignment(JButton.CENTER);
75 | setVerticalAlignment(JButton.CENTER);
76 | setBackground(new Color(93, 199, 236)); // Blue background color
77 | setBorder(new EmptyBorder(5, 10, 5, 10)); // Set internal margins for the text
78 | this.ch = ch;
79 | this.cornerRadius = 10; // Set the corner radius
80 | // Set the font with specified style and size
81 | setFont(new Font("Arial", Font.PLAIN, 16));
82 | setForeground(Color.WHITE);
83 | setPreferredSize(new Dimension(50, 30));
84 | setMaximumSize(new Dimension(50, 30));
85 | setMinimumSize(new Dimension(50, 30));
86 | }
87 |
88 | /**
89 | * Ridisegna il pulsante con grafiche personalizzate, tra cui angoli arrotondati e animazione di scaling.
90 | * Questo metodo viene chiamato automaticamente durante il processo di repaint.
91 | *
92 | * @param g L'oggetto {@code Graphics} utilizzato per disegnare il componente.
93 | */
94 | @Override
95 | protected void paintComponent(Graphics g) {
96 | Graphics2D g2d = (Graphics2D) g.create();
97 | g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
98 |
99 | int width = getWidth();
100 | int height = getHeight();
101 |
102 | // Calculate the center of the JLabel for the transformation
103 | int centerX = width / 2 - ch;
104 | int centerY = height / 2 - ch;
105 |
106 | // Apply the scale transformation
107 | g2d.translate(centerX, centerY);
108 | g2d.scale(scale, scale);
109 | g2d.translate(-centerX, -centerY);
110 |
111 | // Draw the rounded rectangle
112 | g2d.setColor(getBackground());
113 | g2d.fillRoundRect(0, 0, width - 1, height - 1, cornerRadius, cornerRadius);
114 |
115 | // Set the composite to ensure text is rendered correctly with transparency
116 | g2d.setComposite(java.awt.AlphaComposite.SrcOver);
117 |
118 | // Draw the button text
119 | g2d.setColor(getForeground());
120 | g2d.setFont(getFont());
121 | Font font = getFont();
122 | String text = getText();
123 | int textWidth = g2d.getFontMetrics(font).stringWidth(text);
124 | int textHeight = g2d.getFontMetrics(font).getAscent();
125 | int textX = (width - textWidth) / 2;
126 | int textY = (height - textHeight) / 2 + g2d.getFontMetrics(font).getAscent() - g2d.getFontMetrics(font).getDescent() / 2;
127 | g2d.drawString(text, textX, textY);
128 |
129 | g2d.dispose();
130 | }
131 |
132 | /**
133 | * Sovrascrive il comportamento predefinito di disegno del bordo, disabilitandolo completamente.
134 | *
135 | * @param g L'oggetto {@code Graphics} utilizzato per disegnare il bordo.
136 | */
137 | @Override
138 | protected void paintBorder(Graphics g) {
139 | // Do not paint the border
140 | }
141 |
142 | /**
143 | * Indica se questo componente è opaco.
144 | *
145 | * @return Restituisce sempre {@code false} per indicare trasparenza.
146 | */
147 | @Override
148 | public boolean isOpaque() {
149 | return false; // Make the JButton itself transparent
150 | }
151 |
152 | /**
153 | * Avvia l'animazione, espandendo o contraendo il pulsante in base al parametro specificato.
154 | * Se un'animazione è già in corso, viene interrotta prima di avviare la nuova.
155 | *
156 | * @param expand Se {@code true}, il pulsante si espande; se {@code false}, si contrae.
157 | */
158 | public void startAnimation(boolean expand) {
159 | if (animationTimer != null && animationTimer.isRunning()) {
160 | animationTimer.stop(); // Stop the current animation if it exists
161 | }
162 |
163 | if (expand) {
164 | expandAnimation();
165 | } else {
166 | collapseAnimation();
167 | }
168 | }
169 |
170 | /**
171 | * Gestisce l'animazione di espansione, scalando gradualmente il pulsante da 0.0 a 1.0.
172 | * L'animazione viene eseguita utilizzando un {@code Timer} che aggiorna la scala e ridisegna il componente.
173 | *
174 | * @throws IllegalStateException Se l'animazione non può essere avviata.
175 | */
176 | private void expandAnimation() {
177 | // Expand animation from 0 to 1
178 | scale = 0.0f;
179 | animationTimer = new Timer(5, new ActionListener() {
180 | @Override
181 | public void actionPerformed(ActionEvent e) {
182 | scale += 0.02f;
183 | if (scale >= 1.0f) {
184 | scale = 1.0f;
185 | ((Timer) e.getSource()).stop(); // Stop the animation when it reaches 1.0
186 | }
187 | repaint();
188 | }
189 | });
190 | animationTimer.start();
191 | }
192 | /**
193 | * Gestisce l'animazione di contrazione, scalando gradualmente il pulsante da 1.0 a 0.0.
194 | * L'animazione viene eseguita utilizzando un {@code Timer} che aggiorna la scala e ridisegna il componente.
195 | *
196 | * @throws IllegalStateException Se l'animazione non può essere avviata.
197 | */
198 |
199 | private void collapseAnimation() {
200 | // Collapse animation from 1 to 0
201 | scale = 1.0f;
202 | animationTimer = new Timer(3, new ActionListener() {
203 | @Override
204 | public void actionPerformed(ActionEvent e) {
205 | scale -= 0.02f;
206 | if (scale <= 0.0f) {
207 | scale = 0.0f;
208 | ((Timer) e.getSource()).stop(); // Stop the animation when it reaches 0.0
209 | }
210 | repaint();
211 | }
212 | });
213 | animationTimer.start();
214 | }
215 | }
216 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/AnimatedLabel.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.Color;
41 | import java.awt.Font;
42 | import java.awt.Graphics;
43 | import java.awt.Graphics2D;
44 | import java.awt.RenderingHints;
45 | import java.awt.event.ActionEvent;
46 | import java.awt.event.ActionListener;
47 |
48 | import javax.swing.JLabel;
49 | import javax.swing.Timer;
50 |
51 | /**
52 | * Una classe personalizzata di JLabel che supporta animazioni fluide basate su trasformazioni di scala.
53 | * Il testo all'interno del JLabel può espandersi, contrarsi o eseguire altre animazioni fluide tramite un timer.
54 | */
55 | public class AnimatedLabel extends JLabel {
56 | private float scale = 0.0f; // Scala iniziale a 0 per un corretto avvio dell'animazione
57 | private Timer animationTimer;
58 | private int ch;
59 |
60 | /**
61 | * Crea un'istanza di {@code AnimatedLabel} con il testo, lo stile, la dimensione, il colore e l'offset specificati.
62 | *
63 | * @param text Il testo da visualizzare all'interno del JLabel.
64 | * @param style Lo stile del font (ad esempio {@code Font.PLAIN}, {@code Font.BOLD}).
65 | * @param size La dimensione del font.
66 | * @param color Il colore del testo.
67 | * @param ch L'offset verticale per il posizionamento del testo.
68 | */
69 | public AnimatedLabel(String text, int style, int size,Color color,int ch) {
70 | super(text);
71 | setOpaque(false); // Rende il JLabel trasparente
72 | setHorizontalAlignment(JLabel.CENTER);
73 | setVerticalAlignment(JLabel.CENTER);
74 | this.ch = ch;
75 | // Imposta il font con stile e dimensione specificati
76 | setFont(new Font("Arial", style, size));
77 | setForeground(color);
78 | setVisible(true);
79 | scale = 1.0f;
80 | }
81 | /**
82 | * Ridisegna il JLabel con una trasformazione di scala e grafica anti-aliasing per un rendering fluido.
83 | * Viene chiamato automaticamente durante il processo di repaint.
84 | *
85 | * @param g L'oggetto {@code Graphics} utilizzato per disegnare il componente.
86 | */
87 | @Override
88 | protected void paintComponent(Graphics g) {
89 | Graphics2D g2d = (Graphics2D) g.create();
90 | g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
91 |
92 | int width = getWidth();
93 | int height = getHeight();
94 |
95 | // Calcola il centro del JLabel per la trasformazione
96 | int centerX = width / 2;
97 | int centerY = height / 2 - ch;
98 |
99 | // Applica la trasformazione di scala
100 | g2d.translate(centerX, centerY);
101 | g2d.scale(scale, scale);
102 | g2d.translate(-centerX, -centerY);
103 |
104 | // Disegna il testo del JLabel
105 | super.paintComponent(g2d);
106 | g2d.dispose();
107 | }
108 |
109 | /**
110 | * Avvia un'animazione di espansione o contrazione in base al parametro specificato.
111 | * Se un'animazione è già in corso, viene interrotta prima di avviare la nuova.
112 | *
113 | * @param expand Se {@code true}, il JLabel si espande; se {@code false}, si contrae.
114 | */
115 | public void startAnimation(boolean expand) {
116 | if (animationTimer != null && animationTimer.isRunning()) {
117 | animationTimer.stop(); // Ferma l'animazione corrente se esiste
118 | }
119 |
120 | if (expand) {
121 | expandAnimation();
122 | } else {
123 | collapseAnimation();
124 | }
125 | }
126 |
127 | /**
128 | * Gestisce l'animazione di espansione, scalando gradualmente il JLabel da 0.0 a 1.0.
129 | * L'animazione viene eseguita tramite un {@code Timer} che aggiorna il valore di scala e ridisegna il componente.
130 | *
131 | * @throws IllegalStateException Se l'animazione non può essere avviata.
132 | */
133 |
134 | private void expandAnimation() {
135 | // Animazione di espansione da 0 a 1
136 | scale = 0.0f;
137 | animationTimer = new Timer(5, new ActionListener() {
138 | @Override
139 | public void actionPerformed(ActionEvent e) {
140 | scale += 0.02f;
141 | if (scale >= 1.0f) {
142 | scale = 1.0f;
143 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 1.0
144 | }
145 | repaint();
146 | }
147 | });
148 | animationTimer.start();
149 | }
150 |
151 | /**
152 | * Gestisce un'animazione di riduzione della scala da 1.0 a 0.9, riducendo leggermente il JLabel.
153 | * Viene utilizzata per simulare un leggero ridimensionamento verso il basso.
154 | */
155 | public void reduxAnimation() {
156 | scale = 1.0f;
157 | animationTimer = new Timer(3, new ActionListener() {
158 | @Override
159 | public void actionPerformed(ActionEvent e) {
160 | scale -= 0.005f;
161 | if (scale <= 0.9f) {
162 | scale = 0.9f;
163 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 0.8
164 | }
165 | repaint();
166 | }
167 | });
168 | animationTimer.start();
169 | }
170 | /**
171 | * Gestisce un'animazione di zoom che aumenta la scala del JLabel da 0.9 a 1.0.
172 | * Viene utilizzata per simulare un leggero ingrandimento del testo.
173 | */
174 | public void zoomAnimation() {
175 | scale = 0.9f;
176 | animationTimer = new Timer(3, new ActionListener() {
177 | @Override
178 | public void actionPerformed(ActionEvent e) {
179 | scale += 0.005f;
180 | if (scale >= 1.0f) {
181 | scale = 1.0f;
182 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 1.0
183 | }
184 | repaint();
185 | }
186 | });
187 | animationTimer.start();
188 | }
189 | /**
190 | * Gestisce l'animazione di collasso, scalando gradualmente il JLabel da 1.0 a 0.0.
191 | * L'animazione viene eseguita tramite un {@code Timer} che aggiorna la scala e ridisegna il componente.
192 | *
193 | * @throws IllegalStateException Se l'animazione non può essere avviata.
194 | */
195 |
196 | private void collapseAnimation() {
197 | // Animazione di collasso da 1 a 0
198 | scale = 1.0f;
199 | animationTimer = new Timer(3, new ActionListener() {
200 | @Override
201 | public void actionPerformed(ActionEvent e) {
202 | scale -= 0.02f;
203 | if (scale <= 0.0f) {
204 | scale = 0.0f;
205 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 0.0
206 | }
207 | repaint();
208 | }
209 | });
210 | animationTimer.start();
211 | }
212 | /**
213 | * Gestisce un'animazione che riduce la scala del JLabel a 0.0 e poi la riporta a 1.0.
214 | * Questa animazione può essere utilizzata per simulare un "click" o un rapido movimento di rimbalzo.
215 | */
216 | public void clickAnimation() {
217 | // Ferma l'animazione corrente se esiste
218 | if (animationTimer != null && animationTimer.isRunning()) {
219 | animationTimer.stop();
220 | }
221 |
222 | // Avvia l'animazione da 1 a 0 e poi da 0 a 1
223 | scale = 1.0f;
224 | animationTimer = new Timer(5, new ActionListener() {
225 | private boolean decreasing = true; // Indica se stiamo diminuendo scale
226 |
227 | @Override
228 | public void actionPerformed(ActionEvent e) {
229 | if (decreasing) {
230 | scale -= 0.02f;
231 | if (scale <= 0.0f) {
232 | scale = 0.0f;
233 | decreasing = false; // Passa al modo di aumento
234 | }
235 | } else {
236 | scale += 0.02f;
237 | if (scale >= 1.0f) {
238 | scale = 1.0f;
239 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 1.0
240 | }
241 | }
242 | repaint(); // Ridisegna il componente con il nuovo valore di scale
243 | }
244 | });
245 | animationTimer.start();
246 | }
247 |
248 |
249 | }
250 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/AnimatedModal.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.BasicStroke;
41 | import java.awt.Color;
42 | import java.awt.Graphics;
43 | import java.awt.Graphics2D;
44 | import java.awt.RenderingHints;
45 | import java.awt.event.ActionEvent;
46 | import java.awt.event.ActionListener;
47 | import java.awt.event.ComponentAdapter;
48 | import java.awt.event.ComponentEvent;
49 | import java.awt.geom.RoundRectangle2D;
50 |
51 | import javax.swing.JPanel;
52 | import javax.swing.Timer;
53 |
54 | /**
55 | * Una classe personalizzata di {@code JPanel} che fornisce un'interfaccia grafica animata con
56 | * una scala dinamica e un design arrotondato. Questo pannello supporta animazioni di espansione
57 | * e contrazione quando viene mostrato o nascosto.
58 | */
59 | public class AnimatedModal extends JPanel {
60 | /**
61 | * Colore del bordo del pannello.
62 | */
63 | private Color borderColor;
64 | /**
65 | * Spessore del bordo del pannello.
66 | */
67 | private int borderThickness;
68 | /**
69 | * Colore di sfondo del pannello.
70 | */
71 | private Color backgroundColor;
72 | /**
73 | * Scala attuale dell'animazione; inizialmente impostata a 0 per garantire un avvio corretto dell'animazione.
74 | */
75 | private float scale = 0.0f; // Initial scale to 0 for proper animation start
76 | /**
77 | * Timer utilizzato per gestire le animazioni del pannello.
78 | */
79 | private Timer animationTimer;
80 | /**
81 | * Costruisce un {@code AnimatedModal} con il colore di sfondo, il colore del bordo e lo spessore specificati.
82 | *
83 | * @param backgroundColor Il colore di sfondo del pannello.
84 | * @param borderColor Il colore del bordo del pannello.
85 | * @param borderThickness Lo spessore del bordo del pannello.
86 | */
87 | public AnimatedModal(Color backgroundColor, Color borderColor, int borderThickness) {
88 | this.backgroundColor = backgroundColor;
89 | this.borderColor = borderColor;
90 | this.borderThickness = borderThickness;
91 | setOpaque(false);
92 |
93 | addComponentListener(new ComponentAdapter() {
94 | @Override
95 | public void componentShown(ComponentEvent e) {
96 | expandAnimation(); // Expand animation
97 | }
98 |
99 | @Override
100 | public void componentHidden(ComponentEvent e) {
101 | collapseAnimation(); // Collapse animation
102 | }
103 | });
104 | }
105 | /**
106 | * Disegna il componente con grafica anti-aliasing, applicando una trasformazione di scala
107 | * e un rettangolo arrotondato che rappresenta il pannello.
108 | *
109 | * @param g L'oggetto {@code Graphics} utilizzato per disegnare il componente.
110 | */
111 | @Override
112 | protected void paintComponent(Graphics g) {
113 | super.paintComponent(g);
114 | int width = getWidth();
115 | int height = getHeight();
116 | Graphics2D graphics = (Graphics2D) g.create();
117 |
118 | graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
119 | graphics.translate(width / 2, height / 2);
120 | graphics.scale(scale, scale);
121 | graphics.translate(-width / 2, -height / 2);
122 |
123 | RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(
124 | 0, 0, width - 1, height - 1, 24, 24);
125 |
126 | graphics.setColor(backgroundColor);
127 | graphics.fill(roundedRectangle);
128 |
129 | graphics.setColor(borderColor);
130 | graphics.setStroke(new BasicStroke(borderThickness));
131 | graphics.draw(roundedRectangle);
132 |
133 | graphics.dispose();
134 | }
135 | /**
136 | * Avvia l'animazione di espansione o contrazione del pannello in base al parametro specificato.
137 | *
138 | * @param expand Se {@code true}, viene avviata l'animazione di espansione; se {@code false}, quella di contrazione.
139 | */
140 | public void startAnimation(boolean expand) {
141 | if (expand) {
142 | expandAnimation();
143 | } else {
144 | collapseAnimation();
145 | }
146 | }
147 |
148 | /**
149 | * Metodo di animazione per espandere il pannello, scalando da 0 a 1.2 e poi stabilizzando a 1.
150 | * L'animazione è gestita da un {@code Timer} che aggiorna la scala del pannello e lo ridisegna.
151 | */
152 | private void expandAnimation() {
153 | // Animation method for expanding from 0 to 1.2 and then to 1
154 |
155 | if (animationTimer != null && animationTimer.isRunning()) {
156 | animationTimer.stop();
157 | }
158 |
159 | scale = 0.0f;
160 | animationTimer = new Timer(5, new ActionListener() {
161 | @Override
162 | public void actionPerformed(ActionEvent e) {
163 | scale += 0.02f;
164 | if (scale >= 1.0f) {
165 | scale = 1.0f;
166 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 1.0
167 | }
168 | repaint();
169 | }
170 | });
171 | animationTimer.start();
172 | }
173 |
174 | /**
175 | * Metodo di animazione per contrarre il pannello, scalando da 1 a 0.
176 | * L'animazione è gestita da un {@code Timer} che riduce gradualmente la scala e ridisegna il pannello.
177 | */
178 | private void collapseAnimation() {
179 | // Animation method for collapsing from 1 to 0
180 |
181 | if (animationTimer != null && animationTimer.isRunning()) {
182 | animationTimer.stop();
183 | }
184 |
185 | scale = 1.0f;
186 | animationTimer = new Timer(5, new ActionListener() {
187 | @Override
188 | public void actionPerformed(ActionEvent e) {
189 | scale -= 0.02f;
190 | if (scale <= 0.0f) {
191 | scale = 0.0f;
192 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 0.0
193 | }
194 | repaint();
195 | }
196 | });
197 | animationTimer.start();
198 | }
199 |
200 | /**
201 | * Restituisce il colore del bordo del pannello.
202 | *
203 | * @return Il colore del bordo del pannello.
204 | */
205 | public Color getBorderColor() {
206 |
207 | return borderColor;
208 | }
209 |
210 | /**
211 | * Imposta il colore del bordo del pannello e richiede il ridisegno.
212 | *
213 | * @param borderColor Il nuovo colore del bordo.
214 | */
215 | public void setBorderColor(Color borderColor) {
216 | this.borderColor = borderColor;
217 | repaint();
218 | }
219 |
220 | /**
221 | * Restituisce lo spessore del bordo del pannello.
222 | *
223 | * @return Lo spessore del bordo.
224 | */
225 | public int getBorderThickness() {
226 | return borderThickness;
227 | }
228 |
229 | /**
230 | * Imposta lo spessore del bordo del pannello e richiede il ridisegno.
231 | *
232 | * @param borderThickness Il nuovo spessore del bordo.
233 | */
234 | public void setBorderThickness(int borderThickness) {
235 | this.borderThickness = borderThickness;
236 | repaint();
237 | }
238 |
239 | /**
240 | * Restituisce il colore di sfondo del pannello.
241 | *
242 | * @return Il colore di sfondo.
243 | */
244 | public Color getBackgroundColor() {
245 | return backgroundColor;
246 | }
247 |
248 | /**
249 | * Imposta il colore di sfondo del pannello e richiede il ridisegno.
250 | *
251 | * @param backgroundColor Il nuovo colore di sfondo.
252 | */
253 | public void setBackgroundColor(Color backgroundColor) {
254 | this.backgroundColor = backgroundColor;
255 | repaint();
256 | }
257 | }
258 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/AnimatedOpacityPanel.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.AlphaComposite;
41 | import java.awt.Color;
42 | import java.awt.Graphics;
43 | import java.awt.Graphics2D;
44 | import java.awt.event.ActionEvent;
45 | import java.awt.event.ActionListener;
46 |
47 | import javax.swing.JPanel;
48 | import javax.swing.Timer;
49 | /**
50 | * Un pannello personalizzato che consente un'animazione graduale della sua opacità,
51 | * permettendo effetti di apparizione e scomparsa tramite transizioni fluide.
52 | */
53 | public class AnimatedOpacityPanel extends JPanel {
54 |
55 | /**
56 | * Opacità corrente del pannello. Varia durante l'animazione.
57 | */
58 | private float currentOpacity = 0.0f;
59 | /**
60 | * Opacità target che il pannello deve raggiungere durante l'animazione.
61 | * Per impostazione predefinita è 0.5f.
62 | */
63 | private float targetOpacity = 0.5f; // Opacity target set to 0.4
64 | /**
65 | * Incremento per ogni passo dell'animazione dell'opacità.
66 | * Per impostazione predefinita è 0.05f.
67 | */
68 | private float opacityIncrement = 0.05f; // Default increment amount per step
69 | /**
70 | * Timer utilizzato per gestire i passi dell'animazione.
71 | */
72 | private Timer timer;
73 |
74 | /**
75 | * Costruttore della classe {@code AnimatedOpacityPanel}.
76 | * Imposta il pannello come non opaco per consentire la gestione della trasparenza.
77 | */
78 | public AnimatedOpacityPanel() {
79 | setOpaque(false);
80 | }
81 |
82 | /**
83 | * Avvia l'animazione dell'opacità basata sulla direzione specificata.
84 | *
85 | * @param appear {@code true} per animare l'opacità da 0 a 0.5, {@code false} per animare l'opacità da 0.5 a 0.
86 | */
87 | public void startAnimation(boolean appear) {
88 | // Adjust increment and target based on direction
89 | if (appear) {
90 | currentOpacity = 0.0f;
91 | targetOpacity = 0.5f;
92 | opacityIncrement = 0.05f;
93 | } else {
94 | currentOpacity = 0.4f;
95 | targetOpacity = 0.0f;
96 | opacityIncrement = -0.05f; // Decrease opacity
97 | }
98 |
99 | // Ensure the timer is not null and running before starting a new animation
100 | if (timer != null && timer.isRunning()) {
101 | timer.stop();
102 | }
103 |
104 | timer = new Timer(20, new ActionListener() {
105 | @Override
106 | public void actionPerformed(ActionEvent e) {
107 | // Increment the opacity gradually
108 | currentOpacity += opacityIncrement;
109 | if ((appear && currentOpacity >= targetOpacity) || (!appear && currentOpacity <= targetOpacity)) {
110 | currentOpacity = targetOpacity;
111 | timer.stop(); // Stop the timer when opacity reaches the target
112 | }
113 | repaint(); // Request repaint to animate
114 | }
115 | });
116 | timer.start(); // Start the timer
117 | }
118 |
119 | /**
120 | * Disegna il pannello con l'opacità corrente, riempiendolo con un colore grigio.
121 | * L'opacità varia a seconda dello stato corrente dell'animazione.
122 | *
123 | * @param g L'oggetto {@code Graphics} utilizzato per disegnare il pannello.
124 | */
125 | @Override
126 | protected void paintComponent(Graphics g) {
127 | super.paintComponent(g);
128 |
129 | Graphics2D g2d = (Graphics2D) g.create();
130 |
131 | // Set transparency based on currentOpacity
132 | g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, currentOpacity));
133 |
134 | g2d.setColor(Color.GRAY);
135 | g2d.fillRect(0, 0, getWidth(), getHeight());
136 |
137 | g2d.dispose();
138 | }
139 |
140 | // Test the animation
141 |
142 | }
143 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/AnimatedRoundedLabel.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.Color;
41 | import java.awt.Font;
42 | import java.awt.Graphics;
43 | import java.awt.Graphics2D;
44 | import java.awt.Insets;
45 | import java.awt.RenderingHints;
46 | import java.awt.event.ActionEvent;
47 | import java.awt.event.ActionListener;
48 |
49 | import javax.swing.JLabel;
50 | import javax.swing.Timer;
51 |
52 |
53 |
54 | /**
55 | * La classe {@code AnimatedRoundedLabel} estende JLabel e rappresenta un'etichetta animata
56 | * con bordi arrotondati, che include effetti di animazione per l'espansione e la riduzione.
57 | * Questo componente può essere utilizzato per migliorare l'interfaccia utente con transizioni visive.
58 | */
59 |
60 | public class AnimatedRoundedLabel extends JLabel {
61 |
62 | /**
63 | * Scala corrente utilizzata per l'animazione.
64 | */
65 | private float scale = 0.0f; // Initial scale for animation
66 | /**
67 | * Timer per gestire i passi dell'animazione.
68 | */
69 | private Timer animationTimer;
70 | /**
71 | * Parametro di compensazione verticale per la centratura del testo.
72 | */
73 | private int ch;
74 | /**
75 | * Raggio degli angoli arrotondati.
76 | */
77 | private int cornerRadius; // Radius for rounded corners
78 |
79 | // Padding variables
80 | private int topPadding = 0;
81 | private int leftPadding = 0;
82 | private int bottomPadding = 0;
83 | private int rightPadding =2 ;
84 |
85 |
86 | /**
87 | * Crea un'istanza di {@code AnimatedRoundedLabel} con il testo specificato.
88 | *
89 | * @param text Il testo dell'etichetta.
90 | * @param ch Compensazione verticale per la centratura del testo.
91 | */
92 | public AnimatedRoundedLabel(String text, int ch) {
93 | super(text);
94 | setOpaque(false); // Make the label transparent
95 | setHorizontalAlignment(JLabel.CENTER);
96 | setVerticalAlignment(JLabel.CENTER);
97 | setBackground(new Color(93, 199, 236)); // Blue background color
98 | this.ch = ch;
99 | this.cornerRadius = 10; // Set the corner radius
100 | setFont(new Font("Arial", Font.PLAIN, 16));
101 | setForeground(Color.WHITE);
102 | }
103 |
104 | /**
105 | * Sovrascrive il metodo di pittura per disegnare l'etichetta con angoli arrotondati e applicare la trasformazione di scala.
106 | *
107 | * @param g L'oggetto {@code Graphics} utilizzato per disegnare il componente.
108 | */
109 | @Override
110 | protected void paintComponent(Graphics g) {
111 | Graphics2D g2d = (Graphics2D) g.create();
112 | g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
113 | g2d.scale(scale, scale);
114 | int width = getWidth();
115 | int height = getHeight();
116 |
117 | // Calculate the center of the JLabel for the transformation
118 | int centerX = width / 2 - ch;
119 | int centerY = height / 2 - ch;
120 |
121 | // Apply the scale transformation
122 | g2d.translate(centerX, centerY);
123 | g2d.scale(scale, scale);
124 | g2d.translate(-centerX, -centerY);
125 |
126 | // Draw the rounded rectangle with background color
127 | g2d.setColor(getBackground());
128 | g2d.fillRoundRect(0, 0, width - 1, height - 1, cornerRadius, cornerRadius);
129 |
130 | // Set the composite to ensure text is rendered correctly with transparency
131 | g2d.setComposite(java.awt.AlphaComposite.SrcOver);
132 |
133 | // Draw the label text with foreground color and font
134 | g2d.setColor(getForeground());
135 | g2d.setFont(getFont());
136 | Font font = getFont();
137 | String text = getText();
138 | int textWidth = g2d.getFontMetrics(font).stringWidth(text);
139 | int textHeight = g2d.getFontMetrics(font).getAscent();
140 | int textX = leftPadding + (width - leftPadding - rightPadding - textWidth) / 2;
141 | int textY = topPadding + (height - topPadding - bottomPadding - textHeight) / 2 + g2d.getFontMetrics(font).getAscent() - g2d.getFontMetrics(font).getDescent() / 2;
142 | g2d.drawString(text, textX, textY);
143 |
144 | g2d.dispose();
145 | }
146 |
147 | /**
148 | * Sovrascrive il metodo per evitare di dipingere un bordo.
149 | *
150 | * @param g L'oggetto {@code Graphics} utilizzato per disegnare il bordo.
151 | */
152 | @Override
153 | protected void paintBorder(Graphics g) {
154 | // Do not paint the border
155 | }
156 |
157 | /**
158 | * Restituisce sempre {@code false} per indicare che l'etichetta è trasparente.
159 | *
160 | * @return {@code false}, indicando che l'etichetta è trasparente.
161 | */
162 | @Override
163 | public boolean isOpaque() {
164 | return false; // Make the label itself transparent
165 | }
166 |
167 | /**
168 | * Restituisce i margini di inserimento del contenuto dell'etichetta.
169 | *
170 | * @return Un oggetto {@code Insets} contenente i margini.
171 | */
172 | @Override
173 | public Insets getInsets() {
174 | return new Insets(topPadding, leftPadding, bottomPadding, rightPadding);
175 | }
176 |
177 | /**
178 | * Avvia l'animazione in base alla direzione specificata.
179 | *
180 | * @param expand {@code true} per espandere l'animazione, {@code false} per ridurla.
181 | */
182 | public void startAnimation(boolean expand) {
183 | if (animationTimer != null && animationTimer.isRunning()) {
184 | animationTimer.stop(); // Stop the current animation if it exists
185 | }
186 |
187 | if (expand) {
188 | expandAnimation();
189 | } else {
190 | collapseAnimation();
191 | }
192 | }
193 |
194 | /**
195 | * Avvia l'animazione di espansione da 0 a 1.
196 | */
197 | private void expandAnimation() {
198 | // Expand animation from 0 to 1
199 | scale = 0.0f;
200 | animationTimer = new Timer(5, new ActionListener() {
201 | @Override
202 | public void actionPerformed(ActionEvent e) {
203 | scale += 0.02f;
204 | if (scale >= 1.0f) {
205 | scale = 1.0f;
206 | ((Timer) e.getSource()).stop(); // Stop the animation when it reaches 1.0
207 | }
208 | repaint();
209 | }
210 | });
211 | animationTimer.start();
212 | }
213 |
214 | /**
215 | * Avvia l'animazione di riduzione da 1 a 0.
216 | */
217 | private void collapseAnimation() {
218 | // Collapse animation from 1 to 0
219 | scale = 1.0f;
220 | animationTimer = new Timer(3, new ActionListener() {
221 | @Override
222 | public void actionPerformed(ActionEvent e) {
223 | scale -= 0.02f;
224 | if (scale <= 0.0f) {
225 | scale = 0.0f;
226 | ((Timer) e.getSource()).stop(); // Stop the animation when it reaches 0.0
227 | }
228 | repaint();
229 | }
230 | });
231 | animationTimer.start();
232 | }
233 |
234 | /**
235 | * Avvia un'animazione di click che riduce l'etichetta a 0 e la riporta a 1.
236 | */
237 | public void clickAnimation() {
238 | // Ferma l'animazione corrente se esiste
239 | if (animationTimer != null && animationTimer.isRunning()) {
240 | animationTimer.stop();
241 | }
242 |
243 | // Avvia l'animazione da 1 a 0 e poi da 0 a 1
244 | scale = 1.0f;
245 | animationTimer = new Timer(5, new ActionListener() {
246 | private boolean decreasing = true; // Indica se stiamo diminuendo scale
247 |
248 | @Override
249 | public void actionPerformed(ActionEvent e) {
250 | if (decreasing) {
251 | scale -= 0.02f;
252 | if (scale <= 0.0f) {
253 | scale = 0.0f;
254 | decreasing = false; // Passa al modo di aumento
255 | }
256 | } else {
257 | scale += 0.02f;
258 | if (scale >= 1.0f) {
259 | scale = 1.0f;
260 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 1.0
261 | }
262 | }
263 | repaint(); // Ridisegna il componente con il nuovo valore di scale
264 | }
265 | });
266 | animationTimer.start();
267 | }
268 |
269 | }
270 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/AnimatedSVG.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.BorderLayout;
41 | import java.awt.Color;
42 | import java.awt.Dimension;
43 | import java.awt.event.ActionEvent;
44 | import java.awt.event.ActionListener;
45 | import java.awt.geom.AffineTransform;
46 | import java.io.File;
47 | import java.net.URL;
48 |
49 | import javax.swing.JPanel;
50 | import javax.swing.Timer;
51 |
52 | import org.apache.batik.swing.JSVGCanvas;
53 |
54 |
55 | /**
56 | * La classe {@code AnimatedSVG} rappresenta un pannello che visualizza e anima un'immagine SVG
57 | * con transizioni fluide di espansione e riduzione. Utilizza Batik per il rendering delle immagini SVG.
58 | */
59 | public class AnimatedSVG extends JPanel {
60 | public JSVGCanvas svgCanvas;
61 | private Timer animationTimer;
62 | private float scale = 0.0f;
63 | private static final float targetScale = 1.0f;
64 | private static final float delta = 0.02f;
65 | private int ch;
66 |
67 | /**
68 | * Crea un'istanza di {@code AnimatedSVG} che carica e visualizza un file SVG specificato.
69 | *
70 | * @param svgFilePath Il percorso del file SVG da caricare.
71 | * @param ch La compensazione verticale per centrare l'immagine durante la trasformazione.
72 | */
73 | public AnimatedSVG(String svgFilePath, int ch) {
74 | setPreferredSize(new Dimension(72, 72)); // Dimensioni più grandi per una visualizzazione migliore
75 | setLayout(new BorderLayout());
76 | setOpaque(false);
77 | this.ch = ch;
78 | svgCanvas = new JSVGCanvas();
79 |
80 | // Load the SVG file from the resources/assets directory
81 | URL svgFileUrl = getClass().getResource("/assets/" + svgFilePath);
82 | if (svgFileUrl != null) {
83 | svgCanvas.setURI(svgFileUrl.toString());
84 | } else {
85 | throw new RuntimeException("SVG file not found: " + svgFilePath);
86 | }
87 |
88 | svgCanvas.setBackground(new Color(0, 0, 0, 0));
89 | svgCanvas.setOpaque(false);
90 |
91 | add(svgCanvas, BorderLayout.CENTER);
92 | }
93 | /**
94 | * Avvia l'animazione in base alla direzione specificata.
95 | *
96 | * @param expand {@code true} per espandere l'immagine, {@code false} per ridurla.
97 | */
98 | public void startAnimation(boolean expand) {
99 | if (animationTimer != null && animationTimer.isRunning()) {
100 | animationTimer.stop(); // Ferma l'animazione corrente se esiste
101 | }
102 |
103 | if (expand) {
104 | expandAnimation();
105 | } else {
106 | collapseAnimation();
107 | }
108 | }
109 |
110 |
111 | /**
112 | * Avvia l'animazione di espansione da 0 a 1.0.
113 | */
114 | private void expandAnimation() {
115 | // Metodo per l'animazione di espansione da 0 a 1.0
116 | scale = 0.0f;
117 | animationTimer = new Timer(5, new ActionListener() { // Intervallo di 5 ms per un'animazione più fluida
118 | @Override
119 | public void actionPerformed(ActionEvent e) {
120 | scale += delta; // Incrementa la scala per l'espansione
121 | if (scale >= targetScale) {
122 | scale = targetScale;
123 | ((Timer) e.getSource()).stop(); // Ferma il timer quando raggiunge la scala finale
124 | }
125 |
126 | applyTransform(scale);
127 | }
128 | });
129 |
130 | animationTimer.start(); // Avvia l'animazione
131 | }
132 |
133 | /**
134 | * Avvia l'animazione di riduzione da 1.0 a 0.
135 | */
136 | private void collapseAnimation() {
137 | // Metodo per l'animazione di collasso da 1.0 a 0
138 | scale = 1.0f;
139 | animationTimer = new Timer(3, new ActionListener() { // Intervallo di 5 ms per un'animazione più fluida
140 | @Override
141 | public void actionPerformed(ActionEvent e) {
142 | scale -= delta; // Decrementa la scala per il collasso
143 | if (scale <= 0.02f) {
144 | scale = 0.001f;
145 | ((Timer) e.getSource()).stop(); // Ferma il timer quando raggiunge la scala finale
146 | }
147 |
148 | applyTransform(scale);
149 | }
150 | });
151 |
152 | animationTimer.start(); // Avvia l'animazione
153 | }
154 |
155 | /**
156 | * Applica la trasformazione di scala centrata al canvas SVG.
157 | *
158 | * @param scaleFactor Il fattore di scala da applicare.
159 | */
160 | private void applyTransform(float scaleFactor) {
161 | // Applica la trasformazione di scala centrata al canvas SVG
162 | Dimension size = svgCanvas.getSize();
163 | double centerX = size.getWidth() / 2;
164 | double centerY = size.getHeight() / 2 + ch;
165 |
166 | AffineTransform transform = new AffineTransform();
167 | transform.translate(centerX, centerY); // Trasla al centro del pannello
168 | transform.scale(scaleFactor, scaleFactor);
169 | transform.translate(-centerX, -centerY); // Trasla indietro per centrare correttamente
170 |
171 | svgCanvas.setRenderingTransform(transform);
172 | svgCanvas.revalidate();
173 | svgCanvas.repaint();
174 | }
175 | /**
176 | * Avvia un'animazione di riduzione parziale da 1.0 a 0.9.
177 | */
178 | public void reduxAnimation() {
179 | scale = 1.0f;
180 | animationTimer = new Timer(3, new ActionListener() {
181 | @Override
182 | public void actionPerformed(ActionEvent e) {
183 | scale -= 0.005f;
184 | if (scale <= 0.9f) {
185 | scale = 0.9f;
186 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 0.8
187 | }
188 | applyTransform(scale);
189 | }
190 | });
191 | animationTimer.start();
192 | }
193 | /**
194 | * Avvia un'animazione di ingrandimento parziale da 0.9 a 1.0.
195 | */
196 | public void zoomAnimation() {
197 | scale = 0.9f;
198 | animationTimer = new Timer(3, new ActionListener() {
199 | @Override
200 | public void actionPerformed(ActionEvent e) {
201 | scale += 0.005f;
202 | if (scale >= 1.0f) {
203 | scale = 1.0f;
204 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 1.0
205 | }
206 | applyTransform(scale);
207 | }
208 | });
209 | animationTimer.start();
210 | }
211 | /**
212 | * Avvia un'animazione di click che riduce l'immagine a 0.01 e poi la riporta a 1.0.
213 | */
214 | public void clickAnimation() {
215 | // Ferma l'animazione corrente se esiste
216 | if (animationTimer != null && animationTimer.isRunning()) {
217 | animationTimer.stop();
218 | }
219 |
220 | // Avvia l'animazione da 1 a 0 e poi da 0 a 1
221 | scale = 1.0f;
222 | animationTimer = new Timer(5, new ActionListener() {
223 | private boolean decreasing = true; // Indica se stiamo diminuendo scale
224 |
225 | @Override
226 | public void actionPerformed(ActionEvent e) {
227 | if (decreasing) {
228 | scale -= 0.02f;
229 | if (scale <= 0.01f) {
230 | scale = 0.01f;
231 | decreasing = false; // Passa al modo di aumento
232 | }
233 | } else {
234 | scale += 0.02f;
235 | if (scale >= 1.0f) {
236 | scale = 1.0f;
237 | ((Timer) e.getSource()).stop(); // Ferma l'animazione quando raggiunge 1.0
238 | }
239 | }
240 | applyTransform(scale); }
241 | });
242 | animationTimer.start();
243 | }
244 | }
245 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/CalcFLSM.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.net.InetAddress;
41 | import java.net.UnknownHostException;
42 |
43 | /**
44 | * La classe {@code CalcFLSM} fornisce metodi per calcolare le sottoreti in una rete IP basata su una maschera di sottorete iniziale
45 | * e un numero specificato di sottoreti. Calcola anche gli indirizzi IP associati a ciascuna sottorete, incluso l'indirizzo di rete,
46 | * il gateway, l'indirizzo di broadcast, il primo e l'ultimo host.
47 | */
48 | public class CalcFLSM {
49 |
50 | /**
51 | * Metodo principale per calcolare e stampare le sottoreti.
52 | * @param args Argomenti della riga di comando (non utilizzati).
53 | * @throws UnknownHostException Se l'indirizzo IP o la maschera di sottorete non possono essere risolti.
54 | */
55 | public static void main(String[] args) throws UnknownHostException {
56 | // Initial IP address, default subnet mask, and number of subnets
57 | String ipAddress = "10.0.0.0";
58 | String initialSubnetMask = "255.255.255.0"; // Example initial subnet mask
59 | int numSubnets = 4;
60 | System.out.print(CalcManager.calculateNumberOfHostsPerSubnet(ipAddress,4));
61 | // Calculate and print subnet information
62 | ObjSM[] subnets = calculateSubnets(ipAddress, initialSubnetMask, numSubnets);
63 | for (ObjSM subnet : subnets) {
64 | System.out.println(subnet);
65 | }
66 | }
67 |
68 | /**
69 | * Calcola le sottoreti basate su un indirizzo IP iniziale, una maschera di sottorete e un numero specificato di sottoreti.
70 | * @param ipAddress Indirizzo IP iniziale.
71 | * @param initialSubnetMask Maschera di sottorete iniziale.
72 | * @param numSubnets Numero di sottoreti desiderate.
73 | * @return Un array di {@link ObjSM} contenente le informazioni di ciascuna sottorete calcolata.
74 | * @throws UnknownHostException Se l'indirizzo IP o la maschera di sottorete non possono essere risolti.
75 | */
76 | public static ObjSM[] calculateSubnets(String ipAddress, String initialSubnetMask, int numSubnets) throws UnknownHostException {
77 | // Convert IP address and initial subnet mask to byte arrays
78 | InetAddress inetAddress = InetAddress.getByName(ipAddress);
79 | byte[] ipBytes = inetAddress.getAddress();
80 |
81 | InetAddress initialSubnet = InetAddress.getByName(initialSubnetMask);
82 | byte[] initialMaskBytes = initialSubnet.getAddress();
83 |
84 | // Convert initial subnet mask to an integer
85 | int initialMask = 0;
86 | for (byte b : initialMaskBytes) {
87 | initialMask = (initialMask << 8) | (b & 0xFF);
88 | }
89 |
90 | // Calculate the number of bits for the initial subnet mask
91 | int initialMaskLength = Integer.bitCount(initialMask);
92 |
93 | // Calculate the number of bits to borrow for the new subnet mask
94 | int bitsToBorrow = (int) Math.ceil(Math.log(numSubnets) / Math.log(2));
95 | int newMaskLength = initialMaskLength + bitsToBorrow;
96 |
97 | // Calculate the total number of hosts per subnet with the new subnet mask
98 | int totalHosts = (int) Math.pow(2, 32 - newMaskLength);
99 |
100 | // Calculate the new subnet mask
101 | int newMask = initialMask | ((1 << (32 - initialMaskLength)) - 1) & ~((1 << (32 - newMaskLength)) - 1);
102 | String newSubnetMask = intToIpString(newMask);
103 |
104 | ObjSM[] subnets = new ObjSM[numSubnets];
105 |
106 | for (int i = 0; i < numSubnets; i++) {
107 | byte[] subnetIpBytes = ipBytes.clone();
108 | int subnetIncrement = i * totalHosts;
109 |
110 | // Calculate the Network ID for the i-th subnet
111 | for (int j = subnetIpBytes.length - 1; j >= 0; j--) {
112 | int part = subnetIpBytes[j] & 0xFF;
113 | part += subnetIncrement & 0xFF;
114 | subnetIpBytes[j] = (byte) part;
115 | subnetIncrement >>= 8;
116 | }
117 |
118 | String subnetIp = InetAddress.getByAddress(subnetIpBytes).getHostAddress();
119 | String networkId = subnetIp;
120 | String gateway = getNextIp(subnetIp, 1);
121 | String broadcast = getNextIp(subnetIp, totalHosts - 1);
122 | String firstHost = getNextIp(subnetIp, 2);
123 | String lastHost = getNextIp(subnetIp, totalHosts - 2);
124 |
125 | // Use the newly calculated subnet mask
126 | subnets[i] = new ObjSM(
127 | i + 1,
128 | networkId,
129 | newSubnetMask,
130 | gateway,
131 | broadcast,
132 | firstHost,
133 | lastHost
134 | );
135 | }
136 |
137 | return subnets;
138 | }
139 |
140 | /**
141 | * Calcola il prossimo indirizzo IP basato su un offset dato.
142 | * @param ipAddress Indirizzo IP iniziale.
143 | * @param offset Offset da aggiungere all'indirizzo IP.
144 | * @return Il prossimo indirizzo IP calcolato.
145 | * @throws UnknownHostException Se l'indirizzo IP non può essere risolto.
146 | */
147 | public static String getNextIp(String ipAddress, int offset) throws UnknownHostException {
148 | InetAddress inetAddress = InetAddress.getByName(ipAddress);
149 | byte[] ipBytes = inetAddress.getAddress();
150 |
151 | for (int i = ipBytes.length - 1; i >= 0; i--) {
152 | int part = ipBytes[i] & 0xFF;
153 | part += offset;
154 | ipBytes[i] = (byte) (part & 0xFF);
155 | offset = (part >> 8) & 0xFF;
156 | }
157 |
158 | return InetAddress.getByAddress(ipBytes).getHostAddress();
159 | }
160 |
161 | /**
162 | * Converte un intero rappresentante un indirizzo IP in una stringa formattata.
163 | * @param ip Indirizzo IP rappresentato come intero.
164 | * @return L'indirizzo IP come stringa.
165 | */
166 | public static String intToIpString(int ip) {
167 | return ((ip >> 24) & 0xFF) + "." + ((ip >> 16) & 0xFF) + "." + ((ip >> 8) & 0xFF) + "." + (ip & 0xFF);
168 | }
169 | }
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/CalcIP.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.net.InetAddress;
41 | import java.net.UnknownHostException;
42 |
43 |
44 | /**
45 | * La classe {@code CalcIP} fornisce metodi per calcolare informazioni sui tipi e classi degli indirizzi IP.
46 | * Il metodo principale {@code main} dimostra l'uso della classe con una serie di indirizzi IP di esempio.
47 | */
48 | public class CalcIP {
49 |
50 | /**
51 | * Metodo principale che calcola e stampa informazioni sugli indirizzi IP di esempio.
52 | * @param args Argomenti della riga di comando (non utilizzati).
53 | * @throws UnknownHostException Se un indirizzo IP non può essere risolto.
54 | */
55 | public static void main(String[] args) throws UnknownHostException {
56 | // Esempi di indirizzi IP
57 | String[] ipAddresses = {
58 | "10.0.0.1",
59 | "172.16.0.1",
60 | "192.168.1.1",
61 | "8.8.8.8",
62 | "169.254.0.1",
63 | "224.0.0.1"
64 | };
65 |
66 | for (String ipAddress : ipAddresses) {
67 | ObjIP objIP = CalcIP.calculateIPInfo(ipAddress);
68 | System.out.println(objIP);
69 | }
70 | }
71 |
72 |
73 | /**
74 | * Calcola le informazioni su un indirizzo IP, inclusi il tipo di IP e la classe di IP.
75 | * @param ipAddress Indirizzo IP da analizzare.
76 | * @return Un oggetto {@link ObjIP} contenente l'indirizzo IP, il tipo e la classe dell'IP.
77 | * @throws UnknownHostException Se l'indirizzo IP non può essere risolto.
78 | */
79 | public static ObjIP calculateIPInfo(String ipAddress) throws UnknownHostException {
80 | InetAddress inetAddress = InetAddress.getByName(ipAddress);
81 | byte[] ipBytes = inetAddress.getAddress();
82 |
83 | String type = determineIPType(ipBytes);
84 | String ipClass = determineIPClass(ipBytes);
85 |
86 | return new ObjIP(ipAddress, type, ipClass);
87 | }
88 |
89 | /**
90 | * Determina il tipo di un indirizzo IP basato sui suoi byte.
91 | * @param ipBytes Byte dell'indirizzo IP.
92 | * @return Una stringa che rappresenta il tipo di IP: "Privato", "Indefinito" o "Pubblico".
93 | */
94 | public static String determineIPType(byte[] ipBytes) {
95 | int firstByte = ipBytes[0] & 0xFF;
96 |
97 | // Verifica degli indirizzi IP privati
98 | if ((firstByte == 10) ||
99 | (firstByte == 172 && (ipBytes[1] & 0xF0) == 16) ||
100 | (firstByte == 192 && (ipBytes[1] & 0xFF) == 168)) {
101 | return "Privato";
102 | }
103 |
104 | // Verifica degli indirizzi APIPA
105 | if (firstByte == 169 && (ipBytes[1] & 0xFF) == 254) {
106 | return "Indefinito";
107 | }
108 |
109 | // Verifica degli indirizzi multicast
110 | if (firstByte >= 224 && firstByte <= 239) {
111 | return "Indefinito";
112 | }
113 |
114 | // Se non è né privato né APIPA, allora è pubblico
115 | return "Pubblico";
116 | }
117 |
118 | /**
119 | * Determina la classe di un indirizzo IP basato sul primo byte.
120 | * @param ipBytes Byte dell'indirizzo IP.
121 | * @return Una stringa che rappresenta la classe dell'IP: "A", "B", "C" o "Indefinito".
122 | */
123 | public static String determineIPClass(byte[] ipBytes) {
124 | int firstByte = ipBytes[0] & 0xFF;
125 |
126 | if (firstByte >= 1 && firstByte <= 126) {
127 | return "A";
128 | } else if (firstByte >= 128 && firstByte <= 191) {
129 | return "B";
130 | } else if (firstByte >= 192 && firstByte <= 223) {
131 | return "C";
132 | } else {
133 | return "Indefinito";
134 | }
135 | }
136 | }
137 |
138 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/CalcManager.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.net.InetAddress;
41 | import java.net.UnknownHostException;
42 | import java.util.regex.Pattern;
43 |
44 | /**
45 | * La classe {@code CalcManager} fornisce metodi per la validazione degli indirizzi IP, delle maschere di sottorete,
46 | * e per il calcolo del numero di sottoreti e di host per sottorete.
47 | */
48 | public class CalcManager {
49 |
50 | /**
51 | * Metodo principale per dimostrare l'uso dei metodi di controllo e calcolo.
52 | * @param args Argomenti della riga di comando (non utilizzati).
53 | */
54 | public static void main(String[] args) {
55 | // Esempi di utilizzo dei metodi di controllo
56 | System.out.println(isValidIPAddress("192.168.1.1")); // true
57 | System.out.println(isValidIPAddress("999.999.999.999")); // false
58 | System.out.println(isValidSubnetMask("255.255.255.0")); // true
59 | System.out.println(isValidSubnetMask("255.0.0.255")); // false
60 | System.out.println(isValidNumberOfSubnets(4)); // true
61 | System.out.println(isValidNumberOfSubnets(-1)); // false
62 | System.out.println(isValidNumberOfHosts(256)); // true
63 | System.out.println(isValidNumberOfHosts(-10)); // false
64 | }
65 |
66 | /**
67 | * Verifica se una stringa rappresenta un indirizzo IP valido.
68 | * @param ipAddress L'indirizzo IP da verificare.
69 | * @return {@code true} se l'indirizzo IP è valido, {@code false} altrimenti.
70 | */
71 | public static boolean isValidIPAddress(String ipAddress) {
72 | // Pattern regex per un indirizzo IP valido
73 | String ipPattern = "^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$";
74 | return Pattern.matches(ipPattern, ipAddress);
75 | }
76 |
77 | /**
78 | * Verifica se una stringa rappresenta una maschera di sottorete valida.
79 | * @param subnetMask La maschera di sottorete da verificare.
80 | * @return {@code true} se la maschera di sottorete è valida, {@code false} altrimenti.
81 | */
82 | public static boolean isValidSubnetMask(String subnetMask) {
83 | try {
84 | // Convertire l'indirizzo in byte
85 | InetAddress inetAddress = InetAddress.getByName(subnetMask);
86 | byte[] addressBytes = inetAddress.getAddress();
87 |
88 | // Convertire i byte in un intero
89 | int mask = 0;
90 | for (byte b : addressBytes) {
91 | mask = (mask << 8) | (b & 0xFF);
92 | }
93 |
94 | // Verifica che la maschera di sottorete sia contigua
95 | boolean foundZero = false;
96 | for (int i = 31; i >= 0; i--) {
97 | if ((mask & (1 << i)) == 0) {
98 | foundZero = true;
99 | } else if (foundZero) {
100 | return false;
101 | }
102 | }
103 | return true;
104 | } catch (UnknownHostException e) {
105 | return false;
106 | }
107 | }
108 |
109 | /**
110 | * Verifica se un numero di sottoreti è valido.
111 | * @param numSubnets Il numero di sottoreti da verificare.
112 | * @return {@code true} se il numero di sottoreti è positivo, {@code false} altrimenti.
113 | */
114 | public static boolean isValidNumberOfSubnets(int numSubnets) {
115 | // Il numero di sottoreti deve essere un intero positivo
116 | return numSubnets > 0;
117 | }
118 |
119 | /**
120 | * Verifica se una stringa rappresenta un numero di sottoreti valido.
121 | * @param numHosts La stringa che rappresenta il numero di sottoreti.
122 | * @return {@code true} se la stringa rappresenta un numero valido e positivo, {@code false} altrimenti.
123 | */
124 | public static boolean isValidNumberOfSubnets(String numHosts) {
125 | // Controllo se la stringa è vuota
126 | if (numHosts.isEmpty()) {
127 | return false;
128 | }
129 |
130 | // Controllo se la stringa contiene un numero decimale valido
131 | try {
132 | double number = Double.parseDouble(numHosts);
133 | // Verifica che il numero sia maggiore di 0
134 | return number > 0;
135 | } catch (NumberFormatException e) {
136 | // Se non è possibile convertire la stringa in un numero, ritorna false
137 | return false;
138 | }
139 | }
140 |
141 | /**
142 | * Verifica se un numero di host è valido.
143 | * @param numHosts Il numero di host da verificare.
144 | * @return {@code true} se il numero di host è positivo, {@code false} altrimenti.
145 | */
146 | public static boolean isValidNumberOfHosts(int numHosts) {
147 | // Il numero di host deve essere un intero positivo
148 | return numHosts > 0;
149 | }
150 |
151 | /**
152 | * Verifica se una stringa rappresenta un numero di host valido.
153 | * @param numHosts La stringa che rappresenta il numero di host.
154 | * @return {@code true} se la stringa rappresenta un numero valido e positivo, {@code false} altrimenti.
155 | */
156 | public static boolean isValidNumberOfHosts(String numHosts) {
157 | // Controllo se la stringa è vuota
158 | if (numHosts.isEmpty()) {
159 | return false;
160 | }
161 |
162 | // Controllo se la stringa contiene un numero decimale valido
163 | try {
164 | double number = Double.parseDouble(numHosts);
165 | // Verifica che il numero sia maggiore di 0
166 | return number > 0;
167 | } catch (NumberFormatException e) {
168 | // Se non è possibile convertire la stringa in un numero, ritorna false
169 | return false;
170 | }
171 | }
172 |
173 | /**
174 | * Calcola il numero massimo di sottoreti che possono essere create con una determinata quantità di bit per gli host.
175 | * @param ipAddress Indirizzo IP (non utilizzato in questo metodo, ma passato per coerenza con altri metodi).
176 | * @param numHosts Numero di host per sottorete.
177 | * @return Il numero massimo di sottoreti.
178 | */
179 | public static int calculateNumberOfSubnets(String ipAddress, int numHosts) {
180 | // Numero di bit necessari per rappresentare il numero di host
181 | int hostBits = (int) Math.ceil(Math.log(numHosts + 2) / Math.log(2)); // +2 per network e broadcast
182 |
183 | // Numero di bit disponibili per le sottoreti
184 | int subnetBits = 32 - hostBits;
185 |
186 | // Numero massimo di sottoreti
187 | int maxSubnets = 1 << subnetBits;
188 |
189 | return maxSubnets;
190 | }
191 |
192 | /**
193 | * Calcola il numero massimo di host per sottorete con un determinato numero di sottoreti.
194 | * @param ipAddress Indirizzo IP (non utilizzato in questo metodo, ma passato per coerenza con altri metodi).
195 | * @param numSubnets Numero di sottoreti.
196 | * @return Il numero massimo di host per sottorete.
197 | */
198 | public static int calculateNumberOfHostsPerSubnet(String ipAddress, int numSubnets) {
199 | // Numero di bit richiesti per il numero di sottoreti
200 | int subnetBits = (int) Math.ceil(Math.log(numSubnets) / Math.log(2));
201 |
202 | // Numero di bit disponibili per gli host
203 | int hostBits = 32 - subnetBits;
204 |
205 | // Numero massimo di host per sottorete
206 | int numHosts = (1 << hostBits) - 2; // -2 per network e broadcast
207 |
208 | return numHosts;
209 | }
210 |
211 | }
212 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/CalcNetIDs.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;
2 | /*
3 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
4 | Copyright 2024 Vittorio Piotti
5 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
6 | */
7 |
8 | /*
9 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
10 | Copyright 2024 The Apache Software Foundation
11 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
12 | */
13 |
14 |
15 | /*
16 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
17 | Copyright 2024 JFormDesigner GmbH
18 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
19 | */
20 |
21 | /*
22 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
23 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
24 | Copyright 2024 The Apache Software Foundation
25 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
26 | */
27 |
28 | /*
29 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
30 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
31 | Copyright 2024 The Apache Software Foundation
32 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
33 | */
34 |
35 | /*!
36 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
37 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
38 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
39 | */
40 |
41 | import java.net.InetAddress;
42 | import java.net.UnknownHostException;
43 |
44 |
45 | /**
46 | * La classe {@code CalcNetIDs} fornisce metodi per calcolare e visualizzare i Network ID di due indirizzi IP
47 | * dati un indirizzo IP e una maschera di sottorete per ciascuno.
48 | */
49 | public class CalcNetIDs {
50 | /**
51 | * Metodo principale per dimostrare il calcolo dei Network ID.
52 | * @param args Argomenti della riga di comando (non utilizzati).
53 | * @throws UnknownHostException Se l'indirizzo IP o la maschera di sottorete non possono essere risolti.
54 | */
55 | public static void main(String[] args) throws UnknownHostException {
56 | // Indirizzi IP e subnet mask
57 | String ip1 = "192.168.1.10";
58 | String sm1 = "255.255.0.0";
59 | String ip2 = "192.168.1.20";
60 | String sm2 = "255.255.255.0";
61 |
62 | // Calcola i Network ID e stampa i risultati
63 | ObjNetIDs result = calculateNetworkIDs(ip1, sm1, ip2, sm2);
64 | System.out.println(result);
65 | }
66 |
67 | /**
68 | * Calcola i Network ID per due indirizzi IP e le loro rispettive maschere di sottorete.
69 | * @param ip1 Il primo indirizzo IP.
70 | * @param sm1 La maschera di sottorete per il primo indirizzo IP.
71 | * @param ip2 Il secondo indirizzo IP.
72 | * @param sm2 La maschera di sottorete per il secondo indirizzo IP.
73 | * @return Un oggetto {@code ObjNetIDs} contenente entrambi i Network ID calcolati.
74 | * @throws UnknownHostException Se uno degli indirizzi IP o delle maschere di sottorete non può essere risolto.
75 | */
76 |
77 | public static ObjNetIDs calculateNetworkIDs(String ip1, String sm1, String ip2, String sm2) throws UnknownHostException {
78 | // Calcola il Network ID per il primo indirizzo IP
79 | String netId1 = calculateNetworkID(ip1, sm1);
80 |
81 | // Calcola il Network ID per il secondo indirizzo IP
82 | String netId2 = calculateNetworkID(ip2, sm2);
83 |
84 | // Ritorna un oggetto contenente entrambi i Network ID
85 | return new ObjNetIDs(netId1, netId2);
86 | }
87 |
88 | /**
89 | * Calcola il Network ID per un dato indirizzo IP e una maschera di sottorete.
90 | * @param ipAddress L'indirizzo IP per il quale calcolare il Network ID.
91 | * @param subnetMask La maschera di sottorete da utilizzare per il calcolo del Network ID.
92 | * @return Il Network ID come stringa.
93 | * @throws UnknownHostException Se l'indirizzo IP o la maschera di sottorete non può essere risolto.
94 | */
95 | public static String calculateNetworkID(String ipAddress, String subnetMask) throws UnknownHostException {
96 | // Ottiene i byte dell'indirizzo IP e della subnet mask
97 | byte[] ipBytes = InetAddress.getByName(ipAddress).getAddress();
98 | byte[] maskBytes = InetAddress.getByName(subnetMask).getAddress();
99 |
100 | // Calcola il Network ID byte per byte usando l'operatore AND bit a bit
101 | byte[] networkBytes = new byte[ipBytes.length];
102 | for (int i = 0; i < ipBytes.length; i++) {
103 | networkBytes[i] = (byte) (ipBytes[i] & maskBytes[i]);
104 | }
105 |
106 | // Converte i byte del Network ID in un formato stringa
107 | return InetAddress.getByAddress(networkBytes).getHostAddress();
108 | }
109 |
110 |
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/CalcVLSM.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.net.InetAddress;
41 | import java.net.UnknownHostException;
42 | import java.util.Arrays;
43 | import java.util.Comparator;
44 |
45 | /**
46 | * La classe {@code CalcVLSM} fornisce metodi per calcolare le sottoreti in un'allocazione di subnet
47 | * utilizzando il metodo VLSM (Variable Length Subnet Mask). VLSM consente di ottimizzare l'uso
48 | * degli indirizzi IP suddividendo un singolo blocco di indirizzi IP in sottoreti di diverse dimensioni.
49 | */
50 | public class CalcVLSM {
51 | /**
52 | * Metodo principale per dimostrare il calcolo delle sottoreti con VLSM.
53 | * @param args Argomenti della riga di comando (non utilizzati).
54 | * @throws UnknownHostException Se l'indirizzo IP non può essere risolto.
55 | */
56 | public static void main(String[] args) throws UnknownHostException {
57 | // Indirizzo IP di base e configurazione delle sottoreti
58 | String ipAddress = "192.168.1.0";
59 | String subnetMask = "255.255.255.0"; // Sottorete iniziale
60 | int[][] subnets = {
61 | {0, 50}, // Subnet 0 richiede 50 host
62 | {1, 20}, // Subnet 1 richiede 20 host
63 | {2, 10}, // Subnet 2 richiede 10 host
64 | {3, 5} // Subnet 3 richiede 5 host
65 | };
66 |
67 | ObjSM[] subnetInfos = calculateCalcVLSM(ipAddress, subnetMask, subnets);
68 | for (ObjSM subnetInfo : subnetInfos) {
69 | System.out.println(subnetInfo);
70 | }
71 | }
72 |
73 | /**
74 | * Calcola le sottoreti utilizzando VLSM (Variable Length Subnet Mask).
75 | * @param ipAddress L'indirizzo IP di base da cui iniziare il calcolo delle sottoreti.
76 | * @param subnetMask La maschera di sottorete iniziale da utilizzare come riferimento.
77 | * @param subnets Un array bidimensionale che contiene gli indici delle sottoreti e il numero di host richiesti per ciascuna sottorete.
78 | * @return Un array di oggetti {@code ObjSM} contenente le informazioni sulle sottoreti calcolate.
79 | * @throws UnknownHostException Se l'indirizzo IP o la maschera di sottorete non può essere risolto.
80 | */
81 | public static ObjSM[] calculateCalcVLSM(String ipAddress, String subnetMask, int[][] subnets) throws UnknownHostException {
82 | // Ordina le sottoreti in base al numero di host richiesti, in ordine decrescente
83 | Arrays.sort(subnets, new Comparator() {
84 | @Override
85 | public int compare(int[] a, int[] b) {
86 | return Integer.compare(b[1], a[1]);
87 | }
88 | });
89 |
90 | ObjSM[] subnetInfos = new ObjSM[subnets.length];
91 |
92 | // Indirizzo di partenza
93 | InetAddress inetAddress = InetAddress.getByName(ipAddress);
94 | byte[] ipBytes = inetAddress.getAddress();
95 |
96 | for (int i = 0; i < subnets.length; i++) {
97 | int[] subnet = subnets[i];
98 | int subnetIndex = subnet[0];
99 | int requiredHosts = subnet[1];
100 |
101 | // Calcola il numero di bit per gli host richiesti
102 | int numHostBits = (int) Math.ceil(Math.log(requiredHosts + 2) / Math.log(2)); // +2 per Network ID e Broadcast
103 | int subnetMaskBits = 32 - numHostBits;
104 | int totalHosts = 1 << numHostBits;
105 |
106 | // Calcola la subnet mask
107 | String subnetMaskStr = calculateSubnetMask(subnetMaskBits);
108 |
109 | // Calcola l'indirizzo di rete
110 | String networkId = InetAddress.getByAddress(ipBytes).getHostAddress();
111 | String broadcast = getNextIp(networkId, totalHosts - 1);
112 | String gateway = getNextIp(networkId, 1);
113 | String firstHost = getNextIp(networkId, 2);
114 | String lastHost = getNextIp(networkId, totalHosts - 2);
115 |
116 | subnetInfos[i] = new ObjSM(
117 | subnetIndex,
118 | networkId,
119 | subnetMaskStr,
120 | gateway,
121 | broadcast,
122 | firstHost,
123 | lastHost
124 | );
125 |
126 | // Incrementa l'indirizzo IP di partenza per la prossima sottorete
127 | ipBytes = getNextIpBytes(networkId, totalHosts);
128 | }
129 |
130 | return subnetInfos;
131 | }
132 |
133 | /**
134 | * Restituisce il prossimo indirizzo IP aggiungendo un offset all'indirizzo IP dato.
135 | * @param ipAddress L'indirizzo IP di partenza.
136 | * @param offset Il valore da aggiungere all'indirizzo IP.
137 | * @return Il prossimo indirizzo IP come stringa.
138 | * @throws UnknownHostException Se l'indirizzo IP non può essere risolto.
139 | */
140 | public static String getNextIp(String ipAddress, int offset) throws UnknownHostException {
141 | InetAddress inetAddress = InetAddress.getByName(ipAddress);
142 | byte[] ipBytes = inetAddress.getAddress();
143 |
144 | for (int i = ipBytes.length - 1; i >= 0; i--) {
145 | int part = ipBytes[i] & 0xFF;
146 | part += offset;
147 | ipBytes[i] = (byte) (part & 0xFF);
148 | offset = (part >> 8) & 0xFF;
149 | }
150 |
151 | return InetAddress.getByAddress(ipBytes).getHostAddress();
152 | }
153 |
154 | /**
155 | * Restituisce i byte del prossimo indirizzo IP aggiungendo un offset all'indirizzo IP dato.
156 | * @param ipAddress L'indirizzo IP di partenza.
157 | * @param offset Il valore da aggiungere all'indirizzo IP.
158 | * @return I byte del prossimo indirizzo IP.
159 | * @throws UnknownHostException Se l'indirizzo IP non può essere risolto.
160 | */
161 | public static byte[] getNextIpBytes(String ipAddress, int offset) throws UnknownHostException {
162 | InetAddress inetAddress = InetAddress.getByName(ipAddress);
163 | byte[] ipBytes = inetAddress.getAddress();
164 |
165 | for (int i = ipBytes.length - 1; i >= 0; i--) {
166 | int part = ipBytes[i] & 0xFF;
167 | part += offset;
168 | ipBytes[i] = (byte) (part & 0xFF);
169 | offset = (part >> 8) & 0xFF;
170 | }
171 |
172 | return ipBytes;
173 | }
174 |
175 | /**
176 | * Calcola la subnet mask in formato stringa basata sul numero di bit della maschera di sottorete.
177 | * @param subnetMaskBits Il numero di bit nella maschera di sottorete.
178 | * @return La maschera di sottorete come stringa.
179 | */
180 | public static String calculateSubnetMask(int subnetMaskBits) {
181 | int mask = 0xffffffff << (32 - subnetMaskBits);
182 | return intToIpString(mask);
183 | }
184 |
185 | /**
186 | * Calcola il numero di bit della maschera di sottorete basato sulla maschera di sottorete in formato stringa.
187 | * @param subnetMask La maschera di sottorete come stringa.
188 | * @return Il numero di bit nella maschera di sottorete.
189 | */
190 | public static int calculateSubnetMaskBits(String subnetMask) {
191 | String[] parts = subnetMask.split("\\.");
192 | int maskBits = 0;
193 | for (String part : parts) {
194 | int value = Integer.parseInt(part);
195 | maskBits += Integer.bitCount(value);
196 | }
197 | return maskBits;
198 | }
199 |
200 | /**
201 | * Converte un intero in una stringa di indirizzo IP in formato "xxx.xxx.xxx.xxx".
202 | * @param ip L'indirizzo IP come intero.
203 | * @return L'indirizzo IP come stringa.
204 | */
205 | public static String intToIpString(int ip) {
206 | return ((ip >> 24) & 0xFF) + "." + ((ip >> 16) & 0xFF) + "." + ((ip >> 8) & 0xFF) + "." + (ip & 0xFF);
207 | }
208 | }
209 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/LayoutTable.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.Color;
41 | import java.awt.Component;
42 | import java.awt.Font;
43 |
44 | import javax.swing.JFrame;
45 | import javax.swing.JLabel;
46 | import javax.swing.JScrollPane;
47 | import javax.swing.JTable;
48 | import javax.swing.SwingConstants;
49 | import javax.swing.border.LineBorder;
50 | import javax.swing.table.DefaultTableCellRenderer;
51 | import javax.swing.table.JTableHeader;
52 | import javax.swing.table.TableCellRenderer;
53 | /**
54 | * Costruttore della classe che estende {@link JTable}.
55 | *
56 | * @param data i dati da visualizzare nella tabella
57 | * @param columnNames i nomi delle colonne della tabella
58 | */
59 | public class LayoutTable extends JTable {
60 | private JFrame frame;
61 |
62 | // Costruttore della classe che estende JTable
63 | public LayoutTable(String[][] data, String[] columnNames) {
64 | // Costruttore di JTable
65 | super(data, columnNames);
66 |
67 | // Configura la tabella
68 | configureTable();
69 | }
70 |
71 |
72 | /**
73 | * Configura le proprietà della tabella, inclusi l'altezza delle righe, la larghezza delle colonne,
74 | * l'allineamento delle celle, il colore dei bordi e l'aspetto dell'intestazione.
75 | */
76 | private void configureTable() {
77 | // Metodo per configurare la tabella
78 | // Imposta la dimensione delle righe e colonne
79 | this.setRowHeight(40);
80 | for (int i = 0; i < this.getColumnCount(); i++) {
81 | this.getColumnModel().getColumn(i).setPreferredWidth(100);
82 | }
83 |
84 | // Colore del bordo
85 | Color borderColor = new Color(208, 215, 222);
86 |
87 | // Imposta l'allineamento centrale e aggiungi bordi per tutte le celle
88 | DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer() {
89 | @Override
90 | public Component getTableCellRendererComponent(JTable table, Object value,
91 | boolean isSelected, boolean hasFocus, int row, int column) {
92 | Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
93 | ((JLabel) comp).setHorizontalAlignment(SwingConstants.CENTER);
94 | ((JLabel) comp).setVerticalAlignment(SwingConstants.CENTER);
95 | ((JLabel) comp).setBorder(new LineBorder(borderColor, 1));
96 | return comp;
97 | }
98 | };
99 |
100 | for (int i = 0; i < this.getColumnCount(); i++) {
101 | this.getColumnModel().getColumn(i).setCellRenderer(centerRenderer);
102 | }
103 |
104 | // Personalizza l'intestazione
105 | JTableHeader header = this.getTableHeader();
106 | header.setBackground(new Color(240, 240, 240));
107 | header.setFont(new Font("SansSerif", Font.BOLD, 12));
108 |
109 | // Imposta il renderer personalizzato per l'intestazione
110 | header.setDefaultRenderer(new CustomHeaderRenderer(this.getTableHeader().getDefaultRenderer(), borderColor));
111 | }
112 |
113 | /**
114 | * Renderer personalizzato per l'intestazione della tabella.
115 | * Questo renderer si occupa di personalizzare l'aspetto delle intestazioni delle colonne.
116 | */
117 | static class CustomHeaderRenderer implements TableCellRenderer {
118 | // Renderer personalizzato per l'intestazione della tabella
119 |
120 | private final TableCellRenderer delegate;
121 | private final Color borderColor;
122 |
123 | /**
124 | * Costruttore del renderer personalizzato.
125 | *
126 | * @param delegate il renderer predefinito da delegare
127 | * @param borderColor il colore del bordo per l'intestazione
128 | */
129 | public CustomHeaderRenderer(TableCellRenderer delegate, Color borderColor) {
130 | this.delegate = delegate;
131 | this.borderColor = borderColor;
132 | }
133 |
134 | /**
135 | * Restituisce il componente utilizzato per visualizzare una cella dell'intestazione della tabella.
136 | *
137 | * @param table la tabella a cui appartiene la cella
138 | * @param value il valore della cella
139 | * @param isSelected indica se la cella è selezionata
140 | * @param hasFocus indica se la cella ha il fuoco
141 | * @param row la riga della cella
142 | * @param column la colonna della cella
143 | * @return il componente per visualizzare la cella dell'intestazione
144 | */
145 | @Override
146 | public Component getTableCellRendererComponent(JTable table, Object value,
147 | boolean isSelected, boolean hasFocus, int row, int column) {
148 | Component comp = delegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
149 | comp.setBackground(new Color(240, 240, 240));
150 | comp.setFont(new Font("SansSerif", Font.BOLD, 12));
151 | ((DefaultTableCellRenderer) comp).setHorizontalAlignment(SwingConstants.CENTER);
152 | ((JLabel) comp).setBorder(new LineBorder(borderColor, 1));
153 | return comp;
154 | }
155 | }
156 |
157 | /**
158 | * Aggiorna i dati visualizzati nella tabella.
159 | *
160 | * @param newData i nuovi dati da visualizzare nella tabella
161 | */
162 | public void updateData(String[][] newData) {
163 | // Metodo per aggiornare i dati della tabella
164 |
165 | this.setModel(new javax.swing.table.DefaultTableModel(
166 | newData,
167 | new String[]{"IP", "Classe", "Tipo"}
168 | ));
169 | }
170 |
171 | /**
172 | * Mostra la tabella all'interno di un {@link JFrame}.
173 | */
174 | public void showInFrame() {
175 | // Metodo per mostrare la tabella in un frame
176 |
177 | frame = new JFrame("Tabella IP");
178 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
179 | frame.add(new JScrollPane(this));
180 | frame.setSize(400, 150);
181 | frame.setVisible(true);
182 | }
183 |
184 |
185 | }
186 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/ObjIP.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | /**
41 | * Rappresenta un oggetto IP con un indirizzo IP, un tipo e una classe.
42 | */
43 | class ObjIP {
44 | private String ipAddress;
45 |
46 | /**
47 | * Restituisce l'indirizzo IP dell'oggetto.
48 | *
49 | * @return l'indirizzo IP dell'oggetto
50 | */
51 | public String getIpAddress() {
52 | return ipAddress;
53 | }
54 |
55 | /**
56 | * Imposta l'indirizzo IP dell'oggetto.
57 | *
58 | * @param ipAddress l'indirizzo IP da impostare
59 | */
60 | public void setIpAddress(String ipAddress) {
61 | this.ipAddress = ipAddress;
62 | }
63 |
64 | /**
65 | * Restituisce il tipo dell'oggetto IP.
66 | *
67 | * @return il tipo dell'oggetto IP
68 | */
69 | public String getType() {
70 | return type;
71 | }
72 |
73 | /**
74 | * Imposta il tipo dell'oggetto IP.
75 | *
76 | * @param type il tipo da impostare
77 | */
78 | public void setType(String type) {
79 | this.type = type;
80 | }
81 |
82 | private String type;
83 | private String ipClass;
84 |
85 | /**
86 | * Restituisce la classe dell'oggetto IP.
87 | *
88 | * @return la classe dell'oggetto IP
89 | */
90 | public String getIpClass() {
91 | return ipClass;
92 | }
93 |
94 | /**
95 | * Imposta la classe dell'oggetto IP.
96 | *
97 | * @param ipClass la classe da impostare
98 | */
99 | public void setIpClass(String ipClass) {
100 | this.ipClass = ipClass;
101 | }
102 |
103 | /**
104 | * Costruisce un oggetto {@code ObjIP} con i valori specificati.
105 | *
106 | * @param ipAddress l'indirizzo IP dell'oggetto
107 | * @param type il tipo dell'oggetto IP
108 | * @param ipClass la classe dell'oggetto IP
109 | */
110 | public ObjIP(String ipAddress, String type, String ipClass) {
111 | this.ipAddress = ipAddress;
112 | this.type = type;
113 | this.ipClass = ipClass;
114 | }
115 |
116 | /**
117 | * Restituisce una rappresentazione in formato stringa dell'oggetto {@code ObjIP}.
118 | * La stringa risultante include l'indirizzo IP, il tipo e la classe.
119 | *
120 | * @return una stringa che rappresenta l'oggetto {@code ObjIP}
121 | */
122 | @Override
123 | public String toString() {
124 | return "IP Address: " + ipAddress + "\n" +
125 | " Type: " + type + "\n" +
126 | " Class: " + ipClass;
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/ObjNetIDs.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | /**
41 | * Rappresenta un oggetto che contiene due identificatori di rete.
42 | */
43 |
44 | public class ObjNetIDs {
45 | private String netId1;
46 | private String netId2;
47 |
48 | /**
49 | * Costruisce un oggetto {@code ObjNetIDs} con i valori specificati per gli identificatori di rete.
50 | *
51 | * @param netId1 il primo identificatore di rete
52 | * @param netId2 il secondo identificatore di rete
53 | */
54 | public ObjNetIDs(String netId1, String netId2) {
55 | this.netId1 = netId1;
56 | this.netId2 = netId2;
57 | }
58 |
59 | /**
60 | * Restituisce il primo identificatore di rete.
61 | *
62 | * @return il primo identificatore di rete
63 | */
64 | public String getNetId1() {
65 | return netId1;
66 | }
67 |
68 | /**
69 | * Restituisce il secondo identificatore di rete.
70 | *
71 | * @return il secondo identificatore di rete
72 | */
73 | public String getNetId2() {
74 | return netId2;
75 | }
76 |
77 | /**
78 | * Restituisce una rappresentazione in formato stringa dell'oggetto {@code ObjNetIDs}.
79 | * La stringa risultante include i due identificatori di rete.
80 | *
81 | * @return una stringa che rappresenta l'oggetto {@code ObjNetIDs}
82 | */
83 | @Override
84 | public String toString() {
85 | return "Network IDs:\n" +
86 | " Net ID 1: " + netId1 + "\n" +
87 | " Net ID 2: " + netId2;
88 | }
89 |
90 | /**
91 | * Calcola gli identificatori di rete a partire dagli indirizzi IP e dalle maschere di rete forniti.
92 | * Questo metodo non è implementato e lancia {@code UnsupportedOperationException} se chiamato.
93 | *
94 | * @param ip1 l'indirizzo IP del primo identificatore di rete
95 | * @param sm1 la maschera di rete del primo identificatore di rete
96 | * @param ip2 l'indirizzo IP del secondo identificatore di rete
97 | * @param sm2 la maschera di rete del secondo identificatore di rete
98 | * @return un array di caratteri che rappresentano gli identificatori di rete calcolati
99 | * @throws UnsupportedOperationException se il metodo non è implementato
100 | */
101 | public static char[] calculateNetworkIDs(String ip1, String sm1, String ip2, String sm2) {
102 | // TODO Auto-generated method stub
103 | throw new UnsupportedOperationException("Unimplemented method 'calculateNetworkIDs'");
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/ObjSM.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | /**
41 | * Rappresenta un oggetto che contiene le informazioni relative a una subnet, inclusi ID di rete, maschera di rete,
42 | * gateway, indirizzi di broadcast, primo host e ultimo host.
43 | */
44 | public class ObjSM {
45 | private int subnetIndex;
46 |
47 | /**
48 | * Restituisce l'indice della subnet.
49 | *
50 | * @return l'indice della subnet
51 | */
52 | public int getSubnetIndex() {
53 | return subnetIndex;
54 | }
55 |
56 | /**
57 | * Imposta l'indice della subnet.
58 | *
59 | * @param subnetIndex l'indice della subnet da impostare
60 | */
61 | public void setSubnetIndex(int subnetIndex) {
62 | this.subnetIndex = subnetIndex;
63 | }
64 |
65 | private String networkId;
66 | private String subnetMask;
67 | private String gateway;
68 | private String broadcast;
69 | private String firstHost;
70 | private String lastHost;
71 |
72 | /**
73 | * Costruisce un oggetto {@code ObjSM} con i valori specificati.
74 | *
75 | * @param subnetIndex l'indice della subnet
76 | * @param networkId l'ID di rete
77 | * @param subnetMask la maschera di rete
78 | * @param gateway l'indirizzo del gateway
79 | * @param broadcast l'indirizzo di broadcast
80 | * @param firstHost l'indirizzo del primo host
81 | * @param lastHost l'indirizzo dell'ultimo host
82 | */
83 | public ObjSM(int subnetIndex, String networkId, String subnetMask, String gateway, String broadcast, String firstHost, String lastHost) {
84 | this.subnetIndex = subnetIndex;
85 | this.networkId = networkId;
86 | this.subnetMask = subnetMask;
87 | this.gateway = gateway;
88 | this.broadcast = broadcast;
89 | this.firstHost = firstHost;
90 | this.lastHost = lastHost;
91 | }
92 |
93 | /**
94 | * Restituisce una rappresentazione in formato stringa dell'oggetto {@code ObjSM}.
95 | * La stringa risultante include l'indice della subnet, l'ID di rete, la maschera di rete, l'indirizzo del gateway,
96 | * l'indirizzo di broadcast, il primo host e l'ultimo host.
97 | *
98 | * @return una stringa che rappresenta l'oggetto {@code ObjSM}
99 | */
100 | @Override
101 | public String toString() {
102 | return "Subnet " + subnetIndex + ":\n" +
103 | " Network ID: " + networkId + "\n" +
104 | " Subnet Mask: " + subnetMask + "\n" +
105 | " Gateway: " + gateway + "\n" +
106 | " Broadcast Address: " + broadcast + "\n" +
107 | " First Host: " + firstHost + "\n" +
108 | " Last Host: " + lastHost;
109 | }
110 |
111 | /**
112 | * Restituisce l'ID di rete.
113 | *
114 | * @return l'ID di rete
115 | */
116 | public String getNetworkId() {
117 | return networkId;
118 | }
119 |
120 | /**
121 | * Imposta l'ID di rete.
122 | *
123 | * @param networkId l'ID di rete da impostare
124 | */
125 | public void setNetworkId(String networkId) {
126 | this.networkId = networkId;
127 | }
128 |
129 | /**
130 | * Restituisce la maschera di rete.
131 | *
132 | * @return la maschera di rete
133 | */
134 | public String getSubnetMask() {
135 | return subnetMask;
136 | }
137 |
138 | /**
139 | * Imposta la maschera di rete.
140 | *
141 | * @param subnetMask la maschera di rete da impostare
142 | */
143 | public void setSubnetMask(String subnetMask) {
144 | this.subnetMask = subnetMask;
145 | }
146 |
147 | /**
148 | * Restituisce l'indirizzo del gateway.
149 | *
150 | * @return l'indirizzo del gateway
151 | */
152 | public String getGateway() {
153 | return gateway;
154 | }
155 |
156 | /**
157 | * Imposta l'indirizzo del gateway.
158 | *
159 | * @param gateway l'indirizzo del gateway da impostare
160 | */
161 | public void setGateway(String gateway) {
162 | this.gateway = gateway;
163 | }
164 |
165 | /**
166 | * Restituisce l'indirizzo di broadcast.
167 | *
168 | * @return l'indirizzo di broadcast
169 | */
170 | public String getBroadcast() {
171 | return broadcast;
172 | }
173 |
174 | /**
175 | * Imposta l'indirizzo di broadcast.
176 | *
177 | * @param broadcast l'indirizzo di broadcast da impostare
178 | */
179 | public void setBroadcast(String broadcast) {
180 | this.broadcast = broadcast;
181 | }
182 |
183 | /**
184 | * Restituisce l'indirizzo del primo host.
185 | *
186 | * @return l'indirizzo del primo host
187 | */
188 | public String getFirstHost() {
189 | return firstHost;
190 | }
191 |
192 | /**
193 | * Imposta l'indirizzo del primo host.
194 | *
195 | * @param firstHost l'indirizzo del primo host da impostare
196 | */
197 | public void setFirstHost(String firstHost) {
198 | this.firstHost = firstHost;
199 | }
200 |
201 | /**
202 | * Restituisce l'indirizzo dell'ultimo host.
203 | *
204 | * @return l'indirizzo dell'ultimo host
205 | */
206 | public String getLastHost() {
207 | return lastHost;
208 | }
209 |
210 | /**
211 | * Imposta l'indirizzo dell'ultimo host.
212 | *
213 | * @param lastHost l'indirizzo dell'ultimo host da impostare
214 | */
215 | public void setLastHost(String lastHost) {
216 | this.lastHost = lastHost;
217 | }
218 | }
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/RoundedButton.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.Dimension;
41 | import java.awt.Graphics;
42 | import java.awt.Graphics2D;
43 | import java.awt.RenderingHints;
44 |
45 | import javax.swing.JButton;
46 | /**
47 | * Un pulsante con angoli arrotondati personalizzato.
48 | * La classe estende {@link JButton} e disegna un pulsante con angoli arrotondati.
49 | */
50 | public class RoundedButton extends JButton {
51 |
52 | private int cornerRadius;
53 |
54 | /**
55 | * Costruisce un pulsante con angoli arrotondati.
56 | *
57 | * @param text il testo da visualizzare sul pulsante
58 | * @param radius il raggio degli angoli arrotondati
59 | */
60 | public RoundedButton(String text, int radius) {
61 | super(text);
62 | this.cornerRadius = radius;
63 | setOpaque(false); // Make the button background transparent
64 | }
65 |
66 | /**
67 | * Disegna il componente del pulsante. Il metodo sovrascritto disegna lo sfondo arrotondato e il testo del pulsante.
68 | *
69 | * @param g il contesto grafico da utilizzare per il disegno
70 | */
71 | @Override
72 | protected void paintComponent(Graphics g) {
73 | Graphics2D g2 = (Graphics2D) g.create();
74 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
75 |
76 | // Draw rounded background
77 | g2.setColor(getBackground());
78 | g2.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, cornerRadius, cornerRadius);
79 |
80 | // Draw the button text
81 | super.paintComponent(g);
82 |
83 | g2.dispose();
84 | }
85 |
86 | /**
87 | * Disegna il bordo del pulsante. Questo metodo è lasciato vuoto poiché non è richiesto alcun bordo.
88 | *
89 | * @param g il contesto grafico da utilizzare per il disegno del bordo
90 | */
91 |
92 | @Override
93 | protected void paintBorder(Graphics g) {
94 | // If you want to draw a border, you can do it here
95 | // For now, leaving it empty as no border is required
96 | }
97 |
98 | /**
99 | * Restituisce la dimensione preferita del pulsante. Il metodo sovrascritto aumenta le dimensioni per tenere conto
100 | * del raggio degli angoli arrotondati.
101 | *
102 | * @return la dimensione preferita del pulsante
103 | */
104 | @Override
105 | public Dimension getPreferredSize() {
106 | Dimension size = super.getPreferredSize();
107 | size.width += cornerRadius;
108 | size.height += cornerRadius;
109 | return size;
110 | }
111 |
112 | /**
113 | * Restituisce {@code false} poiché il pulsante è trasparente.
114 | *
115 | * @return {@code false}, rendendo il {@code JButton} stesso trasparente
116 | */
117 | @Override
118 | public boolean isOpaque() {
119 | return false; // Make the JButton itself transparent
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/RoundedLabel.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.Dimension;
41 | import java.awt.Graphics;
42 | import java.awt.Graphics2D;
43 | import java.awt.RenderingHints;
44 |
45 | import javax.swing.JLabel;
46 |
47 | /**
48 | * Una {@code JLabel} con angoli arrotondati personalizzata.
49 | * Questa classe estende {@link JLabel} e disegna un'etichetta con angoli arrotondati.
50 | */
51 | public class RoundedLabel extends JLabel {
52 |
53 | private int cornerRadius;
54 |
55 | /**
56 | * Costruisce un'etichetta con angoli arrotondati.
57 | *
58 | * @param text il testo da visualizzare sull'etichetta
59 | * @param radius il raggio degli angoli arrotondati
60 | */
61 | public RoundedLabel(String text, int radius) {
62 | super(text);
63 | this.cornerRadius = radius;
64 | setOpaque(false); // Rende trasparente lo sfondo del JLabel
65 | }
66 |
67 | /**
68 | * Disegna il componente dell'etichetta. Questo metodo sovrascritto disegna lo sfondo arrotondato e poi il testo dell'etichetta.
69 | *
70 | * @param g il contesto grafico da utilizzare per il disegno
71 | */
72 |
73 | @Override
74 | protected void paintComponent(Graphics g) {
75 | Graphics2D g2 = (Graphics2D) g.create();
76 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
77 |
78 | // Disegna il background arrotondato
79 | g2.setColor(getBackground());
80 | g2.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, cornerRadius, cornerRadius);
81 |
82 | // Disegna il testo centrato
83 | super.paintComponent(g);
84 |
85 | g2.dispose();
86 | }
87 |
88 | /**
89 | * Disegna il bordo dell'etichetta. Questo metodo è lasciato vuoto poiché non è richiesto alcun bordo.
90 | *
91 | * @param g il contesto grafico da utilizzare per il disegno del bordo
92 | */
93 | @Override
94 | protected void paintBorder(Graphics g) {
95 |
96 | }
97 |
98 | /**
99 | * Restituisce la dimensione preferita dell'etichetta. Il metodo sovrascritto aumenta le dimensioni per tenere conto
100 | * del raggio degli angoli arrotondati.
101 | *
102 | * @return la dimensione preferita dell'etichetta
103 | */
104 | @Override
105 | public Dimension getPreferredSize() {
106 | Dimension size = super.getPreferredSize();
107 | size.width += cornerRadius;
108 | size.height += cornerRadius;
109 | return size;
110 | }
111 |
112 | /**
113 | * Restituisce {@code false} poiché l'etichetta è trasparente.
114 | *
115 | * @return {@code false}, rendendo il {@code JLabel} stesso trasparente
116 | */
117 | @Override
118 | public boolean isOpaque() {
119 | return false; // Rende trasparente anche il componente JLabel stesso
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/RoundedPanel.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.BasicStroke;
41 | import java.awt.Color;
42 | import java.awt.Graphics;
43 | import java.awt.Graphics2D;
44 | import java.awt.RenderingHints;
45 | import java.awt.geom.RoundRectangle2D;
46 |
47 | import javax.swing.JPanel;
48 |
49 | /**
50 | * Un {@code JPanel} con bordi arrotondati e opzioni di personalizzazione per il colore di sfondo, il colore del bordo e lo spessore del bordo.
51 | * Questa classe estende {@link JPanel} e disegna un pannello con un angolo arrotondato e un bordo personalizzabile.
52 | */
53 | public class RoundedPanel extends JPanel {
54 | // Classe per un JPanel con bordi arrotondati
55 | private Color borderColor;
56 | private int borderThickness;
57 | private Color backgroundColor;
58 |
59 | /**
60 | * Costruisce un pannello con bordi arrotondati e le specifiche del colore e dello spessore del bordo.
61 | *
62 | * @param backgroundColor il colore di sfondo del pannello
63 | * @param borderColor il colore del bordo del pannello
64 | * @param borderThickness lo spessore del bordo del pannello
65 | */
66 | public RoundedPanel(Color backgroundColor, Color borderColor, int borderThickness) {
67 | this.backgroundColor = backgroundColor;
68 | this.borderColor = borderColor;
69 | this.borderThickness = borderThickness;
70 | setOpaque(false); // Permette al background di mostrarsi
71 | }
72 |
73 | /**
74 | * Disegna il componente del pannello. Questo metodo sovrascritto disegna il background arrotondato e il bordo.
75 | *
76 | * @param g il contesto grafico da utilizzare per il disegno
77 | */
78 | @Override
79 | protected void paintComponent(Graphics g) {
80 | super.paintComponent(g);
81 | int width = getWidth();
82 | int height = getHeight();
83 | Graphics2D graphics = (Graphics2D) g.create();
84 |
85 | // Imposta il rendering per anti-aliasing
86 | graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
87 |
88 | // Crea la forma del pannello con i bordi arrotondati
89 | RoundRectangle2D roundedRectangle = new RoundRectangle2D.Float(
90 | 0, 0, width - 1, height - 1, 24, 24); // 10 è il raggio degli angoli, puoi cambiarlo
91 |
92 | // Disegna il background del pannello
93 | graphics.setColor(backgroundColor);
94 | graphics.fill(roundedRectangle);
95 |
96 | // Disegna il bordo del pannello
97 | graphics.setColor(borderColor);
98 | graphics.setStroke(new BasicStroke(borderThickness));
99 | graphics.draw(roundedRectangle);
100 |
101 | graphics.dispose();
102 | }
103 |
104 | /**
105 | * Avvia un'animazione sul pannello. Questo metodo non è implementato e lancia {@code UnsupportedOperationException} se chiamato.
106 | *
107 | * @throws UnsupportedOperationException se il metodo non è implementato
108 | */
109 | public void startAnimation() {
110 | // TODO Auto-generated method stub
111 | throw new UnsupportedOperationException("Unimplemented method 'startAnimation'");
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/RoundedPanelApp.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.Dimension;
41 | import java.awt.Graphics;
42 | import java.awt.Graphics2D;
43 | import java.awt.RenderingHints;
44 |
45 | import javax.swing.JPanel;
46 |
47 |
48 | /**
49 | * Un {@code JPanel} con uno sfondo arrotondato.
50 | * Questa classe estende {@link JPanel} e disegna un pannello con uno sfondo arrotondato
51 | * utilizzando il raggio degli angoli specificato.
52 | */
53 | public class RoundedPanelApp extends JPanel {
54 | private int cornerRadius;
55 |
56 | /**
57 | * Costruisce un pannello con angoli arrotondati.
58 | *
59 | * @param radius il raggio degli angoli arrotondati
60 | */
61 | public RoundedPanelApp(int radius) {
62 | super();
63 | this.cornerRadius = radius;
64 | setOpaque(false); // Make the panel background transparent
65 | }
66 |
67 | /**
68 | * Disegna il componente del pannello. Questo metodo sovrascritto disegna uno sfondo arrotondato
69 | * utilizzando il raggio degli angoli specificato.
70 | *
71 | * @param g il contesto grafico da utilizzare per il disegno
72 | */
73 | @Override
74 | protected void paintComponent(Graphics g) {
75 | super.paintComponent(g);
76 |
77 | Graphics2D g2 = (Graphics2D) g.create();
78 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
79 |
80 | // Draw rounded rectangle background
81 | g2.setColor(getBackground());
82 | g2.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, cornerRadius, cornerRadius);
83 |
84 | g2.dispose();
85 | }
86 |
87 | /**
88 | * Restituisce la dimensione preferita del pannello. Questo metodo utilizza la dimensione
89 | * preferita della classe {@link JPanel} e non modifica le dimensioni.
90 | *
91 | * @return la dimensione preferita del pannello
92 | */
93 | @Override
94 | public Dimension getPreferredSize() {
95 | return super.getPreferredSize();
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/subnetting/src/main/java/org/subnetting/RoundedTextField.java:
--------------------------------------------------------------------------------
1 | package org.subnetting;/*
2 | Subnet Solver v1.0.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/releases/tag/1.0.0)
3 | Copyright 2024 Vittorio Piotti
4 | Licensed under GPL-3.0 (https://github.com/vittorioPiotti/Subnet-Solver-Java/blob/main/LICENSE.md)
5 | */
6 |
7 | /*
8 | batik-all v1.17 (https://xmlgraphics.apache.org/batik/download.html)
9 | Copyright 2024 The Apache Software Foundation
10 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
11 | */
12 |
13 |
14 | /*
15 | FlatLaf v3.2.5 (https://github.com/JFormDesigner/FlatLaf/releases/tag/3.2.5)
16 | Copyright 2024 JFormDesigner GmbH
17 | Licensed under Apache License 2.0 (https://github.com/JFormDesigner/FlatLaf/blob/main/LICENSE)
18 | */
19 |
20 | /*
21 | xml-apis-ext v1.3.04 (https://xmlgraphics.apache.org/batik/download.html)
22 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
23 | Copyright 2024 The Apache Software Foundation
24 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
25 | */
26 |
27 | /*
28 | xmlgraphics-commons v2.9 (https://xmlgraphics.apache.org/batik/download.html)
29 | Part of Apache Batik (https://xmlgraphics.apache.org/batik/)
30 | Copyright 2024 The Apache Software Foundation
31 | Licensed under Apache License 2.0 (https://xmlgraphics.apache.org/batik/license.html)
32 | */
33 |
34 | /*!
35 | * Bootstrap v5.3.0-alpha3 (https://getbootstrap.com/)
36 | * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
37 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
38 | */
39 |
40 | import java.awt.BasicStroke;
41 | import java.awt.Color;
42 | import java.awt.Graphics;
43 | import java.awt.Graphics2D;
44 | import java.awt.RenderingHints;
45 |
46 | import javax.swing.BorderFactory;
47 | import javax.swing.JTextField;
48 |
49 | /**
50 | * Un {@code JTextField} con bordi arrotondati personalizzati e un bordo colorato.
51 | * Questa classe estende {@link JTextField} e disegna un campo di testo con uno sfondo arrotondato,
52 | * un bordo colorato e uno spessore del bordo specificato.
53 | */
54 | public class RoundedTextField extends JTextField {
55 | private int radius;
56 | private Color borderColor;
57 | private int borderWidth;
58 |
59 | /**
60 | * Costruisce un campo di testo con bordi arrotondati, colore del bordo e spessore del bordo.
61 | *
62 | * @param radius il raggio degli angoli arrotondati
63 | * @param borderColor il colore del bordo
64 | * @param borderWidth lo spessore del bordo
65 | */
66 | public RoundedTextField(int radius, Color borderColor, int borderWidth) {
67 | super();
68 | this.radius = radius;
69 | this.borderColor = borderColor;
70 | this.borderWidth = borderWidth;
71 | setOpaque(false); // To allow custom painting
72 | setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8)); // Add some padding inside the text field
73 | }
74 |
75 | /**
76 | * Disegna il componente del campo di testo. Questo metodo sovrascritto disegna il background arrotondato
77 | * e il bordo colorato intorno al campo di testo.
78 | *
79 | * @param g il contesto grafico da utilizzare per il disegno
80 | */
81 | @Override
82 | protected void paintComponent(Graphics g) {
83 | Graphics2D g2 = (Graphics2D) g.create();
84 | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
85 |
86 | // Paint the rounded rectangle background
87 | g2.setColor(getBackground());
88 | g2.fillRoundRect(0, 0, getWidth(), getHeight(), radius, radius);
89 |
90 | // Paint the border
91 | g2.setColor(borderColor);
92 | g2.setStroke(new BasicStroke(borderWidth));
93 | g2.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, radius, radius);
94 |
95 | g2.dispose();
96 | super.paintComponent(g);
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/subnetting/src/main/resources/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Main-Class: org.subnetting.Main
3 |
4 |
--------------------------------------------------------------------------------
/subnetting/src/main/resources/assets/github-primary.svg:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/subnetting/src/main/resources/assets/github.svg:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/subnetting/src/main/resources/assets/x-circle.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/subnetting/target/classes/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Main-Class: org.subnetting.Main
3 |
4 |
--------------------------------------------------------------------------------
/subnetting/target/classes/assets/github-primary.svg:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/subnetting/target/classes/assets/github.svg:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/subnetting/target/classes/assets/x-circle.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedButton$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedButton$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedButton$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedButton$2.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedButton.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedButton.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedLabel$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedLabel$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedLabel$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedLabel$2.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedLabel$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedLabel$3.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedLabel$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedLabel$4.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedLabel$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedLabel$5.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedLabel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedLabel.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedModal$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedModal$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedModal$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedModal$2.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedModal$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedModal$3.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedModal.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedModal.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedOpacityPanel$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedOpacityPanel$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedOpacityPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedOpacityPanel.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel$2.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel$3.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedRoundedLabel.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedSVG$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedSVG$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedSVG$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedSVG$2.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedSVG$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedSVG$3.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedSVG$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedSVG$4.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedSVG$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedSVG$5.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/AnimatedSVG.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/AnimatedSVG.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/CalcFLSM.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/CalcFLSM.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/CalcIP.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/CalcIP.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/CalcManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/CalcManager.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/CalcNetIDs.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/CalcNetIDs.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/CalcVLSM$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/CalcVLSM$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/CalcVLSM.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/CalcVLSM.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/LayoutTable$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/LayoutTable$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/LayoutTable$CustomHeaderRenderer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/LayoutTable$CustomHeaderRenderer.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/LayoutTable.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/LayoutTable.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$10.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$10.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$11.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$11.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$12.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$12.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$2.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$3.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$4.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$5$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$5$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$5.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$6.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$7$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$7$1.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$7.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$7.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$8.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$8.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main$9.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main$9.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/Main.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/ObjIP.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/ObjIP.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/ObjNetIDs.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/ObjNetIDs.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/ObjSM.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/ObjSM.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/RoundedButton.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/RoundedButton.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/RoundedLabel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/RoundedLabel.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/RoundedPanel.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/RoundedPanel.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/RoundedPanelApp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/RoundedPanelApp.class
--------------------------------------------------------------------------------
/subnetting/target/classes/org/subnetting/RoundedTextField.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vittorioPiotti/SubnettingSolver-Java/132fe03e354e030775b2d4635fc9742c72c4e2d0/subnetting/target/classes/org/subnetting/RoundedTextField.class
--------------------------------------------------------------------------------