I've searched extensively for this, but failing to arrive at a proper solution, I had to proceed with this question.

I have just recently started learning JavaFX/Java and I am trying to build a table which, along with some other columns, would have a single ProgressIndicator column. This means that a ProgressIndicator needs to be displayed within a table cell.

Work I've done so far: http://pastebin.com/raw.php?i=QxSmsJCT

    @Override // This method is called by the FXMLLoader when initialization is complete
public void initialize(URL fxmlFileLocation, ResourceBundle resources) {
    fileName.setCellValueFactory(new PropertyValueFactory<Table, String>("fileName"));
    transferSpeed.setCellValueFactory(new PropertyValueFactory<Table, Double>("transferSpeed"));

    piColumn.setCellValueFactory(new PropertyValueFactory<Table, Double>("piColumn"));
    ProgressIndicatorTableCell pitc = new ProgressIndicatorTableCell();
    piColumn.setCellFactory(pitc.<TableCell>forTableColumn());

    transferTable.setItems(data);
}

class ProgressIndicatorTableCell<S> extends TableCell<S, Double> {
    public <S> Callback<TableColumn<S, Double>, TableCell<S, Double>> forTableColumn() {
        return new Callback<TableColumn<S, Double>, TableCell<S, Double>>() {
          @Override
          public TableCell<S, Double> call(TableColumn<S, Double> param) {
            return new ProgressIndicatorTableCell<>();
          }
        };
    }
}

While the other columns work perfectly (and display the data I feed them), I'm not able to figure out why the ProgressIndicator doesn't show up at all.

If the errors and mistakes within my code's logic and/or project hierarchy setup could also be highlighted, it would be extremely appreciated.

Thanks.

Recommended Answers

All 2 Replies

Hi,

After a bit of searching on the internet, I discovered that a native class already exists: ProgressBarTableCell. However, since there was no similar class found for a ProgressIndicator, I modified the ProgressBar class for my purpose. After a bit of fixing, the ProgressIndicator now started showing up, however, no matter what I set the progress to (using setProgress), it always shows up in the "indeterminate" form.

Any ideas?

Hi n21115

JavaFX is still very new as a mainstream technology, and it looks like not many people here have got any real in-depth experience with it yet. Even if you can't get the answers you need I hope you will continue to feed back what you are learning about this for the benefit of everyone who is following just behind you.
Thanks
J

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.