• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StageHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.javafx.stage.StageHelper的典型用法代码示例。如果您正苦于以下问题:Java StageHelper类的具体用法?Java StageHelper怎么用?Java StageHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StageHelper类属于com.sun.javafx.stage包,在下文中一共展示了StageHelper类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTitle

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
public String getTitle() {
    String title = getTitle(window);
    ObservableList<Stage> windows = StageHelper.getStages();
    String original = title;
    int index = 1;
    for (Stage w : windows) {
        if (w == window) {
            return title;
        }
        if (!w.isShowing()) {
            continue;
        }
        String wTitle = getTitle(w);
        if (original.equals(wTitle)) {
            title = original + "(" + index++ + ")";
        }
    }
    return title;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:WindowTitle.java


示例2: getValidWindows

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
private Stage[] getValidWindows() {
    ObservableList<Stage> stages = StageHelper.getStages();
    List<Stage> valid = new ArrayList<Stage>();
    for (Stage window : stages) {
        if (window.isShowing()) {
            valid.add(window);
        }
    }
    return valid.toArray(new Stage[valid.size()]);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:11,代码来源:JavaFXTargetLocator.java


示例3: applySkin

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * @작성자 : KYJ
 * @작성일 : 2016. 12. 5.
 * @param createUserCustomSkin
 * @param btnStyleClass
 * @throws MalformedURLException
 */
public void applySkin(File createUserCustomSkin, String btnStyleClass) {
	ObservableList<Stage> stages = StageHelper.getStages();
	if (stages.isEmpty())
		return;
	Stage stage = stages.get(0);
	ObservableList<String> stylesheets = stage.getScene().getStylesheets();
	stylesheets.clear();

	try {
		stylesheets.add(createUserCustomSkin.toURI().toURL().toExternalForm());
	} catch (Exception e) {
		LOGGER.error(ValueUtil.toString(e));
	}

	if (ValueUtil.isNotEmpty(btnStyleClass)) {
		applyBtnSyleClass(btnStyleClass);
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:26,代码来源:FxSkinManager.java


示例4: handlePlotGenerationForSelectedTab

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Generates a plot for the selected {@code TopsoilTab}.
 *
 * @param tabs  the active TopsoilTabPane
 */
public static void handlePlotGenerationForSelectedTab(TopsoilTabPane tabs) {
    TopsoilTableController tableController = tabs.getSelectedTab().getTableController();

    // Check for open plots.
    List<Stage> stages = StageHelper.getStages();
    if (stages.size() > 1) {
        for (TopsoilTab tab : tabs.getTopsoilTabs()) {
            for (PlotInformation plotInfo : tab.getTableController().getTable().getOpenPlots()) {
                tab.getTableController().getTable().removeOpenPlot(plotInfo.getTopsoilPlotType());
                plotInfo.getStage().close();
            }
        }
        generatePlot(tableController, TopsoilPlotType.BASE_PLOT);
    } else {
        generatePlot(tableController, TopsoilPlotType.BASE_PLOT);
    }
}
 
开发者ID:CIRDLES,项目名称:Topsoil,代码行数:23,代码来源:PlotGenerationHandler.java


示例5: stage

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Return the stage with the given title.
 * 
 * @param titleRegEx <code>null</code> means the title is not set
 */
public static final GcStageFX stage(final String titleRegEx)
{
    return GcUtilsFX.eval(new GcUtils.IEvaluator<GcStageFX>()
    {
        @Override
        public GcStageFX eval()
        {
            for (Stage l_stage : StageHelper.getStages())
            {
                if (GcUtils.startsWithOrMatches(l_stage.getTitle(), titleRegEx))
                {
                    return new GcStageFX(l_stage);
                }
            }

            throw new GcAssertException("Cannot find stage with title: " + titleRegEx);
        }
    });
}
 
开发者ID:SICKAG,项目名称:gui-check,代码行数:25,代码来源:GcTestFX.java


示例6: initializeSaveOnBlur

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
public void initializeSaveOnBlur() {

        stage.focusedProperty().addListener((observable, oldValue, newValue) -> {

            Node focusOwner = stage.getScene().getFocusOwner();

            if (StageHelper.getStages().size() == 1) {
                if (!newValue) {
                    saveAllTabs();
                } else {
                    loadAllTabs();
                }
            }

            if (newValue) {
                if (Objects.nonNull(focusOwner)) {
//                    logger.info("Focus owner changed {}", focusOwner);
                    focusOwner.requestFocus();
                }
            }
        });

    }
 
开发者ID:asciidocfx,项目名称:AsciidocFX,代码行数:24,代码来源:ApplicationController.java


示例7: premain

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
public static void premain(final String args, Instrumentation instrumentation) throws Exception {
    instrumentation.addTransformer(new MenuItemTransformer());
    instrumentation.addTransformer(new FileChooserTransformer());
    logger.info("JavaVersion: " + System.getProperty("java.version"));
    final int port;
    if (args != null && args.trim().length() > 0) {
        port = Integer.parseInt(args.trim());
    } else {
        throw new Exception("Port number not specified");
    }
    windowTitle = System.getProperty("start.window.title", "");
    ObservableList<Stage> stages = StageHelper.getStages();
    stages.addListener(new ListChangeListener<Stage>() {
        boolean done = false;

        @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Stage> c) {
            if (done) {
                return;
            }
            if (!"".equals(windowTitle)) {
                logger.warning("WindowTitle is not supported yet... Ignoring it.");
            }
            c.next();
            if (c.wasAdded()) {
                AccessController.doPrivileged(new PrivilegedAction<Object>() {
                    @Override public Object run() {
                        return new JavaFxRecorderHook(port);
                    }
                });
                done = true;
            }
        }
    });
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:35,代码来源:JavaFxRecorderHook.java


示例8: applyBtnSyleClass

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * 버튼 스타일 클래스를 적용.
 * 
 * @작성자 : KYJ
 * @작성일 : 2016. 12. 5.
 * @param btnStyleClass
 */
public void applyBtnSyleClass(String btnStyleClass) {
	ObservableList<Stage> stages = StageHelper.getStages();
	if (stages.isEmpty())
		return;
	Stage stage = stages.get(0);
	ObservableList<String> stylesheets = stage.getScene().getStylesheets();

	URL buttonURL = toButtonURL(btnStyleClass);
	if (buttonURL != null) {
		stylesheets.add(buttonURL.toExternalForm());
	}

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:21,代码来源:FxSkinManager.java


示例9: resetSkin

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * 스킨을 초기화 시킨다. 디폴트 스킨이 적용된다.
 *
 * @작성자 : KYJ
 * @작성일 : 2016. 12. 3.
 */
public void resetSkin() {
	ObservableList<Stage> stages = StageHelper.getStages();
	if (stages.isEmpty())
		return;
	Stage primaryStage = stages.get(0);

	Scene scene = primaryStage.getScene();
	scene.getStylesheets().clear();
	scene.getStylesheets().add(getSkin());
	scene.getStylesheets().add(getButtonSkin());
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:18,代码来源:FxSkinManager.java


示例10: closeAllTabsAndPlots

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Closes all open tabs in the {@code TopsoilTabPane}, as well as any open plots. Used when a project is loaded,
 * or when one is closed.
 *
 * @param tabs  the active TopsoilTabPane
 */
private static void closeAllTabsAndPlots(TopsoilTabPane tabs) {
    tabs.getTabs().clear();
    List<Stage> stages = StageHelper.getStages();
    for (int index = stages.size() - 1; index > 0; index--) {
        stages.get(index).close();
    }
}
 
开发者ID:CIRDLES,项目名称:Topsoil,代码行数:14,代码来源:MenuItemEventHandler.java


示例11: handleSaveAsProjectFile

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Creates a new .topsoil file for the current tabs and plots.
 *
 * @param tabs  the TopsoilTabPane from which to save tables
 * @return  true if the file was successfully saved
 */
public static boolean handleSaveAsProjectFile(TopsoilTabPane tabs) {
    FileChooser fileChooser =  TopsoilFileChooser.getTopsoilSaveFileChooser();
    File file = fileChooser.showSaveDialog(StageHelper.getStages().get(0));

    if (file != null) {
        saveProjectFile(file, tabs);
        TopsoilSerializer.setCurrentProjectFile(file);
        return true;
    }
    return false;
}
 
开发者ID:CIRDLES,项目名称:Topsoil,代码行数:18,代码来源:MenuItemEventHandler.java


示例12: checkForModalChildStages

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
private void checkForModalChildStages()
{
    for (Stage s : StageHelper.getStages())
    {
        if (s.getOwner() == m_stage.getFXComponent() && s.isShowing() && s.getModality() != Modality.NONE)
        {
            throw new GcAssertException("The stage <" + ((Stage)m_stage.getFXComponent()).getTitle() + "> is blocked by the modal child window <" + s.getTitle() + ">");
        }
    }
}
 
开发者ID:SICKAG,项目名称:gui-check,代码行数:11,代码来源:GcRobotFX.java


示例13: waitAndExitWhenAllStagesClosed

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Use this method to stop the test at any point and wait until all stages get closed by the program or user. The
 * program will exit after waiting. This method is especially useful while debugging with GUI tests.
 */
public static void waitAndExitWhenAllStagesClosed()
{
    while (StageHelper.getStages().size() > 0)
    {
        GcUtils.sleepAndIgnoreInterrupts(500);
    }

    Platform.exit();
    System.exit(0);
}
 
开发者ID:SICKAG,项目名称:gui-check,代码行数:15,代码来源:GcUtilsFX.java


示例14: getStages

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected static List<Stage> getStages() throws QTasteTestFailException
{
    final FutureTask query = new FutureTask(() -> Collections.unmodifiableList(StageHelper.getStages()));
    PlatformImpl.runAndWait(query);
    try {
        return (List<Stage>) query.get();
    } catch (InterruptedException | ExecutionException e) {
        throw new QTasteTestFailException("Cannot get JavaFx stages", e);
    }
}
 
开发者ID:qspin,项目名称:qtaste,代码行数:12,代码来源:ComponentCommander.java


示例15: GargoyleLoadBar

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
public GargoyleLoadBar(Window owner, Task<V> task) {
	this.task = task;
	this.owner = owner;

	if (owner == null) {
		ObservableList<Stage> stages = StageHelper.getStages();
		this.owner = stages.stream().findFirst().get();
	}

	stage = new Stage();

	StackPane stackPane = new StackPane();
	double radius = this.owner.getWidth() / 10;
	for (double r = radius; r >= (radius - 40) && radius >= 0; r -= 10) {
		JFXSpinner spinner = new JFXSpinner();
		//			spinner.setStyle("-fx-background-color:transparent ; -fx-fill : transparent");
		spinner.setRadius(r);
		stackPane.getChildren().add(spinner);
	}
	//		stackPane.setBackground(Background.EMPTY);
	stackPane.getStyleClass().add("loading-bar");
	stackPane.setStyle("-fx-background-color: transparent ;");
	//		scene.getStylesheets().add(SkinManager.getInstance().getSkin());

	Scene scene = new Scene(stackPane, stackPane.prefWidth(0), stackPane.prefHeight(0));
	scene.setFill(null);
	stage.setScene(scene);

	stage.setX(this.owner.getX() + (this.owner.getWidth() / 2) - (stage.getScene().getWidth() / 2));
	stage.setY(this.owner.getY() + (this.owner.getHeight() / 2) - (stage.getScene().getHeight() / 2));

	this.owner.xProperty().addListener(xListener);
	this.owner.yProperty().addListener(yListener);

	//		stage.setScene(new Scene(root));
	stage.initStyle(StageStyle.TRANSPARENT);

	stage.setAlwaysOnTop(false);
	stage.initOwner(this.owner);
	stage.addEventHandler(KeyEvent.KEY_PRESSED, this::stageOnKeyPress);

}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:43,代码来源:GargoyleLoadBar.java


示例16: pickEventTarget

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Traverse the scene graph for all open stages and pick an event target for
 * a dock event based on the location. Once the event target is chosen run
 * the event task with the target and the previous target of the last dock
 * event if one is cached. If an event target is not found fire the explicit
 * dock event on the stage root if one is provided.
 *
 * @param location
 *            The location of the dock event in screen coordinates.
 * @param eventTask
 *            The event task to be run when the event target is found.
 * @param explicit
 *            The explicit event to be fired on the stage root when no event
 *            target is found.
 */
private void pickEventTarget(Point2D location, EventTask eventTask, Event explicit) {
	// RFE for public scene graph traversal API filed but closed:
	// https://bugs.openjdk.java.net/browse/JDK-8133331

	ObservableList<Stage> stages = FXCollections.unmodifiableObservableList(StageHelper.getStages());
	// fire the dock over event for the active stages
	for (Stage targetStage : stages) {
		// obviously this title bar does not need to receive its own events
		// though users of this library may want to know when their
		// dock node is being dragged by subclassing it or attaching
		// an event listener in which case a new event can be defined or
		// this continue behavior can be removed
		if (targetStage == this.dockNode.getStage())
			continue;

		eventTask.reset();

		Node dragNode = dragNodes.get(targetStage);

		Parent root = targetStage.getScene().getRoot();
		Stack<Parent> stack = new Stack<Parent>();
		if (root.contains(root.screenToLocal(location.getX(), location.getY())) && !root.isMouseTransparent()) {
			stack.push(root);
		}
		// depth first traversal to find the deepest node or parent with no
		// children
		// that intersects the point of interest
		while (!stack.isEmpty()) {
			Parent parent = stack.pop();
			// if this parent contains the mouse click in screen coordinates
			// in its local bounds
			// then traverse its children
			boolean notFired = true;
			for (Node node : parent.getChildrenUnmodifiable()) {
				if (node.contains(node.screenToLocal(location.getX(), location.getY())) && !node.isMouseTransparent()) {
					if (node instanceof Parent) {
						stack.push((Parent) node);
					} else {
						eventTask.run(node, dragNode);
					}
					notFired = false;
					break;
				}
			}
			// if none of the children fired the event or there were no
			// children
			// fire it with the parent as the target to receive the event
			if (notFired) {
				eventTask.run(parent, dragNode);
			}
		}

		if (explicit != null && dragNode != null && eventTask.getExecutions() < 1) {
			Event.fireEvent(dragNode, explicit.copyFor(this, dragNode));
			dragNodes.put(targetStage, null);
		}
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:74,代码来源:DockTitleBar.java


示例17: pickEventTarget

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Traverse the scene graph for all open stages and pick an event target for a dock event based on
 * the location. Once the event target is chosen run the event task with the target and the
 * previous target of the last dock event if one is cached. If an event target is not found fire
 * the explicit dock event on the stage root if one is provided.
 * 
 * @param location The location of the dock event in screen coordinates.
 * @param eventTask The event task to be run when the event target is found.
 * @param explicit The explicit event to be fired on the stage root when no event target is found.
 */
private void pickEventTarget(Point2D location, EventTask eventTask, Event explicit) {
  // RFE for public scene graph traversal API filed but closed:
  // https://bugs.openjdk.java.net/browse/JDK-8133331

  ObservableList<Stage> stages =
      FXCollections.unmodifiableObservableList(StageHelper.getStages());
  // fire the dock over event for the active stages
  for (Stage targetStage : stages) {
    // obviously this title bar does not need to receive its own events
    // though users of this library may want to know when their
    // dock node is being dragged by subclassing it or attaching
    // an event listener in which case a new event can be defined or
    // this continue behavior can be removed
    if (targetStage == this.dockNode.getStage())
      continue;

    eventTask.reset();

    Node dragNode = dragNodes.get(targetStage);

    Parent root = targetStage.getScene().getRoot();
    Stack<Parent> stack = new Stack<Parent>();
    if (root.contains(root.screenToLocal(location.getX(), location.getY()))
        && !root.isMouseTransparent()) {
      stack.push(root);
    }
    // depth first traversal to find the deepest node or parent with no children
    // that intersects the point of interest
    while (!stack.isEmpty()) {
      Parent parent = stack.pop();
      // if this parent contains the mouse click in screen coordinates in its local bounds
      // then traverse its children
      boolean notFired = true;
      for (Node node : parent.getChildrenUnmodifiable()) {
        if (node.contains(node.screenToLocal(location.getX(), location.getY()))
            && !node.isMouseTransparent()) {
          if (node instanceof Parent) {
            stack.push((Parent) node);
          } else {
            eventTask.run(node, dragNode);
          }
          notFired = false;
          break;
        }
      }
      // if none of the children fired the event or there were no children
      // fire it with the parent as the target to receive the event
      if (notFired) {
        eventTask.run(parent, dragNode);
      }
    }

    if (explicit != null && dragNode != null && eventTask.getExecutions() < 1) {
      Event.fireEvent(dragNode, explicit.copyFor(this, dragNode));
      dragNodes.put(targetStage, null);
    }
  }
}
 
开发者ID:RobertBColton,项目名称:DockFX,代码行数:69,代码来源:DockTitleBar.java


示例18: handleExportTable

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
public static void handleExportTable(TopsoilDataTable table) {
    PrintWriter writer = null;
    try {
        String[] titles = table.getColumnNames();
        List<Double[]> data = table.getFormattedDataAsArrays();
        File file = TopsoilFileChooser.getExportTableFileChooser().showSaveDialog(StageHelper.getStages().get(0));

        if (file != null) {
            String location = file.toString();
            String type = location.substring(location.length() - 3);
            String delim;
            switch (type) {
                case "csv":
                    delim = ", ";
                    break;
                case "tsv":
                    delim = "\t";
                    break;
                case "txt":
                    delim = requestDelimiter();
                    break;
                default:
                    delim = "\t";
                    break;
            }
            writer = new PrintWriter(location, "UTF-8");
            for (int i = 0; i < titles.length; i++) {
                writer.print(titles[i]);
                if (i < titles.length - 1) {
                    writer.print(delim);
                }
            }
            writer.print('\n');
            for (int i = 0; i < data.size(); i++) {
                for (int j = 0; j < data.get(i).length; j++) {
                    writer.print(data.get(i)[j]);
                    if (j < data.get(i).length - 1) {
                        writer.print(delim);
                    }
                }
                writer.print('\n');
            }
            writer.close();
        }

    } catch (FileNotFoundException | UnsupportedEncodingException ex) {
        Logger.getLogger(MenuItemEventHandler.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        if (writer != null) {
            writer.close();
        }
    }

}
 
开发者ID:CIRDLES,项目名称:Topsoil,代码行数:55,代码来源:MenuItemEventHandler.java


示例19: startApp

import com.sun.javafx.stage.StageHelper; //导入依赖的package包/类
/**
 * Starts the given main class with the given arguments using the given classloader.
 */
protected static final void startApp(ClassLoader loader, final String clazz, final String... args)
{
    Thread l_thread = new Thread("GUIcheck-FX-Runner")
    {
        @Override
        public void run()
        {
            try
            {
                // Load the class and invoke the main method
                Class<?> l_clazz = Thread.currentThread().getContextClassLoader().loadClass(clazz);
                Method l_method = l_clazz.getMethod("main", String[].class);

                l_method.invoke(null, new Object[] {args});
            }
            catch (Exception e)
            {
                throw new GcException("Failed to invoke main method", e);
            }
        }
    };

    l_thread.setContextClassLoader(loader);
    l_thread.start();

    // Wait for platform to start and the first stage to become visible
    long l_start = System.currentTimeMillis();
    boolean l_initialized = false;
    while (System.currentTimeMillis() - l_start < FIRST_STAGE_VISIBLE_TIMEOUT)
    {
        if (GcUtilsFX.isPlatformAlive())
        {
            ObservableList<Stage> l_stages = StageHelper.getStages();
            if (l_stages.size() > 0 && l_stages.get(0).isShowing())
            {
                l_initialized = true;
                GcUtilsFX.waitForIdle();
                break;
            }

            GcUtilsFX.waitForIdle();
        }
    }

    if (!l_initialized)
    {
        throw new GcException("The JavaFX platform did not initialize");
    }
}
 
开发者ID:SICKAG,项目名称:gui-check,代码行数:53,代码来源:GcTestFX.java



注:本文中的com.sun.javafx.stage.StageHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BulkConnection类代码示例发布时间:2022-05-23
下一篇:
Java XMLErrorHandler类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap