本文整理汇总了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));
}