Simple windowed application: Difference between revisions
Content added Content deleted
m (→{{libheader|Tk}}: Tk -> Perl/Tk) |
(B4J) |
||
Line 89: | Line 89: | ||
ExitApp ; exit this process |
ExitApp ; exit this process |
||
Return</lang> |
Return</lang> |
||
=={{header|B4J}}== |
|||
<lang freebasic> |
|||
#Region Project Attributes |
|||
#MainFormWidth: 593 |
|||
#MainFormHeight: 179 |
|||
#End Region |
|||
Sub Process_Globals |
|||
Private fx As JFX |
|||
Private MainForm As Form |
|||
Private btnClickMe As Button |
|||
Private lblClickCounter As Label |
|||
Private nClicks As Int = 0 |
|||
End Sub |
|||
Sub AppStart (Form1 As Form, Args() As String) |
|||
MainForm = Form1 |
|||
MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file. |
|||
MainForm.Show |
|||
End Sub |
|||
Sub btnClickMe_Action |
|||
nClicks = nClicks + 1 |
|||
lblClickCounter.Text = "There " & IIF(nClicks = 1, "has", "have") & " been " & (nClicks) & " " & IIF(nClicks=1, "click", "clicks") & " so far." |
|||
End Sub |
|||
Sub IIF(test As Boolean, trueText As String, falseText As String) As String |
|||
If test Then |
|||
Return trueText |
|||
Else |
|||
Return falseText |
|||
End If |
|||
End Sub</lang> |
|||
Format1.fxml (as B4J uses JavaFX's Scene Builder) |
|||
<lang cfm> |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<?import javafx.scene.text.*?> |
|||
<?import java.lang.*?> |
|||
<?import java.util.*?> |
|||
<?import javafx.collections.*?> |
|||
<?import javafx.scene.control.*?> |
|||
<?import javafx.scene.image.*?> |
|||
<?import javafx.scene.layout.*?> |
|||
<?import javafx.scene.paint.*?> |
|||
<?import javafx.scene.web.*?> |
|||
<AnchorPane id="paneMain" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="179.0" prefWidth="593.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> |
|||
<children> |
|||
<Button id="btnClickMe" layoutX="254.0" layoutY="90.0" mnemonicParsing="false" text="Click Me"> |
|||
<font> |
|||
<Font size="20.0" /> |
|||
</font> |
|||
</Button> |
|||
<Label id="lblClickCounter" layoutX="162.0" layoutY="31.0" text="There have been no clicks as yet."> |
|||
<font> |
|||
<Font size="20.0" /> |
|||
</font> |
|||
</Label> |
|||
</children> |
|||
</AnchorPane> |
|||
</lang> |
|||
=={{header|BBC BASIC}}== |
=={{header|BBC BASIC}}== |