Question: 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); } }

Window.java// import javax.swing.*; class Window extends JFrame { JPanel pnl = new

JPanel(); public static void main(String[]args) { Window gui = new Window() ;

J Cro -a ne.VERI' AL COLLBAR LW constant as the argument. 1 Edit a copy of Window.java from page 135, changing the class name in the declaration, the constructor, and the instance statement from "Window to "TextFields" JAVA TextFields.java 2 Before the TextFields0 constructor, create two JTextField obiects TextField txt1 = new JTextField( 38 ) ; TextField txt2 = new JTextField( "Default Text" , 38 ) ; ...cont'd 3 Create a JTextArea object five lines high JTextArea txtArea new JTextArea( 5, 37); 4 Add a JScrollPane object - to contain the JTextArea created in step 3 JScrollPane pane new JScrollPane( txtArea ) ; Beware 5 In the TextFields) constructor method, insert statements to enable the JTextArea object to wrap at word endings txtArea.setLineWrap( true) txtArea.setWrapStyleWord( true) A JTextArea component has no scrolling ability unless it is contained within a JScrollPane comnonent

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!