{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Intro to Java Web-Notes_Part66

Intro to Java Web-Notes_Part66 - add(status...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: add(status); status.set3nabled(false); ReportCliC< handler = new ReportClick(); i : 0; while (i < 10) i buttonsii].addActionListener(handler); i++; 1 Class ReportCliCk implements ActionListener { public void actionPerformed(Action3vent event) 1 JButton btn : (JButton) event.getSource(); String s : btn.getText(); status.setText(s); 1 When run, the following window is created: Exercises 1. Create a Java application that puts 35 text fields in a window. Each text field should be five characters in size. 2. Create a Java application that puts 15 buttons in a window with the names "Button 0", "Button 1", etc. Also show a text field with the initial contents of "Times clicked: 0". Each time a button is clicked the "Times clicked" count goes up by one (i.e., after six buttons have been clicked the text field shows "Times clicked: 6"). 3. Write a program that will act as a simple calculator. Present ten buttons where each button displays a single digit (0 through 9), a non-editable J TextField for showing the current total, and a clear button. Pressing a button will add its value into the running total kept in the J TextField. Clear will set the total back to zero. 4. Create a Java application that puts 15 buttons in a window with the names "Button 0", "Button 1", etc. Whenever a button is clicked the text on the face of the button changes to "Clicked! ”. Home - About Us Copyright © 2006 by Kiowok, Ann Arbor, Michigan, USA ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern