public class IPview extends HBox { private ImageView imgWebCamCapturedImage; private BufferedImage grabbedImage; private ObjectProperty<Image> imageProperty = new SimpleObjectProperty<Image>(); public IPview(){ this.setPadding(new Insets(15, 12, 15, 12)); this.setSpacing(10); this.setStyle("-fx-background-color: #336699;"); Button buttonCurrent = new Button("Current"); buttonCurrent.setPrefSize(100, 20); Button buttonProjected = new Button("Projected"); buttonProjected.setPrefSize(100, 20); this.getChildren().addAll(buttonCurrent, buttonProjected); } }
double[] points = new double[12]; for (int i = 0; i < 12; i += 2) { double angle = Math.PI * (0.5 + i / 6d); points[i] = Math.cos(angle); points[i + 1] = Math.sin(angle); } Polygon polygon = new Polygon(points); OffsetPane op = new OffsetPane(); double fieldHeight = 100; double fieldWidth = Math.sqrt(0.75) * fieldHeight; for (int i = 0; i < 23; i++) { Button button = new Button(); button.setShape(polygon); button.setPrefSize(fieldWidth, fieldHeight); op.getChildren().add(button); } // horizontal placement just right of the last element op.setHPositionFunction((int index, double x, double y, double width, double height) -> new Point2D(x + width, y)); // vertical position half the size left/right depending on index and // 1/4 the node height above the bottom of the last node op.setVPositionFunction((int index, double x, double y, double width, double height) -> new Point2D(x + (index % 2 == 0 ? width : -width) / 2, y + height * 0.75));
int buttonSize = 70; Button button = new Button("A"); button.setMinSize(buttonSize, buttonSize); button.setPrefSize(buttonSize, buttonSize); button.setMaxSize(buttonSize, buttonSize); button.setStyle(String.format("-fx-font-size: %dpx;", (int)(0.45 * buttonSize)));
public class IPview { private ImageView imgWebCamCapturedImage; private BufferedImage grabbedImage; private ObjectProperty<Image> imageProperty = new SimpleObjectProperty<Image>(); private HBox hbox; public IPview(){ hbox = new HBox(); hbox.setPadding(new Insets(15, 12, 15, 12)); hbox.setSpacing(10); hbox.setStyle("-fx-background-color: #336699;"); Button buttonCurrent = new Button("Current"); buttonCurrent.setPrefSize(100, 20); Button buttonProjected = new Button("Projected"); buttonProjected.setPrefSize(100, 20); hbox.getChildren().addAll(buttonCurrent, buttonProjected); } public Node getView() { return hbox ; } }
textField.setPrefSize(50,30); Button button = new Button("Send"); button.setPrefSize(80,30); Button button2 = new Button("Start"); button2.setPrefSize(50,30); VBox container = new VBox(); VBox box = new VBox();
/** * This Method creates and defines a horizontal box with a button. */ public HBox addHorizontalBoxWithButton() { // set up horizontal box and button HBox hBox = new HBox(); hBox.setId("hBox"); hBox.setPadding(new Insets(10, 10, 10, 10)); hBox.setSpacing(10); // hBox.setStyle("-fx-background-colour: #FFFFFF;"); hBox.setAlignment(Pos.CENTER); Button startButton = new Button("CLICK ME"); startButton.setPrefSize(100, 30); // set up a message Text message = new Text("Click the button to get started."); message.setId("message"); hBox.getChildren().add(message); hBox.getChildren().add(startButton); return hBox; }
for (int c = 0; c < count; c++) { Button b = new Button(); b.setPrefSize(width, size); b.setShape(polygon); result.add(b, 2 * c + offset, 2 * r, 2, 3);
button.setPrefSize(80, 30);
vbox.setSpacing( 100 ); Button buttonArticle = new Button( "ARTICLES" ); buttonArticle.setPrefSize( 100 , 50 ); Button buttonNews = new Button( "NEWS" ); buttonNews.setPrefSize( 100 , 50 ); vbox.getChildren( ).addAll( buttonArticle , buttonNews ); return vbox;
for (int c = 0; c < n; c++) { Button button = new Button(); button.setPrefSize(30, 30); button.setStyle("-fx-background-color:" + ((c + r) % 2 == 0 ? "red;" : "black;")); grid.add(button, c, r);
private VBox addVBox() { VBox vb1 = new VBox(); vb1.setPadding(new Insets(40, 40, 20, 40)); vb1.setSpacing(20); vb1.setStyle("-fx-background-color: #333333;"); TextField txt1 = new TextField(); txt1.setPromptText("Class Number"); txt1.setPrefSize(70, 30); txt1.setFocusTraversable(false); // set focus traversable false. Button b1 = new Button("DELETE"); b1.setFont(Font.font("Calibri", FontWeight.BOLD, 17)); b1.setPrefSize(100, 30); b1.setStyle(" -fx-base: #ffffff;"); b1.setTextFill(Color.BLACK); vb1.getChildren().addAll( txt1, b1); return vb1; }
root.layoutBoundsProperty().addListener((observableValue, oldBounds, newBounds) -> { double size = Math.max(MIN_BUTTON_SIZE, Math.min(newBounds.getWidth(), newBounds.getHeight())); buttonWithGraphics.setPrefSize(size, size);
moveLeftButton.setPrefSize(200, 30); moveLeftButton.setAlignment(Pos.CENTER); moveRightButton.setPrefSize(200, 30); moveRightButton.setAlignment(Pos.CENTER);
buttonCurrent.setPrefSize(100, 20); buttonProjected.setPrefSize(100, 20); hbox.getChildren().addAll(buttonCurrent, buttonProjected);
buttonCurrent.setPrefSize(100, 20); buttonProjected.setPrefSize(100, 20); hbox.getChildren().addAll(buttonCurrent, buttonProjected);
Scene scene = new Scene(new Group(), 450, 250); Button notification = new Button(); notification.setPrefSize(80, 60); notification.setAlignment(Pos.CENTER); MenuItem item1 = new MenuItem("About");
button.setPrefSize(0, 0);