Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

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 real effort on P3

2 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

3 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?

4 Swing, Swing, Swing...

5 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)

6 The Model-View-Controller Pattern model viewcontroller myAppClass myAppData1

7 The Model-View-Controller Pattern model viewcontroller myAppClass myAppData1

8 The Model-View-Controller Pattern model viewcontroller myAppClass myAppData1

9 The Model-View-Controller Pattern model viewcontroller myAppClass myAppData1

10 The Swing Component Model

11 JFrame

12 The Swing Component Model JFrame.getContentPane()

13 The Swing Component Model JLabel

14 The Swing Component Model JTabbedPane

15 The Swing Component Model ButtonGroup (JRadioButton s )

16 The Swing Component Model JButton

17 The Swing Component Model JLabel

18 The Swing Component Model JRadioButton

19 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

20 Assembling the GUI JFrame JLabel JTabbedPane JRadioButton group JButton JLabel 4

21 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

22 Arranging Stuff JFrame JLabel JTabbedPane JRadioButton JButton JLabel JPanel vertical arrangement vertical arrangement horizontal arrangement 44 contentPane


Download ppt "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."

Similar presentations


Ads by Google