1. Introduction

Provides a shortcut for adding flag icons for all counties listed at Wikipedia’s ISO_3166-1_alpha-2 country codes. Icons based on Mark Jame’s FamFamFam Flag Icons.

Country names are i18n aware. The default language is English, there are no additional language versions. Provide a suitable griffon.plugins.flagicons.countrynames_<locale>.properties file for your Locale if you wish to use a different translation for a Country name.

Missing flags

The following country codes have no flags assigned to them because the Flag icon collection does not provide one.

  • AQ - Antartica

  • GG - Guernsey

  • IM - Isle of Man

  • JE - Jersey

Non-standard country names

This plugin assigns the following non standard country names to some additional flags found in the Flag icon set. Be warned that these country codes are not sanctioned by ISO 3166-1 alpha-2.

  • CT - Catalonia

  • EN - England

  • EU - European Union

  • WL - Wales

  • XL - Scotland

Griffon version: 2.2.0

2. Usage

2.1. Swing

The griffon-flag-swing:1.1.0 JAR provides a new Icon class: griffon.swing.support.flagicons.FlagIcon. You may use this class with any Swing component that supports an Icon property.

2.2. JavaFX

The griffon-flag-javafx:1.1.0 JAR provides a new Node class: griffon.javafx.support.flagicons.FlagIcon. You may use this class with any JavaFX control that accepts a graphic property. You may also use the icon directly as it is a subclass of javafx.scene.control.Label.

2.3. Action Resources

Action icons can be set using resources files if the following format is used:

iconClassName|code

Here’s an example using the Swing icon

griffon-app/i18n/messages.properties
org.example.AppController.action.Preferences.icon=griffon.swing.support.flag.FlagIcon|ch

The JavaFX version for the same icon value is

griffon-app/i18n/messages.properties
org.example.AppController.action.Preferences.icon=griffon.javafx.support.flag.FlagIcon|ch

3. Configuration

The plugin delivers artifacts for both Swing and JavaFX. It also contains Groovy enhancements that can be used in combination with the respective UI toolkit DSL (SwingBuilder and GroovyFX).

3.1. Gradle

You have two options for configuring this plugin: automatic and manual.

3.1.1. Automatic

As long as the project has the org.codehaus.griffon.griffon plugin applied to it you may include the following snippet in build.gradle

dependencies {
    griffon 'org.codehaus.griffon.plugins:griffon-flagicons-plugin:1.1.0'
}

The griffon plugin will take care of the rest given its configuration.

3.1.2. Manual

You will need to configure any of the following blocks depending on your setup

Java + Swing
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-flagicons-swing:1.1.0'
}
Java + JavaFX
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-flagicons-javafx:1.1.0'
}
Groovy + Swing
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-flagicons-swing-groovy:1.1.0'
}
Groovy + JavaFX
dependencies {
    compile 'org.codehaus.griffon.plugins:griffon-flagicons-javafx-groovy:1.1.0'
}

3.2. Maven

First configure the griffon-flagicons-plugin BOM in your POM file, by placing the following snippet before the <build> element

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.griffon.plugins</groupId>
            <artifactId>griffon-flagicons-plugin</artifactId>
            <version>1.1.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Next configure dependencies as required by your particular setup

Java + Swing
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-flagicons-swing</artifactId>
</dependency>
Java + JavaFX
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-flagicons-javafx</artifactId>
</dependency>
Groovy + Swing
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-flagicons-swing-groovy</artifactId>
</dependency>
Groovy + JavaFX
<dependency>
    <groupId>org.codehaus.griffon.plugins</groupId>
    <artifactId>griffon-flagicons-javafx-groovy</artifactId>
</dependency>

4. Modules

The following sections display all bindings per module. Use this information to successfully override a binding on your own modules or to troubleshoot a module binding if the wrong type has been applied by the Griffon runtime.

4.1. JavaFX

Module name: flagicons-javafx-groovy

Depends on: javafx-groovy

bind(BuilderCustomizer.class)
    .to(FlagIconsJavaFXBuilderCustomizer.class)
    .asSingleton();

The following nodes will become available on a Groovy View

Node Type

flagIcon

griffon.javafx.support.flagicons.FlagIcon

