本文整理汇总了Java中javafx.scene.control.ScrollPane.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollPane.getContent方法的具体用法?Java ScrollPane.getContent怎么用?Java ScrollPane.getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ScrollPane
的用法示例。
在下文中一共展示了ScrollPane.getContent方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ensureVisible
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
protected void ensureVisible(Node target) {
ScrollPane scrollPane = getParentScrollPane(target);
if (scrollPane == null) {
return;
}
Node content = scrollPane.getContent();
Bounds contentBounds = content.localToScene(content.getBoundsInLocal());
Bounds viewportBounds = scrollPane.getViewportBounds();
Bounds nodeBounds = target.localToScene(target.getBoundsInLocal());
if (scrollPane.contains(nodeBounds.getMinX() - contentBounds.getMinX(), nodeBounds.getMinY() - contentBounds.getMinY())) {
return;
}
double toVScroll = (nodeBounds.getMinY() - contentBounds.getMinY())
* ((scrollPane.getVmax() - scrollPane.getVmin()) / (contentBounds.getHeight() - viewportBounds.getHeight()));
scrollPane.setVvalue(toVScroll);
double toHScroll = (nodeBounds.getMinX() - contentBounds.getMinX())
* ((scrollPane.getHmax() - scrollPane.getHmin()) / (contentBounds.getWidth() - viewportBounds.getWidth()));
scrollPane.setHvalue(toHScroll);
}
示例2: scrollTo
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
private void scrollTo(Node target) {
ScrollPane scrollPane = getParentScrollPane(target);
if (scrollPane == null)
return;
Node content = scrollPane.getContent();
Bounds contentBounds = content.localToScene(content.getBoundsInLocal());
Bounds viewportBounds = scrollPane.getViewportBounds();
Bounds nodeBounds = target.localToScene(target.getBoundsInLocal());
double toVScroll = (nodeBounds.getMinY() - contentBounds.getMinY())
* ((scrollPane.getVmax() - scrollPane.getVmin())
/ (contentBounds.getHeight() - viewportBounds.getHeight()));
if (toVScroll >= scrollPane.getVmin() && toVScroll < scrollPane.getVmax())
scrollPane.setVvalue(toVScroll);
double toHScroll = (nodeBounds.getMinX() - contentBounds.getMinX())
* ((scrollPane.getHmax() - scrollPane.getHmin())
/ (contentBounds.getWidth() - viewportBounds.getWidth()));
if (toHScroll >= scrollPane.getHmin() && toHScroll < scrollPane.getHmax())
scrollPane.setHvalue(toHScroll);
}
示例3: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( DualPropertiesTreeItem.TITLE ) );
assertThat( title.getDescription(), is( DualPropertiesTreeItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( DualPropertiesPanel.class ) ) );
DualPropertiesPanel panel = ( DualPropertiesPanel ) scroller.getContent();
assertThat( panel.hasConfiguration( configuration ), is( true ) );
}
示例4: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( FontsTreeItem.TITLE ) );
assertThat( title.getDescription(), is( FontsTreeItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( FontsPanel.class ) ) );
FontsPanel panel = ( FontsPanel ) scroller.getContent();
assertThat( panel.hasConfiguration( configuration ), is( true ) );
}
示例5: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( DimensionsTreeItem.TITLE ) );
assertThat( title.getDescription(), is( DimensionsTreeItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( DimensionsPanel.class ) ) );
DimensionsPanel panel = ( DimensionsPanel ) scroller.getContent();
assertThat( panel.hasConfiguration( configuration ), is( true ) );
}
示例6: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( ColoursTreeItem.TITLE ) );
assertThat( title.getDescription(), is( ColoursTreeItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( ColoursPanel.class ) ) );
ColoursPanel panel = ( ColoursPanel ) scroller.getContent();
assertThat( panel.hasConfiguration( configuration ), is( true ) );
}
示例7: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( SoundsTreeItem.TITLE ) );
assertThat( title.getDescription(), is( SoundsTreeItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( SoundConfigurationPanel.class ) ) );
SoundConfigurationPanel panel = ( SoundConfigurationPanel ) scroller.getContent();
assertThat( panel.isAssociatedWith( configuration ), is( true ) );
}
示例8: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( JobPolicyTreeItem.TITLE ) );
assertThat( title.getDescription(), is( JobPolicyTreeItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( JobPolicyPanel.class ) ) );
JobPolicyPanel panel = ( JobPolicyPanel ) scroller.getContent();
assertThat( panel.hasConfiguration( configuration ), is( true ) );
}
示例9: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( StatisticsStyleItem.TITLE ) );
assertThat( title.getDescription(), is( StatisticsStyleItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( StatisticsStylePanel.class ) ) );
StatisticsStylePanel panel = ( StatisticsStylePanel ) scroller.getContent();
assertThat( panel.isAssociatedWith( configuration ), is( true ) );
}
示例10: shouldHandleClickByInstructingController
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Test public void shouldHandleClickByInstructingController() {
systemUnderTest.handleBeingSelected();
verify( controller ).displayContent( contentTitleCaptor.capture(), contentCaptor.capture() );
assertThat( contentTitleCaptor.getValue(), is( instanceOf( SimpleConfigurationTitle.class ) ) );
SimpleConfigurationTitle title = ( SimpleConfigurationTitle ) contentTitleCaptor.getValue();
assertThat( title.getTitle(), is( StatisticsExclusionsItem.TITLE ) );
assertThat( title.getDescription(), is( StatisticsExclusionsItem.DESCRIPTION ) );
assertThat( contentCaptor.getValue(), is( instanceOf( ScrollPane.class ) ) );
ScrollPane scroller = ( ScrollPane ) contentCaptor.getValue();
assertThat( scroller.getContent(), is( instanceOf( StatisticsExclusionsPanel.class ) ) );
StatisticsExclusionsPanel panel = ( StatisticsExclusionsPanel ) scroller.getContent();
assertThat( panel.isAssociatedWith( configuration ), is( true ) );
}
示例11: getSuggestedWidth
import javafx.scene.control.ScrollPane; //导入方法依赖的package包/类
@Override
public double getSuggestedWidth()
{
if(this.getChildren().size() < 2)
{
return 0;
}
Node currentNode = this.getChildren().get(0);
if(!(currentNode instanceof ScrollPane))
{
return 0;
}
ScrollPane scrollPane = (ScrollPane)currentNode;
Node content = scrollPane.getContent();
if(content == null)
{
return 0;
}
return ((Region)content).getWidth() + 50;
}