Archive for category FXML

Source Code : Draggable ListCell as FriendList Demo

Hello I’m back,

Ah…Today I finally got some time to think of uploading the source code of Draggable ListCell as FriendList Demo.

 

Here we go:

Source Code in GIT : javafx-autocomplete-field
 

Screenshots:

Friends List Demo

Click on above picture to see live example in browser

 

The full description about this blog is posted here: JavaFX Drag and Drop Cell in ListView

Hope you guys like it!

Thanks and have a good day folks 🙂

Tags: , , , , , ,

Customize ScrollBar via CSS

Hello friends,

I came today with new stuffs of customizing the scrollbar control in JavaFX after long duration. 🙂
First Let’s look over what are the parts of ScrollBar as given in below image below.

 

ScrollBar parts CSS information

 

In the above picture there are four main part of ScrollBar .

  • increment
  • thumb
  • track
  • decrement

Read the rest of this entry »

Tags: , , , , , ,

FXML communicates to FXML via FXControllers and Interface

Hello guys, I’m back after my lots of works and stuffs that’s why this post got delayed. Anyway now I’m going to demonstrate today about how to communicate between FXML using FXController classes. Some of my commentator also asked me to share this communication of FXML so I’m blogging for the same. Today I’m going to just continue the blog post of  previous post I’ve blogged about FXML Stuffs (include and define) . So If you have not started reading those previous blog then please have a look because the things I’m going to tell is related to them.

Anyway Let’s summarize the previous blog.

  • Main.fxml (The main container of all fxml)
  • Home.fxml (the tab content of Home Tab)
  • About.fxml (the tab content of About Tab)
  • FXMLTest.java (this is just the executor class)

Now In today’s post we are having one more extras class which is listed below.

  • DockletListener.java (The java interface)

Before going to start this communication between fxml . Let’s have a look at how the flow gets working.

Read the rest of this entry »

Tags: , , , , , ,

FXML Stuffs (include and define)

Hello folks,

Today I would like to blog about the FXML define and include tag which can be very useful for those who are very keen to use FXML in their application. The FXML is an XML file which is loaded by javafx using FXMLLoader . It’s all loaded at the runtime and it’s really fast to load and easy to learn too. The previous blog about the FXML as Flexible XML is just a basic about FXML . Today in this blog here you will learn about how to include FXML files in your main FXML file.

I’m talking about the <fx:include> tag of the FXML.

Let’s see the basic flow of how the <fx:include> are loaded. Let’s assume there are two FXML Main.fxml and Child.fxml

Read the rest of this entry »

Tags: , , , ,

JavaFX has FXML as Flexible XML

Hello Today after long days I’ve came here to share my experience of FXML in JavaFX. After working with FXML I found it’s really easy for every developer.

Requirements:

  •  XML knowledge
  •  CSS knowledge

FXML and Binding Stuff

Ok First lets start with a FXML Template.

<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.shape.*?>
<?import fxmlstuff.fxml.*?>

<GUITemplate id="main" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml" fx:controller="fxmlstuff.fxml.GUITemplate">
    <children>       
        <Rectangle fx:id="back" />        
        <Rectangle fx:id="front" /> <Button fx:id="button" text="Click Me" onAction="#handleButton"/>
        <Button fx:id="clear" text="Clear Me" onAction="#handleClearButton"/>
        <TextArea fx:id="textArea"/>        
    </children>
</GUITemplate>

In above FXML I’ve not added Rectangle,Button,TextArea controls.
As per the FXML specification you can call the function from the FXML attribute using ‘#’ just before the function name. Here I’ve added #handleButton() and #handleClearButton() functions to handle the event of Buttons. Here First we are going to load them in JavaFX Application moreover we are going to make the Rectangle flexible to the Stage‘s width and height. To make any shapes or controls width and height relative to the Stage‘s width, height we can use bind feature plus a the control or the shape which we are going to make bind must static. Ok now we are going to need one Controller for the FXML which helps to control the FXML GUI components. I’ve already added fx:controller = "fxmlstuff.fxml.GUITemplate" in above FXML. So to map the controller we ought to make one conroller class inside fxmlstuff.fxml package with classname GUITemplate.java
Read the rest of this entry »

Tags: , , ,