Author Topic: B4J  (Read 19875 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
B4J
« on: December 04, 2013, 12:57:08 PM »
Looks like Santa arrived early this year.  :)



B4J - The simple way to develop cross platform, desktop applications!

Quote
B4J is a 100% free development tool, similar to Basic4android that generates cross platform, desktop applications.
B4J follows the same concepts of Basic4android, providing a simple and powerful development tool.

B4J development tool is similar to Basic4android. The language and IDE are mostly identical.

The APIs (methods, keywords and libraries) are identical in some cases and different in other cases.

I converted existing frameworks such as DBUtils, HttpUtils2, DateUtils, RDC, ImageDownloader and others from B4A to B4J. It was simpler than I expected it to be. In some cases no changes were required at all.

Modules

There are two types of modules in B4J. Code modules and classes. Classes are identical to B4A classes.
Code modules are similar to B4A modules however they are more powerful as they can handle events.

A code module can be considered as a class with exactly one instance (such instances are sometimes called singletons or static classes). Activities and Services are not required in B4J. You should instead use code modules. Note that when you add an existing B4A activity or service to B4J project it will be converted to a code module.

CallSub is mostly not required in B4J as you can directly call methods of other classes or code modules.

Generally speaking it is simpler to develop with B4J as you do not need to deal with the activities (and services) life cycle. This also means that there is no such concept as "activity object".

UI

The main difference is in the UI. B4J is based on JavaFX UI and Basic4android is based on the native Android UI.

It is worth going over Oracle Scene Builder tutorials to better understand the UI. Once you understand how the UI integrates with B4J code then the other concepts such as the "event name" concept are the same.

Colors - In Basic4android colors are represented as Ints (2 bytes for Alpha, R, G, and B). In B4J colors are represented as Paints.
You can use fx.Colors.From32bit to convert an Int value to a Paint.
Project site link

Quote
Hi,

I'm happy to release a new development tool, named B4J.

B4J is a development tool, similar to Basic4android that allows you to develop Windows, Mac and Linux apps.

You can download B4J here:

B4J is free for both personal usage and commercial usage.

Best regards,
Erel Uziel
Anywhere Software

Update: I installed the 64 bit version of Java 7 JDK and JavaFX Scene Builder on Windows 7 64 bit. B4J is still a 32 bit IDE. The JavaFX designer/IDE is very nice. What we have here is Basic4Android language /IDE which is a Windows only environment that translates its BASIC code to Java. The B4J version uses JavaFX as the GUI toolkit and B4J is more or less just a BASIC to Java converter. Once the .JAR file is created you can run it on anything that runs JRE. (Java Runtime Environment)
« Last Edit: December 04, 2013, 06:45:24 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
B4J
« Reply #1 on: November 11, 2015, 02:14:17 AM »
B4J - The simplest way to develop cross platform, desktop, server and IoT solutions!

B4J is a 100% free development tool for desktop, server and IoT solutions.
B4J follows the same concepts of B4A and B4i, providing a simple and powerful development tool.
The compiled apps can run on Windows, Mac, Linux and ARM boards (such as Raspberry Pi).

Web Site / Download





BTW: I subscribe to this companies other commercial BASIC products. Great stuff and the author is a generous and friendly guy.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: B4J
« Reply #2 on: November 11, 2015, 03:34:19 PM »
AIR,

I'm surprised you're not all over this. A VB like BASIC that runs on everything, common GUI, and FREE.


Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: B4J
« Reply #3 on: November 11, 2015, 04:30:02 PM »
IDE only runs on Windows?  No thanks....

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: B4J
« Reply #4 on: November 11, 2015, 05:30:22 PM »
IDE only runs on Windows?  No thanks....

I knew you were going to say that.  :(

I'm going to give it a try and with the JavaFX graphic / forms library.


Getting Started Examples (see attached)
The following examples are included:

  • Hello World - One line example that prints Hello World.
  • Guess My Number - The computer chooses a number. You need to guess the number.
  • Three Pages - Example of an app with several forms. There are two main forms (login and the user form) and a font picker that is implemented as a class.
  • The app structure is similar to the structure of B4i apps.
  • Text Files - Save and load the program state.
  • Bouncing Smiley - Uses Canvas and Timer to create a bouncing ball.
  • Dynamic Controls - Creates a grid of 100 buttons.
  • Anchors - A multi-pane layout with anchors and designer script.
  • Sorting Algorithms - Implementation of the following sorting algorithms: bubble sort, quick sort, binary tree, merge sort and selection sort.

JavaFX Scene Builder
Quote
JavaFX Scene Builder (32-Bit) is a layout tool which lets users quickly design JavaFX application user interfaces, without coding. Users can drag and drop UI components to a work area, modify their properties, apply style sheets, and the FXML code for the layout that they are creating is automatically generated in the background. The result is an FXML file that can then be combined with a Java project by binding the UI to the application's logic.It features FXML Visual Editor which is an XML-based markup language that enables users to define an application's user interface, separately from the application logic,
Integrated Developer Workflow, preview what the user interface will really look like when deployed, unencumbered by the tool's menus and palettes, apply the look and feel of your choice to your GUI layout by using style sheets, and animations and effects can be applied seamlessly for more sophisticated UIs.


« Last Edit: January 04, 2021, 10:13:44 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
B4J
« Reply #5 on: November 13, 2015, 11:53:53 PM »
I installed B4J (BASIC for Java) with JavaFX support.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: B4J
« Reply #6 on: January 04, 2021, 09:23:24 PM »
I renewed my interest in B4J (BASIC for Java) FREE! I'm hoping to generate some interest with BASIC programmers also interested in cross platform Java apps.

Here is a graphic example I compiled as a standalone executable.

Code: [Select]
#Region  Project Attributes
#MainFormWidth: 600
#MainFormHeight: 400
#End Region

Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private Canvas1 As Canvas
Private Timer1 As Timer
'speed
Private vx = 10, vy = 10 As Double
'location
Private currentX = 100, currentY = 150 As Double
Private smiley As Image
Private size As Double = 50
'smiley rotation
Private deg As Double = 0
End Sub

Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.SetFormStyle("UNIFIED")
MainForm.RootPane.LoadLayout("1")
MainForm.Show
smiley = fx.LoadImage(File.DirAssets, "smiley.gif")
Timer1.Initialize("Timer1", 20)
Timer1.Enabled = True
End Sub

Sub Timer1_Tick
   Canvas1.ClearRect(currentX, currentY, size, size)
   If currentX + size > Canvas1.Width Then
     vx = -Abs(vx)
   Else If currentX < 0 Then
     vx = Abs(vx)
   End If
   If currentY + size > Canvas1.Height Then
     vy = -Abs(vy)
   Else If currentY < 0 Then
     vy = Abs(vy)
   End If
   currentX = currentX + vx
   currentY = currentY + vy
   deg = deg + 1
   Canvas1.DrawImageRotated(smiley, currentX, currentY, size, size, deg)
End Sub

Offline AlyssonR

  • Advocate
  • Posts: 131
Re: B4J
« Reply #7 on: May 18, 2024, 10:39:55 AM »
B4x is an excellent piece of software.

In addition to B4J there are also B4R (Arduino), B4I (IOS), B4A (Android) and what
caught my attention B4PPC (pocket PC). The last is only by request as the codebase
was frozen as those old PDAs fell out of use.

I haven't got much use out of it though.