Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package n3as;
- import javax.swing.*;
- import java.awt.*;
- import java.awt.geom.Rectangle2D;
- import java.util.*;
- public class geo extends JFrame implements Runnable{
- Forme[] f;
- ArrayList<Shape> t;
- Text c;
- public geo() {
- f=new Forme[3];
- Date d=new Date();
- int h=d.getHours();
- int m=d.getMinutes();
- int s=d.getSeconds();
- c= new Text(h+":"+m+":"+s);
- JPanel p=new JPanel(new BorderLayout());
- t=new ArrayList<Shape>();
- t.add(new Polygon());
- t.add(new Rectangle2D.Double());
- t.add(new Circle());
- for(int i=0;i<t.size();i++) {
- f[i]= new Forme(t.get(i));
- }
- }
- }
- ________________________________________________________________________________
- package n3as;
- import java.awt.*;
- import javax.swing.*;
- public class Forme extends JPanel {
- Shape s;
- public Forme(Shape s) {
- this.s=s;
- }
- public void paintComponnent(Graphics g) {
- super.paintComponent(g);
- Graphics2D g2d= (Graphics2D)g;
- g2d.draw(s);
- }
- public Shape getSt() {
- return s;
- }
- public void setSh(Shape s) {
- this.s=s;
- }
- }
- _______________________________________________________________________________________
- package n3as;
- import java.awt.*;
- import javax.swing.*;
- public class Text extends JPanel {
- String s;
- public Text(String s) {
- this.s=s;
- }
- public void paintComponnent(Graphics g) {
- super.paintComponent(g);
- Graphics2D g2d= (Graphics2D)g;
- g2d.drawString(s, 10, 10);
- }
- public String getSt() {
- return s;
- }
- public void setSt(String s) {
- this.s=s;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement