1.
The
JButton, JTextField, and JComponent classes are defined in the package.
JButton, JTextField, and JComponent classes are defined in the package.
JButton, an will automatically be generated.
ActionEvent s are and . JButtons, JTextFields, and JLabels are all subclasses of .
JFrame class is a subclass of .
ActionEvent s, it must implement the interface.
ActionEvent and an ActionListener() method.
JButton class on Oracleโs Web site: https://docs.oracle.com/javase/8/docs/api/javax/swing/JButton.html. List the signatures of all its constructors.
JTextField. What method should we use and where is this method defined?
JTextField
JButton have an init() method? Explain.
JButton have an add() method? Explain.
JButton named button. Describe what happens, in terms of Javaโs event handling model, when the user clicks the button.
JButton s, initially labeled, โMe first!โ and โMe next!โ Each time the user clicks either button, the labels on both buttons should be exchanged.
JButton s, initially labeled โFirst,โ โSecond,โ and โThird.โ Each time the user clicks one of the buttons, the labels on the buttons should be rotated. Second should get firstโs label, third should get secondโs, and first should get thirdโs label.
JTextField and two JButton s, initially labeled โLeftโ and โRight.โ Each time the user clicks a button, display its label in the JTextField. A JButton()โs label can be gotten with the getText() method.
JFrame by using the setSize(int h, int v) method, where h and v give its horizontal and vertical dimensions pixels. Write a GUI application that contains two JButton s, labeled โBigโ and โSmall.โ Whenever the user clicks on small, set the JFrame's dimensions to 200 ร 100, and whenever the user clicks on big, set the dimensions to 300 ร 200.
JButton is labeled โBig,โ clicking it should give the JFrame its big dimensions.
JFrameโs background color to one of three choices, indicated by buttons. Like all other Java Component s, JFrameโs have an associated background color, which can be set by the following commands: setBackground(Color.red);
setBackground(Color.yellow);
setBackground() method is defined in the Component class, and 13 primary colorsโblack, blue, cyan, darkGray, gray, green, lightGray, magenta, orange, pink, red, white, yellowโare defined in the java.awt.Color class.