Skip to content

Instantly share code, notes, and snippets.

@Roland09
Roland09 / CustomTableMenuDemo.java
Created February 11, 2015 17:53
This is an example about how you can customize the table menu button in a JavaFX TableView using reflection.
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
@Roland09
Roland09 / CustomTableMenuDemo.java
Created February 11, 2015 17:56
This is an example about how you can customize the table menu button in a JavaFX TableView with node finding using a style class. It works without reflection.
import javafx.application.Application;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
@Roland09
Roland09 / TableCopyCellsDemo.java
Created February 11, 2015 17:58
Example about copying multiple selected table cells to the clipboard. Select the cells and press CTRL+C. The clipboard data can then be pasted into Excel, Notepad, etc. Copy works, Paste operation will be added in a separate gist.
import javafx.application.Application;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
@Roland09
Roland09 / TableCopyCellsDemo.java
Created February 11, 2015 17:59
Example about copying multiple selected table cells to the clipboard. Select the cells and press CTRL+C. The clipboard data can then be pasted into Excel, Notepad, etc. Copy works, Paste operation will be added in a separate gist.
import javafx.application.Application;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
@Roland09
Roland09 / TableCopyCellsDemo.java
Created February 11, 2015 18:07
Example about copying multiple selected table cells to the clipboard. Select the cells and press CTRL+C. The clipboard data can then be pasted into Excel, Notepad, etc. Copy works, Paste operation will be added in a separate gist.
import javafx.application.Application;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
@Roland09
Roland09 / SummaryTableDemo.java
Created February 11, 2015 18:08
SummaryTableDemo.java
import java.text.Format;
import java.time.LocalDate;
import java.time.Month;
import java.util.Set;
import javafx.application.Application;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
@Roland09
Roland09 / NavigableVideoWall.java
Last active August 29, 2015 14:15
Image wall like it was demonstrated at the JavaFX 2.0 presentation. Navigable via left, right and middle mouse button. You can replace the image nodes with WebView nodes and stream videos for every node.
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.PerspectiveCamera;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseEvent;
@Roland09
Roland09 / CardFaceCreator.java
Created February 12, 2015 04:01
Deck of playing cards. Solely created from plain Java, no images, no svg.
package cards;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.Node;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Priority;
import javafx.scene.paint.Color;
@Roland09
Roland09 / TableCopyPasteCellsDemo.java
Last active November 30, 2023 05:52
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;
@Roland09
Roland09 / ColumnGroup.java
Last active August 29, 2015 14:21
Groupable JTable with editable Textfields (i. e. for a Filter) below Header. Details on http://stackoverflow.com/questions/30236664/groupable-table-header-with-filter-below-header
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;