The previous tutorial on Custom JList here covers the creation of a simple JList displaying a list of countries. This tutorial introduces the implementation of a custom cell renderer to achieve pretty cool stuff with the JList. Here, the list of countries appear with not just their names, but also their flags. First, we begin by modifying the Country model. We add a variable to hold the name of the country's flag. The flag is added in the same package as the view class. package com. coolcodingtutorials . model ; /** * * @author jaletechs */ public class Country { private String name; private int id; public Country ( int id, String name) { this . name = name; this . id = id; } public String getName () { return name; } public void setName (String name) { this . name = name; } public int getId () { return id; } public void setId ( int id) { this . id = i...
The previous tutorial on Custom JList here covers the creation of a simple JList displaying a list of countries. This tutorial introduces the implementation of a custom cell renderer to achieve pretty cool stuff with the JList. Here, the list of countries appear with not just their names, but also their flags. First, we begin by modifying the Country model. We add a variable to hold the name of the country's flag. The flag is added in the same package as the view class. package com. coolcodingtutorials . model ; /** * * @author jaletechs */ public class Country { private String name; private int id; public Country ( int id, String name) { this . name = name; this . id = id; } public String getName () { return name; } public void setName (String name) { this . name = name; } public int getId () { return id; } public void setId ( int id) { this . id = i...