Answered step by step
Verified Expert Solution
Question
1 Approved Answer
int sum(int a, int b, int c) return a b1 class Example3 f oublic static void nain(string argst Parentclass p new Chiloclass) Systen out.printin(p.sun(5, s,
int sum(int a, int b, int c) return a b1 class Example3 f oublic static void nain(string argst Parentclass p new Chiloclass) Systen out.printin(p.sun(5, s, 5) System.out.printin(p.sum(s, s)): System.out.println(p.x); There is a Graphic User Interface program ButtonDemo in the following, with layoat 2. Flow Layout, one text field (type: JTextField, width 20) and two buttons (JButton, manager Kand "Cancel"). When button OK (or Cancel) is clicked, string You clicked Ok !" (or "You clicked Cancel button:") will be shown in the text field. (10 marks) button Button Demo- You clicked an attorn OK Cancel import java, awt,* import java.awt. event. public class ButtonDemo import the whole swing package { private JTextField text; private 3Button okButt, cancelButt; public ButtonDemo() 1f super("Button Deno) setsize(25e, 1ee) Set up the defuult close operation to Exit ON CLOSE c getContentPane(); Container /Set the lay out to FlowLayout managesr text new JTextField(28); okButt-new JButton("OK"); cancelButt new JButton("Cancel"); c.add(text); c.add (okButt); c.add(cancelButt); //Register the listener to the OK button /Register the listener to the Cancel buton /Set the frame to be visible .s. -o
Step 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