本文整理汇总了Java中info.monitorenter.gui.chart.Chart2D.addPropertyChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java Chart2D.addPropertyChangeListener方法的具体用法?Java Chart2D.addPropertyChangeListener怎么用?Java Chart2D.addPropertyChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类info.monitorenter.gui.chart.Chart2D
的用法示例。
在下文中一共展示了Chart2D.addPropertyChangeListener方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ChartPanel
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Creates an instance that decorates the given chart with controls in form of
* popup menus.
* <p>
*
* @param chart
* A configured Chart2D instance that will be displayed and
* controlled by this panel.
*
* @param adaptUI2Chart
* if true the menu will adapt it's basic UI properties (font,
* foreground and background color) to the given chart.
*/
public ChartPanel(final Chart2D chart, final boolean adaptUI2Chart) {
super();
this.m_chart = chart;
this.setBackground(chart.getBackground());
// we paint our own labels
chart.setPaintLabels(false);
// get the layout factory for popup menus:
final LayoutFactory factory = LayoutFactory.getInstance();
factory.createChartPopupMenu(this, adaptUI2Chart);
// layout
this.setLayout(new BorderLayout());
this.add(chart, BorderLayout.CENTER);
// initial Labels
// put to a flow layout panel
this.m_labelPanel = new JPanel();
this.m_labelPanel.setFont(chart.getFont());
this.m_labelPanel.setLayout(new FlowLayoutCorrectMinimumSize(FlowLayout.LEFT));
this.m_labelPanel.setBackground(chart.getBackground());
JLabel label;
for (final ITrace2D trace : chart) {
label = factory.createTraceContextMenuLabel(chart, trace, true);
if (label != null) {
this.m_labelPanel.add(label);
}
// In case trace.getLabel() becomes empty hide the corresponding
// menu label via listeners!
trace.addPropertyChangeListener(ITrace2D.PROPERTY_PHYSICALUNITS, this);
trace.addPropertyChangeListener(ITrace2D.PROPERTY_NAME, this);
}
this.add(this.m_labelPanel, BorderLayout.SOUTH);
chart.addPropertyChangeListener("background", this);
// listen to new traces and deleted ones:
chart.addPropertyChangeListener(Chart2D.PROPERTY_ADD_REMOVE_TRACE, this);
}
示例2: testPropertyChange
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* <p>
* Register <code>PropertyChangeListener</code> instances on a for different
* properties on a <code>Char2D</code>, fire property changes a check for
* <code>PropertyChangeEvent</code> instances being fired or not if they
* should not be fired.
* </p>
*
*/
public void testPropertyChange() {
Chart2D chart = new Chart2D();
/**
* Helper class to detect if <code>{@link PropertyChangeEvent}</code>
* are received as expected.
* <p>
*
* @author <a href="mailto:[email protected]">Achim Westermann</a>
*
* @version $Revision: 1.6 $
*/
class PropertyChangeDetector implements PropertyChangeListener {
/** The caught property change event. */
private PropertyChangeEvent m_event = null;
/**
* Defcon.
* <p>
*/
public PropertyChangeDetector() {
super();
}
/**
* Returns the last <code>{@link PropertyChangeEvent}</code>
* received and clears it internally.
* <p>
*
* @return the last <code>{@link PropertyChangeEvent}</code>
* received
*/
public PropertyChangeEvent consumeEvent() {
PropertyChangeEvent ret = this.m_event;
this.m_event = null;
return ret;
}
/**
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
public void propertyChange(final PropertyChangeEvent evt) {
this.m_event = evt;
}
}
// test font trigger a "font" change
PropertyChangeDetector fontListener = new PropertyChangeDetector();
chart.addPropertyChangeListener("font", fontListener);
chart.setFont(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getAllFonts()[0]);
Assert
.assertNotNull(
"setFont(Font) on Chart2D did not trigger a PropertyChange for property \"font\". ",
fontListener.consumeEvent());
// trigger a different change:
chart.setBackground(Color.GREEN);
Assert
.assertNull(
"setColor(Color) on Chart2D did trigger a PropertyChange for property \"font\".",
fontListener.consumeEvent());
}
示例3: AxisActionSetGrid
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the chart's axis by argument
* <code>axis</code> and identifies itself with the given action String and
* invokes
* {@link info.monitorenter.gui.chart.axis.AAxis#setPaintGrid(boolean)} on the
* axis upon selection.
* <p>
*
* @param chart
* the owner of the axis to trigger actions upon.
*
* @param axis
* needed to identify the axis of the chart: one of {@link Chart2D#X}
* , {@link Chart2D#Y}.
*
* @param description
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*
*/
public AxisActionSetGrid(final Chart2D chart, final String description, final int axis) {
super(chart, description, axis);
if (axis == Chart2D.X) {
chart.getAxisX().addPropertyChangeListener(IAxis.PROPERTY_PAINTGRID, this);
chart.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_X, this);
} else if (axis == Chart2D.Y) {
chart.getAxisY().addPropertyChangeListener(IAxis.PROPERTY_PAINTGRID, this);
chart.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_Y, this);
}
}
示例4: Chart2DActionSaveImageSingleton
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the trace and identifies itself with the given
* action String.
* <p>
*
* @param chart
* the target the action will work on
* @param colorName
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this <code>Action</code>
* assigned ( {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*/
private Chart2DActionSaveImageSingleton(final Chart2D chart, final String colorName) {
super(chart, colorName);
chart.addPropertyChangeListener(Chart2D.PROPERTY_GRID_COLOR, this);
// configure the file chooser:
this.m_filechooser = new JFileChooser();
this.m_filechooser.setAcceptAllFileFilterUsed(false);
}
示例5: Chart2DActionSaveEps
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the trace and identifies
* itself with the given action String.
* <p>
*
* @param chart
* the target the action will work on
* @param colorName
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}
* ).
*/
public Chart2DActionSaveEps(final Chart2D chart, final String colorName) {
super(chart, colorName);
chart.addPropertyChangeListener(Chart2D.PROPERTY_GRID_COLOR, this);
// configure the file chooser:
this.m_filechooser = new JFileChooser();
this.m_filechooser.setAcceptAllFileFilterUsed(false);
}
示例6: ChartActionSetToolTipType
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that sets the constructor given
* <code>{@link IToolTipType}</code> to the chart.
* <p>
*
* @see Chart2D#setToolTipType(IToolTipType)
*
* @param chart
* the owner of the axis to trigger actions upon.
*
* @param toolTipType
* the tool tip type to use.
*
* @param description
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*
*/
public ChartActionSetToolTipType(final Chart2D chart, final String description,
final IToolTipType toolTipType) {
super(chart, description);
this.m_toolTipType = toolTipType;
chart.addPropertyChangeListener(Chart2D.PROPERTY_TOOLTIP_TYPE, this);
}
示例7: AxisActionSetFormatter
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the chart's axis by argument
* <code>axis</code> and identifies itself with the given action String and
* invokes
* {@link info.monitorenter.gui.chart.axis.AAxis#setPaintGrid(boolean)} on the
* axis upon selection.
* <p>
*
* @param chart
* the owner of the axis to trigger actions upon.
*
* @param axis
* needed to identify the axis of the chart: one of {@link Chart2D#X}
* , {@link Chart2D#Y}.
*
* @param description
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*
* @param formatter
* the formatter to set.
*/
public AxisActionSetFormatter(final Chart2D chart, final String description, final int axis,
final IAxisLabelFormatter formatter) {
super(chart, description, axis);
this.m_formatter = formatter;
if (axis == Chart2D.X) {
chart.getAxisX().addPropertyChangeListener(IAxis.PROPERTY_LABELFORMATTER, this);
chart.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_X, this);
} else if (axis == Chart2D.Y) {
chart.getAxisY().addPropertyChangeListener(IAxis.PROPERTY_LABELFORMATTER, this);
chart.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_Y, this);
}
}
示例8: Chart2DActionSetAxis
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the trace and identifies
* itself with the given action String.
* <p>
*
* @param chart
* the target the action will work on.
*
* @param axis
* the axis implementation to use.
*
* @param description
* the description of this action to show in the UI.
*
* @param axisTarget
* Identifies where to set the axis on the chart: either
* {@link Chart2D#X} or {@link Chart2D#Y}
*
* @throws IllegalArgumentException
* if the axis argument is invalid.
*/
public Chart2DActionSetAxis(final Chart2D chart, final AAxis<?> axis, final String description,
final int axisTarget) throws IllegalArgumentException {
super(chart, description);
if (axisTarget != Chart2D.X && axisTarget != Chart2D.Y) {
throw new IllegalArgumentException(
"Argument axisTarget is invalid, choose one of Chart2D.X, Chart2D.Y.");
}
this.m_axisTarget = axisTarget;
this.m_axis = axis;
chart.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_X, this);
chart.addPropertyChangeListener(Chart2D.PROPERTY_AXIS_Y, this);
}
示例9: Chart2DActionSetCustomGridColor
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the trace and identifies
* itself with the given action String.
* <p>
*
* @param chart
* the target the action will work on
* @param colorName
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*/
public Chart2DActionSetCustomGridColor(final Chart2D chart, final String colorName) {
super(chart, colorName);
chart.addPropertyChangeListener(Chart2D.PROPERTY_GRID_COLOR, this);
}
示例10: Chart2DActionEnableAntialiasing
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Creates an <code>Action</code> that will invoke
* <code>{@link Chart2D#enablePointHighlighting(boolean)}</code> with the
* state of the triggering <code>{@link ItemSelectable}</code>
* <p>
*
* @param chart
* the owner of the axis to trigger actions upon.
*
*
* @param description
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*/
public Chart2DActionEnableAntialiasing(Chart2D chart, String description) {
super(chart, description);
chart.addPropertyChangeListener(Chart2D.PROPERTY_ANTIALIASING_ENABLED, this);
}
示例11: Chart2DActionSetGridColor
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the chart and identifies
* itself with the given action String.
* <p>
*
* @param chart
* the target the action will work on
* @param colorName
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
* @param color
* the color of gridlines to set.
*
*/
public Chart2DActionSetGridColor(final Chart2D chart, final String colorName, final Color color) {
super(chart, colorName);
this.m_color = color;
chart.addPropertyChangeListener(Chart2D.PROPERTY_GRID_COLOR, this);
}
示例12: Chart2DActionSetCustomGridColorSingleton
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the trace and identifies
* itself with the given action String.
* <p>
*
* @param chart
* the target the action will work on
* @param colorName
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*/
private Chart2DActionSetCustomGridColorSingleton(final Chart2D chart, final String colorName) {
super(chart, colorName);
chart.addPropertyChangeListener(Chart2D.PROPERTY_GRID_COLOR, this);
}
示例13: Chart2DActionEnableHighlighting
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Creates an <code>Action</code> that will invoke
* <code>{@link Chart2D#enablePointHighlighting(boolean)}</code> with the
* state of the triggering <code>{@link ItemSelectable}</code>
* <p>
*
* @param chart
* the owner of the axis to trigger actions upon.
*
*
* @param description
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*/
public Chart2DActionEnableHighlighting(Chart2D chart, String description) {
super(chart, description);
chart.addPropertyChangeListener(Chart2D.PROPERTY_POINT_HIGHLIGHTING_ENABLED, this);
}
示例14: Chart2DActionSetPaintLabels
import info.monitorenter.gui.chart.Chart2D; //导入方法依赖的package包/类
/**
* Create an <code>Action</code> that accesses the axis, identifies itself
* with the given action String and invokes
* {@link info.monitorenter.gui.chart.Chart2D#setPaintLabels(boolean)} on the
* chart upon selection.
*
* @param chart
* the target the action will work on.
*
* @param description
* the descriptive <code>String</code> that will be displayed by
* {@link javax.swing.AbstractButton} subclasses that get this
* <code>Action</code> assigned (
* {@link javax.swing.AbstractButton#setAction(javax.swing.Action)}).
*
*/
public Chart2DActionSetPaintLabels(final Chart2D chart, final String description) {
super(chart, description);
chart.addPropertyChangeListener(Chart2D.PROPERTY_PAINTLABELS, this);
}