Package org.knowm.xchart
Class SwingWrapper<T extends Chart<?,?>>
- java.lang.Object
-
- org.knowm.xchart.SwingWrapper<T>
-
public class SwingWrapper<T extends Chart<?,?>> extends java.lang.ObjectA convenience class used to display a Chart in a barebones Swing application
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<XChartPanel<T>>chartPanelsprivate java.util.List<T>chartsprivate booleanisCenteredprivate intnumColumnsprivate intnumRowsprivate java.lang.StringwindowTitle
-
Constructor Summary
Constructors Constructor Description SwingWrapper(java.util.List<T> charts)Constructor - The number of rows and columns will be calculated automatically ConstructorSwingWrapper(java.util.List<T> charts, int numRows, int numColumns)ConstructorSwingWrapper(T chart)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JFramedisplayChart()Display the chart in a Swing JFramejavax.swing.JFramedisplayChartMatrix()Display the chart in a Swing JFrameXChartPanel<T>getXChartPanel()Get the default XChartPanel.XChartPanel<T>getXChartPanel(int index)Get the XChartPanel given the provided index.SwingWrapperisCentered(boolean isCentered)Set the Window in the center of screenvoidrepaintChart()Repaint the default XChartPanel.voidrepaintChart(int index)Repaint the XChartPanel given the provided index.SwingWrappersetTitle(java.lang.String windowTitle)Set the Window Title
-
-
-
Field Detail
-
chartPanels
private final java.util.List<XChartPanel<T extends Chart<?,?>>> chartPanels
-
windowTitle
private java.lang.String windowTitle
-
isCentered
private boolean isCentered
-
numRows
private int numRows
-
numColumns
private int numColumns
-
-
Constructor Detail
-
SwingWrapper
public SwingWrapper(T chart)
Constructor- Parameters:
chart-
-
SwingWrapper
public SwingWrapper(java.util.List<T> charts)
Constructor - The number of rows and columns will be calculated automatically Constructor- Parameters:
charts-
-
SwingWrapper
public SwingWrapper(java.util.List<T> charts, int numRows, int numColumns)
Constructor- Parameters:
charts-numRows- - the number of rowsnumColumns- - the number of columns
-
-
Method Detail
-
displayChart
public javax.swing.JFrame displayChart()
Display the chart in a Swing JFrame
-
displayChartMatrix
public javax.swing.JFrame displayChartMatrix()
Display the chart in a Swing JFrame
-
getXChartPanel
public XChartPanel<T> getXChartPanel()
Get the default XChartPanel. This is the only one for single panel chart displays and the first panel in matrix chart displays- Returns:
- the XChartPanel
-
repaintChart
public void repaintChart()
Repaint the default XChartPanel. This is the only one for single panel chart displays and the first panel in matrix chart displays
-
getXChartPanel
public XChartPanel<T> getXChartPanel(int index)
Get the XChartPanel given the provided index.- Parameters:
index-- Returns:
- the XChartPanel
-
repaintChart
public void repaintChart(int index)
Repaint the XChartPanel given the provided index.- Parameters:
index-
-
isCentered
public SwingWrapper isCentered(boolean isCentered)
Set the Window in the center of screen- Parameters:
isCentered-- Returns:
-
setTitle
public SwingWrapper setTitle(java.lang.String windowTitle)
Set the Window Title- Parameters:
windowTitle-- Returns:
-
-