Modify code in java so that the split pane displays the appropriate images when the name of the image file is clicked in the left
Modify code in java so that the split pane displays the appropriate images when the name of the image file is clicked in the left pane.
Here are the images to be displayed in order
Denali2.jpg (note that this image was actually displayed on the MSU website last year and the spot is a photo-op for tourists; I prove this with the next .jpg)
Denali.jpg (your's truly at the photo-op spot)
MauiLaPerouseBay.jpg ( this is part of the black lava flow that extends for a kilometer or more beyond the end of the Makena Road
please add any jpg pictures and i will change it please show output !!!!
import java.awt.*; import javax.swing.*; public class PickImage { //----------------------------------------------------------------- // Creates and displays a frame containing a split pane. The // user selects an image name from the list to be displayed. //----------------------------------------------------------------- public static void main(String[] args) { JFrame frame = new JFrame("Pick Image"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel imageLabel = new JLabel(); JPanel imagePanel = new JPanel(); imagePanel.add(imageLabel); imagePanel.setBackground(Color.white); ListPanel imageList = new ListPanel(imageLabel); JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, imageList, imagePanel); sp.setOneTouchExpandable(true); frame.getContentPane().add(sp); frame.pack(); frame.setVisible(true); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started