Question
Using DOM or SAX, load an XML file, parse the data and display the data in a Java GUI Applet.
The Weather Reporting Application is a simple JavaFX GUI app (or can be a web based JSP/JSF application as well) that loads an XML data containing weather data for major cities throughout the world.
The application then parses the data, and places all the cities within a pull down menu.
When a user selects a city, the applet displays the high and low temperature, a short description of the current weather conditions and graphical icon indicating one of the six conditions: sunny, partly sunny, partly cloudy, cloudy rain or snow
Solution Preview
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.
import java.awt.Color;import java.awt.Component;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
/**
*
* @author
*/
public class Weather extends JApplet implements ActionListener{
private JLabel title = new JLabel("The Weather Reporter");
private Font font1 = new Font("Ảrial", Font.BOLD, 15);
private Font font2 = new Font("Ảrial", Font.BOLD, 18);
private Font font3 = new Font("Ảrial", Font.BOLD, 12);
private Container con = getContentPane();
private JComboBox<String> selector = new JComboBox<String>();
private ArrayList<City> cities = null;
private ImageIcon image = null;
private City city = null;...
By purchasing this solution you'll be able to access the following files:
Solution.zip.