-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit aa820f1
Showing
26 changed files
with
2,099 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
*.class | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
#*.jar | ||
*.war | ||
*.ear | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
# netbeans : | ||
nbproject/ | ||
build/ | ||
build.xml | ||
test/ | ||
manifest.mf | ||
nbactions.xml | ||
nb-configuration.xml | ||
|
||
# application log : | ||
log/ | ||
|
||
# mac files : | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MIT License | ||
|
||
<<<<<<< HEAD | ||
Copyright (c) 2017 Nafaa Friaa ([email protected]) | ||
======= | ||
Copyright (c) 2017 Nafaa Friaa | ||
>>>>>>> origin/master | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# swing-desktop-starter-1.0.0 | ||
A Sample Swing Database / CRUD Application | ||
|
||
## Description | ||
A sample Swing Database / CRUD Application / MDI (Multi Documents Interface) to help developers quickly start new project... | ||
The application is pre-configured with Maven, Log4j and auto load properties files under `resources` folder. | ||
|
||
## Dev tools | ||
* Java | ||
* JDK 1.8 | ||
* AWT | ||
* Swing | ||
* MDI (Multi Documents Interfaces) | ||
* Maven | ||
* Log4j | ||
* Java Properties config files | ||
* H2 Database | ||
* MySQL | ||
|
||
## Demo | ||
The demo folder contain a built final jar with dependencies that you can run to have an idea on the application : | ||
``` | ||
java -jar swing-database-starter.jar & | ||
``` | ||
## Clone and create your project | ||
To use this code in your project or to start a new application using this approach you can type in terminal : | ||
``` | ||
$ git clone https://github.com/nfriaa/swing-desktop-starter /your-local-path/your-project-name | ||
``` | ||
Also in pom.xml file change : | ||
```xml | ||
<artifactId>swing-database-starter</artifactId> | ||
``` | ||
To : | ||
```xml | ||
<artifactId>your-project-name</artifactId> | ||
``` | ||
|
||
|
||
;-) | ||
``` | ||
__ _ | ||
/ _| (_) | ||
_ __ | |_ _ __ _ __ _ __ _ | ||
| '_ \| _| '__| |/ _` |/ _` | | ||
| | | | | | | | | (_| | (_| | | ||
|_| |_|_| |_| |_|\__,_|\__,_| | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Demo Jar | ||
Download and run this demo jar to view this project in action... | ||
|
||
## run : | ||
``` | ||
java -jar swing-database-starter & | ||
``` | ||
|
||
;-) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>net.isetjb</groupId> | ||
<artifactId>swing-database-starter</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- log4j : --> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>1.2.17</version> | ||
</dependency> | ||
<!-- H2 Database : --> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<version>1.4.194</version> | ||
</dependency> | ||
<!-- MySQL Database : --> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>6.0.6</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<!-- to add executable jar file with manifest file : --> | ||
<build> | ||
|
||
<!-- To parse properties files under resources folder : --> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
|
||
<!-- plugins : --> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
<archive> | ||
<manifest> | ||
<mainClass>net.isetjb.Application</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> <!-- this is used for inheritance merges --> | ||
<phase>package</phase> <!-- bind to the packaging phase --> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2017 Nafaa Friaa ([email protected]). | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
package net.isetjb; | ||
|
||
import net.isetjb.config.I18N; | ||
import net.isetjb.config.PROP; | ||
import net.isetjb.dao.DAOInitializer; | ||
import org.apache.log4j.Logger; | ||
|
||
/** | ||
* Application class. | ||
* | ||
* @author Nafaa Friaa ([email protected]) | ||
*/ | ||
public class Application | ||
{ | ||
final static Logger log = Logger.getLogger(Application.class); | ||
|
||
public static void main(String[] args) | ||
{ | ||
log.info("Initializing the application..."); | ||
|
||
PROP.init(); | ||
I18N.init(); | ||
DAOInitializer.init(); | ||
macosConfig(); | ||
|
||
log.info("Starting " + PROP.getProperty("app.finalName") + " Application..."); | ||
|
||
// display the desktop frame : | ||
new Desktop(); | ||
|
||
log.info("Application " + PROP.getProperty("app.finalName") + " started."); | ||
} | ||
|
||
/** | ||
* Special settting for macOS. | ||
*/ | ||
public static void macosConfig() | ||
{ | ||
if (System.getProperty("os.name").contains("Mac")) | ||
{ | ||
log.debug("Special settings for macOS users..."); | ||
|
||
// take the menu bar off the jframe : | ||
System.setProperty("apple.laf.useScreenMenuBar", "true"); | ||
} | ||
} | ||
} |
Oops, something went wrong.