當前位置: 首頁>>代碼示例>>Java>>正文


Java ListCell類代碼示例

本文整理匯總了Java中javafx.scene.control.ListCell的典型用法代碼示例。如果您正苦於以下問題:Java ListCell類的具體用法?Java ListCell怎麽用?Java ListCell使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ListCell類屬於javafx.scene.control包,在下文中一共展示了ListCell類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ComponentSelectorPane

import javafx.scene.control.ListCell; //導入依賴的package包/類
public ComponentSelectorPane(String listTitle, ObservableList<Class<? extends Component>> displayedData, SpriteDataPane infoPane) {
	this.infoPane=infoPane;
	this.setPrefWidth(PREF_WIDTH);
	ListView<Class<? extends Component>> componentDisplay = new ListView<>();
	componentDisplay.setItems(displayedData);

	componentDisplay.setCellFactory(
			new Callback<ListView<Class<? extends Component>>, ListCell<Class<? extends Component>>>() {
				@Override
				public ListCell<Class<? extends Component>> call(ListView<Class<? extends Component>> list) {
					return new ComponentCustomizerOption();
				}
			});

	Label title = new Label(listTitle);
	this.getChildren().addAll(title, componentDisplay);
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:18,代碼來源:ComponentSelectorPane.java

示例2: ComponentSearch

import javafx.scene.control.ListCell; //導入依賴的package包/類
public ComponentSearch(List<T> items) {
    if (items != null) {
        setComponents(items);
    }
    
    popup.getContent().add(componentView);
    popup.setAutoHide(true);
    
    componentView.getListView().setCellFactory((ListView<T> param) -> new ListCell<T>() {
        @Override
        protected void updateItem(T item, boolean empty) {
            super.updateItem(item, empty);
            if (empty) {
                setText(null);
                setGraphic(null);
            } else {
                setText(item.getId());
            }
        }
    });
    // 匹配檢查的時候要用字符串轉換器
    componentView.setConverter((T t) -> t.getId());
    componentView.setPrefWidth(250);
    componentView.setPrefHeight(250);
    componentView.setEffect(new DropShadow());
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:27,代碼來源:ComponentSearch.java

示例3: initialize

import javafx.scene.control.ListCell; //導入依賴的package包/類
/**
 * Initializes the controller class.
 *
 * @param url
 * @param rb
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    // TODO
    UssdClient.impl.showData(cboChanel, cboRole, txtLocalHost, txtLocalPort, txtRemoteHost, txtRemotePort, txtPhone);
    cboChanel.setCellFactory((ListView<EnumeratedBase> param) -> new ListCell<EnumeratedBase>() {
        @Override
        protected void updateItem(EnumeratedBase item, boolean empty) {
            super.updateItem(item, empty);
            if (item == null || empty) {
                setText(null);
            } else {
                setText(item.toString());
            }
        }

    });
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:24,代碼來源:HostController.java

示例4: call

import javafx.scene.control.ListCell; //導入依賴的package包/類
@Override
public ListCell<T> call(ListView<T> list) {
	return new ListCell<T>() {
		@Override
		protected void updateItem(T item, boolean empty) {
			super.updateItem(item, empty);

			if (empty || item == null) {
				setText(null);
				setStyle("");
			} else {
				setText(ListCellFactory.this.getText(item));
				setStyle(ListCellFactory.this.getStyle(item));
			}
		}
	};
}
 
開發者ID:sfPlayer1,項目名稱:Matcher,代碼行數:18,代碼來源:ListCellFactory.java

示例5: ListViewCellFactorySample

import javafx.scene.control.ListCell; //導入依賴的package包/類
public ListViewCellFactorySample() {
    final ListView<Number> listView = new ListView<Number>();
    listView.setItems(FXCollections.<Number>observableArrayList(
            100.00, -12.34, 33.01, 71.00, 23000.00, -6.00, 0, 42223.00, -12.05, 500.00,
            430000.00, 1.00, -4.00, 1922.01, -90.00, 11111.00, 3901349.00, 12.00, -1.00, -2.00,
            15.00, 47.50, 12.11

    ));
    
    listView.setCellFactory(new Callback<ListView<java.lang.Number>, ListCell<java.lang.Number>>() {
        @Override public ListCell<Number> call(ListView<java.lang.Number> list) {
            return new MoneyFormatCell();
        }
    });        
    
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    getChildren().add(listView);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:ListViewCellFactorySample.java

示例6: initListView

import javafx.scene.control.ListCell; //導入依賴的package包/類
private void initListView() {
    if (!doesAllowChildren) {
        fillUpChildren(fileChooserInfo.getRoot());
    }
    childrenListView.setCellFactory(new Callback<ListView<File>, ListCell<File>>() {
        @Override public ListCell<File> call(ListView<File> param) {
            return new ChildrenFileCell();
        }
    });
    childrenListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (fileChooserInfo.isFileCreation()) {
            return;
        }
        File selectedItem = childrenListView.getSelectionModel().getSelectedItem();
        if (selectedItem == null) {
            fileNameBox.clear();
        }
    });
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:MarathonFileChooser.java

示例7: initComponents

import javafx.scene.control.ListCell; //導入依賴的package包/類
private void initComponents() {
    VBox.setVgrow(historyView, Priority.ALWAYS);
    historyView.setItems(FXCollections.observableArrayList(runHistoryInfo.getTests()));
    historyView.setCellFactory(new Callback<ListView<JSONObject>, ListCell<JSONObject>>() {
        @Override public ListCell<JSONObject> call(ListView<JSONObject> param) {
            return new HistoryStateCell();
        }
    });

    VBox historyBox = new VBox(5);
    HBox.setHgrow(historyBox, Priority.ALWAYS);

    countField.setText(getRemeberedCount());
    if (countNeeded) {
        form.addFormField("Max count of remembered runs: ", countField);
    }
    historyBox.getChildren().addAll(new Label("Select test", FXUIUtils.getIcon("params")), historyView, form);

    verticalButtonBar.setId("vertical-buttonbar");
    historyPane.setId("history-pane");
    historyPane.getChildren().addAll(historyBox, verticalButtonBar);

    doneButton.setOnAction((e) -> onOK());
    buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
    buttonBar.getButtons().addAll(doneButton);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:27,代碼來源:RunHistoryStage.java

示例8: initComponents

import javafx.scene.control.ListCell; //導入依賴的package包/類
private void initComponents() {
    optionBox.setItems(model);
    optionBox.getSelectionModel().selectedItemProperty().addListener((observableValue, oldValue, newValue) -> {
        if (newValue != null) {
            updateTabPane();
        }
    });
    optionBox.setCellFactory(new Callback<ListView<PlugInModelInfo>, ListCell<PlugInModelInfo>>() {
        @Override public ListCell<PlugInModelInfo> call(ListView<PlugInModelInfo> param) {
            return new LauncherCell();
        }
    });
    optionTabpane.setId("CompositeTabPane");
    optionTabpane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);
    optionTabpane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING);
    VBox.setVgrow(optionTabpane, Priority.ALWAYS);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:18,代碼來源:CompositeLayout.java

示例9: getIndexAt

import javafx.scene.control.ListCell; //導入依賴的package包/類
protected int getIndexAt(ListView<?> listView, Point2D point) {
    if (point == null) {
        return listView.getSelectionModel().getSelectedIndex();
    }
    point = listView.localToScene(point);
    Set<Node> lookupAll = getListCells(listView);
    ListCell<?> selected = null;
    for (Node cellNode : lookupAll) {
        Bounds boundsInScene = cellNode.localToScene(cellNode.getBoundsInLocal(), true);
        if (boundsInScene.contains(point)) {
            selected = (ListCell<?>) cellNode;
            break;
        }
    }
    if (selected == null) {
        return -1;
    }
    return selected.getIndex();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:JavaFXElementPropertyAccessor.java

示例10: start

import javafx.scene.control.ListCell; //導入依賴的package包/類
@Override public void start(Stage primaryStage) throws Exception {
    final ListView<String> listView = new ListView<String>();
    listView.setItems(FXCollections.observableArrayList("Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6", "Row 7",
            "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13", "Row 14", "Row 15", "Row 16", "Row 17", "Row 18",
            "Row 19", "Row 20", "Row 21", "Row 22", "Row 23", "Row 24", "Row 25"));
    listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    Button button = new Button("Debug");
    button.setOnAction((e) -> {
        ObservableList<Integer> selectedIndices = listView.getSelectionModel().getSelectedIndices();
        for (Integer index : selectedIndices) {
            ListCell cellAt = getCellAt(listView, index);
            System.out.println("SimpleListViewScrollSample.SimpleListViewScrollSampleApp.start(" + cellAt + ")");
        }
    });
    VBox root = new VBox(listView, button);
    primaryStage.setScene(new Scene(root, 300, 400));
    primaryStage.show();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:19,代碼來源:SimpleListViewScrollSample.java

示例11: initView

import javafx.scene.control.ListCell; //導入依賴的package包/類
void initView() {
    listview.setCellFactory(param -> new ListCell<String>() {
        @Override
        protected void updateItem(String item, boolean empty) {
            super.updateItem(item, empty);
            if (!empty) {
                BucketItemView view = new BucketItemView();
                view.setBucketName(item);
                setGraphic(view);
            } else {
                setGraphic(null);
            }
        }
    });
    listview.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (StringUtils.isNotEmpty(newValue)) {
            if (this.itemSelectListener != null) {
                this.itemSelectListener.onItemSelected(newValue);
            }
        }
    });
}
 
開發者ID:cmlanche,項目名稱:javafx-qiniu-tinypng-client,代碼行數:23,代碼來源:SiderBarView.java

示例12: loadPatientHistory

import javafx.scene.control.ListCell; //導入依賴的package包/類
private void loadPatientHistory() {
    prescriptions = prescriptionGetway.patientPrescriptions(patient);
    prescriptionList.getItems().addAll(prescriptions);
    prescriptionList.getSelectionModel().select(0);

    prescriptionList.setCellFactory(param -> new ListCell<Prescription>() {
        @Override
        protected void updateItem(Prescription item, boolean empty) {
            super.updateItem(item, empty);
            if (empty || item == null || item.getDate() == null) {
                setText(null);
            } else {
                setText(item.getDate());
            }
        }
    });

    showPrescription();
}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:20,代碼來源:PatientHistoryController.java

示例13: initializeComboBoxTimeChooser

import javafx.scene.control.ListCell; //導入依賴的package包/類
private void initializeComboBoxTimeChooser() {
    LoggerFacade.getDefault().info(this.getClass(), "Initialize [ComboBox] [TimeChooser]"); // NOI18N
    
    cbTimeChooser.setCellFactory((ListView<ETime> listview) -> new ListCell<ETime>() {
        @Override
        public void updateItem(ETime time, boolean empty) {
            super.updateItem(time, empty);
            this.setGraphic(null);
            this.setText(!empty ? time.toString() : null);
        }
    });
    
    final ObservableList<ETime> observableListTimes = FXCollections.observableArrayList();
    observableListTimes.addAll(ETime.values());
    cbTimeChooser.getItems().addAll(observableListTimes);
    cbTimeChooser.getSelectionModel().selectFirst();
}
 
開發者ID:Naoghuman,項目名稱:ABC-List,代碼行數:18,代碼來源:ExercisePresenter.java

示例14: PathSetter

import javafx.scene.control.ListCell; //導入依賴的package包/類
public PathSetter(ObservableList<Path> paths, String variableName){
	super(Path.class,variableName);
	this.myPaths=paths;		
	
	pathChoices= new ComboBox<>(myPaths);
	
	pathChoices.setCellFactory(new Callback<ListView<Path>, ListCell<Path>>(){
		@Override
		public ListCell<Path> call(ListView<Path> list){
			return new PathCell();
		}
	});
	pathChoices.setButtonCell(new PathButtonCell());
	
	this.getChildren().add(pathChoices);
	
}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:18,代碼來源:PathSetter.java

示例15: initialize

import javafx.scene.control.ListCell; //導入依賴的package包/類
@Override
public void initialize(URL url, ResourceBundle rb) {
    recips.setAll(dao.getRecipients());
    topics.setAll(sns.getTopics());

    type.setItems(types);
    recipList.setItems(recips);
    topicCombo.setItems(topics);

    recipList.setCellFactory(p -> new ListCell<Recipient>() {
        @Override
        public void updateItem(Recipient recip, boolean empty) {
            super.updateItem(recip, empty);
            if (!empty) {
                setText(String.format("%s - %s", recip.getType(), recip.getAddress()));
            } else {
                setText(null);
            }
        }
    });
    recipList.getSelectionModel().selectedItemProperty().addListener((obs, oldRecipient, newRecipient) -> {
        type.valueProperty().setValue(newRecipient != null ? newRecipient.getType() : "");
        address.setText(newRecipient != null ? newRecipient.getAddress() : "");
    });
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-Blueprints,代碼行數:26,代碼來源:CloudNoticeManagerController.java


注:本文中的javafx.scene.control.ListCell類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。