当前位置: 首页>>代码示例>>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;未经允许,请勿转载。