private static void layoutizeLabelCreator( ICreatorCustomLabel myLabel, double r, double g, double b) { Color color = Color.color(r, g, b); ((Label) myLabel) .setBackground( new Background(new BackgroundFill(color, new CornerRadii(3), new Insets(0)))); ((Label) myLabel).setStyle("-fx-border-color: white;"); ((Label) myLabel).setMinSize(400, 35); ((Label) myLabel).setTextAlignment(TextAlignment.CENTER); ((Label) myLabel).setFont(Font.font(20)); ((Label) myLabel) .setOnDragDetected( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Dragboard db = ((Label) event.getSource()).startDragAndDrop(TransferMode.ANY); ClipboardContent content = new ClipboardContent(); content.putString("clipboardString"); db.setContent(content); event.consume(); } }); ((Label) myLabel).setVisible(true); }
protected void addLabel(String name) { Label label = new Label(myResource.getString(name)); label.setPrefWidth(myScene.getWidth() / 7); label.setBackground( new Background(new BackgroundFill(Color.CADETBLUE, new CornerRadii(0), new Insets(0)))); getChildren().add(label); }
public static void layoutizeLabel(ICustomLabel myLabel, Color color) { ((Label) myLabel) .setBackground( new Background(new BackgroundFill(color, new CornerRadii(3), new Insets(0)))); ((Label) myLabel).setBorder(Border.EMPTY); ((Label) myLabel).setStyle("-fx-border-color: white;"); ((Label) myLabel).setMinSize(400, 35); ((Label) myLabel).setText(myLabel.getName()); myLabel.setDescription(myLabel.getDescription()); ((Label) myLabel).setTextAlignment(TextAlignment.CENTER); ((Label) myLabel).setFont(Font.font(20)); ((Label) myLabel).setVisible(true); }