编程代写 | Supplementary – Syntax Reference

本次澳洲代写主要为编程相关的assignment

1. JavaFX – Basics
// import statements
public class SampleFX extends Application{
public void start(Stage stage){
addContents(stage);
stage.setTitle(getClass().getName());
stage.show();
}
private void addContents(Stage stage){

root.getChildren().addAll(…); // not for BorderPane
Scene scene = new Scene(root, 400, 300);
stage.setScene(scene);
}
}

Label >>

Label(String text)

setText(String text)

String getText()

Button >>

Button(String text)

setOnActionAction(EventHandler<ActionEvent> handler)

EventHandler<T extends Event> (an interface)
>> handle(T event)

TextField >>

TextField()

setText(String text)

String getText()

TextArea >>

TextArea()

String getText()

setText(String text)

append(String text)

2. TableView – Sample code segments
1. Create table view
TableView<Product> tableView = new TableView<Product>();
2. Define columns
TableColumn<Product,String> idColumn = new TableColumn<Product,String>(“Id”);
idColumn.setCellValueFactory(new PropertyValueFactory<Product,String>(“Id”));
tableView.getColumns().add(idColumn);

3. Set data items

List<Product> list = new ArrayList<Product>();

list.add(new Product(“p40”, “lights”, 40.0, true));

ObservableList<Product> tableData= FXCollections.observableArrayList(list);

tableView.setItems(tableData);

4. Define filter

// Define filtered list and sorted list

FilteredList<Product> filteredList = new FilteredList<>(tableData,p -> true);

SortedList<Product> sortedList = new SortedList<>(filteredList);

tableView.setItems(sortedList);

sortedList.comparatorProperty().bind(tableView.comparatorProperty());

// Define a text field and listener to set filtered list’s predicate
TextField filterTF = new TextField();
filterTF.textProperty().addListener((observable, oldValue, newValue) ->
{
filteredList.setPredicate(product ->
{
if (newValue == null || newValue.isEmpty())

return true;

if (product.getName().contains(newValue))

return true;

else

return false;

});

});


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: itcsdx@outlook.com  微信:itcsdx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank

发表评论