Skip to content

JavaFX class for generating identicons congruent to Ethereum Wallet’s Identicons

Notifications You must be signed in to change notification settings

mattiamonari/blockies4j

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

blockies4j

This is a simple port of https://github.com/alexvandesande/blockies to a JavaFx Canvas component.

Example

This example is also available in test/BlockiesTest.java

After setup a new JavaFx project, in the start() method it's necessary to instantiate a Layout (e.g. BorderPane) which will be the Parent of the future blockie component.

BorderPane p = new BorderPane();

Then adjust the Scene setting according to your needs and set the current scene of the primaryStage.

Scene scene = new Scene(p, YOUR_WIDTH, YOUR_HEIGHT);
primaryStage.setScene(scene);

Now, instantiate a new blockie. In order to do that, the constructor support 3 types of calls:

blockie = new Blockies("0x00000000219ab540356cBB839Cbe05303d7705Fa", 8, 16); //Create an Identicon using the first parameter as a seed, the second as size and the third as the scale.
blockie = new Blockies("0x00000000219ab540356cBB839Cbe05303d7705Fa");  //Creates an Identicon using the argument as a seed, with default size and scale (resp. 8 and 15).
blockie = new Blockies(); //Creates a random seed Identicon, with default size and scale (resp. 8 and 15).   

Finally, we can add the blockie object to the BorderPane and show the scene:

p.setCenter(blockie);
primaryStage.show();

Result:

Blockie example

About

JavaFX class for generating identicons congruent to Ethereum Wallet’s Identicons

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages