本文整理汇总了Java中javafx.scene.Parent类的典型用法代码示例。如果您正苦于以下问题:Java Parent类的具体用法?Java Parent怎么用?Java Parent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Parent类属于javafx.scene包,在下文中一共展示了Parent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initData
import javafx.scene.Parent; //导入依赖的package包/类
@Override
public void initData(Parent node, Map<String, String> bundle) {
progressbar = (ProgressIndicator) node.lookup("#progressbar");
iv_sync = (ImageView) node.lookup("#iv_sync");
iv_down = (ImageView) node.lookup("#iv_down");
iv_sync.setOnMouseEntered(e-> {
iv_sync.setImage(sync_enter);
});
iv_sync.setOnMouseExited(e-> {
iv_sync.setImage(sync_defalt);
});
iv_down.setOnMouseEntered(e-> {
iv_down.setImage(down_enter);
});
iv_down.setOnMouseExited(e-> {
iv_down.setImage(down_default);
});
iv_down.setOnMouseClicked(e->{
download();
});
iv_sync.setOnMouseClicked(e->{
sync();
});
}
示例2: studyProfileDetails
import javafx.scene.Parent; //导入依赖的package包/类
/**
* Displays the StudyProfile details page
*
* @param profile StudyProfile for which the details should be shown.
*/
public void studyProfileDetails(StudyProfile profile) throws IOException
{
StudyProfileController spc = new StudyProfileController(profile);
// Load in the .fxml file:
FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/StudyProfile.fxml"));
loader.setController(spc);
Parent root = loader.load();
// Set the scene:
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
stage.setScene(new Scene(root, 550, 232));
stage.setTitle(profile.getName());
stage.resizableProperty().setValue(false);
stage.getIcons().add(new Image("file:icon.png"));
stage.showAndWait();
}
示例3: start
import javafx.scene.Parent; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader(
getClass().getResource("/FXML/main.fxml"));
Parent root = (Parent) fxmlLoader.load();
MainController mainController
= (MainController) fxmlLoader.getController();
DataModel model = new DataModel();
mainController.initModel(model);
mainController.setStage(stage);
Scene scene = new Scene(root);
scene.getStylesheets().add("/CSS/main.css");
stage.setTitle("Ember");
stage.getIcons().add(new Image(
"/images/EMBER-LOGO-COLOR.png"));
stage.setScene(scene);
stage.setMinHeight(550);
stage.setMinWidth(550);
stage.show();
stage.toFront();
}
示例4: goToHelp
import javafx.scene.Parent; //导入依赖的package包/类
public void goToHelp(double positionX, double positionY) {
try {
Stage HelpStage = new Stage();
Parent root = FXMLLoader.load(getClass().getResource("/view/Help.fxml"));
Scene scene = new Scene(root,800,550);
HelpStage.setScene(scene);
HelpStage.setResizable(false);
HelpStage.getIcons().add(new Image(getClass().getResourceAsStream("/imges/purse.png")));
HelpStage.setTitle("Help");
HelpStage.setX(positionX);
HelpStage.setY(positionY);
HelpStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
示例5: start
import javafx.scene.Parent; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/main.fxml"));
Parent root = fxmlLoader.load();
primaryStage.setTitle("ソースリスト作るよ");
primaryStage.setScene(new Scene(root, 700, 500));
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/icons.png")));
primaryStage.setMinHeight(500);
primaryStage.setMinWidth(700);
Controller controller = fxmlLoader.getController();
controller.init(primaryStage);
primaryStage.setMaxHeight(500);
primaryStage.setMaxWidth(700);
primaryStage.show();
}
示例6: openSubmitAction
import javafx.scene.Parent; //导入依赖的package包/类
@FXML
public void openSubmitAction(ActionEvent event) throws IOException {
Node node = (Node) event.getSource();
final Stage stage = (Stage) node.getScene().getWindow();
final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
final Scene hScene = new Scene(home);
Parent root = FXMLLoader.load(getClass().getResource("/fxml/Submit.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
root.setOnKeyPressed(new EventHandler<KeyEvent>() {
public void handle(KeyEvent ke) {
if (ke.getCode() == KeyCode.ESCAPE) {
System.out.println("Key Pressed: " + ke.getCode());
stage.setScene(hScene);
}
}
});
}
示例7: setState
import javafx.scene.Parent; //导入依赖的package包/类
public void setState(int state)
{
// 0 is on, 1 is off
for (int index = 0; index < segments.size(); index++)
{
int maskedBit = (state >> index) & 1;
boolean isOn = (maskedBit == 0);
String color = isOn ? OFF_COLOR : ON_COLOR;
Parent segment = segments.get(index);
for (Node section : segment.getChildrenUnmodifiable())
{
section.setStyle("-fx-background-color: " + color);
}
}
}
示例8: DrilldownPieChartSample
import javafx.scene.Parent; //导入依赖的package包/类
public DrilldownPieChartSample() {
String drilldownCss = DrilldownPieChartSample.class.getResource("DrilldownChart.css").toExternalForm();
PieChart pie = new PieChart(
FXCollections.observableArrayList(
A = new PieChart.Data("A", 20),
B = new PieChart.Data("B", 30),
C = new PieChart.Data("C", 10),
D = new PieChart.Data("D", 40)));
((Parent) pie).getStylesheets().add(drilldownCss);
setDrilldownData(pie, A, "a");
setDrilldownData(pie, B, "b");
setDrilldownData(pie, C, "c");
setDrilldownData(pie, D, "d");
getChildren().add(pie);
}
示例9: doFindEntryView
import javafx.scene.Parent; //导入依赖的package包/类
private EntryViewBase<?> doFindEntryView(Parent parent, Entry<?> entry) {
EntryViewBase<?> result = null;
for (Node node : parent.getChildrenUnmodifiable()) {
if (node instanceof EntryViewBase) {
EntryViewBase<?> base = (EntryViewBase<?>) node;
if (base.getEntry().equals(entry)) {
result = base;
break;
}
} else if (node instanceof Parent) {
result = doFindEntryView((Parent) node, entry);
if (result != null) {
break;
}
}
}
return result;
}
示例10: openHome
import javafx.scene.Parent; //导入依赖的package包/类
@FXML
public void openHome(ActionEvent event) throws IOException {
Node node = (Node) event.getSource();
final Stage stage = (Stage) node.getScene().getWindow();
final Parent home = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
final Scene hScene = new Scene(home);
Parent root = FXMLLoader.load(getClass().getResource("/fxml/Homepage.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
stage.centerOnScreen();
root.setOnKeyPressed(new EventHandler<KeyEvent>() {
public void handle(KeyEvent ke) {
if (ke.getCode() == KeyCode.ESCAPE) {
System.out.println("Key Pressed: " + ke.getCode() + " Made by ShaMaster");
stage.setScene(hScene);
}
}
});
}
示例11: start
import javafx.scene.Parent; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception{
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(getClass().getResource("sample.fxml"));
Parent root = fxmlLoader.load();
Screen screen = Screen.getPrimary ();
// 界面初始化
Controller controller = fxmlLoader.getController();
controller.init(primaryStage);
Rectangle2D bounds = screen.getVisualBounds ();
double minX = bounds.getMinX ();
double minY = bounds.getMinY ();
double maxX = bounds.getMaxX ();
double maxY = bounds.getMaxY ();
screenWidth = maxX - minX;
screenHeight = maxY - minY;
Scene scene = new Scene(root, (maxX - minX) * 0.6, (maxY - minY) * 0.6);
primaryStage.setTitle ("Higher Cloud Compute Platform");
primaryStage.setScene (scene);
primaryStage.setFullScreen(true);
primaryStage.show ();
}
示例12: overlay
import javafx.scene.Parent; //导入依赖的package包/类
private static Parent overlay(int version, int display,
YCbCr params, int yCode, String suffix) {
double ye = params.fromLumaCode(yCode);
Label label = new Label(getLabel(version, display, params, yCode,
suffix));
label.setFont(font(40));
label.setTextFill(gray(max(0.25, min(0.5, ye))));
BorderPane.setMargin(label, new Insets(20));
BorderPane layout = new BorderPane();
layout.setBackground(EMPTY);
layout.setBottom(label);
return layout;
}
示例13: showHome
import javafx.scene.Parent; //导入依赖的package包/类
public static void showHome()
{
try {
FXMLLoader loader = new FXMLLoader();
loader.setLocation( AppDelegate.class.getResource( "view/home.fxml" ) );
Parent root = (Parent) loader.load();
HomeController homeController = (HomeController)loader.getController();
homeController.init( );
m_scene = new Scene(root, 700, 532);
static_stage.hide();
static_stage.setTitle("亮金跨平台串口助手V1.0.0 by brok1n");
static_stage.setScene(m_scene);
static_stage.show();
}catch (IOException e)
{}
}
示例14: joinNow
import javafx.scene.Parent; //导入依赖的package包/类
public void joinNow(ActionEvent actionEvent) {
try {
FXMLLoader fxmlLoader2 = new FXMLLoader(getClass().getResource("../../Resources/Layouts/register_stage.fxml"));
Parent root2 = (Parent) fxmlLoader2.load();
Stage stage2 = new Stage();
stage2.setScene(new Scene(root2));
stage2.setResizable(false);
stage2.initModality(Modality.WINDOW_MODAL);
stage2.initOwner(ApplicationLauncher.primaryStage);
stage2.initStyle(StageStyle.UNDECORATED);
stage2.showAndWait();
} catch (Exception e1) {
}
}
示例15: NewTaskListWindow
import javafx.scene.Parent; //导入依赖的package包/类
/**
* Builds the window and add events.
* @throws IOException
*/
public NewTaskListWindow() throws IOException {
super();
FXMLLoader fxmlLoader = new FXMLLoader(
getClass().getResource("/FXML/newTaskList.fxml"));
Parent root = (Parent) fxmlLoader.load();
taskListController
= (NewTaskListController) fxmlLoader.getController();
Scene scene = new Scene(root);
setScene(scene);
setResizable(false);
initStyle(StageStyle.TRANSPARENT);
this.wantsToAdd = false;
//After pressing 'Enter', closes this window (which returns the value)
scene.setOnKeyPressed((final KeyEvent keyEvent) -> {
if (keyEvent.getCode() == KeyCode.ENTER) {
this.wantsToAdd = true;
this.close();
} else if (keyEvent.getCode() == KeyCode.ESCAPE) {
this.close();
}
});
//Not focusing the window means closing it
focusedProperty().addListener((obs, wasFocused, isNowFocused) -> {
if (!isNowFocused) {
close();
}
});
}