Microsoft Windows [Version 10.0.19044.2006] (c) Microsoft Corporation. All rights reserved. C:\Users\rlkraft\Desktop\JavaGUIs>jshell | Welcome to JShell -- Version 11.0.12 | For an introduction type: /help intro jshell> int x = 6 x ==> 6 jshell> x x ==> 6 jshell> double y = 5 y ==> 5.0 jshell> double z = x + y z ==> 11.0 jshell> for (int i = 0; i < 4; ++i) System.out.println(i); 0 1 2 3 jshell> import java.swing.JFrame | Error: | package java.swing does not exist | import java.swing.JFrame; | ^---------------^ jshell> import javax.swing.JFrame jshell> JFrame jf = new JFrame() jf ==> javax.swing.JFrame[frame0,0,0,0x0,invalid,hidden, ... tPaneCheckingEnabled=true] jshell> jf.setVisible(true) jshell> jf.setSize(100,100) jshell> jf.setSize(1000,100) jshell> jf.setVisible(false) jshell> jf.setLocation(500, 500) jshell> jf.setVisible(true) jshell> jf.getLocation() $15 ==> java.awt.Point[x=76,y=176] jshell> jf.getLocation() $16 ==> java.awt.Point[x=392,y=634] jshell> jf.getLocation() $17 ==> java.awt.Point[x=190,y=585] jshell> jf.setLocation(0,0) jshell> jf.getLocation() $19 ==> java.awt.Point[x=0,y=0] jshell> jf.setVisible(true) jshell> jf.setVisible(true) jshell> jf.setVisible(true) jshell> jf.getLocation() $23 ==> java.awt.Point[x=0,y=0] jshell> jf.getLocation() $24 ==> java.awt.Point[x=168,y=324] jshell> jf.getLocation() $25 ==> java.awt.Point[x=168,y=324] jshell> jf.setVisible(false) jshell> jf.setVisible(true) jshell> jf.getLocation() $28 ==> java.awt.Point[x=636,y=277] jshell> jf.getSize() $29 ==> java.awt.Dimension[width=507,height=297] jshell> jf.setVisible(true) jshell> import javax.swing.JButon | Error: | cannot find symbol | symbol: class JButon | import javax.swing.JButon; | ^----------------^ jshell> import javax.swing.JButton jshell> JButton jb = new JButton() jb ==> javax.swing.JButton[,0,0,0x0,invalid,alignmentX=0 ... text=,defaultCapable=true] jshell> jf.add(jb) $33 ==> javax.swing.JButton[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@5bd03f44,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true] jshell> jf.remove(jb) jshell> jf.add(jb) $35 ==> javax.swing.JButton[,0,0,581x295,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@5bd03f44,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true] jshell> jf.remove(jb) jshell> jf.repaint() jshell> jf.add(jb) $40 ==> javax.swing.JButton[,0,0,588x295,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@5bd03f44,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true] jshell> jf.repaint() jshell> jf.remove(jb) jshell> jf.add(jb) $43 ==> javax.swing.JButton[,0,0,588x295,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@5bd03f44,flags=296,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=14,bottom=2,right=14],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=,defaultCapable=true] jshell> jf.repaint() jshell> import java.awt.event.ActionEvent jshell> import java.awt.event.ActionListener jshell> jb.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){System.out.println("Ouch.");}}); jshell> Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch. Ouch.