I'm trying to connect 2 components (in this sample i used labels) with a line.
But for some reasons, the line isn't there.
if i trace the x and y positions of both labels, i always get 1, so i think there's the problem, but i can't find a solution
Hope someone can help me out
Here's my sample code
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import org.aswing.ASColor;
import org.aswing.border.LineBorder;
import org.aswing.EmptyLayout;
import org.aswing.geom.IntDimension;
import org.aswing.geom.IntPoint;
import org.aswing.graphics.Graphics2D;
import org.aswing.graphics.Pen;
import org.aswing.JButton;
import org.aswing.JLabel;
import org.aswing.JPanel;
import org.aswing.SoftBoxLayout;
public class Main extends Sprite
private var label1:JLabel;
private var label2:JLabel;
public function Main():void
else addEventListener(Event.ADDED_TO_STAGE, init);
private function init(e:Event = null):void
removeEventListener(Event.ADDED_TO_STAGE, init);
var panel:JPanel = new JPanel(new EmptyLayout())
panel.setSizeWH(800, 600)
var size:IntDimension = new IntDimension(200, 200)
var box1:JPanel = new JPanel(new SoftBoxLayout(SoftBoxLayout.Y_AXIS))
var box2:JPanel = new JPanel(new SoftBoxLayout(SoftBoxLayout.Y_AXIS))
box1.setBorder(new LineBorder())
box2.setBorder(new LineBorder())
box1.setLocationXY(20,20)
box2.setLocationXY(300, 20)
label1 = new JLabel("label 1")
label2 = new JLabel("label 2")
var Knop:JButton = new JButton("Draw")
Knop.addEventListener(MouseEvent.CLICK,Draw)
Knop.setLocationXY(20, 300)
private function Draw(e:MouseEvent):void
var drawPen:Pen = new Pen(ASColor.RED, 3)
var g:Graphics2D = new Graphics2D(this.graphics)
g.drawLine(drawPen, label1.x, label1.y, label2.x, label2.y)