4.2. Swing

Module name: flagicons-swing-groovy

Depends on: swing-groovy

bind(BuilderCustomizer.class)
    .to(FlagIconsSwingBuilderCustomizer.class)
    .asSingleton();

The following nodes will become available on a Groovy View

Node Type

flagIcon

griffon.swing.support.flagicons.FlagIcon

6. Icon Cheat Sheet

The following table shows all available icons.

Country Code Flag

Andorra

AD

ad

United Arab Emirates

AE

ae

Afghanistan

AF

af

Antigua and Barbuda

AG

ag

Anguilla

AI

ai

Albania

AL

al

Armenia

AM

am

Netherlands Antilles

AN

an

Angola

AO

ao

Antarctica

AQ

aq

Argentina

AR

ar

American Samoa

AS

as

Austria

AT

at

Australia

AU

au

Aruba

AW

aw

Aland Islands

AX

ax

Azerbaijan

AZ

az

Bosnia and Herzegovina

BA

ba

Barbados

BB

bb

Bangladesh

BD

bd

Belgium

BE

be

Burkina Faso

BF

bf

Bulgaria

BG

bg

Bahrain

BH

bh

Burundi

BI

bi

Benin

BJ

bj

Saint Barthelemy

BL

bl

Bermuda

BM

bm

Brunei Darussalam

BN

bn

Bolivia

BO

bo

Brazil

BR

br

Bahamas

BS

bs

Bhutan

BT

bt

Bouvet Island

BV

bv

Botswana

BW

bw

Belarus

BY

by

Belize

BZ

bz

Canada

CA

ca

Cocos (Keeling) Islands

CC

cc

Democratic Republic of the Congo

CD

cd

Central African Republic

CF

cf

Congo

CG

cg

Switzerland

CH

ch

Cote d’Ivoire

CI

ci

Cook Islands

CK

ck

Chile

CL

cl

Cameroon

CM

cm

China

CN

cn

Colombia

CO

co

Costa Rica

CR

cr

Catalonia

CT

ct

Cuba

CU

cu

Cape Verde

CV

cv

Christmas Island

CX

cx

Cyprus

CY

cy

Czech Republic

CZ

cz

Germany

DE

de

Djibouti

DJ

dj

Denmark

DK

dk

Dominica

DM

dm

Dominican Republic

DO

do

Algeria

DZ

dz

Ecuador

EC

ec

Estonia

EE

ee

Egypt

EG

eg

Western Sahara

EH

eh

England

EN

en

Eritrea

ER

er

Spain

ES

es

Ethiopia

ET

et

European Union

EU

eu

Finland

FI

fi

Fiji

FJ

fj

Falkland Islands (Malvinas)

FK

fk

Federated States of Micronesia

FM

fm

Faroe Islands

FO

fo

France

FR

fr

Gabon

GA

ga

United Kingdom

GB

gb

Grenada

GD

gd

Georgia

GE

ge

French Guiana

GF

gf

Guernsey

GG

gg

Ghana

GH

gh

Gibraltar

GI

gi

Greenland

GL

gl

Gambia

GM

gm

Guinea

GN

gn

Guadeloupe

GP

gp

Equatorial Guinea

GQ

gq

Greece

GR

gr

South Georgia and the South Sandwich Islands

GS

gs

Guatemala

GT

gt

Guam

GU

gu

Guinea-Bissau

GW

gw

Guyana

GY

gy

Hong Kong

HK

hk

Heard Island and McDonald Islands

HM

hm

Honduras

HN

hn

Croatia

HR

hr

Haiti

HT

ht

Hungary

HU

hu

Indonesia

ID

id

Ireland

IE

ie

Israel

IL

il

Isle of Man

IM

im

India

IN

in

British Indian Ocean Territory

IO

io

Iraq

IQ

iq

Islamic Republic of Iran

IR

ir

Iceland

IS

is

Italy

IT

it

Jersey

JE

je

Jamaica

JM

jm

Jordan

JO

jo

Japan

JP

jp

Kenya

KE

ke

Kyrgyzstan

KG

kg

Cambodia

KH

kh

Kiribati

KI

ki

Comoros

KM

km

Saint Kitts and Nevis

KN

kn

