New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Adv. Object

by: Dorothy Bahringer DVM

Adv. Object CS 3331

Dorothy Bahringer DVM
GPA 3.85

Steven Roach

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Steven Roach
Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 7 page Class Notes was uploaded by Dorothy Bahringer DVM on Thursday October 29, 2015. The Class Notes belongs to CS 3331 at University of Texas at El Paso taught by Steven Roach in Fall. Since its upload, it has received 41 views. For similar materials see /class/231289/cs-3331-university-of-texas-at-el-paso in ComputerScienence at University of Texas at El Paso.

Similar to CS 3331 at UTEP

Popular in ComputerScienence


Reviews for Adv. Object


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/29/15
Problem Build the intemet based convenience store monitor CSM racks the current price of regular gas chips and soda Provide three display elements rrent prices Make it extendable Create an API so other Pangiventuvuu developers can plug in their own displays pricesChanged public void pricesChanged oat gas getGasPriceO CSMData This gets eaiied Whenever oat chip getChipsPn39ceO oat soda getSodaPriceO asF39n puphe vuid pheesChahgedm getChipsF ricEO getsmp no Hyuur cude here pheesChahgedo How do we encapsulate what s Redesign cha nging see same getGasF ricEO getChipsF ricEO EtSudaF riceO pheeschahgedo puphe vuid pheesChahgedm fluat gas getGasF ricEO fluatchip EtChipsF ricEO fluatsuda getSudaF rict Eheapsuiate What changes currentF ricEDisplay update gas chips suda histuryDisplay update gas chips suda furecastDisplay update gas chips suda l Observer Pattern Intent 7 To denne reiatronsnrp between a group orobrects sucn tnat wnenever one obrect rs updated all otners are notrned autornatrcaiiv Context 7 Muitrpie obrects depend on tne state of one obrect 7 Set of dependent obrects rnav cnange at runtrrne Solution 7 Allow dependent obrects to registerwitn obrect of interest and notrrv tnern of updates wnen state cnanges Participants brect e novvs rts observers e Provrdes rnterraee ror attaenrng and detaenrng observers 0 Server 7 Dennes an updatrng rnterraee ConcreteSu rec 7 Stores st t or rnterest e s nds notrneatron to observers on state enange Concrete Server 7 Marntarns a rererenee to a concrete subreet 7 Stores state tnat snouid stav eonsrstentvvrtn tne subreet s e irnpiernentstne updatrng rnterraee to keep rts state eonsrtentvvrtn s Weather Station Design moat sub 4 u revsler bsehEVO a remam bser k39o a quotammo Stru ctu re a nachmbservar o deucMDbservar Collaborations Interfaces public interface Subject public void registerObserverObserver 0 public void remove serverObserver 0 public void notifyObserversO public interface Subject public void update oat temp oat hum oat pres public interface DisplayElement public void display 11 42009 Outline MVC Model GUI components widgets Layout managers Handling events GUI Frameworks CS 3331 MVC Model Separating M from VC Away of cleanly breaking an application into three arts Modefor maintaining data View for displaying all or a portion ofthe data and Controllerforhandling events that affect the model or Due to Separation Due to Separation Cont Multiple views and controllers for models New views and controllers can be added forthe model Changes in views are localized such changes have minimal or no impact on the model Outline I MVC Model GUI components widgets Layout managers Handling events Java GUI Frameworks GUI frameworks Part ofJava Foundation Class JFC Abstract Window Toolkit AWT and Swing Framework classes GUI components orwidgets Layout managers Events and event listeners Graphics and imaging classes AWT Components primitive l l I mu wiiiiw II l I l MA 4 M in I I l l quot container 11 42009 Sample GUI Program Counter applet AWT vs Swing AWT Heavyweight components Swing Lightweightcomponents ie no peer components Swing Components Composite Design Pattern Q How to Layout Widgets Three approaches Manually specify absolute positions Manually specify relative positions Automate it Hierarchy of Layout Managers LayawManager A A EurderLayuut LayoufManageE A GridEagLayuut 1142009 Outline w MVC Model I GUI components widgets Layout managers Handling events Layout Managers Associated with containers Automate the layout of elements When elements are added to the container When the window is resized uturnaticaiiy adjustthe positions and SiZES ufthe e ements Using Layout Managers Methud Descliptiun setLavuutUrn Set imasthe iamm managev addcumll Add a rumpunent momma 251 Add a rumpunem thh cunsuaim uhiicciassCuuntevA letzxtendsA let ppuniccmgmppi i pp gm r W mam add at inclement Decreme Cl i Let uuViE Em tar aum anEutt l 1142009 Flow Layout Flow Layout Cont Width400 heig ht50 my public class Flow extends Applet Applet public Flow g E El Smalltalk l setLayoutnew FIowLayoutO addnew J ButtonquotJ avaquot quotW39E S m ad addnew J ButtonquotCquot addnew J ButtonquotPerlquot addnew J ButtonquotAdaquot W addnew J ButtonquotSmalltalkquot dth 100 h ht 120 addnew J ButtonquotEiffequot er 3 W elg Smalltalk l Applet started Grid Layout Grid Layout Cont public class Grid extends Applet setLayoutmew GridLayouti ow col public void init addnew JButtonquotJavaquot Java cu int row 0 addnew JButtonquotCquot 3X2 grid J int col 0 addnew JButtonquotPerquot PEquot String att getParameterC39rowquot addnew JButtonquotAdaquot swim 0 if att null addnew JButtonquotSmalltakquot row Inte er arseln att add new JButton quotEiffelquot 0x1 grid Peri g p t D att getParameterquotcolquot 1x0 grid Ada if an I nu col ntegerparsentatt it I smamaik AW if row 0 ampamp col 0 Java Cquot Perl Ada Smalltalk Ei ei EiWEI row col Appimstansd APPIEtsmvtzd Border Layout Border Layout Cont public class Border extends Applet public Border App setLayoutmevv BorderLayoutO NW1 addnew JButtonquotNorthquot BorderLayoutNORTl l addnew JButtonC39Southquot BorderLayoutSOUTl I addnew JButtonC39Eastquot BorderLayout EAST West Center East addnew JButtonC39Westquot BorderLayoutWEST addnew JButtonC39Centeiquot BorderLay outCENTER South Applet started Outline l MVC Model GUI components Widgets Layout managers Handling events Event Handling Cont Event A way for GUI components to communicate with the rest of application Implemented as event classes eg Action Event Event source Components generating events Examples buttons check boxes combo boxes etc Example create a button uButton button new JButtorlClrlcrernerlt register an action listener button addActlorlLlsterlerrleW ButtonActionListener i Actlorl listener class class ButtonActiontistener implements Actiontistenerl publlc vold actlorlPerformedActlorlEverlt e l nanole tne event e System out prlrltlrl lrlcrernerlt button pressedl 11 42009 Event Handling Mechanism to write control code Composed of Event Event source Event listener or handler Event Handling Cont Event listener or handler Objects that receives and processes events Must implement an appropriate listener interface Must inform the source its interest in handling a certain type of events by registering May listen to several sources and different types of events How Does It Work b JEutturl


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Anthony Lee UC Santa Barbara

"I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.