import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextArea; import javax.swing.border.TitledBorder; public class ImageViewerFrame2 extends JFrame { private static final int FRAME_WIDTH = 500; private static final int FRAME_HEIGHT = 400; private JRadioButton[] radio = new JRadioButton[6]; private ActionListener listener; private JLabel GeneralLocation; private JTextArea PreciseInfo; private JLabel pictureLabel; private String Description; public ImageViewerFrame2() { GeneralLocation = new JLabel("Wonders of the world "); add(GeneralLocation, BorderLayout.NORTH); PreciseInfo = new JTextArea ("" + Description); PreciseInfo.setRows(5); PreciseInfo.setEditable(false); add(PreciseInfo, BorderLayout.SOUTH); pictureLabel = new JLabel(""); add(pictureLabel,BorderLayout.CENTER); class ChoiceListener implements ActionListener { public void actionPerformed(ActionEvent event) { setText(); } } listener = new ChoiceListener(); createControlPanel(); setText(); setSize(FRAME_WIDTH, FRAME_HEIGHT); } public void createControlPanel() { JPanel AreaGroupPanel = createRadioButtons(); JPanel controlPanel = new JPanel(); controlPanel.add(AreaGroupPanel); add(controlPanel, BorderLayout.WEST); } public JPanel createRadioButtons() { ButtonGroup group = new ButtonGroup(); JPanel panel = new JPanel(); for(int i = 0; i < radio.length; ++i) { radio[i] = new JRadioButton("Area " + (i+1)); radio[i].addActionListener(listener); group.add(radio[i]); panel.add(radio[i]); } panel.setBorder(new TitledBorder("SELECT A BUTTON BELOW")); return panel; } public void setText() { String[] imageStr = {"GreatWall.JPG","Taj_Mahal.JPG","MachuPicchu.JPG","ChristRedeemer.JPG","Colosseum.JPG","Petra.JPG"}; for(int i = 0; i < radio.length; ++i) { if(radio[0].isSelected()) { String Description = "You have selected Great Wall of China. The Great Wall of China is a series of fortifications\n made of stone, brick, tamped earth, wood, and other materials, generally built along \n an east-to-west line across the historical northern borders of China in part to \n protect the Chinese Empire or its prototypical states against intrusions by various \n nomadic groups or military incursions by various warlike peoples or forces"; pictureLabel.setIcon(new ImageIcon("http://www.javaprogrammingforums.com/images/imageStr[0]")); PreciseInfo.setText(Description);} else if(radio[1].isSelected()) { String Description = "You have selected Taj Mahal. is a white marble mausoleum located in Agra, Uttar Pradesh, India. \n It was built by Mughal emperor Shah Jahan in memory of his third wife, Mumtaz Mahal. \n The Taj Mahal is widely recognized as the jewel of Muslim art in India and one of the \n universally admired masterpieces of the world's heritage"; pictureLabel.setIcon(new ImageIcon("http://www.javaprogrammingforums.com/images/imageStr[1]")); PreciseInfo.setText(Description); } else if (radio[2].isSelected()) { String Description = "You have selected Machu Picchu. Machu Picchu is located in the Cusco Region of Peru, South America.\n It is situated on a mountain ridge above the Urubamba Valley in Peru, which is 80 \n kilometres (50 mi) northwest of Cusco and through which the Urubamba River flows. \n Most archaeologists believe that Machu Picchu was built as an estate for the Inca emperor\n Pachacuti (1438–1472). Often referred to as the City of the Incas, it is perhaps the most \n familiar icon of Inca civilization"; pictureLabel.setIcon(new ImageIcon("http://www.javaprogrammingforums.com/images/imageStr[2]")); PreciseInfo.setText(Description); } else if (radio[3].isSelected()) { String Description = "You have selected Christ the Redeemer. Chirst the Redeemer is a statue of Jesus Christ in Rio de Janeiro, Brazil; \n considered the largest Art Deco statue in the world and the 5th largest statue of Jesus \n in the world"; pictureLabel.setIcon(new ImageIcon("http://www.javaprogrammingforums.com/images/imageStr[3]")); PreciseInfo.setText(Description); } else if (radio[4].isSelected()) { String Description = "You have selected the Colosseum. The Colosseum is considered one of the greatest \n works of Roman architecture and Roman engineering."; pictureLabel.setIcon(new ImageIcon("http://www.javaprogrammingforums.com/images/imageStr[4]")); PreciseInfo.setText(Description); } else if (radio[5].isSelected()) { String Description = "You have selected Petra. is a historical and archaeological city in the Jordanian \n governorate of Ma'an, that is famous for its rock-cut architecture and water conduit system."; pictureLabel.setIcon(new ImageIcon("http://www.javaprogrammingforums.com/images/imageStr[5]")); PreciseInfo.setText(Description); } } } }
Can someone explain why there aren't any images being outputted?