Java examples for JavaFX:TabPane
exist JavaFX Tab
/**//from w ww. j a v a 2 s . c o m * Author: obullxl@gmail.com * Copyright (c) 2004-2013 All Rights Reserved. */ //package com.java2s; import javafx.scene.control.Tab; import javafx.scene.control.TabPane; public class Main { public static boolean existTab(TabPane tabpane, Object userData) { return (findTab(tabpane, userData) != null); } public static Tab findTab(TabPane tabpane, Object userData) { if (userData == null) { return null; } if (tabpane == null) { return null; } for (Tab tab : tabpane.getTabs()) { Object tabUserData = findTabUserData(tab); if (tabUserData == null) { return null; } if (userData.equals(tabUserData)) { return tab; } } return null; } @SuppressWarnings("unchecked") public static <T> T findTabUserData(Tab tab) { if (tab == null) { return null; } Object object = tab.getUserData(); if (object == null) { return null; } return (T) object; } }