Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming – Lecture 15 Going Beyond the ACM Library.

Similar presentations


Presentation on theme: "Programming – Lecture 15 Going Beyond the ACM Library."— Presentation transcript:

1 Programming – Lecture 15 Going Beyond the ACM Library

2 The ACM Library So far, we have used the ACM library to write our programs. Most of our programs were instances of one of these classes: 2 ConsoleProgram DialogProgram GraphicsProgram Text-based Graphics-based

3 Alternatives 3 ConsoleProgram DialogProgram GraphicsProgram

4 Alternatives: Text-Based public class HelloWorld { public static void main (String[] args) { System.out.println("Hello World!"); } 4 Simple Java programs are text-based by default. Remember lecture 2:

5 Class Definition 5 ACM: public class Wubbel extends ConsoleProgram { //... } Java: No restrictions. Every class can have a main method.

6 Program Entry Point 6 ACM: public void run() { //... } Java: public static void main(String[] args) { //... }

7 Console Output 7 ACM: println(...); Java: System.out.println(...);

8 Console Input 8 ACM: String s = readLine(); int i = readInt(); Java: Scanner scanner = new Scanner( System.in); String s = scanner.next(); int i = scanner.nextInt();

9 Alternatives 9 ConsoleProgram DialogProgram GraphicsProgram

10 Java AWT 10 This is the original Java GUI library. Very outdated. You shouldn’t use this one.

11 Java Swing 11 The second Java GUI library. Quite flexible and different visual styles available. Can still be used, but has been superseded. Web resource: Creating a GUI With JFC/Swing

12 JavaFX 12 The current Java GUI library. Themeable, support for animations. This is a good choice for your applications. Web resource: Java Client Technologies


Download ppt "Programming – Lecture 15 Going Beyond the ACM Library."

Similar presentations


Ads by Google