Results 1 to 3 of 3
  1. #1
    juscelino is offline Member
    Join Date
    Jul 2014
    Rep Power

    Default pass a parameter to a Java FX pie chart.

    Hello guys,

    I have this class and I want to pass "pergunta" from another class:
    Java Code:
    here* =  if I put a number, the code works. I want to receive the parameter "pergunta" here but I can't put a parameter in start .    
    I want to populate the array pergunta in a previous class and use in this one.
    import javafx.application.Application;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.scene.Scene;
    import javafx.stage.Stage;
    import javafx.scene.chart.*;
    import javafx.scene.Group;
    public class GraficoPizza extends Application {
        int[][] pergunta = new int [36][7];   
        public void start(Stage stage) {
            Scene scene = new Scene(new Group());
            ObservableList<PieChart.Data> pieChartData =
                    new PieChart.Data("Não respondido", pergunta[0][0]),//<----here*.                  
                    new PieChart.Data("Ruim", pergunta[0][1]),
                    new PieChart.Data("Insuficiente", pergunta[0][2]),
                    new PieChart.Data("Bom", pergunta[0][3]),
                    new PieChart.Data("Ótimo", pergunta[0][4]),
                    new PieChart.Data("Excelente", pergunta[0][5]));
            final PieChart chart = new PieChart(pieChartData);
            ((Group) scene.getRoot()).getChildren().add(chart);
        public void Grafico(int[][] p1){
            launch(); // I use this method to launch my pie chart from another class.
    Last edited by juscelino; 07-25-2014 at 03:10 AM.

  2. #2
    milovan is offline Senior Member
    Join Date
    Jan 2011
    Belgrade, Serbia
    Rep Power

    Default Re: pass a parameter to a Java FX pie chart.

    unfortunately your comment is not visible to the end and it is not clear what is your intention / problem. could you re-post it again. so far I see that you declared and initialized your array but did not populated it so default values inside array are zeros. has it something with your problem?

  3. #3
    juscelino is offline Member
    Join Date
    Jul 2014
    Rep Power

    Default Re: pass a parameter to a Java FX pie chart.

    Just made some improvements on the frst post.
    What I want to do is populate the array in a previous class to use in this one. But I can't pass it as a parameter because of JavaFX.
    Last edited by juscelino; 07-25-2014 at 03:44 AM.

Similar Threads

  1. Pass a superclass as a parameter?
    By kkid in forum New To Java
    Replies: 4
    Last Post: 11-29-2013, 02:55 PM
  2. Replies: 10
    Last Post: 01-10-2012, 04:44 PM
  3. Replies: 1
    Last Post: 03-11-2011, 01:55 PM
  4. how to pass parameter from one jsp to another jsp
    By kader_sit in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 06-10-2010, 02:04 PM
  5. I can't seem to pass a file through a parameter
    By daletron3030 in forum New To Java
    Replies: 5
    Last Post: 01-15-2009, 06:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts