Results 1 to 5 of 5
  1. #1
    s22380 is offline Member
    Join Date
    Aug 2016
    Posts
    4
    Rep Power
    0

    Default Creating a Gridpane

    Hi first post here.

    I'm stuck with this problem for some days: I have done a code sample of what I need but I get invisible Grid Lines. Not sure why they are not shown. I've tried different settings and also with adding pane and experimenting with SetVisible(true) but no luck, here is the code:

    Java FX Code:
    Integer rr_status_row_index; 
        Integer iff_bit_row_index; 
        Integer iff_status_row_index; 
     
    //Method to draw the Grid Panel when action in Menu Overview 
        @FXML
        private void menuOverview(ActionEvent event) { 
          Integer i = 0;  
        // CLear previously created Grid Panel 
          grid.getChildren().clear(); 
           
          grid.setGridLinesVisible(true); 
           
          //Check if CAR Menu item is enabled or disabled in Vehicles 
          if (CAR_Status.isSelected()) { 
          //draw row in Grid Panel 
                String colorname = "Red"; 
                //Status of messages into an array 
                String[] ArrayColor = new String[11]; 
                ArrayColor[0] = "Red"; 
                ArrayColor[1] = "Green"; 
                ArrayColor[2] = "Yellow"; 
                ArrayColor[3] = "Yellow"; 
                ArrayColor[4] = "Yellow"; 
                ArrayColor[5] = "Yellow"; 
             
                for(int count=0; count<11; count++){ 
                  Label txt = new Label("  ");  
                  grid.add(txt,count,i); 
     
                  if (count ==3) { 
                    txt.setStyle("-fx-background-color: black;"); 
                  }    
                  if (count ==5) { 
                    txt.setStyle("-fx-background-color: blue;"); 
                  }  
                   
                } 
                rr_status_row_index=i; 
                i++; 
                //END draw row for CAR_Status 
            grid.setGridLinesVisible(true);    
          }    
           
          if (IFF_Status.isSelected()) { 
               
                //draw row in Grid Panel 
                grid.addRow(i, new Label("TRUCK_Status")); 
                System.out.println(i); 
                iff_status_row_index=i; 
                i++; 
                grid.addRow(i, new Label("TRUCK_BIT")); 
                iff_bit_row_index=i; 
                i++; 
                //END draw row in Grid Panel 
          } 
           
          //Draw the fixed row in Grid Panel 
          grid.addRow(i, new Label("I am fixed!")); 
          grid.setGridLinesVisible(true); 
        }
    So grid.setGridLinesVisible(true); is set in 3 diff places in the event handler, but no result. What is wrong?
    I also tried to test with SetVisible(true) and actually the Grid lines were shown but the Grid layout was not working. My thoughts are: Is it a layer problem that the grids are not shown.

    Thanks for your help!

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: Creating a Gridpane

    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Creating a Gridpane

    I don't see anything advanced about this. But it doesn't matter since it should be under the JavaFX subforum.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  4. #4
    Sizzlewump's Avatar
    Sizzlewump is offline Member
    Join Date
    Oct 2010
    Location
    MI, USA
    Posts
    68
    Rep Power
    0

    Default Re: Creating a Gridpane

    Where is the first part of the code that contains your Jpanel object and how the CAR_Status is defined?
    "The secret to getting what you want is to reject everything that you don't want." -Wolbers

  5. #5
    s22380 is offline Member
    Join Date
    Aug 2016
    Posts
    4
    Rep Power
    0

    Default Re: Creating a Gridpane

    Quote Originally Posted by Sizzlewump View Post
    Where is the first part of the code that contains your Jpanel object and how the CAR_Status is defined?
    Complete code posted here: Creating A Gridpane - Java | Dream.In.Code, Creating A Gridpane - Java | Dream.In.Code

Similar Threads

  1. Creating a GUI
    By HoustonsOwn88 in forum New To Java
    Replies: 6
    Last Post: 11-16-2012, 09:38 AM
  2. Replies: 4
    Last Post: 04-02-2012, 01:50 PM
  3. Replies: 9
    Last Post: 07-29-2011, 02:18 PM
  4. Creating an EXE help
    By funnygames in forum New To Java
    Replies: 5
    Last Post: 09-27-2010, 07:53 PM
  5. Creating files stopped creating...
    By Dieter in forum Advanced Java
    Replies: 3
    Last Post: 09-25-2009, 11:45 PM

Tags for this Thread

Posting Permissions

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