I'm coding a Java program that provides the user with some info on a given element. For example, the user chooses "Hydrogen," and the program gives some info about Hydrogen. I'd like to take the "thumbnail" image from the Wikipedia article associated with the element. Here's an example of the thumbnail image. I know it's asking for a lot, but I'd like to take a String ("Helium," for example) and convert it into ImageIcon that I can put into a JPanel. I've looked at the WikiData API, but I just don't know how to read that in Java. Here's a little sample of what I'm talking about:
import javax.swing.*;
class ImageTest{
public static void main(String args[]){
String elementName = "Hydrogen";
findImage(elementName);
JFrame frame = new JFrame("Frame");
ImageIcon source = new ImageIcon(//blah blah);
JLabel image = new JLabel(source);
frame.add(image);
frame.pack();
frame.setVisible(true);
}
}
Thanks in advance for the input! :)