FIGUE
*Tutorial *Previous *Current *Next

More Constructs : Integration of Lightweight Components

* Step by Step

Create an usual java lightweight component and implement LightweightInterface.
class MyLightweight extends java.awt.Component 
          implements LightweightInterface {
Keep track of the Figue parent.
public MyLightweight() {
 ...
 _parent = null;
 ...
}

  private LightweightComponentAdapter _parent;

public void setParent(LightweightComponentAdapter aGlyph) {
   _parent = aGlyph;
}
Delegate the invalidate task to Figue.
public void invalidate() {
  if ( _parent != null ) {
     _parent.invalidate();
  }
}
Delegate the repaint task to Figue.
public void repaint() {
  if ( _parent != null ) {
     _parent.refresh();
  }
}
Use the current awt font and color as usual.
public void update(Graphics g) {
   ...
   g.setColor(getForeground());
   g.fillArc(0, 0, s, s, 0, 360);
   g.drawArc(0, 0, s, s, 0, 360);
Use the current awt font metric as usual.
public java.awt.Dimension getPreferredSize() {
  Font f = getFont();
  if(f != null) {
Return the expected alignment as usual.
public float getAlignmentX() {
   ...
}
public float getAlignmentY() {
Insert the lightweight component in an adapter.
LightweightInterface theLightweight = new MyLightweight();
theLine.addChild(
   new LightweightComponentAdapter(theLightweight));
theLine.addChild(Atom.newAtom(aText));

* Example

Accelerators :
home, end, page up, page down, left arrow,right arrow, up arrow, down arrow.
Autoscrolling :
drag the mouse inside the text area, approach a border or a corner, and wait.
Actions :
- move the mouse over a round
- click a round

* The Whole Program

* Related Classes and Methods

* What Next ?

Now you can :

*Tutorial *Previous *Current *Next

Comments or suggestions?
Need some help?
Copyright ©1998 INRIA
Last updated 4 November 1998 by Bruno Conductier
FIGUE