Democratic People’s Republic of Korea

KP

kp

Republic of Korea

KR

kr

Kuwait

KW

kw

Cayman Islands

KY

ky

Kazakhstan

KZ

kz

Lao People’s Democratic Republic

LA

la

Lebanon

LB

lb

Saint Lucia

LC

lc

Liechtenstein

LI

li

Sri Lanka

LK

lk

Liberia

LR

lr

Lesotho

LS

ls

Lithuania

LT

lt

Luxembourg

LU

lu

Latvia

LV

lv

Libyan Arab Jamahiriya

LY

ly

Morocco

MA

ma

Monaco

MC

mc

Republic of Moldova

MD

md

Montenegro

ME

me

Saint Martin (French part)

MF

mf

Madagascar

MG

mg

Marshall Islands

MH

mh

Macedonia

MK

mk

Mali

ML

ml

Myanmar

MM

mm

Mongolia

MN

mn

Macao

MO

mo

Northern Mariana Islands

MP

mp

Martinique

MQ

mq

Mauritania

MR

mr

Montserrat

MS

ms

Malta

MT

mt

Mauritius

MU

mu

Maldives

MV

mv

Malawi

MW

mw

Mexico

MX

mx

Malaysia

MY

my

Mozambique

MZ

mz

Namibia

NA

na

New Caledonia

NC

nc

Niger

NE

ne

Norfolk Island

NF

nf

Nigeria

NG

ng

Nicaragua

NI

ni

Netherlands

NL

nl

Norway

NO

no

Nepal

NP

np

Nauru

NR

nr

Niue

NU

nu

New Zealand

NZ

nz

Oman

OM

om

Panama

PA

pa

Peru

PE

pe

French Polynesia

PF

pf

Papua New Guinea

PG

pg

Philippines

PH

ph

Pakistan

PK

pk

Poland

PL

pl

Saint Pierre and Miquelon

PM

pm

Pitcairn

PN

pn

Puerto Rico

PR

pr

Occupied Palestinian Territory

PS

ps

Portugal

PT

pt

Palau

PW

pw

Paraguay

PY

py

Qatar

QA

qa

Reunion

RE

re

Romania

RO

ro

Serbia

RS

rs

Russian Federation

RU

ru

Rwanda

RW

rw

Saudi Arabia

SA

sa

Solomon Islands

SB

sb

Seychelles

SC

sc

Sudan

SD

sd

Sweden

SE

se

Singapore

SG

sg

Ascension and Tristan da Cunha Saint Helena

SH

sh

Slovenia

SI

si

Svalbard and Jan Mayen

SJ

sj

Slovakia

SK

sk

Sierra Leone

SL

sl

San Marino

SM

sm

Senegal

SN

sn

Somalia

SO

so

Suriname

SR

sr

South Sudan

SS

ss

Sao Tome and Principe

ST

st

El Salvador

SV

sv

Syrian Arab Republic

SY

sy

Swaziland

SZ

sz

Turks and Caicos Islands

TC

tc

Chad

TD

td

French Southern Territories

TF

tf

Togo

TG

tg

Thailand

TH

th

Tajikistan

TJ

tj

Tokelau

TK

tk

Timor-Leste

TL

tl

Turkmenistan

TM

tm

Tunisia

TN

tn

Tonga

TO

to

Turkey

TR

tr

Trinidad and Tobago

TT

tt

Tuvalu

TV

tv

Taiwan

TW

tw

United Republic of Tanzania

TZ

tz

Ukraine

UA

ua

Uganda

UG

ug

United States Minor Outlying Islands

UM

um

United States

US

us

Uruguay

UY

uy

Uzbekistan

UZ

uz

Holy See (Vatican City State)

VA

va

Saint Vincent and the Grenadines

VC

vc

Venezuela

VE

ve

Virgin Islands, British

VG

vg

Virgin Islands, U.S.

VI

vi

Viet Nam

VN

vn

Vanuatu

VU

vu

Wallis and Futuna

WF

wf

Wales

WL

wl

Samoa

WS

ws

Scotland

XL

xl

Yemen

YE

ye

Mayotte

YT

yt

South Africa

ZA

za

Zambia

ZM

zm

Zimbabwe

ZW

zw