subject
Computers and Technology, 25.12.2019 03:31 ming8

Stringset yet again

attached files:

file stringsetguiframes. zip (86.121 kb)

in several labs we've written classes that stored and analyzed string objects. the inheritance lesson had stringset revisited and writing classes better had the original stringset. use one of these previously written classes in this program (it doesn't really matter which--they do the same thing).

write a widgetview application. create a class stringanalysis.

this class has an event handler inner class extending widgetviewactionevent

it has instance variables
stringset sset

jtextfield inputstr

jlabel numstr

jlabel numchar

in the constructor,
create a widgetview object

create sset

create a local variable jlabel prompt initialized to "enter a string"

create inputstr with some number of columns

create a local variable jbutton pushme initialized to "push to include string"

create numstr initialized to "number of strings: 0"

create numchar initalized to "number of characters: 0"

create an event handler object and add it as a listener to pushme

add prompt, inputstr, pushme, numstr and numchar to your widgetview object.

your event handler should add inputstr's contents to sset and set inputstr to "". it should update numstr
and numchar labels to contain sset's current information.

note: the same event handler that handles button pushes can, with no modification, handle the key
for a jtextfield. for the adventurous, use inputstr's addactionevent method to add your event handler.
(you can use the same object you added to pushme--you don't even have to create a new one). then run
your program, enter text in the inputstr field, and press the enter key.

note 2: in the writing classes lesson, the anatomy of a java program item said " often want to use
the business logic in multiple contexts. we might want a text-based we might want to also use it
in a graphical user interface (gui), and we'll write things like that before the course is over."
we've just made good on that promise. the stringset class (no matter which incarnation of stringset you
choose to use) was written as part of a text application. we've now incorporated it into a gui application
with no changes at all. in fact, if our development environment was sophisticated enough, we wouldn't even
recompile it. our gui app picked up the stringset class for free.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 23.06.2019 07:50
Apython programming question: assume s is a string of lower case characters. write a program that prints the number of times the string 'bob' occurs in s. for example, if s = 'azcbobobegghakl', then your program should print number of times bob occurs is: 2
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Plz ( which is an example of a good url?
Answers: 1
You know the right answer?
Stringset yet again

attached files:

file stringsetguiframes. zip (86.121...
Questions
question
History, 19.08.2020 18:01
Questions on the website: 13722361