Hello everyone !
How can i draw a custom Canvas img using non-ui project and send using smtp ?
How can i draw a custom Canvas img using non-ui project and send using smtp ?
Maybe that he is writing a NONUI app. You can not include UI Elements in a NONUI app. At least that´s what i have in mind....so perhaps I am missing something
Sub AppStart (Form1 As Form, Args() As String)
' MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
' MainForm.Show
File.WriteString("D:\", "1.png", "")
Private imv As Image
imv.Initialize("D:\", "1.png")
Private cvs As Canvas
cvs.Initialize("")
cvs.PrefWidth = 100
cvs.PrefHeight = 100
cvs.DrawLine(10, 10, 100, 100, fx.Colors.Red, 2)
imv = cvs.Snapshot
Private Out As OutputStream = File.OpenOutput("D:\", "1.png", False)
imv.WriteToStream(Out)
Out.Close
End Sub
You are right, it works.
Below my test code and project.
B4X:Sub AppStart (Form1 As Form, Args() As String) ' MainForm = Form1 'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file. ' MainForm.Show File.WriteString("D:\", "1.png", "") Private imv As Image imv.Initialize("D:\", "1.png") Private cvs As Canvas cvs.Initialize("") cvs.PrefWidth = 100 cvs.PrefHeight = 100 cvs.DrawLine(10, 10, 100, 100, fx.Colors.Red, 2) imv = cvs.Snapshot Private Out As OutputStream = File.OpenOutput("D:\", "1.png", False) imv.WriteToStream(Out) Out.Close End Sub
Have you even tried it?
It is a app which you can run, for example, in a dos box (cmd-prompt under windows).What exactly is a Console Project?
Can you share your test project and/or error message that is given!?dont works ... because javafx dont is initialized on non-ui ( console ) project ...
it will works fine in vps ubuntu ?There are differences between UI apps and non-ui apps. JavaFX elements will not work properly in a non-ui app. You can create a UI app and don't show any form.
Need i install JavaFX dependencies ?In a VPS, yes, it will.
It's a jar file, so it works in ANY system that is capable of running a jar file!