Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/memoire/dja/DjaHLine.java


1   /**
2    * @modification $Date: 2001/12/03 16:28:08 $
3    * @statut       unstable
4    * @file         DjaHLine.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 DjaHLine
27         extends DjaForm
28  {
29    public DjaHLine(String _texte)
30    {
31      super(_texte,NORTH);
32    }
33  
34    public DjaHLine()
35    {
36      this(null);
37    }
38  
39    public int getHeight()
40    {
41      return 1;
42    }
43  
44    public void setHeight(int _h)
45    {
46      super.setHeight(1);
47    }
48  
49    public boolean contains(int _x, int _y)
50    {
51      return new Rectangle(getX(),getY()-3,getWidth(),7).contains(_x,_y);
52    }
53  
54    public DjaAnchor[] getAnchors()
55    {
56      int x=getX();
57      int y=getY();
58      int w=getWidth();
59  
60      DjaAnchor[] r=new DjaAnchor[2];
61      r[0]=new DjaAnchor(this,0,WEST ,x    ,y);
62      r[1]=new DjaAnchor(this,1,EAST ,x+w-1,y);
63  
64      return r;
65    }
66  
67    public DjaHandle[] getHandles()
68    {
69      int x=getX();
70      int y=getY();
71      int w=getWidth();
72  
73      DjaHandle[] r=new DjaHandle[2];
74      r[0]=new DjaHandle(this,WEST      ,x    -deltaX,y);
75      r[1]=new DjaHandle(this,EAST      ,x+w-1+deltaX,y);
76  
77      return r;
78    }
79  
80    public void paintObject(Graphics _g)
81    {
82      Color fg=getForeground();
83      if(fg!=null)
84      {
85        _g.setColor(fg);
86  
87        DjaGraphics.BresenhamParams bp=DjaGraphics.getBresenhamParams(this);
88        DjaGraphics.drawLine(_g,getX(),getY(),getX()+getWidth(),getY(),bp);
89      }
90  
91      super.paintObject(_g);
92    }
93  }