java - Parenthesis Compiler Error -


i keep getting parenthesis highlighted compiler errors. got of code oracle docs. docs
code:

package helloworld;  import javafx.application.application; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.layout.stackpane; import javafx.stage.stage;  public class helloworld extends application {      @override     public void start(stage primarystage) {         primarystage.settitle("javafx welcome");          primarystage.show();     }     gridpane grid = new gridpane(); grid.setalignment(pos.center); grid.sethgap(10); grid.setvgap(10); grid.setpadding(new insets(25, 25, 25, 25));  scene scene = new scene(grid, 300, 275); primarystage.setscene(scene);\ text scenetitle = new text("welcome"); scenetitle.setfont(font.font("tahoma", fontweight.normal, 20)); grid.add(scenetitle, 0, 0, 2, 1);  label username = new label("user name:"); grid.add(username, 0, 1);  textfield usertextfield = new textfield(); grid.add(usertextfield, 1, 1);  label pw = new label("password:"); grid.add(pw, 0, 2);  passwordfield pwbox = new passwordfield(); grid.add(pwbox, 1, 2);  button btn = new button("sign in"); hbox hbbtn = new hbox(10); hbbtn.setalignment(pos.bottom_right); hbbtn.getchildren().add(btn); grid.add(hbbtn, 1, 4); final text actiontarget = new text();         grid.add(actiontarget, 1, 6); btn.setonaction(new eventhandler<actionevent>() {      @override     public void handle(actionevent e) {         actiontarget.setfill(color.firebrick);         actiontarget.settext("sign in button pressed");     } }); 

what is(are) error(s)? try remove of lines w/the parenthesis more become highlighted.

  1. you have code outside of code block.

  2. the code mentioned in note above shall added within body of start method.

    public class helloworld extends application {     @override     public void start(stage primarystage) {         primarystage.settitle("javafx welcome");          // put here of 'homeless' code, starting         gridpane grid = new gridpane();         // ...          // last instruction of 'homeless' code, can use lambda          btn.setonaction(e -> {             actiontarget.setfill(color.firebrick);             actiontarget.settext("sign in button pressed");         });          primarystage.show();     } } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -