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


Java PanHandlerFX类代码示例

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


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

示例1: ChartCanvas

import org.jfree.chart.fx.interaction.PanHandlerFX; //导入依赖的package包/类
/**
 * Creates a new canvas to display the supplied chart in JavaFX.  If
 * {@code chart} is {@code null}, a blank canvas will be displayed.
 * 
 * @param chart  the chart. 
 */
public ChartCanvas(JFreeChart chart) {
    this.chart = chart;
    if (this.chart != null) {
        this.chart.addChangeListener(this);
    }
    this.tooltip = null;
    this.tooltipEnabled = true;
    this.chartMouseListeners = new ArrayList<>();
    
    widthProperty().addListener(e -> draw());
    heightProperty().addListener(e -> draw());
    // change the default font smoothing for better results
    GraphicsContext gc = getGraphicsContext2D();
    gc.setFontSmoothingType(FontSmoothingType.LCD);
    FXGraphics2D fxg2 = new FXGraphics2D(gc);
    fxg2.setRenderingHint(FXHints.KEY_USE_FX_FONT_METRICS, true);
    fxg2.setZeroStrokeWidth(0.1);
    fxg2.setRenderingHint(
                RenderingHints.KEY_FRACTIONALMETRICS, 
                RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    this.g2 = fxg2;
    this.liveHandler = null;
    this.availableMouseHandlers = new ArrayList<>();
    
    this.availableMouseHandlers.add(new PanHandlerFX("pan", true, false, 
            false, false));
 
    this.auxiliaryMouseHandlers = new ArrayList<>();
    this.auxiliaryMouseHandlers.add(new TooltipHandlerFX("tooltip"));
    this.auxiliaryMouseHandlers.add(new ScrollHandlerFX("scroll"));
    this.domainZoomable = true;
    this.rangeZoomable = true;
    this.auxiliaryMouseHandlers.add(new AnchorHandlerFX("anchor"));
    this.auxiliaryMouseHandlers.add(new DispatchHandlerFX("dispatch"));

    this.overlays = FXCollections.observableArrayList();

    setOnMouseMoved(e -> handleMouseMoved(e));
    setOnMouseClicked(e -> handleMouseClicked(e));
    setOnMousePressed(e -> handleMousePressed(e));
    setOnMouseDragged(e -> handleMouseDragged(e));
    setOnMouseReleased(e -> handleMouseReleased(e));
    setOnScroll(e -> handleScroll(e));
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:51,代码来源:ChartCanvas.java


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