administrivia p2 was due already if you’re not done yet: turn in what you can asap decide whether...

22
Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend real effort on P3

Post on 20-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Administrivia

P2 was due already If you’re not done yet:

Turn in what you can ASAP Decide whether you can really make

>= 15% improvement by tomorrow Spend real effort on P3

Page 2: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Administrivia

P3 stuff: Put serious work into design now -- will

save you big time/effort later G1 still needs to schedule their meeting

for tomorrow Available times: 10-11 AM, 2-3:30, 4:00-

5:00

Page 3: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Stuff I’m Looking for in P3M1

How will the game engine work? What classes/modules will there be? How will they communicate?

Exception hierarchy? What exceptions are possible? How are they arranged? Checked or uncheked?

Assembler/disassembler? How does it work? Parts? Will it share functionality w/ main game engine? How?

GUI: What will it look like? (Sketches are good) What does each part do? How do they communicate?

Multithreading? Who manages? Synchronization?

Page 4: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Swing, Swing, Swing...

Page 5: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Model-View-Controller Pattern

Design principle for GUI apps (not the only principle!)

Separate the core data structures and logic (e.g., RVM; game rules) from the UI This is the “model”

Separate UI “input” (control) from “display” (view)

Page 6: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Model-View-Controller Pattern

model

view controller

myAppClass

myAppData1

myAppData1

myAppData1

Page 7: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Model-View-Controller Pattern

model

view controller

myAppClass

myAppData1

myAppData1

myAppData1

Page 8: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Model-View-Controller Pattern

model

view controller

myAppClass

myAppData1

myAppData1

myAppData1

Page 9: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Model-View-Controller Pattern

model

view controller

myAppClass

myAppData1

myAppData1

myAppData1

Page 10: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

Page 11: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

JFrame

Page 12: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

JFrame.getContentPane()

Page 13: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

JLabel

Page 14: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

JTabbedPane

Page 15: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

ButtonGroup (JRadioButtons)

Page 16: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

JButton

Page 17: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

JLabel

Page 18: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

The Swing Component Model

JRadioButton

Page 19: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Assembling the GUI

All visual things in a Swing app are “components” (JComponent) Essentially, a component is something that

can be drawn on the screen May also be able to “contain” some other

component All components support an add() operation

Components nested inside other components

UI built hierarchically Create a top-level component (JFrame)

and recursively add parts to it

Page 20: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Assembling the GUI

JFrame

JLabel

JTabbedPane

JRadioButtongroup

JButton

JLabel

4

Page 21: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Arranging Stuff

How big should components be? Where should they be put relative to each

other? How do we get the JLabel on top of the JTabbedPane, beside the ButtonGroup, above the JButton...?

Swing uses a “layout manager” approach Instead of: “Make this thing 200 pixels

wide, starting at (x=150,y=35)” “Stack these things horizontally and flush

them all left” Use objects of type LayoutManager to control

Page 22: Administrivia P2 was due already If you’re not done yet: Turn in what you can ASAP Decide whether you can really make >= 15% improvement by tomorrow Spend

Arranging Stuff

JFrame

JLabel

JTabbedPane

JRadioButton

JButton

JLabel

JPanel

JPanel

JPanel

verticalarrangement

verticalarrangement

horizontalarrangement

4 4

contentPane