WEBVTT 00:00:00.000 --> 00:00:10.000 [intro music] 00:00:10.000 --> 00:00:14.000 This presentation is delivered by the Stanford Center for Professional Development. 00:00:22.000 --> 00:00:26.000 It's time to delve into a continuation of our last great topic. Okay? 00:00:26.000 --> 00:00:30.000 So, it's time to continue a bit with our friend the "interactor". 00:00:30.000 --> 00:00:34.000 And if we think about the interactor, an action listener...so last time we talked about 00:00:34.000 --> 00:00:38.000 having buttons and buttons-generated action events. Remember that? 00:00:38.000 --> 00:00:41.000 So we're going to do a brief review of that and push it a little bit further. 00:00:41.000 --> 00:00:46.000 So one of things we talked about is: how in your program, say, in your init method 00:00:46.000 --> 00:00:50.000 somewhere you might have "public void init ()" 00:00:51.000 --> 00:00:54.000 and inside here you would set up sort of the 00:00:54.000 --> 00:00:57.000 parts of your program that you want to actually do something, like, the various 00:00:57.000 --> 00:01:00.000 interactors so that when someone clicks on them something happens 00:01:00.000 --> 00:01:07.000 and then you would say, "add ActionListeners". And what this would do 00:01:07.000 --> 00:01:10.000 is basically say,"Hey I got some buttons in my program, 00:01:10.000 --> 00:01:14.000 I want you to be listening for buttons so when someone clicks on a button, I want you to call 00:01:14.000 --> 00:01:17.000 a particular method for me called 'ActionPerformed' 00:01:17.000 --> 00:01:20.000 and then based on when you call ActionPerformed, I'll figure out what button was clicked 00:01:20.000 --> 00:01:23.000 and then actually do something." Okay? 00:01:23.000 --> 00:01:25.000 So, over here we had our friend 00:01:25.000 --> 00:01:29.000 "public void ActionPerformed" 00:01:29.000 --> 00:01:37.000 And "ActionPerformed" would get as its parameter something called an "ActionEvent". 00:01:37.000 --> 00:01:41.000 And an ActionEvent (we'd just refer to it as "e"), 00:01:41.000 --> 00:01:43.000 was basically what it would check to see 00:01:43.000 --> 00:01:47.000 what action was actually taken or basically which button was actually clicked. Okay? 00:01:47.000 --> 00:01:51.000 So hopefully you remember that. That's a little bit of review from last time. 00:01:51.000 --> 00:01:53.000 Now, when we got this action event we said there are a couple things you could do with it. 00:01:54.000 --> 00:01:58.000 Well, there is actually one main thing we talked about which you could do with it 00:01:58.000 --> 00:02:02.000 and you could figure out which command was actually the thing that caused this action event 00:02:02.000 --> 00:02:05.000 to be generated by saying, "Hey, you know what i want to do?" 00:02:05.000 --> 00:02:09.000 I wanna pull out as a string (and I'll just call it 'cmd' for 'command') 00:02:09.000 --> 00:02:12.000 the command, or, the name of the interactor 00:02:12.000 --> 00:02:15.000 that caused this ActionPerformed method to be called." So here I would say 00:02:15.000 --> 00:02:17.000 e dot 00:02:17.000 --> 00:02:19.000 command equals e dot 00:02:19.000 --> 00:02:22.000 getActionCommand 00:02:22.000 --> 00:02:25.000 and what GetActionCommand does...it's just a method 00:02:25.000 --> 00:02:30.000 of this ActionEvent that says,"Hey, I'll return to you the name of the interactor as a string 00:02:30.000 --> 00:02:33.000 and buttons' names are basically just whatever displays on the button. 00:02:33.000 --> 00:02:38.000 So then I could have some ifs in here based on this command, "if command dot equals" 00:02:38.000 --> 00:02:40.000 and I can check for some name, then I might wanna take some action based on that button. 00:02:42.000 --> 00:02:45.000 It turns out there something else you can ask this ActionEvent e for 00:02:45.000 --> 00:02:47.000 other than the action command 00:02:47.000 --> 00:02:50.000 you saw this very briefly last time in the program that we did and you're going to see it a little bit more now, 00:02:50.000 --> 00:02:54.000 so i want to spend a little bit more time on it 00:02:54.000 --> 00:02:56.000 which is something where you can say, "Hey e, 00:02:56.000 --> 00:03:02.000 what i want to get from you is not the action command, I want to get the source of the action." 00:03:02.000 --> 00:03:07.000 Now the interesting thing about what "getSource" returns to you...actually let me not put the semicolon 00:03:07.000 --> 00:03:09.000 here right now... 00:03:09.000 --> 00:03:12.000 is getSource actually returns to you an object. 00:03:12.000 --> 00:03:17.000 It returns to you the object that caused this event to be generated, which means if a button was clicked 00:03:19.000 --> 00:03:22.000 e.getActionCommand will get the name of the button 00:03:22.000 --> 00:03:27.000 e.getSource will actually give you a reference to the button object. 00:03:27.000 --> 00:03:31.000 So what you're getting back from this is an object. You're getting a reference to that object. 00:03:31.000 --> 00:03:34.000 So, what does that mean for you in, sort of, your everyday life? 00:03:34.000 --> 00:03:37.000 What that means is: over here when you want to set up your initialization 00:03:37.000 --> 00:03:40.000 You could say, "Hey I want to create a button." 00:03:40.000 --> 00:03:42.000 And so i'll have some button i want to create 00:03:42.000 --> 00:03:45.000 so I'll say "new JButton" 00:03:46.000 --> 00:03:49.000 and maybe that button, i want it to say "Hi" on it 00:03:49.000 --> 00:03:54.000 And so one thing I can do is I could say, "hi = new JButton"and "hi" 00:03:54.000 --> 00:03:58.000 what I'm going to do is make that an instance variable 00:03:58.000 --> 00:04:03.000 so somewhere down here in my program where I have my ivars, my instance variables, 00:04:03.000 --> 00:04:11.000 i would have "private JButton hi;" So I just do the declaration of a variable called "Hi" 00:04:11.000 --> 00:04:13.000 which is of type JButton and then in my initialization method 00:04:13.000 --> 00:04:17.000 i actually create that button with the label "Hi" on it 00:04:17.000 --> 00:04:20.000 and then i go ahead and add it somewhere to 00:04:20.000 --> 00:04:25.000 one of the control bars in my programs. So I would say, "add 'hi' maybe to the SOUTH control bar" 00:04:25.000 --> 00:04:27.000 because we really like adding things to the SOUTH control bar 00:04:27.000 --> 00:04:30.000 It's just fun when buttons show up on the bottom of our screen. 00:04:30.000 --> 00:04:33.000 So we say, "Add it there" and then wait for something to happen. 00:04:33.000 --> 00:04:35.000 So add my action listener in case this button gets clicked. 00:04:35.000 --> 00:04:37.000 Now when the button gets clicked over here, 00:04:37.000 --> 00:04:40.000 what i can do 00:04:40.000 --> 00:04:41.000 as i could actually 00:04:41.000 --> 00:04:47.000 ask command to get its name. Right? Or I could ask the action event to get the action command name 00:04:47.000 --> 00:04:52.000 and then i could say something like," if (cmd.equals " 00:04:52.000 --> 00:04:56.000 and the name of the particular button that i created over there happens to be ("Hi"). If it happens to be "Hi" 00:04:57.000 --> 00:05:02.000 then there's something i want to do, like maybe i'd want to print something on the screen or whatever the case may be. 00:05:03.000 --> 00:05:04.000 That's one way i could write this 00:05:04.000 --> 00:05:07.000 and this is kind of the classic way that you've seen it written before. 00:05:07.000 --> 00:05:09.000 Okay? That's the way you saw it last time. 00:05:09.000 --> 00:05:14.000 The other way i can write it with my friend "get source" is: rather than getting the name of the command 00:05:14.000 --> 00:05:16.000 and checking to see if the command is equal to ("Hi") 00:05:16.000 --> 00:05:21.000 i can actually say, "Hey, you know what? Mehran told me about this thing called e.getSource 00:05:21.000 --> 00:05:24.000 as a matter of fact i don't even need this line for command 00:05:24.000 --> 00:05:27.000 anymore let me just comment it out so I don't erase it, okay? 00:05:27.000 --> 00:05:33.000 And I can say, " if (e.getSource ... this returns an object to me 00:05:33.000 --> 00:05:38.000 i want to check to see if that object that it returns is my ("Hi") button 00:05:38.000 --> 00:05:44.000 so here i check directly, is it equal equal to "hi" and then I do whatever I was going to do 00:05:44.000 --> 00:05:48.000 so this has exactly the same effect as before. It's checking to see if I've gotten a button 00:05:48.000 --> 00:05:52.000 that is the "Hi" button that was clicked. Okay? 00:05:52.000 --> 00:05:56.000 so the difference between these two things if you kind of think about them, right?, one of them is 00:05:56.000 --> 00:06:01.000 i'm just using the name is a string and the other ones i'm using the actual object 00:06:01.000 --> 00:06:07.000 Now if you think about more deeply what that means if i think about the name over here, right? 00:06:07.000 --> 00:06:12.000 If i think just in terms of the name i never need to be able to refer to the actual object 00:06:12.000 --> 00:06:15.000 which means that if i don't need to refer to the actual object again over here 00:06:15.000 --> 00:06:20.000 I don't necessarily need it as an instance variable. I only need it as an instance variable if I'm going to refer 00:06:20.000 --> 00:06:24.000 to it again in someplace that's in a different method 00:06:24.000 --> 00:06:26.000 that's some other method i may have already used it in. 00:06:26.000 --> 00:06:31.000 So let me show you an example of what i mean by that in code to make that more concrete. 00:06:31.000 --> 00:06:33.000 Okay, so if we come over here to code 00:06:33.000 --> 00:06:35.000 here's essentially the code i just wrote 00:06:35.000 --> 00:06:39.000 for basically creating a button so it's just the code i wrote on the board, right? 00:06:39.000 --> 00:06:43.000 except I just made the font bigger. i create a button with the name "hi" 00:06:43.000 --> 00:06:47.000 i put in the southern region. I add my action listeners to listen for that button getting clicked. 00:06:47.000 --> 00:06:52.000 When the button gets clicked I say, "Hey. Is the thing that got clicked this button I created?" 00:06:52.000 --> 00:06:54.000 Here i actually called it HiButton. 00:06:54.000 --> 00:06:57.000 instead of just "hi" over there. I shortened it to "hi" so it would take up less board space. 00:06:57.000 --> 00:07:02.000 if it's actually the source of that action is not have my high but not all 00:07:02.000 --> 00:07:04.000 will print out below them 00:07:04.000 --> 00:07:07.000 so i can go ahead and run this program 00:07:07.000 --> 00:07:13.000 and if i run this program this is now i click on get the same thing i saw the four everytime i click on a get 00:07:13.000 --> 00:07:14.000 hello there 00:07:14.000 --> 00:07:17.000 now alternatively i could have written some slightly differently which is the 00:07:17.000 --> 00:07:18.000 way you saw a blast time 00:07:18.000 --> 00:07:21.000 what i can do here as i can say hey 00:07:21.000 --> 00:07:25.000 when i'm going to do the added just go ahead and create that button and add it 00:07:25.000 --> 00:07:29.000 all in one line because i don't need to have some variables it stores the button 00:07:29.000 --> 00:07:35.000 because down here i'd i need to check for the source of 00:07:35.000 --> 00:07:35.000 what that action and that was 00:07:35.000 --> 00:07:37.000 i'm going to have a safe action event 00:07:37.000 --> 00:07:39.000 give me your command 00:07:39.000 --> 00:07:41.000 and the command is going to be the name of the button 00:07:41.000 --> 00:07:45.000 so i no longer need a variable to actually store a reference to the actual 00:07:45.000 --> 00:07:47.000 button object 00:07:47.000 --> 00:07:51.000 because this is going to give me the name whenever i needed and so as a 00:07:51.000 --> 00:07:53.000 result notice your i don't have an instance variable 00:07:53.000 --> 00:07:56.000 so this is one of those things that's a trade-off it also should give you a 00:07:56.000 --> 00:07:59.000 little bit more insight into when you have instance variables were so when you 00:07:59.000 --> 00:08:00.000 don't have instance variables 00:08:00.000 --> 00:08:02.000 you need to have the instance variable 00:08:02.000 --> 00:08:08.000 in the case 00:08:08.000 --> 00:08:11.000 where you need to have 00:08:11.000 --> 00:08:12.000 and i want the new one 00:08:12.000 --> 00:08:13.000 you want the instance variable in the case where 00:08:13.000 --> 00:08:15.000 you want to be able to refer to this variable 00:08:15.000 --> 00:08:17.000 in some method 00:08:17.000 --> 00:08:21.000 it's different then perhaps the method which got created right so i created i 00:08:21.000 --> 00:08:23.000 created the button over here and start somewhere 00:08:23.000 --> 00:08:26.000 but i need to be able to refer to and some other method so it's got to be an 00:08:26.000 --> 00:08:27.000 instance variable 00:08:27.000 --> 00:08:34.000 if i don't need to refer to any other method which is what i saw on the second 00:08:34.000 --> 00:08:35.000 place 00:08:35.000 --> 00:08:36.000 i don't need to report would again here is a matter fact there's no other place 00:08:36.000 --> 00:08:41.000 i need to refer to it after i created then i don't need distorting 00:08:41.000 --> 00:08:52.000 and questions about her 00:08:52.000 --> 00:08:57.000 was so that's about the neurological at the computer shouldn't try to figure out 00:08:57.000 --> 00:08:59.000 which one could if you give it to bond with the same name 00:08:59.000 --> 00:09:01.000 i have no idea 00:09:01.000 --> 00:09:07.000 right and it's going to cause you problems they don't do it if you want to 00:09:07.000 --> 00:09:08.000 see what happens go ahead and dry bread it's a bug in logic not about and what 00:09:08.000 --> 00:09:09.000 the computers executing 00:09:09.000 --> 00:09:19.000 any other questions are gone 00:09:19.000 --> 00:09:21.000 up it's not going to get the actual button so 00:09:21.000 --> 00:09:25.000 you're saying in this other case ever here 00:09:25.000 --> 00:09:29.000 what is this thing going to return if i didn't create a variable over here 00:09:29.000 --> 00:09:32.000 this thing starting to return some reference to your object 00:09:32.000 --> 00:09:35.000 the only issue for you now though is you have no way of checking for equality 00:09:35.000 --> 00:09:39.000 with some object right as you know if you don't have the same instance 00:09:39.000 --> 00:09:42.000 variable you can check to see if that things equal the high button so if you 00:09:42.000 --> 00:09:46.000 created high button over here just immediately added it never kept track of 00:09:46.000 --> 00:09:46.000 it over here 00:09:46.000 --> 00:09:48.000 this guy would return to you 00:09:48.000 --> 99:59:59.999 a pointer too high but menu take right i got appointed a high button how do you 99:59:59.999 --> 99:59:59.999 know it's high button 99:59:59.999 --> 99:59:59.999 you don't because you have no way of comparing it to the actual hot button 99:59:59.999 --> 99:59:59.999 created 99:59:59.999 --> 99:59:59.999 and that's why we need to work 99:59:59.999 --> 99:59:59.999 so why do i show these to differ quite of doing it the reason why i say these 99:59:59.999 --> 99:59:59.999 two different ways of doing it is now you're actually make use of this 99:59:59.999 --> 99:59:59.999 with respect to some other interact or is the tracks and see where we care 99:59:59.999 --> 99:59:59.999 about doing debt source as opposed to you 99:59:59.999 --> 99:59:59.999 the uh... action plan 99:59:59.999 --> 99:59:59.999 so what we're gonna do next 99:59:59.999 --> 99:59:59.999 is going to say you know allot of times and programs that you really want to 99:59:59.999 --> 99:59:59.999 have if you want to have some way of letting the user specified 99:59:59.999 --> 99:59:59.999 some taxed 99:59:59.999 --> 99:59:59.999 in a program that's running interactively that's not consul right 99:59:59.999 --> 99:59:59.999 they'd like to be able to type something and so let me just show you example of 99:59:59.999 --> 99:59:59.999 this 99:59:59.999 --> 99:59:59.999 dvd buchanan 99:59:59.999 --> 99:59:59.999 so you have a program that's got what we refer to as a text feel down here 99:59:59.999 --> 99:59:59.999 and i call that name and so if i say hey my name is maryland 99:59:59.999 --> 99:59:59.999 it says hello maryland 99:59:59.999 --> 99:59:59.999 and then i say are not and i was joking my name is really sally 99:59:59.999 --> 99:59:59.999 most of you don't know this 99:59:59.999 --> 99:59:59.999 as as a hollow sally right so it's just some way of being able to 99:59:59.999 --> 99:59:59.999 have some taxes 99:59:59.999 --> 99:59:59.999 field over here that the user fails and in the senate interact a right this is 99:59:59.999 --> 99:59:59.999 just one fields dot on the console 99:59:59.999 --> 99:59:59.999 and then do some action in the action we have to do here is to write something 99:59:59.999 --> 99:59:59.999 the console 99:59:59.999 --> 99:59:59.999 that makes use of the tax that the 99:59:59.999 --> 99:59:59.999 the use your actually typed in 99:59:59.999 --> 99:59:59.999 so how do we get something like that to work 99:59:59.999 --> 99:59:59.999 so what we need to do is 99:59:59.999 --> 99:59:59.999 av and interact with it's called the text field 99:59:59.999 --> 99:59:59.999 and basically text field is 99:59:59.999 --> 99:59:59.999 is just epping use alright it's a little place where someone can type some text 99:59:59.999 --> 99:59:59.999 isn't interact or such as if it under control bars 99:59:59.999 --> 99:59:59.999 and then potentially one make it enter 99:59:59.999 --> 99:59:59.999 you get some action event that tells you unique actually or if you want you can 99:59:59.999 --> 99:59:59.999 do something with this text 99:59:59.999 --> 99:59:59.999 so that's the basic idea what you really get is a box and that's all you get with 99:59:59.999 --> 99:59:59.999 it if you want to add a label to that box like the added name over here 99:59:59.999 --> 99:59:59.999 we need to sort of specified that 99:59:59.999 --> 99:59:59.999 and i'll show you how to do that in just a second but what you're really get at 99:59:59.999 --> 99:59:59.999 the box in a new types in something 99:59:59.999 --> 99:59:59.999 and then hits began turkey then potentially some of them is generated 99:59:59.999 --> 99:59:59.999 for you 99:59:59.999 --> 99:59:59.999 so how does that actually set up so the thing we want to create is called ej 99:59:59.999 --> 99:59:59.999 text field ok it's just another one of these interact or just like you saw 99:59:59.999 --> 99:59:59.999 before we had checkboxes in combo boxes and all that stuff it's just called it a 99:59:59.999 --> 99:59:59.999 text field 99:59:59.999 --> 99:59:59.999 off named this twenty ab 99:59:59.999 --> 99:59:59.999 to stand for text field 99:59:59.999 --> 99:59:59.999 and what you do when you trade and you want to be easy to use a new g tax to be 99:59:59.999 --> 99:59:59.999 loved and what you've given as a parameter here's the funky thing 99:59:59.999 --> 99:59:59.999 you don't give it its label 99:59:59.999 --> 99:59:59.999 the label doesn't come with the tax till you need to create the label separately 99:59:59.999 --> 99:59:59.999 what you give it is the size of that text feel how big it should be in terms 99:59:59.999 --> 99:59:59.999 of the maximum number of characters that would show up in their so if we say ten 99:59:59.999 --> 99:59:59.999 for example you're saying is i want to have some text you'll get a hold almost 99:59:59.999 --> 99:59:59.999 ten characters and if you some font that's variable with it automatically 99:59:59.999 --> 99:59:59.999 gives you the size of like ten ends kazan is the widest character in case 99:59:59.999 --> 99:59:59.999 you didn't know that's just life in the city 99:59:59.999 --> 99:59:59.999 now the funny thing about this right were let relative to add this action 99:59:59.999 --> 99:59:59.999 performed 99:59:59.999 --> 99:59:59.999 is one the user hits answer 99:59:59.999 --> 99:59:59.999 if i didn't do anything else you would not actually get this call to action 99:59:59.999 --> 99:59:59.999 performed 99:59:59.999 --> 99:59:59.999 we'll because action performed only called for you for buttons 99:59:59.999 --> 99:59:59.999 so what you need to do is after you actually create this text field you need 99:59:59.999 --> 99:59:59.999 to say hey you know what 99:59:59.999 --> 99:59:59.999 i need to let you know about this text field add something that can generate 99:59:59.999 --> 99:59:59.999 actions and so the way you do this is a looks a little bit funky 99:59:59.999 --> 99:59:59.999 would you tell the tax field 99:59:59.999 --> 99:59:59.999 not and 99:59:59.999 --> 99:59:59.999 action listeners 99:59:59.999 --> 99:59:59.999 bits to pay 99:59:59.999 --> 99:59:59.999 you don't need to worry about all that blood is that actually mean at a very 99:59:59.999 --> 99:59:59.999 low level all you need to know if you're telling 99:59:59.999 --> 99:59:59.999 this text field 99:59:59.999 --> 99:59:59.999 hey guess what 99:59:59.999 --> 99:59:59.999 you're going to be able to generate actions now and the thing that you're 99:59:59.999 --> 99:59:59.999 going to let people know when you generate some actions is yourself which 99:59:59.999 --> 99:59:59.999 is why we pass this 99:59:59.999 --> 99:59:59.999 but anytime you create excel the youngest do this once for all text of 99:59:59.999 --> 99:59:59.999 the via multiple text fields 99:59:59.999 --> 99:59:59.999 you need to send this add action listener this 99:59:59.999 --> 99:59:59.999 message 99:59:59.999 --> 99:59:59.999 each one independently we only have one year so we only need to do it once here 99:59:59.999 --> 99:59:59.999 but what this basically gaza says 99:59:59.999 --> 99:59:59.999 auto text field 99:59:59.999 --> 99:59:59.999 that you can now generate these action events as well 99:59:59.999 --> 99:59:59.999 so after you created any sort of set up this line and you would want to add it 99:59:59.999 --> 99:59:59.999 some more inter program write to someone your program you would probably say 99:59:59.999 --> 99:59:59.999 bad 99:59:59.999 --> 99:59:59.999 kidnapped and we might add ginsburg's ample in the south as we had everything 99:59:59.999 --> 99:59:59.999 in the south 99:59:59.999 --> 99:59:59.999 when someone takes something and it's yep and hits internet will generate some 99:59:59.999 --> 99:59:59.999 call to action event for prefer action performed pasternak shanavas 99:59:59.999 --> 99:59:59.999 once that gets set up 99:59:59.999 --> 99:59:59.999 how do you actually say grout 99:59:59.999 --> 99:59:59.999 what was the text field that generated this about right because you could have 99:59:59.999 --> 99:59:59.999 multiple text feels that someone could have typed into it hit the enter key 99:59:59.999 --> 99:59:59.999 what you're doing teary-eyed use your friend if you just dot me dot get sore 99:59:59.999 --> 99:59:59.999 so inside here which are to say is 99:59:59.999 --> 99:59:59.999 he died gets worse 99:59:59.999 --> 99:59:59.999 is people equal to so yeah 99:59:59.999 --> 99:59:59.999 and at this point all kinds of warning bells should go out for you and so maybe 99:59:59.999 --> 99:59:59.999 inside here you won't be something like you want to print len 99:59:59.999 --> 99:59:59.999 where you want to say hi and then add to it the tax that's in that text box in 99:59:59.999 --> 99:59:59.999 the way you do that as you just say the name of whatever the text field is and 99:59:59.999 --> 99:59:59.999 the message you sended is get taxed and what it will give you back 99:59:59.999 --> 99:59:59.999 act is it will just returned to you this thing by it's not just returns a string 99:59:59.999 --> 99:59:59.999 of whatever's in that box on the user enter 99:59:59.999 --> 99:59:59.999 so that's all right out hike and then whatever text they type in just like you 99:59:59.999 --> 99:59:59.999 saw on the program except that was writing hello 99:59:59.999 --> 99:59:59.999 and maybe that's what we want to do 99:59:59.999 --> 99:59:59.999 but the warning bells it should be going off now what's the problem if i've just 99:59:59.999 --> 99:59:59.999 written the code like this 99:59:59.999 --> 99:59:59.999 it's not an instance variable writes i have no way if this is my payment method 99:59:59.999 --> 99:59:59.999 over here i have no way of being able to report that's me up again 99:59:59.999 --> 99:59:59.999 out here 99:59:59.999 --> 99:59:59.999 so i need to create the instance variable right if this is my new method 99:59:59.999 --> 99:59:59.999 public void in eight in front of him 99:59:59.999 --> 99:59:59.999 what i need to do is this year somewhere else in my class let's say over here 99:59:59.999 --> 99:59:59.999 which is where i declare my art bar's right which is just lower down in the 99:59:59.999 --> 99:59:59.999 class umar 99:59:59.999 --> 99:59:59.999 i need to actually have prided 99:59:59.999 --> 99:59:59.999 jamie 99:59:59.999 --> 99:59:59.999 packs 99:59:59.999 --> 99:59:59.999 field 99:59:59.999 --> 99:59:59.999 grossly out and then over here rather than declaring it 99:59:59.999 --> 99:59:59.999 i'd just create the new thier so i need to set it up with an instance variable 99:59:59.999 --> 99:59:59.999 okay just like this on the example of the button same kind of thing that's 99:59:59.999 --> 99:59:59.999 going on here 99:59:59.999 --> 99:59:59.999 except the surtax feels 99:59:59.999 --> 99:59:59.999 so let me show you an example of this code inaction 99:59:59.999 --> 99:59:59.999 so here's a little text field example what i want to do is i'm going to create 99:59:59.999 --> 99:59:59.999 next and the consul program some so i don't have a console 99:59:59.999 --> 99:59:59.999 in my hand nick i'm going to have 99:59:59.999 --> 99:59:59.999 something called name field what's name field it's just a private j text field 99:59:59.999 --> 99:59:59.999 right it's an instance variable so i can save off name field 99:59:59.999 --> 99:59:59.999 name field i a nationwide over here to be some new jerry text field of site and 99:59:59.999 --> 99:59:59.999 write is exactly what i just saw over there 99:59:59.999 --> 99:59:59.999 now when i also want to do here is the one actor funk innocent program i want 99:59:59.999 --> 99:59:59.999 to give that box a label so before i add this box to my control bar 99:59:59.999 --> 99:59:59.999 i'm gonna adding new jail able with jess says names all j label does it just says 99:59:59.999 --> 99:59:59.999 hey i'm going to create something that's just this name 99:59:59.999 --> 99:59:59.999 or just this particular these attacks attacks happens to be named and i'm 99:59:59.999 --> 99:59:59.999 going to add 99:59:59.999 --> 99:59:59.999 to my southern control bar 99:59:59.999 --> 99:59:59.999 so forth it's just going to write name out there and then after i write name 99:59:59.999 --> 99:59:59.999 i'm going to add to my name field which is going to create the box after name 99:59:59.999 --> 99:59:59.999 and then i'm going to show you you know i'm going to do exactly what i told you 99:59:59.999 --> 99:59:59.999 where you have to tell me name field 99:59:59.999 --> 99:59:59.999 you're going to add action listeners of yourself 99:59:59.999 --> 99:59:59.999 so that if you do anything 99:59:59.999 --> 99:59:59.999 you're going to let 99:59:59.999 --> 99:59:59.999 someone else know that you actually have done some action when the user tight 99:59:59.999 --> 99:59:59.999 since you would please enter 99:59:59.999 --> 99:59:59.999 that means action performed is going to get called for you because now you're 99:59:59.999 --> 99:59:59.999 going to be able to generate events to an action listener 99:59:59.999 --> 99:59:59.999 and inaction performed 99:59:59.999 --> 99:59:59.999 we check you don't get source we can compare against name field 'cause we 99:59:59.999 --> 99:59:59.999 have that saved up down here is an instance variable 99:59:59.999 --> 99:59:59.999 and will just right out hello and then the text assisted with name field 99:59:59.999 --> 99:59:59.999 and money 99:59:59.999 --> 99:59:59.999 increase the tax eyes here 99:59:59.999 --> 99:59:59.999 just so it's a little bit bigger and we can all see what's actually going on set 99:59:59.999 --> 99:59:59.999 for one 99:59:59.999 --> 99:59:59.999 of the wild favorite career twenty four 99:59:59.999 --> 99:59:59.999 aquino na make a bigger 99:59:59.999 --> 99:59:59.999 yeah the asset just in case victor 99:59:59.999 --> 99:59:59.999 so here once again they're on 99:59:59.999 --> 99:59:59.999 hello marilyn c and one in those it's getting a bit like it in a row right 99:59:59.999 --> 99:59:59.999 enter entertainer entertainers that exerc entertainer 99:59:59.999 --> 99:59:59.999 that's another one of things it's only so much fun 99:59:59.999 --> 99:59:59.999 trying to sell these were scroll emerge from one 99:59:59.999 --> 99:59:59.999 not a lot of time going on their why does this gap of about two minutes maybe 99:59:59.999 --> 99:59:59.999 one 99:59:59.999 --> 99:59:59.999 so we can do it we can go ahead and do it this way now you can get information 99:59:59.999 --> 99:59:59.999 pentax box 99:59:59.999 --> 99:59:59.999 any questions about text box 99:59:59.999 --> 99:59:59.999 behind the back 99:59:59.999 --> 99:59:59.999 yeah so basically the way layout works is every time you add things they just 99:59:59.999 --> 99:59:59.999 get added sequentially from left to right in whichever region you're adding 99:59:59.999 --> 99:59:59.999 them to in this case the southern region and the whole set of stuff gets honored 99:59:59.999 --> 99:59:59.999 so if you want to space stuff out which actually need to do our ad for example 99:59:59.999 --> 99:59:59.999 more more j labels that might have to spaces in the mental creates more space 99:59:59.999 --> 99:59:59.999 between stuff and there's no economic are just leave it here 99:59:59.999 --> 99:59:59.999 ikea 99:59:59.999 --> 99:59:59.999 so here's what i think india that's kinda funky is we can actually name of 99:59:59.999 --> 99:59:59.999 the text field 99:59:59.999 --> 99:59:59.999 you might say but maryland this won't get source thing yeah yeah keep around 99:59:59.999 --> 99:59:59.999 the instance there but i'm not so keen on that 99:59:59.999 --> 99:59:59.999 what i am comwork you not is giving things name so i can just refer to them 99:59:59.999 --> 99:59:59.999 by their name inside ok thats cool you can you can have a name 99:59:59.999 --> 99:59:59.999 so here that exact same example just slightly differently what i want to do 99:59:59.999 --> 99:59:59.999 is on the air 99:59:59.999 --> 99:59:59.999 had just one more line here so this is exactly the same code i had before 99:59:59.999 --> 99:59:59.999 except after i create the name field i say hey name field 99:59:59.999 --> 99:59:59.999 i want to give you an action need 99:59:59.999 --> 99:59:59.999 and that were an action command and your action command is going to be name 99:59:59.999 --> 99:59:59.999 so whenever you generate these events yeah i can check to see if your sources 99:59:59.999 --> 99:59:59.999 actually but the source of that event is you 99:59:59.999 --> 99:59:59.999 or if i've given you a name 99:59:59.999 --> 99:59:59.999 i can do the same thing i just did with buttons which is down here i can get 99:59:59.999 --> 99:59:59.999 action command that gives me the string which is the name of the object the 99:59:59.999 --> 99:59:59.999 created this event 99:59:59.999 --> 99:59:59.999 and i can see if it's equal to name which is the name that i gave it 99:59:59.999 --> 99:59:59.999 so that's just showed you a little back and forth with buttons i kinda showed 99:59:59.999 --> 99:59:59.999 you got for it with buttons you just need them cuz you always name buttons 99:59:59.999 --> 99:59:59.999 will check against names 99:59:59.999 --> 99:59:59.999 but you could actually 99:59:59.999 --> 99:59:59.999 check against the source of the button if you want to 99:59:59.999 --> 99:59:59.999 gatech still just kinda backwards j text field you always 99:59:59.999 --> 99:59:59.999 in some sense have the tax field that you can get with debt source but if you 99:59:59.999 --> 99:59:59.999 want to report will by name you have to explicitly given name because name 99:59:59.999 --> 99:59:59.999 doesn't show up as part of it right if we want the label we still need to add 99:59:59.999 --> 99:59:59.999 the separate label name over here 99:59:59.999 --> 99:59:59.999 this is just naming the particular events that come from that box that's 99:59:59.999 --> 99:59:59.999 all it does 99:59:59.999 --> 99:59:59.999 answer any questions about them 99:59:59.999 --> 99:59:59.999 at the max max shows 99:59:59.999 --> 99:59:59.999 oss 99:59:59.999 --> 99:59:59.999 yen named feel the stand i've are here it's really actually no longer necessary 99:59:59.999 --> 99:59:59.999 cuz i don't need to refer to it over here so if i wanted to make it just is 99:59:59.999 --> 99:59:59.999 deep sting little campaigns spank sidebars thanks for playing that's real 99:59:59.999 --> 99:59:59.999 nice of you 99:59:59.999 --> 99:59:59.999 and everything's 99:59:59.999 --> 99:59:59.999 although i can't 99:59:59.999 --> 99:59:59.999 that's why i did in here cause i still need to refer to it over here to get its 99:59:59.999 --> 99:59:59.999 what i could to be honest actually what i could do is i could just 99:59:59.999 --> 99:59:59.999 call you get source here and get it source and get it stacks i really don't 99:59:59.999 --> 99:59:59.999 need to 99:59:59.999 --> 99:59:59.999 but it is better stock that makes it clear that i'm getting the texture so 99:59:59.999 --> 99:59:59.999 there is a way around it 99:59:59.999 --> 99:59:59.999 but the cleaner ways to actually do it this way 99:59:59.999 --> 99:59:59.999 already 99:59:59.999 --> 99:59:59.999 get rid of the declaration 99:59:59.999 --> 99:59:59.999 that's like c 99:59:59.999 --> 99:59:59.999 sang questions about that j text field 99:59:59.999 --> 99:59:59.999 uh... yeah 99:59:59.999 --> 99:59:59.999 on weekends 99:59:59.999 --> 99:59:59.999 and i'll show you that no about twenty minutes 99:59:59.999 --> 99:59:59.999 but hand free seats away so before we get there 99:59:59.999 --> 99:59:59.999 it's not something completely different 99:59:59.999 --> 99:59:59.999 and i think it's completely different is this a how to get to the question in the 99:59:59.999 --> 99:59:59.999 back of the room which is 99:59:59.999 --> 99:59:59.999 and they're on these things are all sort of showing up centered on the bottom of 99:59:59.999 --> 99:59:59.999 the screen cut i actually have these enter actor is laid out a different way 99:59:59.999 --> 99:59:59.999 than this way that they're getting laid out for me and in fact you can and 99:59:59.999 --> 99:59:59.999 strangely enough the thing you used to do that is called a layout 99:59:59.999 --> 99:59:59.999 so i'll let you know controls the layout a particular interactions now it turns 99:59:59.999 --> 99:59:59.999 out when you use your friendly console program 99:59:59.999 --> 99:59:59.999 or your friend of the graphics program 99:59:59.999 --> 99:59:59.999 what you got was a layout was called the border layouts and he was a matter of 99:59:59.999 --> 99:59:59.999 fact artists on the border layouts 99:59:59.999 --> 99:59:59.999 you saw the boarder layout last time it looked like this 99:59:59.999 --> 99:59:59.999 which is you had some cena region you had a north south east and west borders 99:59:59.999 --> 99:59:59.999 which is why this thing called a border layout 99:59:59.999 --> 99:59:59.999 and what you 99:59:59.999 --> 99:59:59.999 what happened with that 99:59:59.999 --> 99:59:59.999 what happened with this border layouts 99:59:59.999 --> 99:59:59.999 powerpoint wants comply 99:59:59.999 --> 99:59:59.999 it at the center was were all the action takes place 99:59:59.999 --> 99:59:59.999 the console program would add a console to the sensor automatically right that 99:59:59.999 --> 99:59:59.999 is what happens in a consul program and a graphics program would added g canvas 99:59:59.999 --> 99:59:59.999 to the center automatically which is what you're going to draw your stuff 99:59:59.999 --> 99:59:59.999 and the other regions are only visible if you add stuff to them so in the very 99:59:59.999 --> 99:59:59.999 early days when you had a graphics program 99:59:59.999 --> 99:59:59.999 that was all just graphics you would say hey mera nothing showed up at is the 99:59:59.999 --> 99:59:59.999 self region 99:59:59.999 --> 99:59:59.999 yeah 'cause we didn't put any interact or if they are so 99:59:59.999 --> 99:59:59.999 these enter actor region's only show up if we actually put in a raptor on 99:59:59.999 --> 99:59:59.999 rightly said these are referred to as control bar say saudis last time 99:59:59.999 --> 99:59:59.999 so how do i consider different kinds of layouts so there's a couple of other 99:59:59.999 --> 99:59:59.999 layout also think about their something called a greed layout 99:59:59.999 --> 99:59:59.999 and and the land grant layout works is you actually creighton object called 99:59:59.999 --> 99:59:59.999 agreed to lay out and you specify inaccurate lay out how many rows and 99:59:59.999 --> 99:59:59.999 columns are in the great layout so 99:59:59.999 --> 99:59:59.999 we might take you rosen three columns which means we're going to have a laying 99:59:59.999 --> 99:59:59.999 out the look something like this is just a grade with two rooms in three columns 99:59:59.999 --> 99:59:59.999 and i say that the code for this in just two seconds and then the nitty-gritty 99:59:59.999 --> 99:59:59.999 details 99:59:59.999 --> 99:59:59.999 but conceptually here's what it is 99:59:59.999 --> 99:59:59.999 now when i had i'd ims so what i do as i say hey you know what i want to set my 99:59:59.999 --> 99:59:59.999 layout to leave is great layout 99:59:59.999 --> 99:59:59.999 what now happens when i had i done is is it will add items the items being the 99:59:59.999 --> 99:59:59.999 interact urs 99:59:59.999 --> 99:59:59.999 one-by-one starting at the top most role in the leftmost center in the last most 99:59:59.999 --> 99:59:59.999 square 99:59:59.999 --> 99:59:59.999 and every time i add a new element it moved over by one until i get to the end 99:59:59.999 --> 99:59:59.999 of the row and then it automatically comes down so go sequentially across row 99:59:59.999 --> 99:59:59.999 by roe 99:59:59.999 --> 99:59:59.999 but allows me to contemplate things that may grade 99:59:59.999 --> 99:59:59.999 if i want to actually be able to do things and agreed so let me show you an 99:59:59.999 --> 99:59:59.999 example of what a grid layout might look like 99:59:59.999 --> 99:59:59.999 world on with you lou died 99:59:59.999 --> 99:59:59.999 so great layout 99:59:59.999 --> 99:59:59.999 here's a simple program it has a great layout what we do is we start off 99:59:59.999 --> 99:59:59.999 inordinate method by saying 99:59:59.999 --> 99:59:59.999 hey you know what i want to create a layout 99:59:59.999 --> 99:59:59.999 so i want to set the existing layout that the program is going to use to be a 99:59:59.999 --> 99:59:59.999 new grid layout that's to come at three to rose by three columns 99:59:59.999 --> 99:59:59.999 now one thing that's interesting about this program if you look at great layout 99:59:59.999 --> 99:59:59.999 example 99:59:59.999 --> 99:59:59.999 it does not extend consul program 99:59:59.999 --> 99:59:59.999 it does not extend graphics program these are not expiry of four house and 99:59:59.999 --> 99:59:59.999 it's beautiful life and it's beautiful children 99:59:59.999 --> 99:59:59.999 what have i done 99:59:59.999 --> 99:59:59.999 what i've done is set i'm just going to extend the program i don't want you to 99:59:59.999 --> 99:59:59.999 create a console for me and i don't want you to create a g canvas for me 99:59:59.999 --> 99:59:59.999 cuz i want to take up the whole story with my barnes baby 99:59:59.999 --> 99:59:59.999 so that's what i'm gonna do 99:59:59.999 --> 99:59:59.999 almanac 99:59:59.999 --> 99:59:59.999 six new buttons and these bonds are just going to get sequentially ad in the 99:59:59.999 --> 99:59:59.999 order you just saw and then i'm not saying a tad weiss action listeners 99:59:59.999 --> 99:59:59.999 and i'm not going to do anything understanding or the buttons but what i 99:59:59.999 --> 99:59:59.999 really the reason why i'm doing this 99:59:59.999 --> 99:59:59.999 is i just want to see some big fab but 99:59:59.999 --> 99:59:59.999 on the air like that 99:59:59.999 --> 99:59:59.999 six buttons that take up to the whole scream 99:59:59.999 --> 99:59:59.999 it's a good 99:59:59.999 --> 99:59:59.999 my enter actors filled up the graded 99:59:59.999 --> 99:59:59.999 the layout takes up as much space as possible in the screen and more 99:59:59.999 --> 99:59:59.999 importantly each of the interac yours that i put into agreed cell takes up as 99:59:59.999 --> 99:59:59.999 much cell as much space and the cell as possible so there's one comes along and 99:59:59.999 --> 99:59:59.999 says 99:59:59.999 --> 99:59:59.999 all yeah i got so much space on lay down your likely why why do you do this is 99:59:59.999 --> 99:59:59.999 the most bring everything ever i don't hahahaha 99:59:59.999 --> 99:59:59.999 lying 99:59:59.999 --> 99:59:59.999 didn't have any plan that separately 99:59:59.999 --> 99:59:59.999 driving everyone talk about a right now 99:59:59.999 --> 99:59:59.999 maybe afterwards 99:59:59.999 --> 99:59:59.999 such as frightening as like avnet sound effects got 99:59:59.999 --> 99:59:59.999 check this out as i resize the window all bein small uncw big buttons 99:59:59.999 --> 99:59:59.999 that's why we 99:59:59.999 --> 99:59:59.999 have layout managers because the layout manager just gives conceptually says 99:59:59.999 --> 99:59:59.999 this is how your layouts going to be 99:59:59.999 --> 99:59:59.999 and it says i'm going to handle all the dynamics of resizing and all that stuff 99:59:59.999 --> 99:59:59.999 for ups_ people resize the window 99:59:59.999 --> 99:59:59.999 but i need to know how things are laid out and if you give me more space 99:59:59.999 --> 99:59:59.999 then i need to understand the take it out 99:59:59.999 --> 99:59:59.999 great layout not so useful page or something to seize taken if you see in 99:59:59.999 --> 99:59:59.999 the book you know it's talking about 99:59:59.999 --> 99:59:59.999 there's another kind of layout 99:59:59.999 --> 99:59:59.999 which is called a table layout 99:59:59.999 --> 99:59:59.999 so that's another kind of lay out all the flow layout when i can talk about it 99:59:59.999 --> 99:59:59.999 all 99:59:59.999 --> 99:59:59.999 but there's something called a table layout 99:59:59.999 --> 99:59:59.999 any table layout is basically just like agreed layout except for the niceties so 99:59:59.999 --> 99:59:59.999 you also give it a number of rows and columns 99:59:59.999 --> 99:59:59.999 except where it says is rather than having each one of the interact urs fill 99:59:59.999 --> 99:59:59.999 up itself a maximum possible size 99:59:59.999 --> 99:59:59.999 i'm just going to give that enter actor as much space is it needs in that cell 99:59:59.999 --> 99:59:59.999 and no more 99:59:59.999 --> 99:59:59.999 so what does that mean 99:59:59.999 --> 99:59:59.999 that means if i come in here rather than a grid layout i say i want to create a 99:59:59.999 --> 99:59:59.999 new table layout 99:59:59.999 --> 99:59:59.999 and i run this 99:59:59.999 --> 99:59:59.999 co-ordinate add more imports 99:59:59.999 --> 99:59:59.999 are a little guide 99:59:59.999 --> 99:59:59.999 i mean just grab the imports from over here 99:59:59.999 --> 99:59:59.999 me 99:59:59.999 --> 99:59:59.999 you happy 99:59:59.999 --> 99:59:59.999 of graphics sorry 99:59:59.999 --> 99:59:59.999 come on table layout 99:59:59.999 --> 99:59:59.999 though table layout 99:59:59.999 --> 99:59:59.999 let me just show you the 99:59:59.999 --> 99:59:59.999 nice for example it cable 99:59:59.999 --> 99:59:59.999 didi 99:59:59.999 --> 99:59:59.999 sometimes in life 99:59:59.999 --> 99:59:59.999 he just got to get on with it 99:59:59.999 --> 99:59:59.999 we got ugly with it 99:59:59.999 --> 99:59:59.999 table layout 99:59:59.999 --> 99:59:59.999 there's table layout 99:59:59.999 --> 99:59:59.999 six button still 99:59:59.999 --> 99:59:59.999 we can spell resize the window but the button there just given as much sizes 99:59:59.999 --> 99:59:59.999 they would actually need they don't fill up the whole 99:59:59.999 --> 99:59:59.999 region of the actually ma 99:59:59.999 --> 99:59:59.999 table layout such something slightly more useful for us than great layout to 99:59:59.999 --> 99:59:59.999 the question came up before which was 99:59:59.999 --> 99:59:59.999 hey can i actually link like buttons and text fields together 99:59:59.999 --> 99:59:59.999 to create something a little bit more funky and in fact i can do that 99:59:59.999 --> 99:59:59.999 initially that any context outside something aloo bit more interesting 99:59:59.999 --> 99:59:59.999 which is a program that allows for conversion in temperature so this one's 99:59:59.999 --> 99:59:59.999 actually in the books i didn't give me the code because although 99:59:59.999 --> 99:59:59.999 cody is actually a the coated on the books i didn't get a chance ever handout 99:59:59.999 --> 99:59:59.999 they say it is where i got a label called degrees fahrenheit a label called 99:59:59.999 --> 99:59:59.999 degrees celsius 99:59:59.999 --> 99:59:59.999 and inside here we can type in some value and if we click fahrenheit to 99:59:59.999 --> 99:59:59.999 celsius 99:59:59.999 --> 99:59:59.999 it will automatically oil 99:59:59.999 --> 99:59:59.999 fill in the southeast field of course one value separately to is zero celsius 99:59:59.999 --> 99:59:59.999 the other thing that's kinda funky if i don't necessarily have to click the 99:59:59.999 --> 99:59:59.999 button i can type in say some value and hit enter 99:59:59.999 --> 99:59:59.999 and that's just like 99:59:59.999 --> 99:59:59.999 clicking the button 99:59:59.999 --> 99:59:59.999 interesting so how do i create this program well if you think about this 99:59:59.999 --> 99:59:59.999 program first i'm going to need is these things are not supersized but they're 99:59:59.999 --> 99:59:59.999 all laid out in a grade so i'm going to need a table layout 99:59:59.999 --> 99:59:59.999 that has to rosen three columns 99:59:59.999 --> 99:59:59.999 the first 99:59:59.999 --> 99:59:59.999 element that i have here is just the label that i'm going to have a field 99:59:59.999 --> 99:59:59.999 that the text field as a matter fact i have a specialized kind of text field 99:59:59.999 --> 99:59:59.999 owners to specialize context field 99:59:59.999 --> 99:59:59.999 something called the into field and a double field 99:59:59.999 --> 99:59:59.999 they work just like text fields except you're guaranteed to get an integer 99:59:59.999 --> 99:59:59.999 value were double value from the menu mighty but now and what happens if 99:59:59.999 --> 99:59:59.999 someone types and and wants to come for a twitter butcher 99:59:59.999 --> 99:59:59.999 i clicked the wrong button they want to convert age were temperature 99:59:59.999 --> 99:59:59.999 it says an internet injuring two brings up this pop-up box and gets in their 99:59:59.999 --> 99:59:59.999 face and say oh yeah sorry my bad 99:59:59.999 --> 99:59:59.999 so guarantees you get a major 99:59:59.999 --> 99:59:59.999 and then i'm going to have a button and somehow i want to link the button and 99:59:59.999 --> 99:59:59.999 the tax bills to do the same action 99:59:59.999 --> 99:59:59.999 so let me show you the car for that it's actually a lot shorter than it looks 99:59:59.999 --> 99:59:59.999 like 99:59:59.999 --> 99:59:59.999 first thing to do is a case at the layout to be a table layout notice once 99:59:59.999 --> 99:59:59.999 again here i am extending a program 'cause i don't want to console or canvas 99:59:59.999 --> 99:59:59.999 created for me 99:59:59.999 --> 99:59:59.999 i want to be able to specify the whole layout 99:59:59.999 --> 99:59:59.999 so i'm just extending a program 99:59:59.999 --> 99:59:59.999 i say set the layout to be a table layout to come in three 99:59:59.999 --> 99:59:59.999 and again we're going to go sequentially through all the elements of what i want 99:59:59.999 --> 99:59:59.999 to have in the first 99:59:59.999 --> 99:59:59.999 element 99:59:59.999 --> 99:59:59.999 basically the first thing i want to add to my layout i don't specify intel down 99:59:59.999 --> 99:59:59.999 here the very first thing to add to my layout is 99:59:59.999 --> 99:59:59.999 degrees fahrenheit as a label 99:59:59.999 --> 99:59:59.999 then i'm going to add some fahrenheit field what how did i create that 99:59:59.999 --> 99:59:59.999 fahrenheit field actually created it up here 99:59:59.999 --> 99:59:59.999 what i did 99:59:59.999 --> 99:59:59.999 first was declaring it as an instance variable so fahrenheit field isn't ants 99:59:59.999 --> 99:59:59.999 field not agape text field that you feel which is just a specialization of eighty 99:59:59.999 --> 99:59:59.999 eight ext field 99:59:59.999 --> 99:59:59.999 to just give you back a major other than that it works just like a text field 99:59:59.999 --> 99:59:59.999 except drugs one show you any feel totally feel 99:59:59.999 --> 99:59:59.999 so i created new and field i specified financial value not its initial sides 99:59:59.999 --> 99:59:59.999 but its initial value 99:59:59.999 --> 99:59:59.999 its initial value is thirty two 99:59:59.999 --> 99:59:59.999 then when i say is hey fahrenheit field 99:59:59.999 --> 99:59:59.999 i'm going to set your action command 99:59:59.999 --> 99:59:59.999 so that when you generate actions the name associated with the actions that 99:59:59.999 --> 99:59:59.999 you generate 99:59:59.999 --> 99:59:59.999 is going to be af 99:59:59.999 --> 99:59:59.999 dash greater than which we can just think of as a rogue c 99:59:59.999 --> 99:59:59.999 that's going to be your name so i said its name and i say you're going to 99:59:59.999 --> 99:59:59.999 generate action events 99:59:59.999 --> 99:59:59.999 someone adn action listener g love yourself 99:59:59.999 --> 99:59:59.999 okay just like you sabi for the text helix up now we're going with an infield 99:59:59.999 --> 99:59:59.999 we do exactly that same thing with something called the southeast feel 99:59:59.999 --> 99:59:59.999 tells his films also declared to be an infield 99:59:59.999 --> 99:59:59.999 it starts off the national volume zero we set it's action command to bc goes to 99:59:59.999 --> 99:59:59.999 ap as opposed to ap goes to see so we give it a slide a different name 99:59:59.999 --> 99:59:59.999 and we also set yet to listen to action events 99:59:59.999 --> 99:59:59.999 okay or did generate action events 99:59:59.999 --> 99:59:59.999 and then we're going to lay out our great so first element of the great is 99:59:59.999 --> 99:59:59.999 the label as we talked about before 99:59:59.999 --> 99:59:59.999 next element of our great is our little text box that's going to actually have 99:59:59.999 --> 99:59:59.999 the numeric value in it 99:59:59.999 --> 99:59:59.999 and last elements of our great on the first of all of the greatest 99:59:59.999 --> 99:59:59.999 is a button that's name is bath goes to see 99:59:59.999 --> 99:59:59.999 and you look at this and you say hey marron if i have a button its name is 99:59:59.999 --> 99:59:59.999 apt goes to see and i named this guy af goes to see 99:59:59.999 --> 99:59:59.999 aren't i getting back to the previous point over here of whether that's the 99:59:59.999 --> 99:59:59.999 logical problem where i actually have two elements that have the same name 99:59:59.999 --> 99:59:59.999 yeah bday i have to always have the same name but i want to do exactly the same 99:59:59.999 --> 99:59:59.999 thing in both cases so it doesn't make a difference 99:59:59.999 --> 99:59:59.999 so what i want to do is say someone clicks the button 99:59:59.999 --> 99:59:59.999 i'm going to do the conversion so i'm going to have some kind of those who do 99:59:59.999 --> 99:59:59.999 the conversion 99:59:59.999 --> 99:59:59.999 if someone type something in the text field it hits enter 99:59:59.999 --> 99:59:59.999 i'm going to do the same thing 99:59:59.999 --> 99:59:59.999 so this is something you see a lot of times on the web where for example if 99:59:59.999 --> 99:59:59.999 there's a search engine you use you type in the search engine then click search 99:59:59.999 --> 99:59:59.999 or you can just take enter how many people actually click the search button 99:59:59.999 --> 99:59:59.999 no one how many people just and hit enter 99:59:59.999 --> 99:59:59.999 yet isn't it nice that you can just hit enter 99:59:59.999 --> 99:59:59.999 that's the same thing we're doing in this program which is why we went 99:59:59.999 --> 99:59:59.999 through the extra rigmarole of setting this action command here 99:59:59.999 --> 99:59:59.999 'cause sometimes it's just nice to hear and 99:59:59.999 --> 99:59:59.999 and we do exactly the same thing for the grease celsius 99:59:59.999 --> 99:59:59.999 the name that was so we add that labeled degree celsius we had the southeast 99:59:59.999 --> 99:59:59.999 field and then we create a new button whose name is the same as the action 99:59:59.999 --> 99:59:59.999 command for the celsius field 99:59:59.999 --> 99:59:59.999 and then we add action listeners that sets up our entire user interface or 99:59:59.999 --> 99:59:59.999 entire graphical user interface and a good week 99:59:59.999 --> 99:59:59.999 and then when the user clicks on a button we say hey 99:59:59.999 --> 99:59:59.999 let me get the action command if the action commands f goes to see which 99:59:59.999 --> 99:59:59.999 means you are they type something in the fahrenheit field and hit enter 99:59:59.999 --> 99:59:59.999 or they click the button 99:59:59.999 --> 99:59:59.999 then i'll get the value in the hair fahrenheit field 99:59:59.999 --> 99:59:59.999 because fahrenheit field integer field i just always gives me back in a major 99:59:59.999 --> 99:59:59.999 and i do a little bit of math if you don't know the map conversion from 99:59:59.999 --> 99:59:59.999 fahrenheit the celsius 99:59:59.999 --> 99:59:59.999 don't worry about it this is just how you convert from fahrenheit celsius 99:59:59.999 --> 99:59:59.999 you taking nine fifth times the fahrenheit value minus thirty two and i 99:59:59.999 --> 99:59:59.999 give you the celtics value now you know 99:59:59.999 --> 99:59:59.999 what i do more interestingly if i set the value in the celsius field 99:59:59.999 --> 99:59:59.999 to be whatever value i computed 99:59:59.999 --> 99:59:59.999 so someone just type something into the fahrenheit feel that he enter or click 99:59:59.999 --> 99:59:59.999 the ftc_ button 99:59:59.999 --> 99:59:59.999 but in what i do to update the screen is ice change whatever values in the 99:59:59.999 --> 99:59:59.999 celsius field 99:59:59.999 --> 99:59:59.999 and i destroy the receptacle of that or i should say that 99:59:59.999 --> 99:59:59.999 compliment reciprocal the inverse the mirror image how many words can you come 99:59:59.999 --> 99:59:59.999 up for the same thing 99:59:59.999 --> 99:59:59.999 of that if someone does see dat 99:59:59.999 --> 99:59:59.999 which is i get the value that's in the celsius field 99:59:59.999 --> 99:59:59.999 i do the map it's necessary to convert herself if the fahrenheit nice at the 99:59:59.999 --> 99:59:59.999 fair field and that's the whole program right here is my instant variables 99:59:59.999 --> 99:59:59.999 so if i run 99:59:59.999 --> 99:59:59.999 my little temperature program 99:59:59.999 --> 99:59:59.999 i have my label 99:59:59.999 --> 99:59:59.999 i have my initial value and i have my fahrenheit to celsius and if i put in 99:59:59.999 --> 99:59:59.999 some value here like a hundred degrees fahrenheit 99:59:59.999 --> 99:59:59.999 is thirty eight degrees celsius 99:59:59.999 --> 99:59:59.999 and two hundred twelve degrees fahrenheit will not touch the mouse just 99:59:59.999 --> 99:59:59.999 hit on me in turkey 99:59:59.999 --> 99:59:59.999 uh... an er does the same thing is if i click the mouse and same thing on the 99:59:59.999 --> 99:59:59.999 second phase zero celsius 99:59:59.999 --> 99:59:59.999 the actor into good times and not created a whole program of the graphical 99:59:59.999 --> 99:59:59.999 user interface and i'd like to resize and it just doesn't know a lot always 99:59:59.999 --> 99:59:59.999 centers for me is not nice if i make it east mall 99:59:59.999 --> 99:59:59.999 while these things don't get too small just sent a i can see the screen that's 99:59:59.999 --> 99:59:59.999 what the state 99:59:59.999 --> 99:59:59.999 any questions about that 99:59:59.999 --> 99:59:59.999 how can use the mikes please 99:59:59.999 --> 99:59:59.999 i gotta keep reminding everyone views the microphones 99:59:59.999 --> 99:59:59.999 p 99:59:59.999 --> 99:59:59.999 but you can look really good 99:59:59.999 --> 99:59:59.999 uh... there are ways the with table layout you can actually get it whatever 99:59:59.999 --> 99:59:59.999 fortuitous at hands 99:59:59.999 --> 99:59:59.999 to actually specify different sizes for things and i just didn't do that here 99:59:59.999 --> 99:59:59.999 it's in the book if you want to do a but we're not going to 99:59:59.999 --> 99:59:59.999 try to push it out for in this class use it but there are ways you can 99:59:59.999 --> 99:59:59.999 so one final thing that we want to do is you might say all this is all good well 99:59:59.999 --> 99:59:59.999 mirror on yeah i'm not kind of fun but 99:59:59.999 --> 99:59:59.999 really what i like to some text in some graphics together and i want to interact 99:59:59.999 --> 99:59:59.999 recycle wanted all right 99:59:59.999 --> 99:59:59.999 i want tax taiwan wrapped on interactive you think back to busy rethinking man 99:59:59.999 --> 99:59:59.999 hangman you had texting had graphics 99:59:59.999 --> 99:59:59.999 but she didn't have interacted 99:59:59.999 --> 99:59:59.999 here you have interact there is and i show you example interact arisen tax 99:59:59.999 --> 99:59:59.999 twenty click the button and said hi and you know 99:59:59.999 --> 99:59:59.999 gave your name or whatever now it's time to roll the enchilada and put them all 99:59:59.999 --> 99:59:59.999 together in our friend 99:59:59.999 --> 99:59:59.999 text and graphics 99:59:59.999 --> 99:59:59.999 so what text and graphics is going to do 99:59:59.999 --> 99:59:59.999 is it basically what we want to think about is having some consul in the 99:59:59.999 --> 99:59:59.999 program 99:59:59.999 --> 99:59:59.999 and the graphics canvas in the program and interact or is in the program so we 99:59:59.999 --> 99:59:59.999 can just go to town and do whatever you want to do 99:59:59.999 --> 99:59:59.999 how do we make this happen 99:59:59.999 --> 99:59:59.999 first thing we're going to do 99:59:59.999 --> 99:59:59.999 you had a little bit text on the board just to get out there a little 99:59:59.999 --> 99:59:59.999 blood circulating in your legs and i know nothing about blood clots in your 99:59:59.999 --> 99:59:59.999 legs where you're actually traveling too long on planes and blood clot 99:59:59.999 --> 99:59:59.999 yeah we want to talk about that 99:59:59.999 --> 99:59:59.999 i didn't give you a small hands of a save your life beverage traveling on a 99:59:59.999 --> 99:59:59.999 trip is longer than two hours sometime during the trip or multiple times get up 99:59:59.999 --> 99:59:59.999 and walk around 99:59:59.999 --> 99:59:59.999 it will save your life 99:59:59.999 --> 99:59:59.999 but nigger ever giving a lecture for longer than two hours 99:59:59.999 --> 99:59:59.999 get up and walk around it'll save your life to not be the blood clots but 99:59:59.999 --> 99:59:59.999 because your students would tell you have to drive you just sitting there 99:59:59.999 --> 99:59:59.999 going like all i know not good bread that layout were which we're not going 99:59:59.999 --> 99:59:59.999 to get into it 99:59:59.999 --> 99:59:59.999 but is it accidentally so text and graphics 99:59:59.999 --> 99:59:59.999 she retains the taste great together 99:59:59.999 --> 99:59:59.999 you can decide which ones chocolate and which ones peanut butter 99:59:59.999 --> 99:59:59.999 lettuce text and graphics and so it's like hangman but with interactives 99:59:59.999 --> 99:59:59.999 so what we're going to do is we're going to extend consul program 99:59:59.999 --> 99:59:59.999 and the reason why we're going to extend the consul program he's we still need 99:59:59.999 --> 99:59:59.999 our plan the console that's what we're going to get the text portion of doing 99:59:59.999 --> 99:59:59.999 this interaction 99:59:59.999 --> 99:59:59.999 it's from having the consul program 99:59:59.999 --> 99:59:59.999 and so what we have a console program what please give this is it gives us 99:59:59.999 --> 99:59:59.999 the borders 99:59:59.999 --> 99:59:59.999 that we've come to know when law writing gives us the north border in the south 99:59:59.999 --> 99:59:59.999 border and western he's and these are places where we can still play so enter 99:59:59.999 --> 99:59:59.999 actors 99:59:59.999 --> 99:59:59.999 the interesting thing is what's going on in the center region 99:59:59.999 --> 99:59:59.999 and what i told you before the consul program 99:59:59.999 --> 99:59:59.999 fills up the senate region with a place where you can put text and that's all 99:59:59.999 --> 99:59:59.999 you can do with it 99:59:59.999 --> 99:59:59.999 so what we're going to say it a consul program what i want to do is in the 99:59:59.999 --> 99:59:59.999 center regent i want to give you a different layout and put stuff in that 99:59:59.999 --> 99:59:59.999 lady out 99:59:59.999 --> 99:59:59.999 second potentially have some text in some graphic 99:59:59.999 --> 99:59:59.999 uh... 99:59:59.999 --> 99:59:59.999 so what am i going to do 99:59:59.999 --> 99:59:59.999 the first thing i want to do is i'm going to think about having some layouts 99:59:59.999 --> 99:59:59.999 okay mine layouts going applied to this middle region 99:59:59.999 --> 99:59:59.999 the important thing to keep in mind as the console program what used to be was 99:59:59.999 --> 99:59:59.999 created console the filled up the entire region 99:59:59.999 --> 99:59:59.999 now what i'm going to get is a console as my first elements 99:59:59.999 --> 99:59:59.999 which means however i do the layout whatever i do and that lay out the very 99:59:59.999 --> 99:59:59.999 first thing like what i have a great that has three elements to it one row 99:59:59.999 --> 99:59:59.999 the first elements of that 99:59:59.999 --> 99:59:59.999 will be my consul 99:59:59.999 --> 99:59:59.999 that you don't have any control over just because of the way the consul 99:59:59.999 --> 99:59:59.999 program works the first elements of whatever layout you used when you extend 99:59:59.999 --> 99:59:59.999 the consul program create a layout for wall waise bhi your whatever your text 99:59:59.999 --> 99:59:59.999 it's 99:59:59.999 --> 99:59:59.999 now you said hey 99:59:59.999 --> 99:59:59.999 there on your awesome tell me about graphics but if i'm doing with the 99:59:59.999 --> 99:59:59.999 consul program how do i get graphics 99:59:59.999 --> 99:59:59.999 we give a little trick we did in hangman which is there's this thing called the g 99:59:59.999 --> 99:59:59.999 candidates 99:59:59.999 --> 99:59:59.999 and what we're going to do is create agee kandicn digi cam this importantly 99:59:59.999 --> 99:59:59.999 is actually something that we can add to a linux 99:59:59.999 --> 99:59:59.999 so what i can do is say hey crave my consul program i'm going to create some 99:59:59.999 --> 99:59:59.999 layout but sam i have a great that's 99:59:59.999 --> 99:59:59.999 i'm going to create some sort of way out like maybe i have agreed me out 99:59:59.999 --> 99:59:59.999 one comment three 99:59:59.999 --> 99:59:59.999 which would give me dressed 99:59:59.999 --> 99:59:59.999 i know that my first things i think up my my console what i want to do is 99:59:59.999 --> 99:59:59.999 creepy g canvas 99:59:59.999 --> 99:59:59.999 and ad that you can visit is my second elements 99:59:59.999 --> 99:59:59.999 and just to be super cool to give you something that normally you'd have to 99:59:59.999 --> 99:59:59.999 pay twelve ninety five four but i want to get at you for for 99:59:59.999 --> 99:59:59.999 we're going to create another g hands and added over here so that she can this 99:59:59.999 --> 99:59:59.999 bills 99:59:59.999 --> 99:59:59.999 so what we get is consul and to different g canvases 99:59:59.999 --> 99:59:59.999 plus we can still add interac result round or screen 99:59:59.999 --> 99:59:59.999 at this point you should be looking at this and shock horror and delight and 99:59:59.999 --> 99:59:59.999 going 99:59:59.999 --> 99:59:59.999 okay marron let's all put it together and five minutes because it's just that 99:59:59.999 --> 99:59:59.999 he 99:59:59.999 --> 99:59:59.999 so here's how it works 99:59:59.999 --> 99:59:59.999 text and graphics ike's ten console program 99:59:59.999 --> 99:59:59.999 okay 'cause that's going to get my consul 99:59:59.999 --> 99:59:59.999 in miami i say set the layout 99:59:59.999 --> 99:59:59.999 on one new grid layout remember great layout the elements of the great layout 99:59:59.999 --> 99:59:59.999 expand to take how much space you give them 99:59:59.999 --> 99:59:59.999 that's what i want in this case 99:59:59.999 --> 99:59:59.999 because what i want to say as i want to have a great i want to give the consul 99:59:59.999 --> 99:59:59.999 one-third of the whole grade and cute and this is another third of those 99:59:59.999 --> 99:59:59.999 grades and grown too is large as they can be 99:59:59.999 --> 99:59:59.999 then i'm going to do is i'm going to create to canvass so i need to have some 99:59:59.999 --> 99:59:59.999 instance variables to refer to these canvases 99:59:59.999 --> 99:59:59.999 i am i have to canvases 99:59:59.999 --> 99:59:59.999 which are just type is g canvas by private labels i will call them the 99:59:59.999 --> 99:59:59.999 right canvas and the left hand yes 99:59:59.999 --> 99:59:59.999 animals have a text field in this program just for laughs just cuz i can 99:59:59.999 --> 99:59:59.999 and that's going to be one of my characters so i want to have interact 99:59:59.999 --> 99:59:59.999 respect graph 99:59:59.999 --> 99:59:59.999 what am i going to do 99:59:59.999 --> 99:59:59.999 first thing to do it on to say that left canvas create a new canvas 99:59:59.999 --> 99:59:59.999 that can viz 99:59:59.999 --> 99:59:59.999 and when i do this add it's adding it to my laid out 99:59:59.999 --> 99:59:59.999 ham adding a whole candid so what is that do it says hey told me got a great 99:59:59.999 --> 99:59:59.999 layout here ive already filled in the first thing with the console 'cause 99:59:59.999 --> 99:59:59.999 that's what i do on the console program 99:59:59.999 --> 99:59:59.999 you just told me to add a canvas 99:59:59.999 --> 99:59:59.999 element number two will be the canvas 99:59:59.999 --> 99:59:59.999 i do the same thing again for white canvas element number three is not the 99:59:59.999 --> 99:59:59.999 right and so i have to big canvasses on there as the second and third elements 99:59:59.999 --> 99:59:59.999 of my grade 99:59:59.999 --> 99:59:59.999 i got a console 99:59:59.999 --> 99:59:59.999 grid canvas tents not going to add to interact with because it's just that 99:59:59.999 --> 99:59:59.999 cool i'm going to create a text field which they knew gatech steel text field 99:59:59.999 --> 99:59:59.999 i declared as a private instance variable i just showed you that 99:59:59.999 --> 99:59:59.999 maximum size is ten 99:59:59.999 --> 99:59:59.999 i will add a label to it and the label just going to be called some text 99:59:59.999 --> 99:59:59.999 sold the rights some tax 99:59:59.999 --> 99:59:59.999 in the southern region 99:59:59.999 --> 99:59:59.999 that'll adam i text field in the southern region and that ads at this 99:59:59.999 --> 99:59:59.999 point you should come to know involved you always gotta remember to add your 99:59:59.999 --> 99:59:59.999 action list are very common thing that happens people create a text field and 99:59:59.999 --> 99:59:59.999 their type in an end stuff in the program enough things happening in their 99:59:59.999 --> 99:59:59.999 tearing their hair and they're wondering why 99:59:59.999 --> 99:59:59.999 they just forgot to add the action list you know it learn it live it probably 99:59:59.999 --> 99:59:59.999 it's a good time 99:59:59.999 --> 99:59:59.999 action listener for your text field 99:59:59.999 --> 99:59:59.999 and then i would have to buttons just for good times so i have my tech said 99:59:59.999 --> 99:59:59.999 i'm gonna have to more buttons a button that says draw on the left 99:59:59.999 --> 99:59:59.999 and a button that says draw on the right 99:59:59.999 --> 99:59:59.999 so i mean show you what all these things are going to do 99:59:59.999 --> 99:59:59.999 before i show you the rest of the program 99:59:59.999 --> 99:59:59.999 so what i want to show you text and graphics 99:59:59.999 --> 99:59:59.999 uh... 99:59:59.999 --> 99:59:59.999 out my consolation 99:59:59.999 --> 99:59:59.999 i have to you can see them but they are side by side q different canvas windows 99:59:59.999 --> 99:59:59.999 over here here's some text i can type in high 99:59:59.999 --> 99:59:59.999 you typed 99:59:59.999 --> 99:59:59.999 while 99:59:59.999 --> 99:59:59.999 that exciting 99:59:59.999 --> 99:59:59.999 drama left in my left hand that some just run rectangles offsite i do that 99:59:59.999 --> 99:59:59.999 just a second 99:59:59.999 --> 99:59:59.999 draw a right 99:59:59.999 --> 99:59:59.999 drawing in my right candidates 99:59:59.999 --> 99:59:59.999 how did i make that happen alright on your share of the programme so i've set 99:59:59.999 --> 99:59:59.999 everything up right console to canvases 99:59:59.999 --> 99:59:59.999 text field and two buttons at the bottom 99:59:59.999 --> 99:59:59.999 here is where all the actions going on when action performed is called right i 99:59:59.999 --> 99:59:59.999 mean someone's interacting with one of the interact urs there's nothing else i 99:59:59.999 --> 99:59:59.999 can do in the program except interact with one of the inner actors 99:59:59.999 --> 99:59:59.999 first a check for the text field if the interaction with the text field so if 99:59:59.999 --> 99:59:59.999 the source of the interaction with the text field i write about you typed and 99:59:59.999 --> 99:59:59.999 the text of the text field this will go into the consul biggest anytime you do 99:59:59.999 --> 99:59:59.999 applicable in the text always goes in the consul so it just shows up in the 99:59:59.999 --> 99:59:59.999 consul not a whole lot exciting going on there 99:59:59.999 --> 99:59:59.999 alternatively if the thing they did was not stipe into the text field 99:59:59.999 --> 99:59:59.999 they clicked one of the bottoms so i say hey i'm showing i could've been there 99:59:59.999 --> 99:59:59.999 done all with get sore throat always get action command 99:59:59.999 --> 99:59:59.999 i'm using both just to show you that you can mix and match if you want 99:59:59.999 --> 99:59:59.999 so i say hey what was the command get action command 99:59:59.999 --> 99:59:59.999 if it was drawl left then what i want to do is i'm going to create a new field a 99:59:59.999 --> 99:59:59.999 rectangle let me show you create new filled rectangle it's very simple 99:59:59.999 --> 99:59:59.999 it just 99:59:59.999 --> 99:59:59.999 creates a rectangle that's fifty by twenty and yes they should have been 99:59:59.999 --> 99:59:59.999 constant i didn't make them conference i wouldn't have to scroll down and show 99:59:59.999 --> 99:59:59.999 you the constant 99:59:59.999 --> 99:59:59.999 i said to be filled 99:59:59.999 --> 99:59:59.999 and i return the rectangle solid does is create a filled rectangle on say hey 99:59:59.999 --> 99:59:59.999 your ego 99:59:59.999 --> 99:59:59.999 and although i do is i take that filled rectangle and i added 99:59:59.999 --> 99:59:59.999 to my left hand dates 99:59:59.999 --> 99:59:59.999 so because that's not a graphics program i can just a tad with the rectangle one 99:59:59.999 --> 99:59:59.999 added if i want to add the rectangle somewhere i need to specify which canvas 99:59:59.999 --> 99:59:59.999 of my adding a few i'm adding it's the left campus icao left hand this ads 99:59:59.999 --> 99:59:59.999 yourself this rectangle where you can add it x location twenty and at one 99:59:59.999 --> 99:59:59.999 location left y 99:59:59.999 --> 99:59:59.999 left wide starts out with the value ten 99:59:59.999 --> 99:59:59.999 and every time i add something i'd space down my wife's i'm just making wide go 99:59:59.999 --> 99:59:59.999 down to buy some spacer mt which is thirty so i was doing is trying a 99:59:59.999 --> 99:59:59.999 rectangle and essentially moving down toward drachmir x next rectangle below 99:59:59.999 --> 99:59:59.999 it moving down to draw the next rectangle below it 99:59:59.999 --> 99:59:59.999 and i do exactly the same thing for the right hand side 99:59:59.999 --> 99:59:59.999 except after a quick quick filled rectangle i have a separate whitewater 99:59:59.999 --> 99:59:59.999 which keeps track of how low of gotten on that side in terms of the white ford 99:59:59.999 --> 99:59:59.999 net 99:59:59.999 --> 99:59:59.999 and i add to the right canvas 99:59:59.999 --> 99:59:59.999 that's the only difference 99:59:59.999 --> 99:59:59.999 so when i run this program 99:59:59.999 --> 99:59:59.999 right some text 99:59:59.999 --> 99:59:59.999 right again if i type and great 99:59:59.999 --> 99:59:59.999 by typing great 99:59:59.999 --> 99:59:59.999 and hit enter it generates the event which does the sprint lynn on the screen 99:59:59.999 --> 99:59:59.999 right it generates this event over here this action performed 99:59:59.999 --> 99:59:59.999 the source was text field and i write out the text on the screen 99:59:59.999 --> 99:59:59.999 if i click on one of the buttons drama apt 99:59:59.999 --> 99:59:59.999 draws the filled rectangle and its incremented the why on the left hand 99:59:59.999 --> 99:59:59.999 side for next time i clicked route left 99:59:59.999 --> 99:59:59.999 it draws at lower and lower and lower and dry right does the same thing 99:59:59.999 --> 99:59:59.999 notice of the x location for both 99:59:59.999 --> 99:59:59.999 this canvas and this can this when i had the rectangles are both a twenty the 99:59:59.999 --> 99:59:59.999 reason why it shows up to a different place in the screen is because they're 99:59:59.999 --> 99:59:59.999 two different and this is in those kind of invisible border here 99:59:59.999 --> 99:59:59.999 so you can create cameron text 99:59:59.999 --> 99:59:59.999 graphics and interactive altogether and just go to town any questions 99:59:59.999 --> 99:59:59.999 all right and i will see you on wednesday