本文整理汇总了Java中javafx.collections.FXCollections.observableArrayList方法的典型用法代码示例。如果您正苦于以下问题:Java FXCollections.observableArrayList方法的具体用法?Java FXCollections.observableArrayList怎么用?Java FXCollections.observableArrayList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.collections.FXCollections
的用法示例。
在下文中一共展示了FXCollections.observableArrayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBrData
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public ObservableList<Browsers> getBrData() {
try {
if (new File(jsonFile).exists()) {
Object obj = parser.parse(new FileReader(jsonFile));
JSONObject jsonObject = (JSONObject) obj;
JSONArray caps = (JSONArray) jsonObject.get("capabilities");
Iterator<JSONObject> iterator = caps.iterator();
List<Browsers> brList = new ArrayList<>();
while (iterator.hasNext()) {
JSONObject objt = iterator.next();
brList.add(new Browsers(objt.get("browserName").toString(), objt.get("maxInstances").toString()));
}
ObservableList<Browsers> data = FXCollections.observableArrayList(brList);
return data;
}
} catch (IOException | ParseException ex) {
Logger.getLogger(ParseJSON.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
示例2: start
import javafx.collections.FXCollections; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group());
stage.setTitle("Europian Country Population");
stage.setWidth(500);
stage.setHeight(500);
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(
new PieChart.Data("Belgium", 3),
new PieChart.Data("France", 26),
new PieChart.Data("Germany", 35),
new PieChart.Data("Netherlands", 7),
new PieChart.Data("Sweden", 4),
new PieChart.Data("United Kingdom", 25));
final PieChart pieChart = new PieChart(pieChartData);
pieChart.setTitle("Country Population");
((Group) scene.getRoot()).getChildren().add(pieChart);
stage.setScene(scene);
stage.show();
}
示例3: getAttributes
import javafx.collections.FXCollections; //导入方法依赖的package包/类
@Override
public ObservableList<IAttribute> getAttributes () {
ObservableList<IAttribute> attributes = FXCollections.observableArrayList();
attributes.add(mySpeed);
attributes.add(myOrientation);
attributes.add(myXVel);
attributes.add(myYVel);
attributes.addAll(getSpecificAttributes());
return attributes;
}
示例4: mbushNgaStatusi
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public void mbushNgaStatusi(String emri){
try {
String sql = "select * from Punet where punetori = '" + emri + "' order by id asc";
Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
ObservableList<TabelaTeDhenatPunetore> data = FXCollections.observableArrayList();
Format format = new SimpleDateFormat("dd/MM/yyyy");
String s = "";
while (rs.next()) {
s = format.format(rs.getDate("data"));
data.add(new TabelaTeDhenatPunetore(rs.getInt("id"), rs.getString("lloji"), s,
rs.getFloat("qmimi"), rs.getString("konsumatori"), rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina")));
}
rs.close();
stmt.close();
conn.close();
table.setItems(data);
}catch (Exception ex){ex.printStackTrace();}
}
示例5: SelectAttributeSFV
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public SelectAttributeSFV (IDefinitionCollection<AttributeDefinition> attributes) {
setMyTitle(MY_TITLE_KEY);
setResoureBunldeAndKey();
myAttributeSelector =
new MultiChoiceEntryView<AttributeDefinition>(myAttributesKey,
attributes.getItems(), 170, 220,
AuthoringView.DEFAULT_ENTRYVIEW);
mySelectedView =
new MultiChoiceEntryView<AttributeDefinition>(mySelectedKey,
FXCollections.observableArrayList(),
300, 220,
AuthoringView.DEFAULT_ENTRYVIEW);
initView();
}
示例6: findAllTopics
import javafx.collections.FXCollections; //导入方法依赖的package包/类
ObservableList<Topic> findAllTopics() {
final ObservableList<Topic> allTopics = FXCollections.observableArrayList();
final List<Topic> topics = DatabaseFacade.getDefault().getCrudService()
.findByNamedQuery(Topic.class, ITopicConfiguration.NAMED_QUERY__NAME__FIND_ALL);
allTopics.addAll(topics);
Collections.sort(allTopics);
return allTopics;
}
示例7: getMyCreatedGlobals
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public DefinitionCollection<AttributeDefinition> getMyCreatedGlobals () {
if (myCreatedGlobals == null) {
myCreatedGlobals =
new DefinitionCollection<>(AuthorshipData.GLOBALS_TITLE_KEY,
FXCollections.observableArrayList());
}
return myCreatedGlobals;
}
示例8: call
import javafx.collections.FXCollections; //导入方法依赖的package包/类
@Override protected ObservableList<DailySales> call() throws Exception {
for (int i = 0; i < 500; i++) {
updateProgress(i, 500);
Thread.sleep(5);
}
ObservableList<DailySales> sales = FXCollections.observableArrayList();
sales.add(new DailySales(1, 5000, new Date()));
sales.add(new DailySales(2, 2473, new Date(0)));
return sales;
}
示例9: getObservableDataList
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public ObservableList<String> getObservableDataList(String query) {
if (query != null && !query.equals("")) {
ObservableList<String> reducedList = FXCollections.observableArrayList();
Iterator<String> it = getObservableDataList().iterator();
while (it.hasNext()) {
String s = it.next();
if (s.equals(query) || s.equalsIgnoreCase(query)||
s.contains(query) || s.matches(query) || Functions.like(s,query)) {
reducedList.add(s);
}
}
return reducedList;
}
return getObservableDataList();
}
示例10: deepCopySeriesData
import javafx.collections.FXCollections; //导入方法依赖的package包/类
static <X, Y> ObservableList<XYChart.Data<X, Y>> deepCopySeriesData(
final Collection<? extends XYChart.Data<X, Y>> data) {
final ObservableList<XYChart.Data<X, Y>> result = FXCollections.observableArrayList();
for (final Data<X, Y> i : data) {
result.add(new Data<>(i.getXValue(), i.getYValue()));
}
return result;
}
示例11: StackedBarChartSample
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public StackedBarChartSample() {
String[] years = {"2007", "2008", "2009"};
CategoryAxis xAxis = CategoryAxisBuilder.create()
.categories(FXCollections.<String>observableArrayList(years)).build();
NumberAxis yAxis = NumberAxisBuilder.create()
.label("Units Sold")
.lowerBound(0.0d)
.upperBound(10000.0d)
.tickUnit(1000.0d).build();
ObservableList<StackedBarChart.Series> barChartData = FXCollections.observableArrayList(
new StackedBarChart.Series("Region 1", FXCollections.observableArrayList(
new StackedBarChart.Data(years[0], 567d),
new StackedBarChart.Data(years[1], 1292d),
new StackedBarChart.Data(years[2], 1292d)
)),
new StackedBarChart.Series("Region 2", FXCollections.observableArrayList(
new StackedBarChart.Data(years[0], 956),
new StackedBarChart.Data(years[1], 1665),
new StackedBarChart.Data(years[2], 2559)
)),
new StackedBarChart.Series("Region 3", FXCollections.observableArrayList(
new StackedBarChart.Data(years[0], 1154),
new StackedBarChart.Data(years[1], 1927),
new StackedBarChart.Data(years[2], 2774)
))
);
StackedBarChart chart = new StackedBarChart(xAxis, yAxis, barChartData, 25.0d);
getChildren().add(chart);
}
示例12: onActionShowAllTermsFromSelectedTopic
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public void onActionShowAllTermsFromSelectedTopic() {
// Is any [Topic] in the [ComboBox] selected?
if (cbFindTermsInTopics.getSelectionModel().isEmpty()) {
lInfoFoundedTerms.setText(TermPresentationConverter.getI18nMsgFoundedEntities(IPropertiesConfiguration.NO_ENTITY));
return;
}
LoggerFacade.getDefault().debug(this.getClass(), "On action show all [Term]s from selected [Topic]"); // NOI18N
// Which [Term]s should be loaded
final Topic topic = cbFindTermsInTopics.getSelectionModel().getSelectedItem();
final long topicId = topic.getId();
// Load [Term]
final ObservableList<Term> terms = FXCollections.observableArrayList();
if (Objects.equals(topicId, DEFAULT_ID__TOPIC__SHOW_ALL_EXISTING_TERMS)) {
terms.addAll(SqlProvider.getDefault().findAllTerms());
}
else if (Objects.equals(topicId, DEFAULT_ID__TOPIC__SHOW_ALL_TERMS_WITHOUT_PARENT)) {
terms.addAll(SqlProvider.getDefault().findAllTermsInExerciseTermsWithoutParent());
}
else {
terms.addAll(SqlProvider.getDefault().findAllTermsWithTopicId(topicId));
}
// Show them in gui
lInfoFoundedTerms.setText(TermPresentationConverter.getI18nMsgFoundedEntities(terms.size()));
lvFoundedTerms.getItems().clear();
lvFoundedTerms.getItems().addAll(terms);
}
示例13: mbush
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public void mbush(String emri){
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
String sql = "select * from Punet where punetori = '" + emri + "' order by id asc";
Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
ObservableList<TabelaTeDhenatPunetore> data = FXCollections.observableArrayList();
Format format = new SimpleDateFormat("dd/MM/yyyy");
String s = "";
while (rs.next()) {
s = format.format(rs.getDate("data"));
data.add(new TabelaTeDhenatPunetore(rs.getInt("id"), rs.getString("lloji"), s,
rs.getFloat("qmimi"), rs.getString("konsumatori"), rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina")));
}
rs.close();
stmt.close();
conn.close();
table.setItems(data);
}catch (Exception ex){ex.printStackTrace();}
}
});
t.start();
}
示例14: getEffectTypes
import javafx.collections.FXCollections; //导入方法依赖的package包/类
public ObservableList<ProfileDisplay> getEffectTypes (ResourceBundle typeFile) {
List<ProfileDisplay> list = Collections.list(typeFile.getKeys())
.stream()
.map(s -> new ProfileDisplay(s))
.collect(Collectors.toList());
return FXCollections.observableArrayList(list);
}
示例15: constructContainer
import javafx.collections.FXCollections; //导入方法依赖的package包/类
@Override
public Parent constructContainer()
{
bp.setId("loginviewbg");
list = new ListView<String>();
items = FXCollections.observableArrayList("Philippe Kr�ttli","Irina Deck","Javier Martinez Alvarez","Frithjof Hoppe");
list.setItems(items);
AllFields = new VBox(50);
AllFields.setAlignment(Pos.CENTER);
AllFields.setMaxWidth(300);
AllFields.setPadding(new Insets(20));
GroupName = new HBox(50);
Option = new HBox(50);
name = new Label("Name:");
groupname = new Label("{Gruppenname}");
btnAdd = new AppButton("Hinzuf�gen");
btnRemove = new AppButton("Entfernen");
back = new BackButton(getFXController(),"Zur�ck");
GroupName.getChildren().addAll(name,groupname);
Option.getChildren().addAll(back,btnAdd,btnRemove);
AllFields.getChildren().addAll(GroupName,Option,list);
bp.setCenter(AllFields);
back.setOnAction(e -> getFXController().showView("groupview"));
btnAdd.setOnAction(e -> getFXController().showView("userlistview"));
btnRemove.setOnAction(e -> {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Mitglied l�schen");
alert.setHeaderText("Sie sind gerade dabei ein Mitglied aus der Gruppe zu entfernen.");
alert.setContentText("Sind Sie sich sicher, dass sie das tun wollen?");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
// ... user chose OK
} else {
Alert noDeletion = new Alert(AlertType.INFORMATION);
noDeletion.setTitle("L�schvorgang abgebrochen");
noDeletion.setHeaderText("Mitglied nicht gel�scht");
noDeletion.setContentText("Der L�schvorgang wurde abgebrochen.");
noDeletion.showAndWait();
alert.close();
}});
return bp;
}