Lecture 21 | Programming Methodology (Stanford)
-
0:00 - 0:10[intro music]
-
0:10 - 0:14This presentation is delivered by the Stanford Center for Professional Development.
-
0:22 - 0:26It's time to delve into a continuation of our last great topic. Okay?
-
0:26 - 0:30So, it's time to continue a bit with our friend the "interactor".
-
0:30 - 0:34And if we think about the interactor, an action listener...so last time we talked about
-
0:34 - 0:38having buttons and buttons-generated action events. Remember that?
-
0:38 - 0:41So we're going to do a brief review of that and push it a little bit further.
-
0:41 - 0:46So one of things we talked about is: how in your program, say, in your init method
-
0:46 - 0:50somewhere you might have "public void init ()"
-
0:51 - 0:54and inside here you would set up sort of the
-
0:54 - 0:57parts of your program that you want to actually do something, like, the various
-
0:57 - 1:00interactors so that when someone clicks on them something happens
-
1:00 - 1:07and then you would say, "add ActionListeners". And what this would do
-
1:07 - 1:10is basically say,"Hey I got some buttons in my program,
-
1:10 - 1:14I want you to be listening for buttons so when someone clicks on a button, I want you to call
-
1:14 - 1:17a particular method for me called 'ActionPerformed'
-
1:17 - 1:20and then based on when you call ActionPerformed, I'll figure out what button was clicked
-
1:20 - 1:23and then actually do something."
Okay? -
1:23 - 1:25So, over here we had our friend
-
1:25 - 1:29"public void ActionPerformed"
-
1:29 - 1:37And "ActionPerformed" would get as its parameter something called an "ActionEvent".
-
1:37 - 1:41And an ActionEvent (we'd just refer to it as "e"),
-
1:41 - 1:43was basically what it would check to see
-
1:43 - 1:47what action was actually taken or basically which button was actually clicked. Okay?
-
1:47 - 1:51So hopefully you remember that. That's a little bit of review from last time.
-
1:51 - 1:53Now, when we got this action event we said there are a couple things you could do with it.
-
1:54 - 1:58Well, there is actually one main thing we talked about which you could do with it
-
1:58 - 2:02and you could figure out which command was actually the thing that caused this action event
-
2:02 - 2:05to be generated by saying, "Hey, you know what i want to do?"
-
2:05 - 2:09I wanna pull out as a string (and I'll just call it 'cmd' for 'command')
-
2:09 - 2:12the command, or, the name of the interactor
-
2:12 - 2:15that caused this ActionPerformed method to be called." So here I would say
-
2:15 - 2:17e dot
-
2:17 - 2:19command equals e dot
-
2:19 - 2:22getActionCommand
-
2:22 - 2:25and what GetActionCommand does...it's just a method
-
2:25 - 2:30of this ActionEvent that says,"Hey, I'll return to you the name of the interactor as a string
-
2:30 - 2:33and buttons' names are basically just whatever displays on the button.
-
2:33 - 2:38So then I could have some ifs in here based on this command, "if command dot equals"
-
2:38 - 2:40and I can check for some name, then I might wanna take some action based on that button.
-
2:42 - 2:45It turns out there something else you can ask this ActionEvent e for
-
2:45 - 2:47other than the action command
-
2:47 - 2:50you saw this very briefly last time in the program that we did and you're going to see it a little bit more now,
-
2:50 - 2:54so i want to spend a little bit more time on it
-
2:54 - 2:56which is something where you can say, "Hey e,
-
2:56 - 3:02what i want to get from you is not the action command, I want to get the source of the action."
-
3:02 - 3:07Now the interesting thing about what "getSource" returns to you...actually let me not put the semicolon
-
3:07 - 3:09here right now...
-
3:09 - 3:12is getSource actually returns to you an object.
-
3:12 - 3:17It returns to you the object that caused this event to be generated, which means if a button was clicked
-
3:19 - 3:22e.getActionCommand will get the name of the button
-
3:22 - 3:27e.getSource will actually give you a reference to the button object.
-
3:27 - 3:31So what you're getting back from this is an object. You're getting a reference to that object.
-
3:31 - 3:34So, what does that mean for you in, sort of, your everyday life?
-
3:34 - 3:37What that means is: over here when you want to set up your initialization
-
3:37 - 3:40You could say, "Hey I want to create a button."
-
3:40 - 3:42And so i'll have some button i want to create
-
3:42 - 3:45so I'll say "new JButton"
-
3:46 - 3:49and maybe that button, i want it to say "Hi" on it
-
3:49 - 3:54And so one thing I can do is I could say, "hi = new JButton"and "hi"
-
3:54 - 3:58what I'm going to do is make that an instance variable
-
3:58 - 4:03so somewhere down here in my program where I have my ivars, my instance variables,
-
4:03 - 4:11i would have "private JButton hi;"
So I just do the declaration of a variable called "Hi" -
4:11 - 4:13which is of type JButton and then in my initialization method
-
4:13 - 4:17i actually create that button with the label "Hi" on it
-
4:17 - 4:20and then i go ahead and add it somewhere to
-
4:20 - 4:25one of the control bars in my programs. So I would say, "add 'hi' maybe to the SOUTH control bar"
-
4:25 - 4:27because we really like adding things to the SOUTH control bar
-
4:27 - 4:30It's just fun when buttons show up on the bottom of our screen.
-
4:30 - 4:33So we say, "Add it there" and then wait for something to happen.
-
4:33 - 4:35So add my action listener in case this button gets clicked.
-
4:35 - 4:37Now when the button gets clicked over here,
-
4:37 - 4:40what i can do
-
4:40 - 4:41as i could actually
-
4:41 - 4:47ask command to get its name. Right? Or I could ask the action event to get the action command name
-
4:47 - 4:52and then i could say something like," if (cmd.equals "
-
4:52 - 4:56and the name of the particular button that i created over there happens to be ("Hi"). If it happens to be "Hi"
-
4:57 - 5:02then there's something i want to do, like maybe i'd want to print something on the screen or whatever the case may be.
-
5:03 - 5:04That's one way i could write this
-
5:04 - 5:07and this is kind of the classic way that you've seen it written before.
-
5:07 - 5:09Okay? That's the way you saw it last time.
-
5:09 - 5:14The other way i can write it with my friend "get source" is: rather than getting the name of the command
-
5:14 - 5:16and checking to see if the command is equal to ("Hi")
-
5:16 - 5:21i can actually say, "Hey, you know what? Mehran told me about this thing called e.getSource
-
5:21 - 5:24as a matter of fact i don't even need this line for command
-
5:24 - 5:27anymore let me just comment it out so I don't erase it, okay?
-
5:27 - 5:33And I can say, " if (e.getSource ... this returns an object to me
-
5:33 - 5:38i want to check to see if that object that it returns is my ("Hi") button
-
5:38 - 5:44so here i check directly, is it equal equal to "hi" and then I do whatever I was going to do
-
5:44 - 5:48so this has exactly the same effect as before. It's checking to see if I've gotten a button
-
5:48 - 5:52that is the "Hi" button that was clicked. Okay?
-
5:52 - 5:56so the difference between these two things if you kind of think about them, right?, one of them is
-
5:56 - 6:01i'm just using the name is a string and the other ones i'm using the actual object
-
6:01 - 6:07Now if you think about more deeply what that means if i think about the name over here, right?
-
6:07 - 6:12If i think just in terms of the name i never need to be able to refer to the actual object
-
6:12 - 6:15which means that if i don't need to refer to the actual object again over here
-
6:15 - 6:20I don't necessarily need it as an instance variable. I only need it as an instance variable if I'm going to refer
-
6:20 - 6:24to it again in someplace that's in a different method
-
6:24 - 6:26that's some other method i may have already used it in.
-
6:26 - 6:31So let me show you an example of what i mean by that in code to make that more concrete.
-
6:31 - 6:33Okay, so if we come over here to code
-
6:33 - 6:35here's essentially the code i just wrote
-
6:35 - 6:39for basically creating a button so it's just the code i wrote on the board, right?
-
6:39 - 6:43except I just made the font bigger. i create a button with the name "hi"
-
6:43 - 6:47i put in the southern region. I add my action listeners to listen for that button getting clicked.
-
6:47 - 6:52When the button gets clicked I say, "Hey. Is the thing that got clicked this button I created?"
-
6:52 - 6:54Here i actually called it HiButton.
-
6:54 - 6:57instead of just "hi" over there. I shortened it to "hi" so it would take up less board space.
-
6:57 - 7:02if it's actually the source of that action is not have my high but not all
-
7:02 - 7:04will print out below them
-
7:04 - 7:07so i can go ahead and run this program
-
7:07 - 7:13and 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
-
7:13 - 7:14hello there
-
7:14 - 7:17now alternatively i could have written some slightly differently which is the
-
7:17 - 7:18way you saw a blast time
-
7:18 - 7:21what i can do here as i can say hey
-
7:21 - 7:25when i'm going to do the added just go ahead and create that button and add it
-
7:25 - 7:29all in one line because i don't need to have some variables it stores the button
-
7:29 - 7:35because down here i'd i need to check for the source of
-
7:35 - 7:35what that action and that was
-
7:35 - 7:37i'm going to have a safe action event
-
7:37 - 7:39give me your command
-
7:39 - 7:41and the command is going to be the name of the button
-
7:41 - 7:45so i no longer need a variable to actually store a reference to the actual
-
7:45 - 7:47button object
-
7:47 - 7:51because this is going to give me the name whenever i needed and so as a
-
7:51 - 7:53result notice your i don't have an instance variable
-
7:53 - 7:56so this is one of those things that's a trade-off it also should give you a
-
7:56 - 7:59little bit more insight into when you have instance variables were so when you
-
7:59 - 8:00don't have instance variables
-
8:00 - 8:02you need to have the instance variable
-
8:02 - 8:08in the case
-
8:08 - 8:11where you need to have
-
8:11 - 8:12and i want the new one
-
8:12 - 8:13you want the instance variable in the case where
-
8:13 - 8:15you want to be able to refer to this variable
-
8:15 - 8:17in some method
-
8:17 - 8:21it's different then perhaps the method which got created right so i created i
-
8:21 - 8:23created the button over here and start somewhere
-
8:23 - 8:26but i need to be able to refer to and some other method so it's got to be an
-
8:26 - 8:27instance variable
-
8:27 - 8:34if i don't need to refer to any other method which is what i saw on the second
-
8:34 - 8:35place
-
8:35 - 8:36i don't need to report would again here is a matter fact there's no other place
-
8:36 - 8:41i need to refer to it after i created then i don't need distorting
-
8:41 - 8:52and questions about her
-
8:52 - 8:57was so that's about the neurological at the computer shouldn't try to figure out
-
8:57 - 8:59which one could if you give it to bond with the same name
-
8:59 - 9:01i have no idea
-
9:01 - 9:07right and it's going to cause you problems they don't do it if you want to
-
9:07 - 9:08see what happens go ahead and dry bread it's a bug in logic not about and what
-
9:08 - 9:09the computers executing
-
9:09 - 9:19any other questions are gone
-
9:19 - 9:21up it's not going to get the actual button so
-
9:21 - 9:25you're saying in this other case ever here
-
9:25 - 9:29what is this thing going to return if i didn't create a variable over here
-
9:29 - 9:32this thing starting to return some reference to your object
-
9:32 - 9:35the only issue for you now though is you have no way of checking for equality
-
9:35 - 9:39with some object right as you know if you don't have the same instance
-
9:39 - 9:42variable you can check to see if that things equal the high button so if you
-
9:42 - 9:46created high button over here just immediately added it never kept track of
-
9:46 - 9:46it over here
-
9:46 - 9:48this guy would return to you
-
9:48 -a pointer too high but menu take right i got appointed a high button how do you
-
Not Syncedknow it's high button
-
Not Syncedyou don't because you have no way of comparing it to the actual hot button
-
Not Syncedcreated
-
Not Syncedand that's why we need to work
-
Not Syncedso why do i show these to differ quite of doing it the reason why i say these
-
Not Syncedtwo different ways of doing it is now you're actually make use of this
-
Not Syncedwith respect to some other interact or is the tracks and see where we care
-
Not Syncedabout doing debt source as opposed to you
-
Not Syncedthe uh... action plan
-
Not Syncedso what we're gonna do next
-
Not Syncedis going to say you know allot of times and programs that you really want to
-
Not Syncedhave if you want to have some way of letting the user specified
-
Not Syncedsome taxed
-
Not Syncedin a program that's running interactively that's not consul right
-
Not Syncedthey'd like to be able to type something and so let me just show you example of
-
Not Syncedthis
-
Not Synceddvd buchanan
-
Not Syncedso you have a program that's got what we refer to as a text feel down here
-
Not Syncedand i call that name and so if i say hey my name is maryland
-
Not Syncedit says hello maryland
-
Not Syncedand then i say are not and i was joking my name is really sally
-
Not Syncedmost of you don't know this
-
Not Syncedas as a hollow sally right so it's just some way of being able to
-
Not Syncedhave some taxes
-
Not Syncedfield over here that the user fails and in the senate interact a right this is
-
Not Syncedjust one fields dot on the console
-
Not Syncedand then do some action in the action we have to do here is to write something
-
Not Syncedthe console
-
Not Syncedthat makes use of the tax that the
-
Not Syncedthe use your actually typed in
-
Not Syncedso how do we get something like that to work
-
Not Syncedso what we need to do is
-
Not Syncedav and interact with it's called the text field
-
Not Syncedand basically text field is
-
Not Syncedis just epping use alright it's a little place where someone can type some text
-
Not Syncedisn't interact or such as if it under control bars
-
Not Syncedand then potentially one make it enter
-
Not Syncedyou get some action event that tells you unique actually or if you want you can
-
Not Synceddo something with this text
-
Not Syncedso that's the basic idea what you really get is a box and that's all you get with
-
Not Syncedit if you want to add a label to that box like the added name over here
-
Not Syncedwe need to sort of specified that
-
Not Syncedand i'll show you how to do that in just a second but what you're really get at
-
Not Syncedthe box in a new types in something
-
Not Syncedand then hits began turkey then potentially some of them is generated
-
Not Syncedfor you
-
Not Syncedso how does that actually set up so the thing we want to create is called ej
-
Not Syncedtext field ok it's just another one of these interact or just like you saw
-
Not Syncedbefore we had checkboxes in combo boxes and all that stuff it's just called it a
-
Not Syncedtext field
-
Not Syncedoff named this twenty ab
-
Not Syncedto stand for text field
-
Not Syncedand what you do when you trade and you want to be easy to use a new g tax to be
-
Not Syncedloved and what you've given as a parameter here's the funky thing
-
Not Syncedyou don't give it its label
-
Not Syncedthe label doesn't come with the tax till you need to create the label separately
-
Not Syncedwhat you give it is the size of that text feel how big it should be in terms
-
Not Syncedof the maximum number of characters that would show up in their so if we say ten
-
Not Syncedfor example you're saying is i want to have some text you'll get a hold almost
-
Not Syncedten characters and if you some font that's variable with it automatically
-
Not Syncedgives you the size of like ten ends kazan is the widest character in case
-
Not Syncedyou didn't know that's just life in the city
-
Not Syncednow the funny thing about this right were let relative to add this action
-
Not Syncedperformed
-
Not Syncedis one the user hits answer
-
Not Syncedif i didn't do anything else you would not actually get this call to action
-
Not Syncedperformed
-
Not Syncedwe'll because action performed only called for you for buttons
-
Not Syncedso what you need to do is after you actually create this text field you need
-
Not Syncedto say hey you know what
-
Not Syncedi need to let you know about this text field add something that can generate
-
Not Syncedactions and so the way you do this is a looks a little bit funky
-
Not Syncedwould you tell the tax field
-
Not Syncednot and
-
Not Syncedaction listeners
-
Not Syncedbits to pay
-
Not Syncedyou don't need to worry about all that blood is that actually mean at a very
-
Not Syncedlow level all you need to know if you're telling
-
Not Syncedthis text field
-
Not Syncedhey guess what
-
Not Syncedyou're going to be able to generate actions now and the thing that you're
-
Not Syncedgoing to let people know when you generate some actions is yourself which
-
Not Syncedis why we pass this
-
Not Syncedbut anytime you create excel the youngest do this once for all text of
-
Not Syncedthe via multiple text fields
-
Not Syncedyou need to send this add action listener this
-
Not Syncedmessage
-
Not Syncedeach one independently we only have one year so we only need to do it once here
-
Not Syncedbut what this basically gaza says
-
Not Syncedauto text field
-
Not Syncedthat you can now generate these action events as well
-
Not Syncedso after you created any sort of set up this line and you would want to add it
-
Not Syncedsome more inter program write to someone your program you would probably say
-
Not Syncedbad
-
Not Syncedkidnapped and we might add ginsburg's ample in the south as we had everything
-
Not Syncedin the south
-
Not Syncedwhen someone takes something and it's yep and hits internet will generate some
-
Not Syncedcall to action event for prefer action performed pasternak shanavas
-
Not Syncedonce that gets set up
-
Not Syncedhow do you actually say grout
-
Not Syncedwhat was the text field that generated this about right because you could have
-
Not Syncedmultiple text feels that someone could have typed into it hit the enter key
-
Not Syncedwhat you're doing teary-eyed use your friend if you just dot me dot get sore
-
Not Syncedso inside here which are to say is
-
Not Syncedhe died gets worse
-
Not Syncedis people equal to so yeah
-
Not Syncedand at this point all kinds of warning bells should go out for you and so maybe
-
Not Syncedinside here you won't be something like you want to print len
-
Not Syncedwhere you want to say hi and then add to it the tax that's in that text box in
-
Not Syncedthe way you do that as you just say the name of whatever the text field is and
-
Not Syncedthe message you sended is get taxed and what it will give you back
-
Not Syncedact is it will just returned to you this thing by it's not just returns a string
-
Not Syncedof whatever's in that box on the user enter
-
Not Syncedso that's all right out hike and then whatever text they type in just like you
-
Not Syncedsaw on the program except that was writing hello
-
Not Syncedand maybe that's what we want to do
-
Not Syncedbut the warning bells it should be going off now what's the problem if i've just
-
Not Syncedwritten the code like this
-
Not Syncedit's not an instance variable writes i have no way if this is my payment method
-
Not Syncedover here i have no way of being able to report that's me up again
-
Not Syncedout here
-
Not Syncedso i need to create the instance variable right if this is my new method
-
Not Syncedpublic void in eight in front of him
-
Not Syncedwhat i need to do is this year somewhere else in my class let's say over here
-
Not Syncedwhich is where i declare my art bar's right which is just lower down in the
-
Not Syncedclass umar
-
Not Syncedi need to actually have prided
-
Not Syncedjamie
-
Not Syncedpacks
-
Not Syncedfield
-
Not Syncedgrossly out and then over here rather than declaring it
-
Not Syncedi'd just create the new thier so i need to set it up with an instance variable
-
Not Syncedokay just like this on the example of the button same kind of thing that's
-
Not Syncedgoing on here
-
Not Syncedexcept the surtax feels
-
Not Syncedso let me show you an example of this code inaction
-
Not Syncedso here's a little text field example what i want to do is i'm going to create
-
Not Syncednext and the consul program some so i don't have a console
-
Not Syncedin my hand nick i'm going to have
-
Not Syncedsomething called name field what's name field it's just a private j text field
-
Not Syncedright it's an instance variable so i can save off name field
-
Not Syncedname field i a nationwide over here to be some new jerry text field of site and
-
Not Syncedwrite is exactly what i just saw over there
-
Not Syncednow when i also want to do here is the one actor funk innocent program i want
-
Not Syncedto give that box a label so before i add this box to my control bar
-
Not Syncedi'm gonna adding new jail able with jess says names all j label does it just says
-
Not Syncedhey i'm going to create something that's just this name
-
Not Syncedor just this particular these attacks attacks happens to be named and i'm
-
Not Syncedgoing to add
-
Not Syncedto my southern control bar
-
Not Syncedso forth it's just going to write name out there and then after i write name
-
Not Syncedi'm going to add to my name field which is going to create the box after name
-
Not Syncedand then i'm going to show you you know i'm going to do exactly what i told you
-
Not Syncedwhere you have to tell me name field
-
Not Syncedyou're going to add action listeners of yourself
-
Not Syncedso that if you do anything
-
Not Syncedyou're going to let
-
Not Syncedsomeone else know that you actually have done some action when the user tight
-
Not Syncedsince you would please enter
-
Not Syncedthat means action performed is going to get called for you because now you're
-
Not Syncedgoing to be able to generate events to an action listener
-
Not Syncedand inaction performed
-
Not Syncedwe check you don't get source we can compare against name field 'cause we
-
Not Syncedhave that saved up down here is an instance variable
-
Not Syncedand will just right out hello and then the text assisted with name field
-
Not Syncedand money
-
Not Syncedincrease the tax eyes here
-
Not Syncedjust so it's a little bit bigger and we can all see what's actually going on set
-
Not Syncedfor one
-
Not Syncedof the wild favorite career twenty four
-
Not Syncedaquino na make a bigger
-
Not Syncedyeah the asset just in case victor
-
Not Syncedso here once again they're on
-
Not Syncedhello marilyn c and one in those it's getting a bit like it in a row right
-
Not Syncedenter entertainer entertainers that exerc entertainer
-
Not Syncedthat's another one of things it's only so much fun
-
Not Syncedtrying to sell these were scroll emerge from one
-
Not Syncednot a lot of time going on their why does this gap of about two minutes maybe
-
Not Syncedone
-
Not Syncedso we can do it we can go ahead and do it this way now you can get information
-
Not Syncedpentax box
-
Not Syncedany questions about text box
-
Not Syncedbehind the back
-
Not Syncedyeah so basically the way layout works is every time you add things they just
-
Not Syncedget added sequentially from left to right in whichever region you're adding
-
Not Syncedthem to in this case the southern region and the whole set of stuff gets honored
-
Not Syncedso if you want to space stuff out which actually need to do our ad for example
-
Not Syncedmore more j labels that might have to spaces in the mental creates more space
-
Not Syncedbetween stuff and there's no economic are just leave it here
-
Not Syncedikea
-
Not Syncedso here's what i think india that's kinda funky is we can actually name of
-
Not Syncedthe text field
-
Not Syncedyou might say but maryland this won't get source thing yeah yeah keep around
-
Not Syncedthe instance there but i'm not so keen on that
-
Not Syncedwhat i am comwork you not is giving things name so i can just refer to them
-
Not Syncedby their name inside ok thats cool you can you can have a name
-
Not Syncedso here that exact same example just slightly differently what i want to do
-
Not Syncedis on the air
-
Not Syncedhad just one more line here so this is exactly the same code i had before
-
Not Syncedexcept after i create the name field i say hey name field
-
Not Syncedi want to give you an action need
-
Not Syncedand that were an action command and your action command is going to be name
-
Not Syncedso whenever you generate these events yeah i can check to see if your sources
-
Not Syncedactually but the source of that event is you
-
Not Syncedor if i've given you a name
-
Not Syncedi can do the same thing i just did with buttons which is down here i can get
-
Not Syncedaction command that gives me the string which is the name of the object the
-
Not Syncedcreated this event
-
Not Syncedand i can see if it's equal to name which is the name that i gave it
-
Not Syncedso that's just showed you a little back and forth with buttons i kinda showed
-
Not Syncedyou got for it with buttons you just need them cuz you always name buttons
-
Not Syncedwill check against names
-
Not Syncedbut you could actually
-
Not Syncedcheck against the source of the button if you want to
-
Not Syncedgatech still just kinda backwards j text field you always
-
Not Syncedin some sense have the tax field that you can get with debt source but if you
-
Not Syncedwant to report will by name you have to explicitly given name because name
-
Not Synceddoesn't show up as part of it right if we want the label we still need to add
-
Not Syncedthe separate label name over here
-
Not Syncedthis is just naming the particular events that come from that box that's
-
Not Syncedall it does
-
Not Syncedanswer any questions about them
-
Not Syncedat the max max shows
-
Not Syncedoss
-
Not Syncedyen named feel the stand i've are here it's really actually no longer necessary
-
Not Syncedcuz i don't need to refer to it over here so if i wanted to make it just is
-
Not Synceddeep sting little campaigns spank sidebars thanks for playing that's real
-
Not Syncednice of you
-
Not Syncedand everything's
-
Not Syncedalthough i can't
-
Not Syncedthat's why i did in here cause i still need to refer to it over here to get its
-
Not Syncedwhat i could to be honest actually what i could do is i could just
-
Not Syncedcall you get source here and get it source and get it stacks i really don't
-
Not Syncedneed to
-
Not Syncedbut it is better stock that makes it clear that i'm getting the texture so
-
Not Syncedthere is a way around it
-
Not Syncedbut the cleaner ways to actually do it this way
-
Not Syncedalready
-
Not Syncedget rid of the declaration
-
Not Syncedthat's like c
-
Not Syncedsang questions about that j text field
-
Not Synceduh... yeah
-
Not Syncedon weekends
-
Not Syncedand i'll show you that no about twenty minutes
-
Not Syncedbut hand free seats away so before we get there
-
Not Syncedit's not something completely different
-
Not Syncedand i think it's completely different is this a how to get to the question in the
-
Not Syncedback of the room which is
-
Not Syncedand they're on these things are all sort of showing up centered on the bottom of
-
Not Syncedthe screen cut i actually have these enter actor is laid out a different way
-
Not Syncedthan this way that they're getting laid out for me and in fact you can and
-
Not Syncedstrangely enough the thing you used to do that is called a layout
-
Not Syncedso i'll let you know controls the layout a particular interactions now it turns
-
Not Syncedout when you use your friendly console program
-
Not Syncedor your friend of the graphics program
-
Not Syncedwhat you got was a layout was called the border layouts and he was a matter of
-
Not Syncedfact artists on the border layouts
-
Not Syncedyou saw the boarder layout last time it looked like this
-
Not Syncedwhich is you had some cena region you had a north south east and west borders
-
Not Syncedwhich is why this thing called a border layout
-
Not Syncedand what you
-
Not Syncedwhat happened with that
-
Not Syncedwhat happened with this border layouts
-
Not Syncedpowerpoint wants comply
-
Not Syncedit at the center was were all the action takes place
-
Not Syncedthe console program would add a console to the sensor automatically right that
-
Not Syncedis what happens in a consul program and a graphics program would added g canvas
-
Not Syncedto the center automatically which is what you're going to draw your stuff
-
Not Syncedand the other regions are only visible if you add stuff to them so in the very
-
Not Syncedearly days when you had a graphics program
-
Not Syncedthat was all just graphics you would say hey mera nothing showed up at is the
-
Not Syncedself region
-
Not Syncedyeah 'cause we didn't put any interact or if they are so
-
Not Syncedthese enter actor region's only show up if we actually put in a raptor on
-
Not Syncedrightly said these are referred to as control bar say saudis last time
-
Not Syncedso how do i consider different kinds of layouts so there's a couple of other
-
Not Syncedlayout also think about their something called a greed layout
-
Not Syncedand and the land grant layout works is you actually creighton object called
-
Not Syncedagreed to lay out and you specify inaccurate lay out how many rows and
-
Not Syncedcolumns are in the great layout so
-
Not Syncedwe might take you rosen three columns which means we're going to have a laying
-
Not Syncedout the look something like this is just a grade with two rooms in three columns
-
Not Syncedand i say that the code for this in just two seconds and then the nitty-gritty
-
Not Synceddetails
-
Not Syncedbut conceptually here's what it is
-
Not Syncednow when i had i'd ims so what i do as i say hey you know what i want to set my
-
Not Syncedlayout to leave is great layout
-
Not Syncedwhat now happens when i had i done is is it will add items the items being the
-
Not Syncedinteract urs
-
Not Syncedone-by-one starting at the top most role in the leftmost center in the last most
-
Not Syncedsquare
-
Not Syncedand every time i add a new element it moved over by one until i get to the end
-
Not Syncedof the row and then it automatically comes down so go sequentially across row
-
Not Syncedby roe
-
Not Syncedbut allows me to contemplate things that may grade
-
Not Syncedif i want to actually be able to do things and agreed so let me show you an
-
Not Syncedexample of what a grid layout might look like
-
Not Syncedworld on with you lou died
-
Not Syncedso great layout
-
Not Syncedhere's a simple program it has a great layout what we do is we start off
-
Not Syncedinordinate method by saying
-
Not Syncedhey you know what i want to create a layout
-
Not Syncedso i want to set the existing layout that the program is going to use to be a
-
Not Syncednew grid layout that's to come at three to rose by three columns
-
Not Syncednow one thing that's interesting about this program if you look at great layout
-
Not Syncedexample
-
Not Syncedit does not extend consul program
-
Not Syncedit does not extend graphics program these are not expiry of four house and
-
Not Syncedit's beautiful life and it's beautiful children
-
Not Syncedwhat have i done
-
Not Syncedwhat i've done is set i'm just going to extend the program i don't want you to
-
Not Syncedcreate a console for me and i don't want you to create a g canvas for me
-
Not Syncedcuz i want to take up the whole story with my barnes baby
-
Not Syncedso that's what i'm gonna do
-
Not Syncedalmanac
-
Not Syncedsix new buttons and these bonds are just going to get sequentially ad in the
-
Not Syncedorder you just saw and then i'm not saying a tad weiss action listeners
-
Not Syncedand i'm not going to do anything understanding or the buttons but what i
-
Not Syncedreally the reason why i'm doing this
-
Not Syncedis i just want to see some big fab but
-
Not Syncedon the air like that
-
Not Syncedsix buttons that take up to the whole scream
-
Not Syncedit's a good
-
Not Syncedmy enter actors filled up the graded
-
Not Syncedthe layout takes up as much space as possible in the screen and more
-
Not Syncedimportantly each of the interac yours that i put into agreed cell takes up as
-
Not Syncedmuch cell as much space and the cell as possible so there's one comes along and
-
Not Syncedsays
-
Not Syncedall yeah i got so much space on lay down your likely why why do you do this is
-
Not Syncedthe most bring everything ever i don't hahahaha
-
Not Syncedlying
-
Not Synceddidn't have any plan that separately
-
Not Synceddriving everyone talk about a right now
-
Not Syncedmaybe afterwards
-
Not Syncedsuch as frightening as like avnet sound effects got
-
Not Syncedcheck this out as i resize the window all bein small uncw big buttons
-
Not Syncedthat's why we
-
Not Syncedhave layout managers because the layout manager just gives conceptually says
-
Not Syncedthis is how your layouts going to be
-
Not Syncedand it says i'm going to handle all the dynamics of resizing and all that stuff
-
Not Syncedfor ups_ people resize the window
-
Not Syncedbut i need to know how things are laid out and if you give me more space
-
Not Syncedthen i need to understand the take it out
-
Not Syncedgreat layout not so useful page or something to seize taken if you see in
-
Not Syncedthe book you know it's talking about
-
Not Syncedthere's another kind of layout
-
Not Syncedwhich is called a table layout
-
Not Syncedso that's another kind of lay out all the flow layout when i can talk about it
-
Not Syncedall
-
Not Syncedbut there's something called a table layout
-
Not Syncedany table layout is basically just like agreed layout except for the niceties so
-
Not Syncedyou also give it a number of rows and columns
-
Not Syncedexcept where it says is rather than having each one of the interact urs fill
-
Not Syncedup itself a maximum possible size
-
Not Syncedi'm just going to give that enter actor as much space is it needs in that cell
-
Not Syncedand no more
-
Not Syncedso what does that mean
-
Not Syncedthat means if i come in here rather than a grid layout i say i want to create a
-
Not Syncednew table layout
-
Not Syncedand i run this
-
Not Syncedco-ordinate add more imports
-
Not Syncedare a little guide
-
Not Syncedi mean just grab the imports from over here
-
Not Syncedme
-
Not Syncedyou happy
-
Not Syncedof graphics sorry
-
Not Syncedcome on table layout
-
Not Syncedthough table layout
-
Not Syncedlet me just show you the
-
Not Syncednice for example it cable
-
Not Synceddidi
-
Not Syncedsometimes in life
-
Not Syncedhe just got to get on with it
-
Not Syncedwe got ugly with it
-
Not Syncedtable layout
-
Not Syncedthere's table layout
-
Not Syncedsix button still
-
Not Syncedwe can spell resize the window but the button there just given as much sizes
-
Not Syncedthey would actually need they don't fill up the whole
-
Not Syncedregion of the actually ma
-
Not Syncedtable layout such something slightly more useful for us than great layout to
-
Not Syncedthe question came up before which was
-
Not Syncedhey can i actually link like buttons and text fields together
-
Not Syncedto create something a little bit more funky and in fact i can do that
-
Not Syncedinitially that any context outside something aloo bit more interesting
-
Not Syncedwhich is a program that allows for conversion in temperature so this one's
-
Not Syncedactually in the books i didn't give me the code because although
-
Not Syncedcody is actually a the coated on the books i didn't get a chance ever handout
-
Not Syncedthey say it is where i got a label called degrees fahrenheit a label called
-
Not Synceddegrees celsius
-
Not Syncedand inside here we can type in some value and if we click fahrenheit to
-
Not Syncedcelsius
-
Not Syncedit will automatically oil
-
Not Syncedfill in the southeast field of course one value separately to is zero celsius
-
Not Syncedthe other thing that's kinda funky if i don't necessarily have to click the
-
Not Syncedbutton i can type in say some value and hit enter
-
Not Syncedand that's just like
-
Not Syncedclicking the button
-
Not Syncedinteresting so how do i create this program well if you think about this
-
Not Syncedprogram first i'm going to need is these things are not supersized but they're
-
Not Syncedall laid out in a grade so i'm going to need a table layout
-
Not Syncedthat has to rosen three columns
-
Not Syncedthe first
-
Not Syncedelement that i have here is just the label that i'm going to have a field
-
Not Syncedthat the text field as a matter fact i have a specialized kind of text field
-
Not Syncedowners to specialize context field
-
Not Syncedsomething called the into field and a double field
-
Not Syncedthey work just like text fields except you're guaranteed to get an integer
-
Not Syncedvalue were double value from the menu mighty but now and what happens if
-
Not Syncedsomeone types and and wants to come for a twitter butcher
-
Not Syncedi clicked the wrong button they want to convert age were temperature
-
Not Syncedit says an internet injuring two brings up this pop-up box and gets in their
-
Not Syncedface and say oh yeah sorry my bad
-
Not Syncedso guarantees you get a major
-
Not Syncedand then i'm going to have a button and somehow i want to link the button and
-
Not Syncedthe tax bills to do the same action
-
Not Syncedso let me show you the car for that it's actually a lot shorter than it looks
-
Not Syncedlike
-
Not Syncedfirst thing to do is a case at the layout to be a table layout notice once
-
Not Syncedagain here i am extending a program 'cause i don't want to console or canvas
-
Not Syncedcreated for me
-
Not Syncedi want to be able to specify the whole layout
-
Not Syncedso i'm just extending a program
-
Not Syncedi say set the layout to be a table layout to come in three
-
Not Syncedand again we're going to go sequentially through all the elements of what i want
-
Not Syncedto have in the first
-
Not Syncedelement
-
Not Syncedbasically the first thing i want to add to my layout i don't specify intel down
-
Not Syncedhere the very first thing to add to my layout is
-
Not Synceddegrees fahrenheit as a label
-
Not Syncedthen i'm going to add some fahrenheit field what how did i create that
-
Not Syncedfahrenheit field actually created it up here
-
Not Syncedwhat i did
-
Not Syncedfirst was declaring it as an instance variable so fahrenheit field isn't ants
-
Not Syncedfield not agape text field that you feel which is just a specialization of eighty
-
Not Syncedeight ext field
-
Not Syncedto just give you back a major other than that it works just like a text field
-
Not Syncedexcept drugs one show you any feel totally feel
-
Not Syncedso i created new and field i specified financial value not its initial sides
-
Not Syncedbut its initial value
-
Not Syncedits initial value is thirty two
-
Not Syncedthen when i say is hey fahrenheit field
-
Not Syncedi'm going to set your action command
-
Not Syncedso that when you generate actions the name associated with the actions that
-
Not Syncedyou generate
-
Not Syncedis going to be af
-
Not Synceddash greater than which we can just think of as a rogue c
-
Not Syncedthat's going to be your name so i said its name and i say you're going to
-
Not Syncedgenerate action events
-
Not Syncedsomeone adn action listener g love yourself
-
Not Syncedokay just like you sabi for the text helix up now we're going with an infield
-
Not Syncedwe do exactly that same thing with something called the southeast feel
-
Not Syncedtells his films also declared to be an infield
-
Not Syncedit starts off the national volume zero we set it's action command to bc goes to
-
Not Syncedap as opposed to ap goes to see so we give it a slide a different name
-
Not Syncedand we also set yet to listen to action events
-
Not Syncedokay or did generate action events
-
Not Syncedand then we're going to lay out our great so first element of the great is
-
Not Syncedthe label as we talked about before
-
Not Syncednext element of our great is our little text box that's going to actually have
-
Not Syncedthe numeric value in it
-
Not Syncedand last elements of our great on the first of all of the greatest
-
Not Syncedis a button that's name is bath goes to see
-
Not Syncedand you look at this and you say hey marron if i have a button its name is
-
Not Syncedapt goes to see and i named this guy af goes to see
-
Not Syncedaren't i getting back to the previous point over here of whether that's the
-
Not Syncedlogical problem where i actually have two elements that have the same name
-
Not Syncedyeah bday i have to always have the same name but i want to do exactly the same
-
Not Syncedthing in both cases so it doesn't make a difference
-
Not Syncedso what i want to do is say someone clicks the button
-
Not Syncedi'm going to do the conversion so i'm going to have some kind of those who do
-
Not Syncedthe conversion
-
Not Syncedif someone type something in the text field it hits enter
-
Not Syncedi'm going to do the same thing
-
Not Syncedso this is something you see a lot of times on the web where for example if
-
Not Syncedthere's a search engine you use you type in the search engine then click search
-
Not Syncedor you can just take enter how many people actually click the search button
-
Not Syncedno one how many people just and hit enter
-
Not Syncedyet isn't it nice that you can just hit enter
-
Not Syncedthat's the same thing we're doing in this program which is why we went
-
Not Syncedthrough the extra rigmarole of setting this action command here
-
Not Synced'cause sometimes it's just nice to hear and
-
Not Syncedand we do exactly the same thing for the grease celsius
-
Not Syncedthe name that was so we add that labeled degree celsius we had the southeast
-
Not Syncedfield and then we create a new button whose name is the same as the action
-
Not Syncedcommand for the celsius field
-
Not Syncedand then we add action listeners that sets up our entire user interface or
-
Not Syncedentire graphical user interface and a good week
-
Not Syncedand then when the user clicks on a button we say hey
-
Not Syncedlet me get the action command if the action commands f goes to see which
-
Not Syncedmeans you are they type something in the fahrenheit field and hit enter
-
Not Syncedor they click the button
-
Not Syncedthen i'll get the value in the hair fahrenheit field
-
Not Syncedbecause fahrenheit field integer field i just always gives me back in a major
-
Not Syncedand i do a little bit of math if you don't know the map conversion from
-
Not Syncedfahrenheit the celsius
-
Not Synceddon't worry about it this is just how you convert from fahrenheit celsius
-
Not Syncedyou taking nine fifth times the fahrenheit value minus thirty two and i
-
Not Syncedgive you the celtics value now you know
-
Not Syncedwhat i do more interestingly if i set the value in the celsius field
-
Not Syncedto be whatever value i computed
-
Not Syncedso someone just type something into the fahrenheit feel that he enter or click
-
Not Syncedthe ftc_ button
-
Not Syncedbut in what i do to update the screen is ice change whatever values in the
-
Not Syncedcelsius field
-
Not Syncedand i destroy the receptacle of that or i should say that
-
Not Syncedcompliment reciprocal the inverse the mirror image how many words can you come
-
Not Syncedup for the same thing
-
Not Syncedof that if someone does see dat
-
Not Syncedwhich is i get the value that's in the celsius field
-
Not Syncedi do the map it's necessary to convert herself if the fahrenheit nice at the
-
Not Syncedfair field and that's the whole program right here is my instant variables
-
Not Syncedso if i run
-
Not Syncedmy little temperature program
-
Not Syncedi have my label
-
Not Syncedi have my initial value and i have my fahrenheit to celsius and if i put in
-
Not Syncedsome value here like a hundred degrees fahrenheit
-
Not Syncedis thirty eight degrees celsius
-
Not Syncedand two hundred twelve degrees fahrenheit will not touch the mouse just
-
Not Syncedhit on me in turkey
-
Not Synceduh... an er does the same thing is if i click the mouse and same thing on the
-
Not Syncedsecond phase zero celsius
-
Not Syncedthe actor into good times and not created a whole program of the graphical
-
Not Synceduser interface and i'd like to resize and it just doesn't know a lot always
-
Not Syncedcenters for me is not nice if i make it east mall
-
Not Syncedwhile these things don't get too small just sent a i can see the screen that's
-
Not Syncedwhat the state
-
Not Syncedany questions about that
-
Not Syncedhow can use the mikes please
-
Not Syncedi gotta keep reminding everyone views the microphones
-
Not Syncedp
-
Not Syncedbut you can look really good
-
Not Synceduh... there are ways the with table layout you can actually get it whatever
-
Not Syncedfortuitous at hands
-
Not Syncedto actually specify different sizes for things and i just didn't do that here
-
Not Syncedit's in the book if you want to do a but we're not going to
-
Not Syncedtry to push it out for in this class use it but there are ways you can
-
Not Syncedso one final thing that we want to do is you might say all this is all good well
-
Not Syncedmirror on yeah i'm not kind of fun but
-
Not Syncedreally what i like to some text in some graphics together and i want to interact
-
Not Syncedrecycle wanted all right
-
Not Syncedi want tax taiwan wrapped on interactive you think back to busy rethinking man
-
Not Syncedhangman you had texting had graphics
-
Not Syncedbut she didn't have interacted
-
Not Syncedhere you have interact there is and i show you example interact arisen tax
-
Not Syncedtwenty click the button and said hi and you know
-
Not Syncedgave your name or whatever now it's time to roll the enchilada and put them all
-
Not Syncedtogether in our friend
-
Not Syncedtext and graphics
-
Not Syncedso what text and graphics is going to do
-
Not Syncedis it basically what we want to think about is having some consul in the
-
Not Syncedprogram
-
Not Syncedand the graphics canvas in the program and interact or is in the program so we
-
Not Syncedcan just go to town and do whatever you want to do
-
Not Syncedhow do we make this happen
-
Not Syncedfirst thing we're going to do
-
Not Syncedyou had a little bit text on the board just to get out there a little
-
Not Syncedblood circulating in your legs and i know nothing about blood clots in your
-
Not Syncedlegs where you're actually traveling too long on planes and blood clot
-
Not Syncedyeah we want to talk about that
-
Not Syncedi didn't give you a small hands of a save your life beverage traveling on a
-
Not Syncedtrip is longer than two hours sometime during the trip or multiple times get up
-
Not Syncedand walk around
-
Not Syncedit will save your life
-
Not Syncedbut nigger ever giving a lecture for longer than two hours
-
Not Syncedget up and walk around it'll save your life to not be the blood clots but
-
Not Syncedbecause your students would tell you have to drive you just sitting there
-
Not Syncedgoing like all i know not good bread that layout were which we're not going
-
Not Syncedto get into it
-
Not Syncedbut is it accidentally so text and graphics
-
Not Syncedshe retains the taste great together
-
Not Syncedyou can decide which ones chocolate and which ones peanut butter
-
Not Syncedlettuce text and graphics and so it's like hangman but with interactives
-
Not Syncedso what we're going to do is we're going to extend consul program
-
Not Syncedand the reason why we're going to extend the consul program he's we still need
-
Not Syncedour plan the console that's what we're going to get the text portion of doing
-
Not Syncedthis interaction
-
Not Syncedit's from having the consul program
-
Not Syncedand so what we have a console program what please give this is it gives us
-
Not Syncedthe borders
-
Not Syncedthat we've come to know when law writing gives us the north border in the south
-
Not Syncedborder and western he's and these are places where we can still play so enter
-
Not Syncedactors
-
Not Syncedthe interesting thing is what's going on in the center region
-
Not Syncedand what i told you before the consul program
-
Not Syncedfills up the senate region with a place where you can put text and that's all
-
Not Syncedyou can do with it
-
Not Syncedso what we're going to say it a consul program what i want to do is in the
-
Not Syncedcenter regent i want to give you a different layout and put stuff in that
-
Not Syncedlady out
-
Not Syncedsecond potentially have some text in some graphic
-
Not Synceduh...
-
Not Syncedso what am i going to do
-
Not Syncedthe first thing i want to do is i'm going to think about having some layouts
-
Not Syncedokay mine layouts going applied to this middle region
-
Not Syncedthe important thing to keep in mind as the console program what used to be was
-
Not Syncedcreated console the filled up the entire region
-
Not Syncednow what i'm going to get is a console as my first elements
-
Not Syncedwhich means however i do the layout whatever i do and that lay out the very
-
Not Syncedfirst thing like what i have a great that has three elements to it one row
-
Not Syncedthe first elements of that
-
Not Syncedwill be my consul
-
Not Syncedthat you don't have any control over just because of the way the consul
-
Not Syncedprogram works the first elements of whatever layout you used when you extend
-
Not Syncedthe consul program create a layout for wall waise bhi your whatever your text
-
Not Syncedit's
-
Not Syncednow you said hey
-
Not Syncedthere on your awesome tell me about graphics but if i'm doing with the
-
Not Syncedconsul program how do i get graphics
-
Not Syncedwe give a little trick we did in hangman which is there's this thing called the g
-
Not Syncedcandidates
-
Not Syncedand what we're going to do is create agee kandicn digi cam this importantly
-
Not Syncedis actually something that we can add to a linux
-
Not Syncedso what i can do is say hey crave my consul program i'm going to create some
-
Not Syncedlayout but sam i have a great that's
-
Not Syncedi'm going to create some sort of way out like maybe i have agreed me out
-
Not Syncedone comment three
-
Not Syncedwhich would give me dressed
-
Not Syncedi know that my first things i think up my my console what i want to do is
-
Not Syncedcreepy g canvas
-
Not Syncedand ad that you can visit is my second elements
-
Not Syncedand just to be super cool to give you something that normally you'd have to
-
Not Syncedpay twelve ninety five four but i want to get at you for for
-
Not Syncedwe're going to create another g hands and added over here so that she can this
-
Not Syncedbills
-
Not Syncedso what we get is consul and to different g canvases
-
Not Syncedplus we can still add interac result round or screen
-
Not Syncedat this point you should be looking at this and shock horror and delight and
-
Not Syncedgoing
-
Not Syncedokay marron let's all put it together and five minutes because it's just that
-
Not Syncedhe
-
Not Syncedso here's how it works
-
Not Syncedtext and graphics ike's ten console program
-
Not Syncedokay 'cause that's going to get my consul
-
Not Syncedin miami i say set the layout
-
Not Syncedon one new grid layout remember great layout the elements of the great layout
-
Not Syncedexpand to take how much space you give them
-
Not Syncedthat's what i want in this case
-
Not Syncedbecause what i want to say as i want to have a great i want to give the consul
-
Not Syncedone-third of the whole grade and cute and this is another third of those
-
Not Syncedgrades and grown too is large as they can be
-
Not Syncedthen i'm going to do is i'm going to create to canvass so i need to have some
-
Not Syncedinstance variables to refer to these canvases
-
Not Syncedi am i have to canvases
-
Not Syncedwhich are just type is g canvas by private labels i will call them the
-
Not Syncedright canvas and the left hand yes
-
Not Syncedanimals have a text field in this program just for laughs just cuz i can
-
Not Syncedand that's going to be one of my characters so i want to have interact
-
Not Syncedrespect graph
-
Not Syncedwhat am i going to do
-
Not Syncedfirst thing to do it on to say that left canvas create a new canvas
-
Not Syncedthat can viz
-
Not Syncedand when i do this add it's adding it to my laid out
-
Not Syncedham adding a whole candid so what is that do it says hey told me got a great
-
Not Syncedlayout here ive already filled in the first thing with the console 'cause
-
Not Syncedthat's what i do on the console program
-
Not Syncedyou just told me to add a canvas
-
Not Syncedelement number two will be the canvas
-
Not Syncedi do the same thing again for white canvas element number three is not the
-
Not Syncedright and so i have to big canvasses on there as the second and third elements
-
Not Syncedof my grade
-
Not Syncedi got a console
-
Not Syncedgrid canvas tents not going to add to interact with because it's just that
-
Not Syncedcool i'm going to create a text field which they knew gatech steel text field
-
Not Syncedi declared as a private instance variable i just showed you that
-
Not Syncedmaximum size is ten
-
Not Syncedi will add a label to it and the label just going to be called some text
-
Not Syncedsold the rights some tax
-
Not Syncedin the southern region
-
Not Syncedthat'll adam i text field in the southern region and that ads at this
-
Not Syncedpoint you should come to know involved you always gotta remember to add your
-
Not Syncedaction list are very common thing that happens people create a text field and
-
Not Syncedtheir type in an end stuff in the program enough things happening in their
-
Not Syncedtearing their hair and they're wondering why
-
Not Syncedthey just forgot to add the action list you know it learn it live it probably
-
Not Syncedit's a good time
-
Not Syncedaction listener for your text field
-
Not Syncedand then i would have to buttons just for good times so i have my tech said
-
Not Syncedi'm gonna have to more buttons a button that says draw on the left
-
Not Syncedand a button that says draw on the right
-
Not Syncedso i mean show you what all these things are going to do
-
Not Syncedbefore i show you the rest of the program
-
Not Syncedso what i want to show you text and graphics
-
Not Synceduh...
-
Not Syncedout my consolation
-
Not Syncedi have to you can see them but they are side by side q different canvas windows
-
Not Syncedover here here's some text i can type in high
-
Not Syncedyou typed
-
Not Syncedwhile
-
Not Syncedthat exciting
-
Not Synceddrama left in my left hand that some just run rectangles offsite i do that
-
Not Syncedjust a second
-
Not Synceddraw a right
-
Not Synceddrawing in my right candidates
-
Not Syncedhow did i make that happen alright on your share of the programme so i've set
-
Not Syncedeverything up right console to canvases
-
Not Syncedtext field and two buttons at the bottom
-
Not Syncedhere is where all the actions going on when action performed is called right i
-
Not Syncedmean someone's interacting with one of the interact urs there's nothing else i
-
Not Syncedcan do in the program except interact with one of the inner actors
-
Not Syncedfirst a check for the text field if the interaction with the text field so if
-
Not Syncedthe source of the interaction with the text field i write about you typed and
-
Not Syncedthe text of the text field this will go into the consul biggest anytime you do
-
Not Syncedapplicable in the text always goes in the consul so it just shows up in the
-
Not Syncedconsul not a whole lot exciting going on there
-
Not Syncedalternatively if the thing they did was not stipe into the text field
-
Not Syncedthey clicked one of the bottoms so i say hey i'm showing i could've been there
-
Not Synceddone all with get sore throat always get action command
-
Not Syncedi'm using both just to show you that you can mix and match if you want
-
Not Syncedso i say hey what was the command get action command
-
Not Syncedif it was drawl left then what i want to do is i'm going to create a new field a
-
Not Syncedrectangle let me show you create new filled rectangle it's very simple
-
Not Syncedit just
-
Not Syncedcreates a rectangle that's fifty by twenty and yes they should have been
-
Not Syncedconstant i didn't make them conference i wouldn't have to scroll down and show
-
Not Syncedyou the constant
-
Not Syncedi said to be filled
-
Not Syncedand i return the rectangle solid does is create a filled rectangle on say hey
-
Not Syncedyour ego
-
Not Syncedand although i do is i take that filled rectangle and i added
-
Not Syncedto my left hand dates
-
Not Syncedso because that's not a graphics program i can just a tad with the rectangle one
-
Not Syncedadded if i want to add the rectangle somewhere i need to specify which canvas
-
Not Syncedof my adding a few i'm adding it's the left campus icao left hand this ads
-
Not Syncedyourself this rectangle where you can add it x location twenty and at one
-
Not Syncedlocation left y
-
Not Syncedleft wide starts out with the value ten
-
Not Syncedand every time i add something i'd space down my wife's i'm just making wide go
-
Not Synceddown to buy some spacer mt which is thirty so i was doing is trying a
-
Not Syncedrectangle and essentially moving down toward drachmir x next rectangle below
-
Not Syncedit moving down to draw the next rectangle below it
-
Not Syncedand i do exactly the same thing for the right hand side
-
Not Syncedexcept after a quick quick filled rectangle i have a separate whitewater
-
Not Syncedwhich keeps track of how low of gotten on that side in terms of the white ford
-
Not Syncednet
-
Not Syncedand i add to the right canvas
-
Not Syncedthat's the only difference
-
Not Syncedso when i run this program
-
Not Syncedright some text
-
Not Syncedright again if i type and great
-
Not Syncedby typing great
-
Not Syncedand hit enter it generates the event which does the sprint lynn on the screen
-
Not Syncedright it generates this event over here this action performed
-
Not Syncedthe source was text field and i write out the text on the screen
-
Not Syncedif i click on one of the buttons drama apt
-
Not Synceddraws the filled rectangle and its incremented the why on the left hand
-
Not Syncedside for next time i clicked route left
-
Not Syncedit draws at lower and lower and lower and dry right does the same thing
-
Not Syncednotice of the x location for both
-
Not Syncedthis canvas and this can this when i had the rectangles are both a twenty the
-
Not Syncedreason why it shows up to a different place in the screen is because they're
-
Not Syncedtwo different and this is in those kind of invisible border here
-
Not Syncedso you can create cameron text
-
Not Syncedgraphics and interactive altogether and just go to town any questions
-
Not Syncedall right and i will see you on wednesday
- Title:
- Lecture 21 | Programming Methodology (Stanford)
- Description:
-
Lecture by Professor Mehran Sahami for the Stanford Computer Science Department (CS106A). Professor Sahami continues lecturing on interactions and pushes it further.
CS106A is an Introduction to the engineering of computer applications emphasizing modern software engineering principles: object-oriented design, decomposition, encapsulation, abstraction, and testing. Uses the Java programming language. Emphasis is on good programming style and the built-in facilities of the Java language.
Complete Playlist for the Course:
http://www.youtube.com/view_play_list?p=84A56BC7F4A1F852CS106A at Stanford Unversity:
http://www.stanford.edu/class/cs106a/Stanford Center for Professional Development:
http://scpd.stanford.edu/Stanford University:
http://www.stanford.eduStanford University Channel on YouTube:
http://www.youtube.com/stanford - Video Language:
- English
- Duration:
- 47:39
codecrystal edited English subtitles for Lecture 21 | Programming Methodology (Stanford) | ||
Eunjeong_Kim added a translation |