本文整理匯總了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;
}