B4J Question [Solved] Draw with java.awt.geom.PathIterator

knutf

Active Member
Licensed User
Longtime User
Hello

Is it possible to use a java.awt.geom.PathIterator to draw on a B4J canvas?

The reason I want to do it is that I construct java.awt.geom.Area to do polygon intersections.

I use the javaobject to access java.awt.geom.Area and other necessary java classes.

Then it could be smart to draw directly on the B4J canvas with the java.awt.geom.PathIterator.
 
Last edited:

knutf

Active Member
Licensed User
Longtime User
Thank you.

I understand. When I look a javafx.scene.shape.Shape it also have an intersect methode.

Is it possible to place a javafx.scene.shape on a pane?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1622183349773.png


B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show
    Dim root As B4XView = MainForm.RootPane
    Dim ellipse As JavaObject = CreateEllipse(50dip, 100dip)
    ellipse.RunMethod("setFill", Array(fx.Colors.Blue))
    root.AddView(ellipse, 210dip, 10dip, 100dip, 100dip)
End Sub

Private Sub CreateEllipse (RadiusX As Double, RadiusY As Double) As JavaObject
    Dim Ellipse As JavaObject
    Ellipse.InitializeNewInstance("javafx.scene.shape.Ellipse", Array(RadiusX, RadiusY))
    Return Ellipse
End Sub
 
Upvote 0

knutf

Active Member
Licensed User
Longtime User
Wow, it's easy!

And I should have seen this my self:

1622262633786.png


Because I know this:

1622262767024.png


it's fascinating how B4X relates to java!
 
Upvote 0
Top