homepage whitepaper documentation download api
Screenshot by Willi Glenzpackage de.wglenz.java;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class Main {
JFrame frame;
JLabel label;
JButton button1;
JButton button2;
JButton button3;
public Main() {
super();
label = new JLabel("Empty");
button1 = new JButton("Button 1");
button1.addActionListener(new Listener1());
button2 = new JButton("Button 2");
button2.addActionListener(new Listener2());
button3 = new JButton("Button 3");
button3.addActionListener(new Listener3());
frame = new JFrame("Phoenix");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(BorderLayout.WEST, button1);
frame.getContentPane().add(BorderLayout.SOUTH, button2);
frame.getContentPane().add(BorderLayout.EAST, button3);
frame.getContentPane().add(BorderLayout.CENTER, label);
frame.setSize(600, 400);
frame.setVisible(true);
}
public static void main(String... args) {
Main phoenix = new Main();
phoenix.run();
}
class Listener1 implements ActionListener {
public void actionPerformed(ActionEvent e) {
label.setText("Button 1: OK");
}
}
class Listener2 implements ActionListener {
public void actionPerformed(ActionEvent e) {
label.setText("Button 2: OK");
}
}
class Listener3 implements ActionListener {
public void actionPerformed(ActionEvent e) {
label.setText("Button 3: OK");
}
}
public void run() {
//
}
}
public class Main {
private String msg;
public Main() {
super();
this.msg = "Hello World!";
}
public static void main(String[] args) {
Main phoenix = new Main();
phoenix.run();
}
public void run() {
System.out.println(msg);
}
}
Class Package Subclass World
private ok - - -
default ok ok - -
protected ok ok ok -
public ok ok ok ok
Arithmetic + - * / & ++ --
Relational == != > < >= <=
Bitwise & | ^ ~ << >> >>>
Logical && || !
Assignment = += -= *= /= %= <<= >>= &= ^= |=
Miscellaneous ?: instanceof
| Type | Size | Range | Default | Class & Field |
|---|---|---|---|---|
| byte | 8 bit | -2^7 to 2^7 -1 | 0 | |
| short | 16 bit | -2^15 to 2^15 -1 | 0 | |
| int | 32-bit | -2^31 to 2^31 -1 | 0 | Integer.MIN_VALUE to Integer.MAX_VALUE |
| long | 64 bit | -2^63 to 2^63-1 | 0L | |
| float | 32 bit | -3.4E38 to 3.4E38 | 0f | |
| double | 64 bit | -1.7E308 to 1.7E308 | 0d | |
| char | 16 bit | '\u0000' to '\uffff' (0 to 65,565) | '\u0000' | |
| boolean | 1 bit | false |
public Byte(byte|String value|s)
public Short(short|String value|s)
public Integer(int|String value|s)
public Long(long|String value|s)
public Float(float|double|String value|value|s)
public Double(double|String value|s)
public Character(char value)
public Boolean(boolean|String value|s)
- TutorialsPoint - Learning Swing
- Oracle Trail - Swing
- O'Reilly - AWT Reference
- Getting Started
- Language Basics
- Object-Oriented Programming Concepts
- Classes and Objects
- Interfaces and Inheritance
- Numbers and Strings
- Packages
- Exceptions
- Basic I/O
- Concurrency
- Generics
- Annotations
- Learning Java - tutorialspoint • javatpoint
- Bradley Kjell - Introduction to Computer Science using Java
- IdeOne - Online Compiler and IDE
# apt-get install default-jdk default-jdk-doc openjdk-11-jdk openjdk-11-doc
$ java -version; javac -version
# update-java-alternatives -l
# update-java-alternatives -s java-1.11.0-openjdk-amd64
# update-alternatives --display java
# update-alternatives --config java
$ mkdir -p /tmp/java/{tools,test,phoenix};cd /tmp/java; ls -lisa
$ vim Main.java ^z fg
$ ( cd /tmp/java/; vim Main.java )