javafx.scene.Scene.setFill()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中javafx.scene.Scene.setFill()方法的一些代码示例,展示了Scene.setFill()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scene.setFill()方法的具体详情如下:
包路径:javafx.scene.Scene
类名称:Scene
方法名:setFill

Scene.setFill介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

VBox box = new VBox();
final Scene scene = new Scene(box, 400, 300);
scene.setFill(Color.LIGHTGRAY);

代码示例来源:origin: jfoenixadmin/JFoenix

dialogPane.setContent(materialNode);
setDialogPane(dialogPane);
dialogPane.getScene().setFill(Color.TRANSPARENT);

代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit

/**
  * Set background of scene or subscene.
  * @param color
  */
  public void setBackgroundColor(Color color)
  {
   if (scene != null)
   {
     scene.setFill(color);
   }
   else
   {
     subScene.setFill(color);
   }
  }
}

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage primaryStage) {
  try {
    BorderPane root = new BorderPane();
    Scene scene = new Scene(root,400,400);
    scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
    primaryStage.initStyle(StageStyle.UNDECORATED);
    scene.setFill(Color.BLACK);
    primaryStage.setScene(scene);
    primaryStage.show();
  } catch(Exception e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit

/**
* Creates a factory that will create and setup a {@link Scene}.
* @param width the width of the scene in pixels.
* @param height the height of the scene in pixels.
* @param depthBuffer the depth buffer flag.
* @param antiAliasing the scene anti-aliasing attribute. A value of {@code null} is treated as DISABLED.
* @param sceneType the type of the scene to create, i.e. {@code MAIN_SCENE} for creating a {@link Scene} or {@code SUB_SCENE} for creating a {@link SubScene}.
*/
public View3DFactory(double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing, SceneType sceneType)
{
 switch (sceneType)
 {
 case MAIN_SCENE:
   scene = new Scene(root, width, height, depthBuffer, antiAliasing);
   scene.setFill(Color.GRAY);
   subScene = null;
   break;
 case SUB_SCENE:
   subScene = new SubScene(root, width, height, depthBuffer, antiAliasing);
   subScene.setFill(Color.GRAY);
   scene = null;
   break;
 default:
   throw new RuntimeException("Unknown sceneType: " + sceneType);
 }
}

代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit

/**
* Creates a factory that will create and setup a {@link Scene}.
* @param width the width of the scene in pixels.
* @param height the height of the scene in pixels.
* @param depthBuffer the depth buffer flag.
* @param antiAliasing the scene anti-aliasing attribute. A value of {@code null} is treated as DISABLED.
* @param sceneType the type of the scene to create, i.e. {@code MAIN_SCENE} for creating a {@link Scene} or {@code SUB_SCENE} for creating a {@link SubScene}.
*/
public View3DFactory(double width, double height, boolean depthBuffer, SceneAntialiasing antiAliasing, SceneType sceneType)
{
 switch (sceneType)
 {
 case MAIN_SCENE:
   scene = new Scene(root, width, height, depthBuffer, antiAliasing);
   scene.setFill(Color.GRAY);
   subScene = null;
   break;
 case SUB_SCENE:
   subScene = new SubScene(root, width, height, depthBuffer, antiAliasing);
   subScene.setFill(Color.GRAY);
   scene = null;
   break;
 default:
   throw new RuntimeException("Unknown sceneType: " + sceneType);
 }
}

代码示例来源:origin: stackoverflow.com

public void start(Stage primaryStage) {
  Group mainGroup = new Group();
  Rectangle r = new Rectangle(0, 0, 200, 200);

  Stop[] stops = new Stop[] { new Stop(0, new Color(0.0, 0.0, 1.0, 1.0)), 
                new Stop(1, new Color(1.0, 1.0, 1.0, 0.0)) };
  LinearGradient lg = new LinearGradient(0, 0, 1, 1, true, CycleMethod.NO_CYCLE, stops);
  r.setFill(lg);

  mainGroup.getChildren().add(r);
  Scene scene = new Scene(mainGroup, 200, 200);
  scene.setFill(Color.TRANSPARENT);
  primaryStage.setScene(scene);
  primaryStage.show();

  WritableImage image = scene.snapshot(null);
  PixelReader pixelReader = image.getPixelReader();

  System.out.println("Color: " + pixelReader.getColor((int)image.getWidth()/2, (int)image.getHeight()/2));
}

代码示例来源:origin: stackoverflow.com

scene2 = new Scene(new Group(new Label("2")), 200, 150);
scene.setFill(Color.GREEN);
scene2.setFill(Color.ORANGE);

代码示例来源:origin: stackoverflow.com

@Override
public void start(Stage stage) {
  Group group = new Group();
  Rectangle rect = new Rectangle(0, 0, 350, 300);
  Rectangle clip = new Rectangle(20, 20, 200, 200);
  clip.setArcHeight(15);
  clip.setArcWidth(15);

  Shape shape = Shape.subtract(rect, clip);

  shape.setFill(Color.GRAY);
  group.getChildren().add(shape);
  Scene scene = new Scene(group);
  scene.setFill(Color.TRANSPARENT);
  stage.initStyle(StageStyle.TRANSPARENT);
  stage.setScene(scene);
  stage.show();
}

代码示例来源:origin: stackoverflow.com

Timer tm= new Timer();
Stage ilk;
int count;
public  void check() {      
 ilk=new Stage();
 TimerTask mission;
 gorev = new TimerTask() {
   @Override
   public void run() {
       Group root = new Group();     
       Scene scene;
    scene = new Scene(root, 960, 540);
           scene.setFill(Color.BLACK);
           ilk.setScene(scene);
           ilk.setTitle("Splash Screen"); 
  sayac++;
  if(count==5){
          tm.cancel();
           ilk.show();  
       }
   }
 };
 tm.schedule(mission, 0, 2000);
 }

代码示例来源:origin: stackoverflow.com

scene.setFill(Color.WHITE);
String css = Main.class.getResource("styles.css").toExternalForm();
scene.getStylesheets().clear();

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Basic constructor with built-in behavior
 *
 * @param stage The main stage
 * @param root your UI to be displayed in the Stage
 */
public UndecoratorScene(Stage stage, Region root) {
 super(root);
 undecorator = new Undecorator();
 undecorator.buildFrom(stage, root);
 super.setRoot(undecorator);
 // Transparent scene and stage
 stage.initStyle(StageStyle.TRANSPARENT);
 super.setFill(Color.TRANSPARENT);
 // Default Accelerators
 undecorator.installAccelerators(this);
}

代码示例来源:origin: org.boofcv/boofcv-javafx

public void initialize() {
    root.getChildren().add(world);
    root.setDepthTest(DepthTest.ENABLE);

    buildCamera();
    buildAxes();

    Scene scene = new Scene(root, 1024, 768, true);
    scene.setFill(Color.GREY);
//        handleKeyboard(scene, world);
    handleMouse(scene, world);
    setPointRadius(pointRadius);
    scene.setCamera(camera);
    setScene(scene);
  }

代码示例来源:origin: stackoverflow.com

scene.setFill(Color.GHOSTWHITE);

代码示例来源:origin: com.aquafx-project/aquafx

@Override public void start(Stage stage) {
  stage.setTitle("CheckBoxCell Samples");
  final Scene scene = new Scene(new Group(), 875, 700);
  scene.setFill(Color.LIGHTGRAY);
  Group root = (Group) scene.getRoot();
  root.getChildren().add(getContent(scene));
  AquaFx.style();
  stage.setScene(scene);
  stage.show();
}

代码示例来源:origin: com.bitplan.dragtop/com.bitplan.dragtop

/**
 * setup the GUI
 * 
 * @param stage
 */
private void setup(Stage stage) {
 stage.setTitle(title);
 Rectangle2D sceneBounds = super.getSceneBounds(screenPercent, divX, divY);
 dropTarget = new DropTarget();
 setScene(
   new Scene(dropTarget, sceneBounds.getWidth(), sceneBounds.getHeight()));
 stage.setScene(getScene());
 scene.setFill(Color.LIGHTGRAY);
 stage.setX(super.getScreenWidth() - sceneBounds.getMinX());
 stage.setY(super.getScreenHeight() - sceneBounds.getMinY());
 stage.show();
}

代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls

public DragFeedbackStage(Node n) {
      this.n = n;
      this.popupWindow = new Stage();
      this.popupWindow.initStyle(StageStyle.TRANSPARENT);
//            this.popupWindow.initOwner(n.getScene().getWindow());
      this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
      this.popupWindow.setAlwaysOnTop(true);
      StackPane root = new StackPane();
      root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
      Scene value = new Scene(root);
      value.setFill(Color.TRANSPARENT);
      this.popupWindow.setScene(value);
      this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
      this.popupWindow.getScene().setRoot(root);
    }

代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls

public DragFeedbackStage(Node n) {
      this.n = n;
      this.popupWindow = new Stage();
      this.popupWindow.initStyle(StageStyle.TRANSPARENT);
//            this.popupWindow.initOwner(n.getScene().getWindow());
      this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
      this.popupWindow.setAlwaysOnTop(true);
      StackPane root = new StackPane();
      root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
      Scene value = new Scene(root);
      value.setFill(Color.TRANSPARENT);
      this.popupWindow.setScene(value);
      this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
      this.popupWindow.getScene().setRoot(root);
    }

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

/**
 * Prepare Stage for dock feedback display
 */
void buildDockFeedbackStage() {
 dockFeedbackPopup = new Stage(StageStyle.TRANSPARENT);
 dockFeedback = new Rectangle(0, 0, 100, 100);
 dockFeedback.setArcHeight(10);
 dockFeedback.setArcWidth(10);
 dockFeedback.setFill(Color.TRANSPARENT);
 dockFeedback.setStroke(Color.BLACK);
 dockFeedback.setStrokeWidth(2);
 dockFeedback.setCache(true);
 dockFeedback.setCacheHint(CacheHint.SPEED);
 dockFeedback.setEffect(new DropShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 10, 0.2, 3, 3));
 dockFeedback.setMouseTransparent(true);
 BorderPane borderpane = new BorderPane();
 borderpane.setStyle("-fx-background-color:transparent"); // J8
 borderpane.setCenter(dockFeedback);
 Scene scene = new Scene(borderpane);
 scene.setFill(Color.TRANSPARENT);
 dockFeedbackPopup.setScene(scene);
 dockFeedbackPopup.sizeToScene();
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

dialogStage.getScene().setFill(Color.TRANSPARENT); // Fill our scene with nothing

相关文章