Download pptx - iLearn

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Programming – Lecture 15
Going Beyond
the ACM Library
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:
ConsoleProgram
Text-based
DialogProgram
Graphics-based
GraphicsProgram
2
Alternatives
ConsoleProgram
DialogProgram
GraphicsProgram
3
Alternatives: Text-Based
Simple Java programs are text-based by default.
Remember Lecture 2:
public class HelloWorld {
public static void main (String[] args) {
System.out.println("Hello World!");
}
}
4
Class Definition
ACM:
public class Wubbel
extends ConsoleProgram {
//...
}
Java:
No restrictions. Every class can have a
main method.
5
Program Entry Point
ACM:
public void run() {
//...
}
Java:
public static void main(String[] args) {
//...
}
6
Console Output
ACM:
println(...);
Java:
System.out.println(...);
7
Console Input
ACM:
String s = readLine();
int i = readInt();
Java:
Scanner scanner = new Scanner(System.in);
String s = scanner.next();
int i = scanner.nextInt();
8
Alternatives
ConsoleProgram
DialogProgram
GraphicsProgram
9
Java AWT
This is the original Java GUI library.
Very outdated.
You shouldn’t use this one.
10
Java Swing
The second Java GUI library.
Quite flexible, provides different visual styles.
Can still be used, but has been superseded.
Web resource:
Creating a GUI With JFC/Swing
11
JavaFX
The current Java GUI library.
Themeable, support for animations.
A good choice for your applications.
Web resource:
Java Client Technologies
12
Related documents