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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:00, vane1161
Aletter or menu command that starts an action when the user presses the designated letter and the alt key together is called what?
Answers: 1
image
Computers and Technology, 22.06.2019 23:00, cchotshot
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
image
Computers and Technology, 23.06.2019 03:50, dondre54
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
image
Computers and Technology, 23.06.2019 10:20, chonawilson4
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
You know the right answer?
Stringset yet again

attached files:

file stringsetguiframes. zip (86.121...

Questions in other subjects:

Konu
Spanish, 05.05.2020 15:01
Konu
Mathematics, 05.05.2020 15:01