Source code: com/memoire/dja/DjaPoint.java
1 /**
2 * @modification $Date: 2001/12/03 16:28:08 $
3 * @statut unstable
4 * @file DjaPoint.java
5 * @version 0.36
6 * @author Guillaume Desnoix
7 * @email guillaume@desnoix.com
8 * @license GNU General Public License 2 (GPL2)
9 * @copyright 1998-2001 Guillaume Desnoix
10 */
11
12 package com.memoire.dja;
13
14 import com.memoire.fu.*;
15 import com.memoire.dnd.*;
16 import com.memoire.bu.*;
17 import com.memoire.dja.*;
18 import com.memoire.mst.*;
19
20
21 import java.awt.*;
22 import java.awt.event.*;
23 import javax.swing.*;
24 import javax.swing.border.*;
25
26 public class DjaPoint
27 extends DjaForm
28 {
29 public DjaPoint(String _texte)
30 {
31 super(_texte,SOUTH);
32 super.setWidth (1);
33 super.setHeight(1);
34 }
35
36 public DjaPoint()
37 {
38 this(null);
39 }
40
41 public void setWidth(int _w)
42 { }
43
44 public void setHeight(int _h)
45 { }
46
47 public int getWidth()
48 { return 1; }
49
50 public int getHeight()
51 { return 1; }
52
53 public boolean contains(int _x, int _y)
54 {
55 Rectangle r=getBounds();
56 r.grow(7,7);
57 return r.contains(_x,_y);
58 }
59
60 public DjaAnchor[] getAnchors()
61 {
62 DjaAnchor[] r=new DjaAnchor[1];
63 r[0]=new DjaAnchor(this,0,NORTH,getX(),getY());
64 return r;
65 }
66
67 public DjaHandle[] getHandles()
68 {
69 DjaHandle[] r=new DjaHandle[0];
70 return r;
71 }
72
73 public void paintInteractive(Graphics _g)
74 {
75 int x=getX();
76 int y=getY();
77
78 Color bg=getBackground();
79 if(bg!=null)
80 {
81 _g.setColor(bg);
82 _g.fillOval(x-4,y-4,9,9);
83 }
84
85 Color fg=getForeground();
86 if(fg!=null)
87 {
88 _g.setColor(fg);
89 _g.drawOval(x-5,y-5,10,10);
90 }
91
92 super.paintInteractive(_g);
93 }
94 }