11 Replies - 3695 Views - Last Post: 01 December 2015 - 07:15 PM Rate Topic: -----

#1 cookieluvscam   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-November 15

cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 12:52 AM

Hi guys, I have a really quick question about the code im making this part of the code wont compile and im not sure why
public void setDisplay(int index) {
      flowPane.setTitle(menuItems[index]);
      flowPane.setGridPane(menuActions[index]);
    }



this is the full code it's incomplete but it should compile
package pkgfinal;

import javafx.application.Application; //
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.Scene; //
import javafx.stage.Stage;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.GridPane;


public class Final extends Application {
  
    //adding actions to the drop down menu
    private String[] menuItems = {"Inmate Booking", "Release Inmate", "View Inmate Status ", 
        "Update Inmate Status", "View Vistor Log","List Inmates","View All Inmates" }; //you can view the vistor log by name or date or prisoner
    //you can view inmate by name and cellblock for list inmates
    
    //create combobox for dropdown menu
    private ComboBox<String> combo = new ComboBox<>();
    //create gridpane to hold actions(?)
    private GridPane[] menuActions = new GridPane [7];
    //creating new flowpane
   private  FlowPane flowPane = new FlowPane(); 
    
  
    @Override
    public void start(Stage primaryStage) {
       //set menu actionse
       menuActions[0] = bookInmate(); //to book an inmate in the system
       menuActions[1] = releaseInmate(); //to release inmate from the prison
       menuActions[2] = viewStatus(); //to view an imates status 
       menuActions[3] = updateImate(); //to updates inmates status
       menuActions[4] = visitorLog(); //to view visitor log by name and 
       menuActions[5] = listInmates(); //to list inmates in prison by name or cellblock
       menuActions[6] = viewAllInmates(); //to view all inmates
        
       setDisplay(0); //set book an inmate as the deafult
       
        BorderPane border = new BorderPane();
        BorderPane pane = new BorderPane();
        
        pane.setLeft(new Label("Select action from menu: "));
        pane.setCenter(combo);
        border.setTop(pane);
        
        combo.setPrefWidth(500);
        combo.setValue("Inmate Booking");
        
        ObservableList<String> items = 
                FXCollections.observableArrayList(menuItems);
                combo.getItems().addAll(items);
                pane.setCenter(flowPane); //adding to combo box
        
        combo.setOnAction(e -> setDisplay(items.indexOf(combo.getValue()))); //display pane user selected
        
        
      
     
        //setting scene for menu actions
        Scene scene = new Scene(border, 500, 500);
        primaryStage.setTitle("Booking System");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

 
    public void setDisplay(int index) {
      flowPane.setTitle(menuItems[index]);
      flowPane.setGridPane(menuActions[index]);
    }

    private GridPane bookInmate() {
        
        return null;
        
    }

    private GridPane releaseInmate() {
        return null;
        
    }

    private GridPane viewStatus() {
        return null;
    }

    private GridPane updateImate() {
        return null;
    }

    private GridPane visitorLog() {
        return null;
    }

    private GridPane listInmates() {
        return null;
    }

    private GridPane viewAllInmates() {
        return null;
    }
    
    
    
    
  
    
}



Is This A Good Question/Topic? 0
  • +

Replies To: cannot find symbol symbol: method setTitle(String) location: variable

#2 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 12:56 AM

Post the error details.
Was This Post Helpful? 0
  • +
  • -

#3 cookieluvscam   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-November 15

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 01:01 AM

it says
'cannot find symbol
symbol: method setTitle(String)
location: variable flowPane of type of FlowPane'

ive been staring at it trying to find what's wrong but i really can't find it
Was This Post Helpful? 0
  • +
  • -

#4 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 1064
  • View blog
  • Posts: 4,105
  • Joined: 13-June 14

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 01:20 AM

The error is exactly what it says: that FlowPane does not have a method setTitle() that takes a String. Reading the API documentation for that class suggests that it's a layout component, so I'm not sure why you'd think it should have a title anyway.

I don't know anything about JavaFX, so can't really be of any more assistance.
Was This Post Helpful? 0
  • +
  • -

#5 cookieluvscam   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-November 15

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 02:11 AM

well see im trying to tweak this code to fit my needs
Posted Image
Posted Image

if you can see that

it didn't seem to have a problem in the example but now it does :(
Was This Post Helpful? 0
  • +
  • -

#6 GregBrannon   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2250
  • View blog
  • Posts: 5,340
  • Joined: 10-September 10

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 03:47 AM

Post your code that you've compiled, run, and results in the errors you want help with. Pictures of code that you've since modified is not useful.

This post has been edited by GregBrannon: 30 November 2015 - 03:47 AM

Was This Post Helpful? 0
  • +
  • -

#7 cookieluvscam   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-November 15

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 08:30 AM

but i already posted the modified code above, i also posted the error i got?

it was the first thing and second thing I posted
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 08:44 AM

** renamed title to be more descriptive than 'Homework Help' **
Was This Post Helpful? 0
  • +
  • -

#9 NormR   User is online

  • D.I.C Lover
  • member icon

Reputation: 870
  • View blog
  • Posts: 6,695
  • Joined: 25-December 13

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 10:20 AM

The answer was provided in post#4.
Read the API doc for the class mentioned in the error message to see what its methods are and how to use them.
Was This Post Helpful? 0
  • +
  • -

#10 cookieluvscam   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-November 15

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 07:22 PM

i mean that doesn't really help me because I know the way its formatted should work, because the book has it formatted the same way and that on works, so are you saying I should change it to descriptionPane like in the book?? which is another problem because when i write a new one it doesn't recognize a new description pane.
Was This Post Helpful? 0
  • +
  • -

#11 NormR   User is online

  • D.I.C Lover
  • member icon

Reputation: 870
  • View blog
  • Posts: 6,695
  • Joined: 25-December 13

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 30 November 2015 - 07:29 PM

You can not make up methods to use with classes. The compiler will object and give error messages.
Read the API doc for the FlowPane class and choose one of its methods that is shown to belong to the class.

I do not know the javafx classes and methods and can't help you decide on what classes and methods to use.

This post has been edited by NormR: 30 November 2015 - 07:30 PM

Was This Post Helpful? 0
  • +
  • -

#12 cookieluvscam   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 30-November 15

Re: cannot find symbol symbol: method setTitle(String) location: variable

Posted 01 December 2015 - 07:15 PM

okaay thanks
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1