当前位置: 首页>>代码示例>>Java>>正文


Java Rectangle2D.getWidth方法代码示例

本文整理汇总了Java中javafx.geometry.Rectangle2D.getWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle2D.getWidth方法的具体用法?Java Rectangle2D.getWidth怎么用?Java Rectangle2D.getWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.geometry.Rectangle2D的用法示例。


在下文中一共展示了Rectangle2D.getWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: InferenceRuleView

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
/**
 * Adds the content for showing the inference rules to the TabPane in the proof
 * @param tabPane
 *
 */
public InferenceRuleView(TabPane tabPane) {


    //load the image
    Image image = new Image("inferenceRules.png");
    ImageView iv1 = new ImageView();
    iv1.setImage(image);
    iv1.setSmooth(true);
    iv1.setPreserveRatio(true);

    //putting the image on a scrollpane
    ScrollPane sp=new ScrollPane();
    sp.getStyleClass().add("rulesView");
    tab = new ViewTab("Inference Rules",this);
    sp.setContent(iv1);
    tabPane.getTabs().add(tab);
    tab.setContent(sp);
    tabPane.getSelectionModel().select(tab);

    //used for getting screensize
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //Avoids scaling too much
    double w=primaryScreenBounds.getWidth()/2;
    iv1.setFitWidth(w);
}
 
开发者ID:nonilole,项目名称:Conan,代码行数:31,代码来源:InferenceRuleView.java

示例2: ShortcutsView

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
/**
 * Adds the content for showing the shortcuts to the TabPane in the proof
 * @param tabPane
 *
 */
public ShortcutsView(TabPane tabPane) {

	Label label = new Label(loadInstructions());
	label.getStyleClass().add("infoText");

    //putting the image on a scrollpane
    ScrollPane sp = new ScrollPane();
    sp.getStyleClass().add("shortcutsView");
    tab = new ViewTab("Shortcuts",this);
    sp.setContent(label);
    tabPane.getTabs().add(tab);
    tab.setContent(sp);
    tabPane.getSelectionModel().select(tab);

    //used for getting screensize
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //Avoids scaling too much
    double w=primaryScreenBounds.getWidth();
    label.setPrefWidth(w); 
}
 
开发者ID:nonilole,项目名称:Conan,代码行数:26,代码来源:ShortcutsView.java

示例3: ParseInfoView

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
/**
 * Adds the content for showing the parser info to the TabPane
 * @param tabPane
 *
 */
public ParseInfoView(TabPane tabPane) {

	Label label = new Label(loadInstructions());
	label.getStyleClass().add("infoText");

    //putting the image on a scrollpane
    ScrollPane sp = new ScrollPane();
    sp.getStyleClass().add("rulesView");
    tab = new ViewTab("Input format",this);
    sp.setContent(label);
    tabPane.getTabs().add(tab);
    tab.setContent(sp);
    tabPane.getSelectionModel().select(tab);

    //used for getting screensize
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    //Avoids scaling too much
    double w=primaryScreenBounds.getWidth();
    label.setPrefWidth(w); 
}
 
开发者ID:nonilole,项目名称:Conan,代码行数:26,代码来源:ParseInfoView.java

示例4: start

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
    Flow flow = new Flow(MainController.class);
    DefaultFlowContainer container = new DefaultFlowContainer();
    flowContext = new ViewFlowContext();
    flowContext.register("Stage", stage);
    flow.createHandler(flowContext).start(container);

    JFXDecorator decorator = new JFXDecorator(stage, container.getView());
    decorator.setCustomMaximize(true);

    double width = 700;
    double height = 200;
    try {
        Rectangle2D bounds = Screen.getScreens().get(0).getBounds();
        width = bounds.getWidth() / 2.5;
        height = bounds.getHeight() / 1.35;
    } catch (Exception e) {
    }

    Scene scene = new Scene(decorator, width, height);
    final ObservableList<String> stylesheets = scene.getStylesheets();
    stylesheets.addAll(Main.class.getResource("/css/jfoenix-fonts.css").toExternalForm(),
            Main.class.getResource("/css/jfoenix-design.css").toExternalForm(),
            Main.class.getResource("/css/jhosts-main.css").toExternalForm());
    stage.setScene(scene);
    stage.show();
}
 
