Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Question about getting HPos and Items from geometry

964972Sep 27 2012 — edited Sep 28 2012
I am new to Java, but not OOP in general. I am having problems with setting up what should be simple statements using HPos, Items and really anything from from javafx.geometry. I am using NetBeans 7.2, and the error it gives is "cannot find symbol", both at the import statements and the main statements in the code. I have entered in the import statements correctly as far as I can tell, but suspect it is something either in my file system setup or declarations. I am following the texts closely, and don't see what is going on at all.

The specific lines that are being rejected are indented alot below, the setPadding and the setHalignment lines. I am pretty confused about the source of this error, as all the other lines compile OK, and this is only a part of a larger JavaFX session that is working fine. Note that the import statements are also giving me the same error. I tried a direct copy of a file from oracle and it complains about all the methods from javafx.geometry.

package javafxapplication1;

// mport java.awt.Insets;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.effect.*;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.*;
import javafx.scene.text.*;
import javafx.stage.Stage;

/*
*
* @author Bob
*/

public class JavaFXApplication1 extends Application {
private Button New;

@Override

public void start(Stage primaryStage) {

Group root = new Group();

// grid pane tests

GridPane bobgrid = new GridPane();
bobgrid.setPadding(new Insets(5));
bobgrid.setHgap(5);
bobgrid.setVgap(5);

bobgrid.setLayoutX(100);
bobgrid.setLayoutY(100);

Label fNameLbl = new Label("First Name");
TextField fNameFld = new TextField();
Label lNameLbl = new Label("Last Name");
TextField lNameFld = new TextField();
Button saveButt = new Button("Save");


// First Name Label

GridPane.setHalignment(fNameLbl, HPos.RIGHT);
bobgrid.add(fNameLbl, 0, 0);

// Last Name Label
//GridPane.setHalignment(lNameLbl, HPos.LEFT);
bobgrid.add(lNameLbl, 0, 1);

// First Name Label
// GridPane.setHalignment(fNameLbl, HPos.LEFT);
bobgrid.add(fNameFld, 1, 0);

// Last Name Label
// GridPane.setHalignment(lNameLbl, HPos.LEFT);
bobgrid.add(lNameFld, 1, 1);

// Save Button
// GridPane.setHalignment(saveButt, HPos.RIGHT);
bobgrid.add(saveButt, 1, 2);


// Add components to the scene (window) and display


root.getChildren().add(bobgrid);

// Scene scene = new Scene(root, 500, 250);

primaryStage.setTitle("A NEW and Exciting Version!");
primaryStage.setScene(scene);
primaryStage.show();


// Output to the console
System.out.println("A Totally Fruity Program");
}

public static void main(String[] args) {
Application.launch(args);
}
}

Thanks!!!

Bob
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2012
Added on Sep 27 2012
3 comments
292 views