Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Window.java// import javax.swing.*; class Window extends JFrame { JPanel pnl = new JPanel(); public static void main(String[]args) { Window gui = new Window() ; }
Window.java//
import javax.swing.*;
class Window extends JFrame { JPanel pnl = new JPanel(); public static void main(String[]args) { Window gui = new Window() ; } public Window() { super("Swing Window"); setSize(500,200); setDefaultCloseOperation(EXIT_ON_CLOSE); add(pnl); setVisible(true); } }
1 Edit a copy of Window.java from page class name in the declaration, the constructor, and the instance statement from "Window" to "Labels" 135, changing the 2 Before the Labels0 constructor, create an Imagelcon object Imagelcon duke new Imagelcon( duke.png" ) ; 3 Next create three JLabel objects to display an image, text, and both text and an image re Label ibl1 = new JLabel( duke ) ; JLabel lb12 = new JLabel( Duke is the friendly mascot of Java technology.") Label ibl3 = new JLabel( "Duke'. , duke , JLabel.CENTER ) ; 4 Inside the Labels0 constructor insert this statement to create a ToolTip for the first label Ibl1.setToolTipText "Duke the Java Mascot" ) 5 align the text centrally be Add these two statements to the third label Ibl3.setHorizontalText Position( JLabel.CENTER) Ibl3.setVerticalTextPosition( JLabel.BOTTOM) lowStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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