开发者ID:b3log,项目名称:JHosts,代码行数:29,代码来源:Main.java

示例5: snapRect

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
private static Rectangle2D snapRect(Rectangle2D bounds, Rectangle2D screenBounds) {
	double x1 = bounds.getMinX(), y1 = bounds.getMinY();
	double x2 = bounds.getMaxX(), y2 = bounds.getMaxY();
	if (Math.abs(x1 - screenBounds.getMinX()) < SNAP_DISTANCE) {
		x1 = screenBounds.getMinX();
	}
	if (Math.abs(y1 - screenBounds.getMinY()) < SNAP_DISTANCE) {
		y1 = screenBounds.getMinY();
	}
	if (Math.abs(x2 - screenBounds.getMaxX()) < SNAP_DISTANCE) {
		x1 = screenBounds.getMaxX() - bounds.getWidth();
	}
	if (Math.abs(y2 - screenBounds.getMaxY()) < SNAP_DISTANCE) {
		y1 = screenBounds.getMaxY() - bounds.getHeight();
	}
	return new Rectangle2D(x1, y1, bounds.getWidth(), bounds.getHeight());
}
 
开发者ID:DeskChan,项目名称:DeskChan,代码行数:18,代码来源:MovablePane.java

示例6: loadPositionFromStorage

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
protected void loadPositionFromStorage() {
	try {
		final String key = getCurrentPositionStorageKey();
		if (key != null) {
			final String value = Main.getProperties().getString(key);
			if (value != null) {
				String[] coords = value.split(";");
				if (coords.length == 2) {
					double x = Double.parseDouble(coords[0]);
					double y = Double.parseDouble(coords[1]);
					Rectangle2D desktop = OverlayStage.getDesktopSize();
					if(desktop.getWidth() == 0 || desktop.getHeight() == 0) return;
					if (x + getHeight() > desktop.getMaxX() || x < -getHeight())
						x = desktop.getMaxX() - getHeight();
					if (y + getWidth() > desktop.getMaxY() || y < -getWidth()) y = desktop.getMaxY() - getWidth();
					setPosition(new Point2D(x, y));
					return;
				}
			}
		}
	} catch (Exception e){ Main.log(e); }
	setDefaultPosition();
}
 
开发者ID:DeskChan,项目名称:DeskChan,代码行数:24,代码来源:MovablePane.java

