#jhv.* Class Package
A basic Java class lib for including as submodule into other repos.
Requires Java 1.7+
This is a collection of classes I use for my Java projects. Since I haven't reviewed all classes for Java 1.7 this only a part of it.
Loads a properties file (used for labels) from a locale path. Looks for it first in JAR and if not found in the same external folder.
Loads a image/icon from a file. Looks for it first in JAR and if not found in the same external folder.
Creates folder structures from an array.
Helpers for the GridBagLayout. Contains GridBagPanel and GridBagContraintFactory.
GridBagContraintFactory is for simplify the work with GridBags. It contains several helper functions for creating the most frequently components
Samples:
Direct usage:
// add a checkbox at grid 1,1 with grid width 1
addCheckbox( "label", true, 1, 1, 1 );
Relative usage:
// go to beginning of next line
nextLine();
// add a checkbox at the beginnig of the next line with current grid width
addCheckbox( "label", true, CURRENT, CURRENT, CURRENT );
// go to next x grid position
nextX();
Helpers for SwingWorker. The SerialTaskExecutor executes all its Task in serial order (FIFO). The AbstractSerialTask is a abstract wrapper that supplies you with status label and progress bar handling.
Simple Web View using JavaFX
Abstract classes and interfaces for loading/saving application configurations from an properties file.
A very simple application logger.
A simple javax.script API Wrapper. Designed for JavaScript (Mozilla Rhino), but extendable.
See jhv.util.script.SimpleScriptSample.
Sample for using JXJavaScriptMethod:
// prepare arguments
ArrayList<JXScriptArgument<?>> arr = new ArrayList<JXScriptArgument<?>>();
JXScriptArgument arg1 = JXScriptArgument<Integer>("a", 1);
arr.add(arg1);
JXScriptArgument arg2 = JXScriptArgument<Integer>("b", 2);
arr.add(arg2);
//prepare method with return type integer
JXJavaScriptMethod m = JXJavaScriptMethod(
new JXScriptFactory(),
Integer.class
);
// codesnippet
String snippet = "var c = a + b; return c;";
// invoke script
int val = m.invoke(snippet,arr);
// prints 3
System.out.println(val);
Git BASH:
// adding submodule
git submodule add git@github.com:HerbertV/jhv.git
// init submodule
git submodule init
git submodule update
// change dir to jhv
cd jhv
git checkout master
git pull
Also check Git Book on submodules