Class ChartButton
java.lang.Object
java.awt.event.MouseAdapter
org.knowm.xchart.internal.chartpart.ChartButton
- All Implemented Interfaces:
MouseListener, MouseMotionListener, MouseWheelListener, EventListener, ChartPart
A button that can be used on the chart for whatever function. For example the ChartZoom class
uses this to reset the zoom function. When it is clicked it fires its actionPerformed action and
whoever is listening to it can react to it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ActionEventprivate Rectangleprivate Shapeprivate final Chartprivate final EventListenerListprivate final Stylerprotected String(package private) booleanprotected doubleprotected doubleFields inherited from interface ChartPart
SOLID_STROKE -
Constructor Summary
ConstructorsConstructorDescriptionChartButton(XYChart xyChart, XChartPanel<XYChart> xChartPanel, String text) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate voidcalculatePosition(Rectangle2D textBounds) private voidNotify listeners that this button was clicked or interacted with in some wayvoidvoidpaint(Graphics2D g) void(package private) void(package private) voidsetVisible(boolean visible) Methods inherited from class MouseAdapter
mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
-
Field Details
-
chart
-
styler
-
bounds
-
text
-
visible
boolean visible -
action
-
listenerList
-
xOffset
protected double xOffset -
yOffset
protected double yOffset -
buttonRect
-
-
Constructor Details
-
ChartButton
Constructor- Parameters:
xyChart-xChartPanel-text-
-
-
Method Details
-
addActionListener
-
removeActionListener
-
getBounds
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener- Overrides:
mouseClickedin classMouseAdapter
-
fireActionPerformed
private void fireActionPerformed()Notify listeners that this button was clicked or interacted with in some way -
paint
-
calculatePosition
-
setText
-
setVisible
void setVisible(boolean visible)
-