Skip to content

Instantly share code, notes, and snippets.

View nezarjhons's full-sized avatar
🎯
Focusing

nezar nezarjhons

🎯
Focusing
View GitHub Profile
@nezarjhons
nezarjhons / gist:0c99dfdb850e0068633a910573b68fbc
Created June 21, 2019 04:41 — forked from prule/gist:5061089
Griffon/JavaFX - Adding a change listener to a text field Part 1
import javafx.beans.value.ChangeListener
import javafx.beans.value.ObservableValue
import org.apache.commons.lang.StringUtils
// model
@FXBindable String amount1
// view
textField(id: 'amount1', text: bind(model.amount1Property))
@nezarjhons
nezarjhons / RecursiveTreeItem.java
Created July 6, 2019 04:23 — forked from manuel-mauky/RecursiveTreeItem.java
Recursive DataModel for JavaFX TreeView/TreeTableView
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.scene.Node;
import javafx.scene.control.TreeItem;
import javafx.util.Callback;
import java.util.List;
import java.util.stream.Collectors;
public class RecursiveTreeItem<T> extends TreeItem<T> {
@nezarjhons
nezarjhons / LoginController.java
Created August 27, 2019 04:23 — forked from jewelsea/LoginController.java
JavaFX sample for an fxml based Login screen to main application transition with login session data transfer
package login;
import javafx.event.*;
import javafx.fxml.FXML;
import javafx.scene.control.*;
/** Controls the login screen */
public class LoginController {
@FXML private TextField user;
@FXML private TextField password;
public class VirtualKeyboard {
private final VBox root ;
/**
* Creates a Virtual Keyboard.
* @param target The node that will receive KeyEvents from this keyboard.
* If target is null, KeyEvents will be dynamically forwarded to the focus owner
* in the Scene containing this keyboard.
*/
public VirtualKeyboard(ReadOnlyObjectProperty<Node> target) {
@nezarjhons
nezarjhons / Role.java
Created May 31, 2020 02:21 — forked from jewelsea/Role.java
Sample for creating a role based UI using JavaFX FXML
public enum Role { FATHER, SON, MOTHER, DAUGHTER, BROTHER, SISTER }
@nezarjhons
nezarjhons / TreeTableView.java
Created September 15, 2020 02:35 — forked from sh9va/TreeTableView.java
JavaFX TableView in TableView (JavaFx Tree like TableView)
import java.util.ArrayList;
import java.util.List;
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Node;
@nezarjhons
nezarjhons / EditCell.java
Created November 7, 2020 01:43 — forked from james-d/EditCell.java
(Fairly) reusable edit cell that commits on loss of focus on the text field. Overriding the commitEdit(...) method is difficult to do without relying on knowing the default implementation, which I had to do here. The test code includes a key handler on the table that initiates editing on a key press.
import javafx.event.Event;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellEditEvent;
import javafx.scene.control.TablePosition;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
@nezarjhons
nezarjhons / LineItemTable.java
Created January 12, 2021 03:33 — forked from james-d/LineItemTable.java
Demonstrates using a TransformationList to create a "total line" in a TableView.
import java.util.function.Function;
import java.util.stream.Collectors;
import javafx.application.Application;
import javafx.beans.Observable;
import javafx.beans.binding.Bindings;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ReadOnlyIntegerProperty;
import javafx.beans.property.ReadOnlyObjectProperty;
import javafx.beans.property.ReadOnlyObjectWrapper;
@nezarjhons
nezarjhons / EditableTableViewWithTab
Created January 27, 2021 01:52 — forked from abhinayagarwal/EditableTableViewWithTab
EditableTableView With Tab Functionality Only for same Row
import java.util.ArrayList;
import java.util.List;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
@nezarjhons
nezarjhons / JavaFXTrayIconSample.java
Created February 14, 2021 02:58 — forked from jewelsea/JavaFXTrayIconSample.java
Demonstrate using the System Tray (AWT) to control a JavaFX application.
import javafx.application.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.*;
import javax.imageio.ImageIO;
import java.io.IOException;