Docsity

Java Programming: Access Privileges, Final Instance Fields, and Swing Components, Slides of Java Programming

Partial preview of the text

Download Java Programming: Access Privileges, Final Instance Fields, and Swing Components and more Slides Java Programming in PDF only on Docsity!

Programming

Swings

Access Privileges

  • Public
  • Private
    • A method can access the private data of all objects of its class.
  • Example

class Box{ private int L,W,H; public void test(Box b){ b.H=10; } }

Java Swings

  • A group of 14 packages to do with the UI
  • 451 classes as at 1.4 (!)
  • Part of JFC Java Foundation Classes (compare now defunct MFC)

Build from bottom up

  • Create:
    • Frame
    • Panel
    • Components
    • Listeners
  • Add: (bottom up)
    • listeners into components
    • components into panel
    • panel into frame

JPanel

JButton

Listener

JFrame

JLabel