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
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.3</version> | |
<configuration> | |
<source>1.8</source> | |
<target>1.8</target> | |
</configuration> |
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
GridPane grid = new GridPane(); | |
grid.setHgap(10); | |
grid.setVgap(10); | |
grid.setPadding(new Insets(0, 10, 0, 10)); | |
// Category in column 2, row 1 | |
Text category = new Text("Sales:"); | |
category.setFont(Font.font("Arial", FontWeight.BOLD, 20)); | |
grid.add(category, 1, 0); | |
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
states.add(new Pair<String, String>("AL", "Alabama")); | |
states.add(new Pair<String, String>("AK", "Alaska")); | |
states.add(new Pair<String, String>("AZ", "Arizona")); | |
states.add(new Pair<String, String>("AR", "Arkansas")); | |
states.add(new Pair<String, String>("CA", "California")); | |
states.add(new Pair<String, String>("CO", "Colorado")); | |
states.add(new Pair<String, String>("CT", "Connecticut")); | |
states.add(new Pair<String, String>("DE", "Delaware")); | |
states.add(new Pair<String, String>("DC", "Dist. of Columbia")); | |
states.add(new Pair<String, String>("FL", "Florida")); |
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
provinces.add(new Pair<String, String>("AB", "Alberta")); | |
provinces.add(new Pair<String, String>("BC", "British Columbia")); | |
provinces.add(new Pair<String, String>("MB", "Manitoba")); | |
provinces.add(new Pair<String, String>("NB", "New Brunswick")); | |
provinces.add(new Pair<String, String>("NL", "Newfoundland and Labrador")); | |
provinces.add(new Pair<String, String>("NS", "Nova Scotia")); | |
provinces.add(new Pair<String, String>("NT", "Northwest Territories")); | |
provinces.add(new Pair<String, String>("NU", "Nunavut")); | |
provinces.add(new Pair<String, String>("ON", "Ontario")); | |
provinces.add(new Pair<String, String>("PE", "Prince Edward Island")); |
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
cbType.setConverter( new StringConverter<SigningArgumentsType>() { // enum SigningArgumentsType; defined all caps | |
@Override | |
public String toString(SigningArgumentsType type) { | |
return StringUtils.capitalize(StringUtils.lowerCase(String.valueOf(type))); | |
} | |
@Override | |
public SigningArgumentsType fromString(String type) { | |
return Enum.valueOf(SigningArgumentsType.class, StringUtils.upperCase(type)); |
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
List<String> list = new ArrayList<>(); | |
list.add( "a" ); | |
list.add( "b" ); | |
list.add( "c" ); | |
List<Label> labels = list | |
.stream() | |
.map( Label::new ) | |
.collect(Collectors.toList()); |
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
public class FullScreenApp extends Application { | |
@Override | |
public void start(Stage primaryStage) throws Exception { | |
VBox vbox = new VBox(new Label("Hello, World!")); | |
vbox.setAlignment(Pos.TOP_CENTER); // 0, auto | |
Scene scene = new Scene( vbox ); |
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
data class ClassWithSurrogateKey(val field1 : String, val field2 : Int) { | |
val id = nextId() // always increasing | |
companion object { | |
private var idgen = 1 // faux static class member | |
fun nextId() = idgen++ | |
} | |
} |
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
import com.google.gson.*; | |
import org.apache.commons.lang3.tuple.Pair; | |
import java.lang.reflect.Type; | |
import java.util.List; | |
import java.util.stream.Collector; | |
// | |
// Converts a List of Pair<String, Long> into a JSON array of objects where the key of the Pair is | |
// field name "url" and the value is "fileSize" |
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
<?xml version="1.0"?> | |
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" | |
version="4.0"> | |
</web-app> |
OlderNewer