示例7: getInsertData

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
private InsertData getInsertData(Point2D screenPoint) {
    for(TabPane tabPane : tabPanes) {
        Rectangle2D tabAbsolute = getAbsoluteRect(tabPane);
        if(tabAbsolute.contains(screenPoint)) {
            int tabInsertIndex = 0;
            if(!tabPane.getTabs().isEmpty()) {
                Rectangle2D firstTabRect = getAbsoluteRect(tabPane.getTabs().get(0));
                if(firstTabRect.getMaxY()+60 < screenPoint.getY() || firstTabRect.getMinY() > screenPoint.getY()) {
                    return null;
                }
                Rectangle2D lastTabRect = getAbsoluteRect(tabPane.getTabs().get(tabPane.getTabs().size() - 1));
                if(screenPoint.getX() < (firstTabRect.getMinX() + firstTabRect.getWidth() / 2)) {
                    tabInsertIndex = 0;
                }
                else if(screenPoint.getX() > (lastTabRect.getMaxX() - lastTabRect.getWidth() / 2)) {
                    tabInsertIndex = tabPane.getTabs().size();
                }
                else {
                    for(int i = 0; i < tabPane.getTabs().size() - 1; i++) {
                        Tab leftTab = tabPane.getTabs().get(i);
                        Tab rightTab = tabPane.getTabs().get(i + 1);
                        if(leftTab instanceof DraggableTab && rightTab instanceof DraggableTab) {
                            Rectangle2D leftTabRect = getAbsoluteRect(leftTab);
                            Rectangle2D rightTabRect = getAbsoluteRect(rightTab);
                            if(betweenX(leftTabRect, rightTabRect, screenPoint.getX())) {
                                tabInsertIndex = i + 1;
                                break;
                            }
                        }
                    }
                }
            }
            return new InsertData(tabInsertIndex, tabPane);
        }
    }
    return null;
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:38,代码来源:DraggableTab.java

示例8: findPopOverArrowLocation

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
public static ArrowLocation findPopOverArrowLocation(Node view) {
    Bounds localBounds = view.getBoundsInLocal();
    Bounds entryBounds = view.localToScreen(localBounds);

    ObservableList<Screen> screens = Screen.getScreensForRectangle(
            entryBounds.getMinX(), entryBounds.getMinY(),
            entryBounds.getWidth(), entryBounds.getHeight());
    Rectangle2D screenBounds = screens.get(0).getVisualBounds();

    double spaceLeft = entryBounds.getMinX();
    double spaceRight = screenBounds.getWidth() - entryBounds.getMaxX();
    double spaceTop = entryBounds.getMinY();
    double spaceBottom = screenBounds.getHeight() - entryBounds.getMaxY();

    if (spaceLeft > spaceRight) {
        if (spaceTop > spaceBottom) {
            return ArrowLocation.RIGHT_BOTTOM;
        }
        return ArrowLocation.RIGHT_TOP;
    }

    if (spaceTop > spaceBottom) {
        return ArrowLocation.LEFT_BOTTOM;
    }

    return ArrowLocation.LEFT_TOP;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:28,代码来源:ViewHelper.java

示例9: computeGameSizing

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
public GameSizing computeGameSizing(Rectangle2D bounds) {

        double sceneWidth = bounds.getWidth();
        double sceneHeight = bounds.getHeight();

        if (sceneWidth == 0 || sceneHeight == 0) {
            throw new IllegalStateException("Invalid gaming area size : bounds = " + bounds);
        }

        final double width;
        final double height;
        final double shift;

        log.info("16/9 or 16/10 screen ? = " + ((sceneWidth / sceneHeight) - (16.0 / 9.0)));

        if (fourThree && ((sceneWidth / sceneHeight) - (16.0 / 9.0)) < 0.1) {
            width = 4 * sceneHeight / 3;
            height = sceneHeight;
            shift = (sceneWidth - width) / 2;
        } else {
            width = sceneWidth;
            height = sceneHeight;
            shift = 0;
        }

        GameSizing gameSizing = new GameSizing(width / nbColumns, height / nbLines, shift);
        log.info("gameSizing = {}", gameSizing);
        return gameSizing;
    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:30,代码来源:GameSizingComputer.java

示例10: makeLighting

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
private static void makeLighting(Group root, Rectangle2D RScreen) {

        int width = (int) RScreen.getWidth();
        int height = (int) RScreen.getHeight();

        T = new Lighting[width / pixelWidth][height / pixelWidth];
        for (int i = 0; i < T.length; i++)
            for (int j = 0; j < T[i].length; j++) {

                T[i][j] = new Lighting(i * pixelWidth, j * pixelWidth, pixelWidth, lightingLength, lightingColor);
                root.getChildren().add(T[i][j]);
            }
    }
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:14,代码来源:SecondScreen.java

示例11: CustomStage

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
public CustomStage(AnchorPane ap, StageStyle style) {
    initStyle(style);

    setSize(ap.getPrefWidth(), ap.getPrefHeight());

    Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds();
    double x = screenBounds.getMinX() + screenBounds.getWidth() - ap.getPrefWidth() - 2;
    double y = screenBounds.getMinY() + screenBounds.getHeight() - ap.getPrefHeight() - 2;

    bottomRight = Location.at(x, y);
}
 
开发者ID:victorward,项目名称:recruitervision,代码行数:12,代码来源:CustomStage.java

示例12: computeActualScale

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
/**
 * Computes the actual scaling of an Image in an ImageView. If the preserveRatio
 * property on the ImageView is false the scaling has no meaning so NaN is
 * returned.
 *
 * @return The scale factor of the image in relation to display coordinates
 */
public double computeActualScale() {

    if (!imageView.isPreserveRatio()) {
        actualScale = Double.NaN;
    }
    else if (doScaleRecompute) {
        Image localImage = imageView.getImage();
        Rectangle2D localViewport = imageView.getViewport();

        double w = 0;
        double h = 0;
        if (localViewport != null && localViewport.getWidth() > 0 && localViewport.getHeight() > 0) {
            w = localViewport.getWidth();
            h = localViewport.getHeight();
        } else if (localImage != null) {
            w = localImage.getWidth();
            h = localImage.getHeight();
        }

        double localFitWidth = imageView.getFitWidth();
        double localFitHeight = imageView.getFitHeight();

        if (w > 0 && h > 0 && (localFitWidth > 0 || localFitHeight > 0)) {
            if (localFitWidth <= 0 || (localFitHeight > 0 && localFitWidth * h > localFitHeight * w)) {
                w = w * localFitHeight / h;
            } else {
                w = localFitWidth;
            }

            actualScale = w / localImage.getWidth();
        }

        doScaleRecompute = false;

    }

    return actualScale;
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:46,代码来源:ImageViewExt.java

示例13: betweenX

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
private boolean betweenX(Rectangle2D r1, Rectangle2D r2, double xPoint) {
    double lowerBound = r1.getMinX() + r1.getWidth() / 2;
    double upperBound = r2.getMaxX() - r2.getWidth() / 2;
    return xPoint >= lowerBound && xPoint <= upperBound;
}
 
开发者ID:ForJ-Latech,项目名称:fwm,代码行数:6,代码来源:DraggableTab.java

示例14: getTreeViewWidth

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
/**
 * get width by total screen size
 *
 * @return intended treeview width
 */
private int getTreeViewWidth() {
    Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
    int totalWidth = (int)primaryScreenBounds.getWidth();
    return totalWidth / maxColumns;
}
 
开发者ID:deltadak,项目名称:plep,代码行数:11,代码来源:Controller.java

示例15: getInsertData

import javafx.geometry.Rectangle2D; //导入方法依赖的package包/类
private InsertData getInsertData(final Point2D screenPoint)
{
    for (final TabPane tabPane : TabManagement.getInstance().getTabPanes())
    {
        final Rectangle2D tabAbsolute = this.getAbsoluteRect(tabPane);
        if (tabAbsolute.contains(screenPoint))
        {
            int tabInsertIndex = 0;
            if (!tabPane.getTabs().isEmpty())
            {
                final Rectangle2D firstTabRect = this.getAbsoluteRect(tabPane.getTabs().get(0));
                if (firstTabRect.getMaxY() + 60 < screenPoint.getY() || firstTabRect.getMinY() > screenPoint.getY())
                    return null;
                final Rectangle2D lastTabRect = this
                        .getAbsoluteRect(tabPane.getTabs().get(tabPane.getTabs().size() - 1));
                if (screenPoint.getX() < firstTabRect.getMinX() + firstTabRect.getWidth() / 2)
                    tabInsertIndex = 0;
                else if (screenPoint.getX() > lastTabRect.getMaxX() - lastTabRect.getWidth() / 2)
                    tabInsertIndex = tabPane.getTabs().size();
                else
                    for (int i = 0; i < tabPane.getTabs().size() - 1; i++)
                    {
                        final Tab leftTab = tabPane.getTabs().get(i);
                        final Tab rightTab = tabPane.getTabs().get(i + 1);
                        if (leftTab instanceof DraggableTab && rightTab instanceof DraggableTab)
                        {
                            final Rectangle2D leftTabRect = this.getAbsoluteRect(leftTab);
                            final Rectangle2D rightTabRect = this.getAbsoluteRect(rightTab);
                            if (this.betweenX(leftTabRect, rightTabRect, screenPoint.getX()))
                            {
                                tabInsertIndex = i + 1;
                                break;
                            }
                        }
                    }
            }
            return new InsertData(tabInsertIndex, tabPane);
        }
    }
    return null;
}
 
开发者ID:Leviathan-Studio,项目名称:MineIDE,代码行数:42,代码来源:DraggableTab.java


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