Today is Thursday, 9th July 2020

Archive for the ‘How-To’ Category

JSF 2.2 Namespaces – JSF Tutorial

JSF 2.2 introduced a list of namespaces for the JSF components. In the list below, I show the old namespace along with the new one:

Faces Core

Do You Need More Details?

  • Do you need to connect to a database?
  • Display SQL results in a HTML table?
  • Perform SQL insert, updates and deletes?
I have a premium course that shows you how to complete all of these tasks.
  • Database Integration with JDBC
  • Displaying Data in Lists and Tables
  • Validating HTML Forms
  • Implementing Business Logic with Managed Beans
  • Deploying applications with WAR Files
Read more about the premium course at

How to Add Google Maps to Java Swing GUI

One of our readers recently had a question regarding Google Maps and Java Swing. He wanted to know how to use Google Maps inside of a Java Swing GUI application.

There are a number of solution out there. In fact, StackOverflow has a good thread about the various solutions.

There is also a commercial product that provides support for GoogleMaps. The JxBrowser component from is a Swing GUI component that you can add to your application. It provides tight integration with Google Maps and has the same look and feel of the regular GoogleMaps application. The only downside is the product costs money ($$$). You can visit the teamdev website to see sample source code and also get pricing information.

However, if you are looking for a free solution, then you can get basic GoogleMaps support. Note that this is very bare bones … but hey, it is free 🙂

Here’s a simple example that will display a GoogleMap in a Swing application.


import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class GoogleMapsDemo {
	public static void main(String[] args) throws IOException {

		JFrame test = new JFrame("Google Maps");

		try {
			String latitude = "40.714728";
			String longitude = "-73.998672";

			String imageUrl = ""
					+ latitude
					+ ","
					+ longitude
					+ "&zoom=11&size=612x612&scale=2&maptype=roadmap";
			String destinationFile = "image.jpg";

			// read the map image from Google
			// then save it to a local file: image.jpg
			URL url = new URL(imageUrl);
			InputStream is = url.openStream();
			OutputStream os = new FileOutputStream(destinationFile);

			byte[] b = new byte[2048];
			int length;

			while ((length = != -1) {
				os.write(b, 0, length);

		} catch (IOException e) {

		// create a GUI component that loads the image: image.jpg
		ImageIcon imageIcon = new ImageIcon((new ImageIcon("image.jpg"))
				.getImage().getScaledInstance(630, 600,
		test.add(new JLabel(imageIcon));

		// show the GUI window


And here’s the output of the program.





Wrox #7: Java REST Web Services Tutorial Overview

In this video, I will give you an overview of the Java REST Web Services.

Please SUBSCRIBE to my YouTube channel.


Follow luv2code with the links below:

– Website:
– YouTube:
– Twitter:
– Facebook:

Hey Everyone,

You may have noticed that things were quiet around here. Well, a couple of months ago I was hired by Wrox to create video tutorials for the book, 24 Hour Java. I created a total of 73 videos (whew) for the book. So the project took up all of my free time that I normally used for YouTube videos. Anyways, the project is over and now I have some free time on the weekends 🙂

The book’s author is Yakov Fain and he’s an Oracle Java champion. It was a real pleasure working with Yakov on this project.

Wrox gave me permission to publish a small set of the videos on my YouTube channel for promotional purposes. Over the next couple of weeks, I’ll release a new video from the book on my YouTube channel. You can check the playlist here:

If you’re interested in the book, then head over to book’s website using the link below.

Java Programming 24-Hour Trainer, 2nd Edition

Here’s the official blurb about the book.

Quick and painless Java programming with expert multimedia instruction

Java Programming 24-Hour Trainer, 2nd Edition is your complete beginner’s guide to the Java programming language, with easy-to-follow lessons and supplemental exercises that help you get up and running quickly. Step-by-step instruction walks you through the basics of object-oriented programming, syntax, interfaces, and more, before building upon your skills to develop games, web apps, networks, and automations.

This second edition has been updated to align with Java SE 8 and Java EE 7, and includes new information on GUI basics, lambda expressions, streaming API, WebSockets, and Gradle. Even if you have no programming experience at all, the more than six hours of Java programming screencasts will demonstrate major concepts and procedures in a way that facilitates learning and promotes a better understanding of the development process.

This is your quick and painless guide to mastering Java, whether you’re starting from scratch or just looking to expand your skill set. Master the building blocks that go into any Java project Make writing code easier with the Eclipse tools Learn to connect Java applications to databases Design and build graphical user interfaces and web applications Learn to develop GUIs with JavaFX

If you want to start programming quickly, Java Programming 24-Hour Trainer, 2nd Edition is your ideal solution.