Skip to content

Instantly share code, notes, and snippets.

@deniscostadsc
Created February 27, 2015 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deniscostadsc/9a92f4285c5ffbccd9de to your computer and use it in GitHub Desktop.
Save deniscostadsc/9a92f4285c5ffbccd9de to your computer and use it in GitHub Desktop.
package javafxexemploslayout;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
public class JavaFXExemplosLayout extends Application {
@Override
public void start(Stage primaryStage) {
BorderPane border = new BorderPane();
HBox hbox = addBox();
border.setTop(hbox);
Scene scene = new Scene(border, 300, 200);
primaryStage.setTitle("Exemplo de layouts");
primaryStage.setScene(scene);
primaryStage.show();
}
public HBox addBox() {
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 12, 15, 12));
hbox.setSpacing(10);
hbox.setStyle("-fx-background-color: #336699");
Button currentButton = new Button("Atual");
currentButton.setPrefSize(100, 20);
Button nextButton = new Button("Próximo");
currentButton.setPrefSize(100, 20);
hbox.getChildren().addAll(currentButton, nextButton);
return hbox;
}
public static void main(String[] args) {
launch(args);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment