本文整理汇总了Java中org.controlsfx.control.textfield.TextFields类的典型用法代码示例。如果您正苦于以下问题:Java TextFields类的具体用法?Java TextFields怎么用?Java TextFields使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextFields类属于org.controlsfx.control.textfield包,在下文中一共展示了TextFields类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupAutoComplete
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
private void setupAutoComplete() {
List<AutoCompletionBinding<String>> bindings = new ArrayList<>();
bindings.add(TextFields.bindAutoCompletion(generalFields.get(0),
manager.getCharacters().keySet()));
for(int x = 0; x < 5; x++) {
bindings.add(TextFields.bindAutoCompletion(itemFields.get(x),
manager.getItems().keySet()));
bindings.add(TextFields.bindAutoCompletion(skillFields.get(x),
manager.getSkills().keySet()));
}
bindings.get(0).setOnAutoCompleted(event -> generalFields.get(0).setText(
manager.getRealEntry(generalFields.get(0).getText())));
for(int x = 0; x < 5; x++) {
int i = x;
bindings.get((x * 2) + 1).setOnAutoCompleted(event -> itemFields.get(i).setText(
manager.getRealEntry(itemFields.get(i).getText())));
bindings.get((x * 2) + 2).setOnAutoCompleted(event -> skillFields.get(i).setText(
manager.getRealEntry(skillFields.get(i).getText())));
}
}
示例2: genTeamList
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
public void genTeamList(){
teamMenu.getItems().clear();
int resultSize = dbread.getSize("teams");
dbread.setQuery("SELECT teamnum,teamname FROM " + Main.getCurrentSchema() +".teams ORDER BY teamnum;");
dbread.executeQuery();
System.out.println(resultSize);
teamNames = new ArrayList<String>();
String newItem = null;
for(int i = 1; i <= resultSize; i++){
try {
dbread.rs.next();
newItem = dbread.rs.getString(1) + " - " + dbread.rs.getString(2);
} catch (SQLException e) {
// TODO Auto-generated catch block
System.out.println("FAILED TO ADD ELEMENT");
e.printStackTrace();
}
teamNames.add(newItem);
}
teamMenu.getItems().addAll(teamNames);
teamMenu.setEditable(true);
TextFields.bindAutoCompletion(teamMenu.getEditor(), teamMenu.getItems());
}
示例3: medicineAutoCompleteBinding
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
public void medicineAutoCompleteBinding() {
TextFields.bindAutoCompletion(medicine_name, whole_medicine_list).setOnAutoCompleted((AutoCompletionBinding.AutoCompletionEvent<String> autoCompletionEvent) -> {
String selectedItem = medicine_name.getText();
try {
Connection dbConnection = JDBC.databaseConnect();
PreparedStatement preparedStatement = dbConnection.prepareStatement("SELECT medicine.hsn_number, medicine.salt, medicine.company, medicine.type, gst.sgst, gst.cgst, gst.igst FROM medicine JOIN gst ON medicine.medicine_id=gst.medicine_id WHERE name=?");
preparedStatement.setString(1, selectedItem);
ResultSet resultSet = preparedStatement.executeQuery();
if (resultSet.next()) {
hsn_code.setText(resultSet.getString("hsn_number"));
salt.setText(resultSet.getString("salt"));
company.setText(resultSet.getString("company"));
medicine_type.getSelectionModel().select(resultSet.getString("type"));
sgst.setText(String.valueOf(resultSet.getInt("sgst")));
cgst.setText(String.valueOf(resultSet.getInt("cgst")));
igst.setText(String.valueOf(resultSet.getInt("igst")));
}
} catch (Exception e) {
e.printStackTrace();
}
});
}
示例4: itemAutoCompleteBinding
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
public void itemAutoCompleteBinding() {
TextFields.bindAutoCompletion(item, whole_item_list).setOnAutoCompleted((AutoCompletionBinding.AutoCompletionEvent<String> autoCompletionEvent) -> {
batch_list.clear();
String selectedItem = item.getText();
batch.setItems(batch_list);
try {
Connection dbConnection = JDBC.databaseConnect();
PreparedStatement preparedStatement = dbConnection.prepareStatement("SELECT medicine_info.batch_number FROM medicine JOIN medicine_info ON medicine.medicine_id=medicine_info.medicine_id WHERE medicine.name=?");
preparedStatement.setString(1, selectedItem);
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
batch_list.add(resultSet.getString("batch_number"));
}
} catch (Exception e) {
e.printStackTrace();
}
batch.setDisable(false);
});
}
示例5: loadDrugList
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
@FXML
public void loadDrugList()
{
ArrayList<String> drugData = doc.getDrugGenericInfo();
ObservableList<String> possibleSuggestions = FXCollections.observableArrayList();
int drugDatalen = drugData.size();
for (int i = 0; i < drugDatalen; i++)
{
possibleSuggestions.add(drugData.get(i));
}
//TextFields.bindAutoCompletion(txtAuto,"test","temp","tempurature","table","tablet");
TextFields.bindAutoCompletion(txtAuto,possibleSuggestions);
}
示例6: bindSuggestions
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
@FXML private void bindSuggestions()
{
String type = (String)searchAppointmentCombo.getSelectionModel().getSelectedItem();
ArrayList<String> tmp = new ArrayList<String>();
switch(type)
{
case "Doctor":
TextFields.bindAutoCompletion(searchValue,docNames);
break;
case "Patient ID":
TextFields.bindAutoCompletion(searchValue,tmp);
break;
case "Appointment ID":
TextFields.bindAutoCompletion(searchValue,tmp);
break;
}
}
示例7: loadUserNames
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
public void loadUserNames()
{
ArrayList<ArrayList<String>> data = newSysUser.getUserNameAndID();
log = new HashMap<String,String>();
ArrayList<String> possibleSuggestions = new ArrayList<String>();
int size = data.size();
for(int i = 1; i < size; i++)
{
log.put(data.get(i).get(0)+" "+data.get(i).get(1),data.get(i).get(3)+" "+data.get(i).get(2));
possibleSuggestions.add(data.get(i).get(3) +" " + data.get(i).get(0)+" "+data.get(i).get(1));
}
TextFields.bindAutoCompletion(receivertxt,possibleSuggestions);
}
示例8: loadUsers
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
public void loadUsers()
{
ArrayList<ArrayList<String>> data = admin.getUserNameAndID();
log = new HashMap<String,String>();
ArrayList<String> possibleSuggestions = new ArrayList<String>();
int size = data.size();
for(int i = 1; i < size; i++)
{
log.put(data.get(i).get(0)+" "+data.get(i).get(1),data.get(i).get(3)+" "+data.get(i).get(2));
possibleSuggestions.add(data.get(i).get(3) +" " + data.get(i).get(0)+" "+data.get(i).get(1));
}
TextFields.bindAutoCompletion(userSearch,possibleSuggestions);
}
示例9: createTab
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
private Tab createTab(Field listField) {
Tab tab = new Tab(listField.getName());
SplitPane pane = new SplitPane();
TextField filter = TextFields.createClearableTextField();
VBox.setMargin(filter, new Insets(2));
TreeView<Object> elements = createTreeView(listField, filter.textProperty());
VBox.setVgrow(elements, Priority.ALWAYS);
PropertySheet properties = createPropertySheet(elements);
pane.getItems().addAll(new VBox(filter, elements), properties);
pane.setDividerPositions(0.3);
tab.setContent(wrap(pane));
return tab;
}
示例10: autocompleteMe
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
public static void autocompleteMe(TextField textfield, List<String> strings) {
TextFields.bindAutoCompletion(textfield, (x)->{
if (x.isCancelled() || x.getUserText().length() < 4)
return new ArrayList<>();
List<String> results = strings.stream()
.filter((y)->
y.length() > 4 &&
y.toLowerCase().contains(x.getUserText().toLowerCase()) &&
!y.equals(x.getUserText())
)
.collect(Collectors.toList());
if (results.size() > maxAutocompleteResults)
return new ArrayList<>();
return results;
});
}
示例11: updateSuggestionProvider
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
private void updateSuggestionProvider(){
if(autoCompletionBinding != null){
// Dispose the old binding
autoCompletionBinding.dispose();
}
if(getSkinnable().getSuggestionProvider() != null){
autoCompletionBinding = TextFields.bindAutoCompletion(tagEdit, getSkinnable().getSuggestionProvider());
autoCompletionBinding.setOnAutoCompleted(completionArgs -> {
if(completionArgs.getCompletion() != null)
appendTag(completionArgs.getCompletion());
tagEdit.setText("");
});
}
}
示例12: initialize
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
@Override
public void initialize(URL url, ResourceBundle rb) {
GuiData.getInstance().getStage().setOnCloseRequest(we -> close());
try {
file = new FatesTerrainFile(FileData.getInstance().getWorkingFile(), "rw");
for (TileBlock t : file.getTiles()) {
tileList.getItems().add(t.getTid());
}
} catch (IOException ex) {
ex.printStackTrace();
}
setupGrid();
populateForm();
tileList.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) ->
updateFields(newValue.intValue()));
scrollPane.widthProperty().addListener((observable, oldValue, newValue) ->
anchorPane.setPrefWidth(newValue.doubleValue()));
scrollPane.heightProperty().addListener((observable, oldValue, newValue) ->
anchorPane.setPrefHeight(newValue.doubleValue()));
AutoCompletionBinding<String> binding = TextFields.bindAutoCompletion(blockFields.get(0),
manager.getTiles().keySet());
binding.setOnAutoCompleted(event -> blockFields.get(0).setText(manager.getRealEntry(blockFields.get(0).getText())));
binding = TextFields.bindAutoCompletion(blockFields.get(1),
manager.getTiles().keySet());
binding.setOnAutoCompleted(event -> blockFields.get(1).setText(manager.getRealEntry(blockFields.get(1).getText())));
}
示例13: updateSongsAutoComplete
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
private void updateSongsAutoComplete() {
if(entry == null)
return;
Set<String> complete = new HashSet<>();
for(String name : contextCollections.getCheckModel().getCheckedItems()) {
SongCollection coll = entry.getStation().getCollections().get(name);
coll.getLocalListOfSongs().stream().forEach(x -> complete.add(x.getName()));
}
TextFields.bindAutoCompletion(songToAdd, complete);
}
示例14: initUI
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
private void initUI() {
findField = TextFields.createClearableTextField();
findButton = new Button("Find");
caseSensitive = new CheckBox("Case Sensitive");
regex = new CheckBox("Regex");
wrapSearch = new CheckBox("Wrap Search");
getChildren().addAll(findField, findButton, regex, caseSensitive, wrapSearch);
setPadding(new Insets(5));
setSpacing(5);
setAlignment(Pos.CENTER_LEFT);
}
示例15: initTableFilter
import org.controlsfx.control.textfield.TextFields; //导入依赖的package包/类
private void initTableFilter() {
// we can't create clearableTextField via FXML so we need to init it manually
// see: https://bitbucket.org/controlsfx/controlsfx/issues/330
try {
Method m = TextFields.class.getDeclaredMethod("setupClearButtonField", TextField.class, ObjectProperty.class);
m.setAccessible(true);
m.invoke(null, tableFilter, tableFilter.rightProperty());
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
log.error("Failed to init table filter field", e);
}
}