當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrollPane.getContent方法代碼示例

本文整理匯總了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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:FXEventQueueDevice.java

示例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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:ScrollPaneSample2.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:17,代碼來源:DualPropertiesTreeItemTest.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:17,代碼來源:FontsTreeItemTest.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:18,代碼來源:DimensionsTreeItemTest.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:17,代碼來源:ColoursTreeItemTest.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:17,代碼來源:SoundsTreeItemTest.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:17,代碼來源:JobPolicyTreeItemTest.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:17,代碼來源:StatisticsStyleItemTest.java

示例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 ) );
}
 
開發者ID:DanGrew,項目名稱:JttDesktop,代碼行數:17,代碼來源:StatisticsExclusionsItemTest.java

示例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;
}
 
開發者ID:deadlocker8,項目名稱:BudgetMaster,代碼行數:25,代碼來源:MonthBarChart.java


注:本文中的javafx.scene.control.ScrollPane.getContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。