Skip to content

Instantly share code, notes, and snippets.

View nezarjhons's full-sized avatar
🎯
Focusing

nezar nezarjhons

🎯
Focusing
View GitHub Profile
@nezarjhons
nezarjhons / TreeTableViewWithStyledRoot.java
Created March 9, 2021 03:25 — forked from james-d/TreeTableViewWithStyledRoot.java
TreeTableView example with styled root node view.
import java.io.File;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.Comparator;
import java.util.Date;
import javafx.application.Application;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
@nezarjhons
nezarjhons / TableCopyPasteCellsDemo.java
Created February 28, 2021 03:12 — forked from Roland09/TableCopyPasteCellsDemo.java
Example about performing copy/paste on a TableView.
import javafx.application.Application;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
@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;
@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 / 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 / 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 / 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 / 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 }
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 / 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;