Java Reference
In-Depth Information
public Question () {
}
public Question (String o, String q, long t) {
this.owner = o;
this.question = q;
this.timestamp = t;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
}
Our Question class has two constructors. The zero-arg constructor is needed in one of the following examples
and we come back to this later. The constructor that takes three arguments is used for convenience in other examples.
In Listing 11-2, we show how to display questions. In this first example, the questions are not obtained via the
StackExchange API, but they are hard-coded in the example.
Listing 11-2. Framework for Rendering Questions in a ListView
package projavafx;
import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene;
import javafx.scene.control.ListView;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
 
Search WWH ::




Custom Search