GUI #43 (Parce que Francais est meiller que l'Anglais.)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program Name: A Frame with a Panel with Some Writing
/// File Name: SimpleFrame.java
/// Date Finished: Oct 22, 2015
import javax.swing.*;
import java.awt.*;
public class SimpleFrameApp {
public static void main(String[] args) {
new SimpleFrame().setVisible(true);
}
}
class SimpleFrame extends JFrame {
public SimpleFrame() {
setTitle("Un Cadre de Base");
setSize(300, 200);
setLocationRelativeTo(null);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
getContentPane().add(new SimplePanel());
}
}
class SimplePanel extends JPanel {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawString("Bonjour Monde", 20, 20);
}
}
Picture of the output