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


Java Labeled类代码示例

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


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

示例1: estimateLineNumberColumnWidth

import javafx.scene.control.Labeled; //导入依赖的package包/类
/** estimates the last visible line number and computes preferred width based on that */ 
protected double estimateLineNumberColumnWidth(Labeled c)
{			
	double h = Math.max(1.0, c.prefHeight(-1));
	int lineCount = (int)(getHeight() / h);
	int ix = Math.max(999, topLine + lineCount);
	
	setLineNumber(c, ix);
	
	c.setManaged(true);
	getChildren().add(c);
	c.applyCss();
	
	double w = c.prefWidth(-1);
	
	getChildren().remove(c);
	
	return w;
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:20,代码来源:VFlow.java

示例2: columnHeaderMapper

import javafx.scene.control.Labeled; //导入依赖的package包/类
/**
 * 헤더로  표현하기 위한 커스터마이즈한 값을 리턴해주는 코드작성.
 * 정의하지않는경우 TableColumn Header텍스트로 표현.
 * 
 * 1. 우선 헤더텍스트값을 먼저 살펴봄
 * 2. JAVAFX의 경우 헤더텍스트가 커스텀으로 구현되어 Graphics가 적용된 경우도 있으므로 
 *   텍스트가 빈값으로 인지된경우 Graphics객체를 리턴받은후 라벨을 리턴받아 적용
 *   
 * @작성자 : KYJ
 * @작성일 : 2016. 9. 6.
 * @param table
 * @param tableColumn
 * @return
 */
public default <T> String columnHeaderMapper(TableView<?> table, TableColumn<?, ?> tableColumn) {

	String headerText = tableColumn.getText();

	/* 2016-09-19 만약 headerText값이 null이라면 graphics에서 리턴받아 처리 시도. */
	if (ValueUtil.isEmpty(headerText)) {
		Node graphic = tableColumn.getGraphic();
		if (graphic != null && graphic instanceof Labeled) {
			Labeled lbl = (Labeled) graphic;
			headerText = lbl.getText();
		}
	}

	return headerText;
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:30,代码来源:IExcelScreenHandler.java

示例3: getConstructorPage

import javafx.scene.control.Labeled; //导入依赖的package包/类
@Override
protected List<Labeled> getConstructorPage() {
    List<Labeled> list = new ArrayList<Labeled>();

    ToggleButton default_button = new ToggleButton(DEFAULT_BUTTON);
    defaultLayout.apply(default_button);
    if (!default_button.getText().equals(DEFAULT_BUTTON)) {
        reportGetterFailure("new ToggleButton(DEFAULT_LABEL)");
    } else {
        list.add(default_button);
    }

    Rectangle rectangle = new Rectangle(10, 10, Color.rgb(200, 100, 100));
    ToggleButton graphic_button = new ToggleButton(GRAPHICS_BUTTON, rectangle);
    defaultLayout.apply(graphic_button);
    if (!graphic_button.getText().equals(GRAPHICS_BUTTON) || graphic_button.getGraphic() != rectangle) {
        reportGetterFailure("new ToggleButton(GRAPHICS_LABEL, rectangle)");
    } else {
        list.add(graphic_button);
    }

    return list;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:24,代码来源:ToggleButtonsApp.java

示例4: setup

import javafx.scene.control.Labeled; //导入依赖的package包/类
@Override
protected TestNode setup() {
    TestNode root = new TestNode();
    defFill(root);
    ArrayList<Change<Labeled>> list = new ArrayList<Change<Labeled>>();
    list.add(new Change<Labeled>(Pages.setSelected.name()) {
        public void apply(Labeled labeled) {
            ToggleButton button = (ToggleButton) labeled;
            button.setSelected(true);
            if (button.isSelected() != true) {
                reportGetterFailure(getMarker());
            }
        }
    });
    root.add(new Page(list), Pages.setSelected.name());
    return root;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:18,代码来源:ToggleButtonsApp.java

示例5: getConstructorPage

import javafx.scene.control.Labeled; //导入依赖的package包/类
@Override
protected List<Labeled> getConstructorPage() {
    List<Labeled> list = new ArrayList<Labeled>();

    MenuButton default_button = new MenuButton(DEFAULT_BUTTON);
    defaultLayout.apply(default_button);
    if (!default_button.getText().equals(DEFAULT_BUTTON)) {
        reportGetterFailure("new MenuButton(DEFAULT_LABEL)");
    } else {
        list.add(default_button);
    }

    Rectangle rectangle = new Rectangle(10, 10, Color.rgb(200, 100, 100));
    MenuButton graphic_button = new MenuButton(GRAPHICS_BUTTON, rectangle);
    defaultLayout.apply(graphic_button);
    if (!graphic_button.getText().equals(GRAPHICS_BUTTON) || graphic_button.getGraphic() != rectangle) {
        reportGetterFailure("new MenuButton(GRAPHICS_LABEL, rectangle)");
    } else {
        list.add(graphic_button);
    }
    return list;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:MenuButtonsApp.java

示例6: getConstructorPage

import javafx.scene.control.Labeled; //导入依赖的package包/类
@Override
protected List<Labeled> getConstructorPage() {
    List<Labeled> list = new ArrayList<Labeled>();

    Label default_label = new Label(DEFAULT_LABEL);
    defaultLayout.apply(default_label);
    if (!default_label.getText().equals(DEFAULT_LABEL)) {
        reportGetterFailure("new Label(DEFAULT_LABEL)");
    } else {
        list.add(default_label);
    }

    Rectangle rectangle = new Rectangle(10, 10, Color.rgb(200, 100, 100));
    Label graphic_label = new Label(GRAPHICS_LABEL, rectangle);
    defaultLayout.apply(graphic_label);
    if (!graphic_label.getText().equals(GRAPHICS_LABEL) || graphic_label.getGraphic() != rectangle) {
        reportGetterFailure("new Label(GRAPHICS_LABEL, rectangle)");
    } else {
        list.add(graphic_label);
    }
    return list;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:LabelsApp.java

示例7: setup

import javafx.scene.control.Labeled; //导入依赖的package包/类
@Override
protected TestNode setup() {
    TestNode root = new TestNode();
    defFill(root);
    List<Change<Labeled>> list = new LinkedList<Change<Labeled>>();

    list.add(new Change<Labeled>(Pages.setTextFill.name()) {
        public void apply(Labeled labeled) {
            labeled.setText("filled");
            Paint paint = Color.rgb(128, 200, 200);
            labeled.setTextFill(paint);
            if (labeled.getTextFill() != paint) {
                reportGetterFailure(getMarker());
            }
        }
    });
    root.add(new LabeledsAbstactApp.Page(list), Pages.setTextFill.name());


    return root;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:LabelsApp.java

示例8: getConstructorPage

import javafx.scene.control.Labeled; //导入依赖的package包/类
@Override
protected List<Labeled> getConstructorPage() {
    List<Labeled> list = new ArrayList<Labeled>();

    Button default_button = new Button(DEFAULT_BUTTON);
    defaultLayout.apply(default_button);
    if (!default_button.getText().equals(DEFAULT_BUTTON)) {
        reportGetterFailure("new Button(DEFAULT_LABEL)");
    } else {
        list.add(default_button);
    }

    Rectangle rectangle = new Rectangle(10, 10, Color.rgb(200, 100, 100));
    Button graphic_button = new Button(GRAPHICS_BUTTON, rectangle);
    defaultLayout.apply(graphic_button);
    if (!graphic_button.getText().equals(GRAPHICS_BUTTON) || graphic_button.getGraphic() != rectangle) {
        reportGetterFailure("new Button(GRAPHICS_LABEL, rectangle)");
    } else {
        list.add(graphic_button);
    }
    return list;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:23,代码来源:ButtonsApp.java

示例9: getConstructorPage

import javafx.scene.control.Labeled; //导入依赖的package包/类
@Override
protected List<Labeled> getConstructorPage() {
    List<Labeled> list = new ArrayList<Labeled>();

    SplitMenuButton defaultButton = new SplitMenuButton();
    defaultLayout.apply(defaultButton);
    if (!defaultButton.getText().equals("")) {
        reportGetterFailure("new SplitMenuButton()");
    } else {
        list.add(defaultButton);
    }

    SplitMenuButton itemsButton = new SplitMenuButton(new MenuItem("Item 1"), new MenuItem("Item 2"), new MenuItem("Item 3"));
    defaultLayout.apply(itemsButton);
    if (!itemsButton.getItems().get(0).getText().equals("Item 1")
            || !itemsButton.getItems().get(1).getText().equals("Item 2")
            || !itemsButton.getItems().get(2).getText().equals("Item 3")
            || !itemsButton.getText().equals("")
            || itemsButton.getGraphic() != null) {
        reportGetterFailure("new SplitMenuButton(MenuItem...)");
    } else {
        list.add(itemsButton);
    }

    return list;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:27,代码来源:SplitMenuButtonsApp.java

示例10: addAlignment

import javafx.scene.control.Labeled; //导入依赖的package包/类
protected void addAlignment(List<Change<Labeled>> list, final boolean wrapped, final String text, String mark) {
    for (final TextAlignment alignment : TextAlignment.values()) {
        list.add(new Change<Labeled>(alignment.toString() + (wrapped ? "_wrapped" : "") + mark) {
            public void apply(Labeled labeled) {
                labeled.setText("TextAlignment = " + alignment.toString() + text);
                labeled.setWrapText(wrapped);
                Utils.LayoutSize layout = new Utils.LayoutSize(250, 40, 250, 40, 250, 40);
                layout.apply(labeled);
                labeled.setTextAlignment(alignment);
                if (labeled.getTextAlignment() != alignment) {
                    reportGetterFailure(getMarker());
                }
            }
        });
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:LabeledsAbstactApp.java

示例11: init

import javafx.scene.control.Labeled; //导入依赖的package包/类
private void init(List<Change<Labeled>> changes) {
    for (Change<Labeled> change : changes) {
        VBox box = new VBox();
        if (change.getName() != null) {
            box.getChildren().add(new Label("[" + change.getName() + "]"));
        }
        Labeled control = getTestingControl();
        change.apply(control);
        if (enableBorder) {
            control.setStyle("-fx-border-color: darkgray");
        }
        box.getChildren().add(control);
        addNode(box);
    }
    changes.clear();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:LabeledsAbstactApp.java

示例12: testEllipsisSize

import javafx.scene.control.Labeled; //导入依赖的package包/类
private void testEllipsisSize() {
    org.jemmy.interfaces.Parent p = getScene().as(org.jemmy.interfaces.Parent.class, Node.class);

    final Wrap<? extends Labeled> node = p.lookup(new ByID<Labeled>(LabeledsPages.setEllipsisString.name() + LabeledsAbstactApp.CONTROL)).wrap();
    final Wrap<? extends Labeled> goldennode = p.lookup(new ByID<Labeled>(LabeledsPages.setEllipsisString.name() + LabeledsAbstactApp.GOLDEN)).wrap();

    new Waiter(Wrap.WAIT_STATE_TIMEOUT).waitState(new State() {
        @Override
        public Object reached() {
            return (node.getControl().getChildrenUnmodifiable().size() > 0) ? true : null;
        }
    });

    LabeledText targetText = searchLabeledText(node.getControl());
    Bounds targetTextBounds = targetText.getBoundsInParent();
    Bounds controlBounds = node.getControl().getBoundsInLocal();
    Bounds goldenControlBounds = goldennode.getControl().getBoundsInLocal();
    Assert.assertTrue(controlBounds.contains(targetTextBounds));
    Assert.assertEquals(goldenControlBounds.getWidth(), controlBounds.getWidth());
    Assert.assertEquals(goldenControlBounds.getHeight(), controlBounds.getHeight());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:LabeledsBase.java

示例13: onAction

import javafx.scene.control.Labeled; //导入依赖的package包/类
/**
 * Finds right arrow button inside pagination and click it to produce an
 * action event.
 */
@Override
@Test(timeout = 60000)
public void onAction()
{
    test(ControlEventsApp.EventTypes.ACTION, new Command() {

        public void invoke() {
            LabeledDock rightButtonDock = new LabeledDock(
                    getPrimeNodeDock().asParent(), new LookupCriteria<Labeled>() {

                public boolean check(Labeled cntrl) {
                    if(cntrl.getStyleClass().containsAll(Arrays.asList(
                        "button", "right-arrow-button")))
                        return true;
                    return false;
                }
            });
            rightButtonDock.mouse().click();
        }
    });
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:PaginationEventsTest.java

示例14: dock

import javafx.scene.control.Labeled; //导入依赖的package包/类
/**
 * <code>*Dock</code> classes are the true API classes. Docks should be used
 * whenever possible. All straightforward operations should be available
 * through docks. If it is not so, please file a feature request.<br/>
 * Dock classes source is generated. They have many different methods which
 * are all convenience methods. Such methods as lookup constructors,
 * <code>as*()</code> methods to perform operations and <code>get*()</code>
 * method to get properties. Please consult other samples to see how to use
 * docks.
 */
@Test
public void dock() {
    //Docks have ...
    //lookup constructors
    LabeledDock button = new LabeledDock(new SceneDock().asParent(), Button.class);
    //as* methods
    Parent<Node> parent = button.asParent();
    //get* methods
    //please make sure to use these rather than direct calls to Java FX node
    //method, becuase this calls the appropriate method on the event queue
    double opacity = button.getOpacity();
    //you can get a wrap out of it
    //see next test method on how to deal with wraps
    Wrap<? extends Labeled> wrap = button.wrap();
    //or a control itself
    Labeled theButtonItself = button.control();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:28,代码来源:DockWrapObjectSample.java

示例15: setFont

import javafx.scene.control.Labeled; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void setFont(IFont pFont)
{
	font = pFont;
	
	if (resource instanceof Labeled)
	{
		// If the resource is an instance of Labeled, we'll set the font
		// by using the setFont(Font) method. Otherwise the font might
		// be inherited by children, which f.e. looks odd in the case
		// of a TitledPane.
		if (font != null)
		{
			((Labeled)resource).setFont((Font)font.getResource());
		}
		else
		{
			((Labeled)resource).setFont(null);
		}
	}
	else
	{
		styleContainer.setFont(font);
	}
}
 
开发者ID:ivartanian,项目名称:JVx.javafx,代码行数:29,代码来源:JavaFXAbstractComponentBase.java


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