Display an Image in a New Dialog When a User Enters a Keyword

I am working on a Java Swing application where I want to display an image in a separate dialog when a user enters a specific keyword in a form.
Here’s what I have so far:
A JDialog for the form, with a JTextField where users can input a city name and a button to confirm.
I want the program to check if the input matches a predefined keyword (e.g., 'Barcelona')
If the keyword matches, it should open another JDialog displaying an image of that city (e.g., 'barcelona.jpg')

Any help would be greatly appreciated!!
Was this page helpful?