Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Window-creation-X11/Java/window-creation-x11-1.java
Normal file
21
Task/Window-creation-X11/Java/window-creation-x11-1.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import javax.swing.JFrame;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
public class WindowExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
createAndShow();
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater(runnable);
|
||||
}
|
||||
|
||||
static void createAndShow() {
|
||||
JFrame frame = new JFrame("Hello World");
|
||||
frame.setSize(640,480);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
27
Task/Window-creation-X11/Java/window-creation-x11-2.java
Normal file
27
Task/Window-creation-X11/Java/window-creation-x11-2.java
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.geom.*;
|
||||
import javax.swing.*;
|
||||
|
||||
public class WindowExample extends JApplet {
|
||||
public void paint(Graphics g) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
|
||||
g2.setStroke(new BasicStroke(2.0f));
|
||||
g2.drawString("Hello java", 20, 20);
|
||||
g2.setPaint(Color.blue);
|
||||
g2.draw(new Rectangle2D.Double(40, 40, 20, 20));
|
||||
}
|
||||
|
||||
public static void main(String s[]) {
|
||||
JFrame f = new JFrame("ShapesDemo2D");
|
||||
f.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent e) {System.exit(0);}
|
||||
});
|
||||
JApplet applet = new ShapesDemo2D();
|
||||
f.getContentPane().add("Center", applet);
|
||||
f.pack();
|
||||
f.setSize(new Dimension(150, 150));
|
||||
f.setVisible(true);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue