Source code: com/memoire/dja/DjaRoundBox.java
1 /**
2 * @modification $Date: 2001/12/03 16:28:08 $
3 * @statut unstable
4 * @file DjaRoundBox.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 DjaRoundBox
27 extends DjaBox
28 {
29 public DjaRoundBox(String _texte)
30 {
31 super(_texte);
32 putProperty("rayon","10");
33 }
34
35 public DjaRoundBox()
36 {
37 this(null);
38 }
39
40 private static class PC extends DjaControl
41 {
42 public PC(DjaObject _f,int _p,int _o,int _x,int _y)
43 {
44 super(_f,_p,_o,_x,_y);
45 }
46
47 public void draggedTo(int _x,int _y)
48 {
49 DjaObject p=getParent();
50 p.putProperty
51 ("rayon",
52 ""+Math.max(0,Math.min
53 (Math.min(p.getWidth(),
54 p.getHeight())/2,_x-p.getX())));
55 }
56 }
57
58 public DjaControl[] getControls()
59 {
60 int rayon=Integer.parseInt(getProperty("rayon"));
61
62 DjaControl[] r=new DjaControl[1];
63 r[0]=new PC(this,0,HORIZONTAL,getX()+rayon,getY());
64 return r;
65 }
66 }