List of usage examples for javafx.scene.effect DropShadow DropShadow
public DropShadow()
From source file:ExcelFx.XLSSettingController.java
@FXML protected void okButton(ActionEvent event) throws IOException { DropShadow ds = new DropShadow(); ds.setColor(Color.RED);/*from w w w . j av a2 s .c o m*/ String err = ""; try { if (pageField.getText().length() == 0) { err += " "; pageField.setEffect(ds); } } catch (Exception ex) { err += " "; pageField.setEffect(ds); } try { if (eddWayField.getText().length() == 0) { err += "? "; eddWayField.setEffect(ds); } } catch (Exception e) { err += "? "; eddWayField.setEffect(ds); } try { if (proffField.getText().length() == 0) { err += "??? "; proffField.setEffect(ds); } } catch (Exception ex) { err += "??? "; proffField.setEffect(ds); } // try { // if (eddNameField.getText().length() == 0) { // err += "? ? "; // eddNameField.setEffect(ds); // } // } catch (Exception ex) { // err += "??? "; // eddNameField.setEffect(ds); // } if (err.length() != 0) { Alert alert = new Alert(Alert.AlertType.INFORMATION); alert.setTitle(""); alert.setHeaderText("? ?"); alert.setContentText(err); alert.showAndWait(); } else { json.setPage(pageField.getText().trim().toLowerCase()); json.setEddWay(eddWayField.getText().trim().toLowerCase()); json.setProffName(proffField.getText().trim().toLowerCase()); // json.setEddName(this.eddNameField.getText().trim().toLowerCase()); gridPane.setUserData(json); Stage stage = (Stage) gridPane.getScene().getWindow(); stage.close(); } switch (type) { case "university": { json.jsonCreate("university.json"); break; } case "college": { json.jsonCreate("college.json"); break; } } }
From source file:Main.java
static Node dropShadow() { Group g = new Group(); DropShadow ds = new DropShadow(); ds.setOffsetY(3.0f);//from w w w .j av a 2 s. c o m ds.setColor(Color.color(0.4f, 0.4f, 0.4f)); Text t = new Text(); t.setEffect(ds); t.setCache(true); t.setX(10.0f); t.setY(270.0f); t.setFill(Color.RED); t.setText("JavaFX drop shadow..."); t.setFont(Font.font("null", FontWeight.BOLD, 32)); DropShadow ds1 = new DropShadow(); ds1.setOffsetY(4.0f); Circle c = new Circle(); c.setEffect(ds1); c.setCenterX(50.0f); c.setCenterY(325.0f); c.setRadius(30.0f); c.setFill(Color.ORANGE); c.setCache(true); g.getChildren().add(t); g.getChildren().add(c); return g; }
From source file:com.rockhoppertech.symchords.fx.SymChordsController.java
protected void setupDragonDrop() { Image image = new Image(getClass().getResourceAsStream("/images/rocky-32-trans.png")); dragImageView = new ImageView(image); dragImageView.setFitHeight(32);/* w w w .j a v a 2 s . c o m*/ dragImageView.setFitWidth(32); grandStaff.setOnDragDetected(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent me) { if (!root.getChildren().contains(dragImageView)) { root.getChildren().add(dragImageView); } // dragImageView.setOpacity(0.5); dragImageView.toFront(); dragImageView.setMouseTransparent(true); dragImageView.setVisible(true); dragImageView.relocate((int) (me.getSceneX() - dragImageView.getBoundsInLocal().getWidth() / 2), (int) (me.getSceneY() - dragImageView.getBoundsInLocal().getHeight() / 2)); Dragboard db = grandStaff.startDragAndDrop(TransferMode.ANY); // TODO remove the custom image nonsense in javafx 8 // javafx 8 // db.setDragView(dragImageView); ClipboardContent content = new ClipboardContent(); // MIDITrack track = grandStaff.getMIDITrack(); MIDITrack track = model.getMIDITrack(); content.put(midiTrackDataFormat, track); db.setContent(content); me.consume(); } }); grandStaff.setOnDragDone(new EventHandler<DragEvent>() { public void handle(DragEvent e) { dragImageView.setVisible(false); e.consume(); } }); // Parent root = grandStaff.getScene().getRoot(); // stage.getScene().getRoot(); if (root != null) { root.setOnDragOver(new EventHandler<DragEvent>() { public void handle(DragEvent e) { Point2D localPoint = grandStaff.getScene().getRoot() .sceneToLocal(new Point2D(e.getSceneX(), e.getSceneY())); dragImageView.relocate( (int) (localPoint.getX() - dragImageView.getBoundsInLocal().getWidth() / 2), (int) (localPoint.getY() - dragImageView.getBoundsInLocal().getHeight() / 2)); e.consume(); } }); } trackList.setOnDragOver(new EventHandler<DragEvent>() { public void handle(DragEvent event) { /* * data is dragged over the target; accept it only if it is not * dragged from the same node and if it has MIDITrack data */ if (event.getGestureSource() != trackList && event.getDragboard().hasContent(midiTrackDataFormat)) { logger.debug("drag over"); /* allow for both copying and moving, whatever user chooses */ event.acceptTransferModes(TransferMode.COPY_OR_MOVE); } // Don't consume the event. Let the layers below process the // DragOver event as well so that the // translucent container image will follow the cursor. // event.consume(); } }); trackList.setOnDragEntered(new EventHandler<DragEvent>() { public void handle(DragEvent event) { /* the drag-and-drop gesture entered the target */ /* show to the user that it is an actual gesture target */ logger.debug("drag entered"); if (event.getGestureSource() != trackList && event.getDragboard().hasContent(midiTrackDataFormat)) { DropShadow dropShadow = new DropShadow(); dropShadow.setRadius(5.0); dropShadow.setOffsetX(3.0); dropShadow.setOffsetY(3.0); dropShadow.setColor(Color.color(0.4, 0.5, 0.5)); trackList.setEffect(dropShadow); } event.consume(); } }); trackList.setOnDragExited(new EventHandler<DragEvent>() { public void handle(DragEvent event) { /* mouse moved away, remove the graphical cues */ trackList.setEffect(null); event.consume(); } }); trackList.setOnDragDropped(new EventHandler<DragEvent>() { public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasContent(midiTrackDataFormat)) { MIDITrack track = (MIDITrack) db.getContent(midiTrackDataFormat); trackList.getItems().add(track); success = true; } /* * let the source know whether the data was successfully * transferred and used */ event.setDropCompleted(success); event.consume(); } }); logger.debug("jvm mime {}", DataFlavor.javaJVMLocalObjectMimeType); }
From source file:Main.java
private Effect getEffect() { Effect effect = null;/*from ww w . j a va 2 s . c o m*/ if (dropshadowEffect.isSelected()) { effect = new DropShadow(); } else if (reflectionEffect.isSelected()) { effect = new Reflection(); } else if (glowEffect.isSelected()) { effect = new Glow(); } return effect; }