下面列出了javax.swing.plaf.metal.MetalTabbedPaneUI#javax.swing.event.EventListenerList 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Creates a new title.
*
* @param position the position of the title (<code>null</code> not
* permitted).
* @param horizontalAlignment the horizontal alignment of the title (LEFT,
* CENTER or RIGHT, <code>null</code> not
* permitted).
* @param verticalAlignment the vertical alignment of the title (TOP,
* MIDDLE or BOTTOM, <code>null</code> not
* permitted).
* @param padding the amount of space to leave around the outside of the
* title (<code>null</code> not permitted).
*/
protected Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment, RectangleInsets padding) {
ParamChecks.nullNotPermitted(position, "position");
ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
ParamChecks.nullNotPermitted(padding, "padding");
this.visible = true;
this.position = position;
this.horizontalAlignment = horizontalAlignment;
this.verticalAlignment = verticalAlignment;
setPadding(padding);
this.listenerList = new EventListenerList();
this.notify = true;
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.zoomFillPaint = SerialUtilities.readPaint(stream);
this.zoomOutlinePaint = SerialUtilities.readPaint(stream);
// we create a new but empty chartMouseListeners list
this.chartMouseListeners = new EventListenerList();
// register as a listener with sub-components...
if (this.chart != null) {
this.chart.addChangeListener(this);
}
}
/**
* Creates a new plot.
*/
protected Plot() {
this.parent = null;
this.insets = DEFAULT_INSETS;
this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;
this.backgroundAlpha = DEFAULT_BACKGROUND_ALPHA;
this.backgroundImage = null;
this.outlineVisible = true;
this.outlineStroke = DEFAULT_OUTLINE_STROKE;
this.outlinePaint = DEFAULT_OUTLINE_PAINT;
this.foregroundAlpha = DEFAULT_FOREGROUND_ALPHA;
this.noDataMessage = null;
this.noDataMessageFont = new Font("SansSerif", Font.PLAIN, 12);
this.noDataMessagePaint = Color.black;
this.drawingSupplier = new DefaultDrawingSupplier();
this.notify = true;
this.listenerList = new EventListenerList();
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.borderStroke = SerialUtilities.readStroke(stream);
this.borderPaint = SerialUtilities.readPaint(stream);
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.progressListeners = new EventListenerList();
this.changeListeners = new EventListenerList();
this.renderingHints = new RenderingHints(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
// register as a listener with sub-components...
if (this.title != null) {
this.title.addChangeListener(this);
}
for (int i = 0; i < getSubtitleCount(); i++) {
getSubtitle(i).addChangeListener(this);
}
this.plot.addChangeListener(this);
}
/**
* Create a new image-wrapper icon.
*
* @param inputStream The input stream to read the image from.
* @param w The width of the icon.
* @param h The height of the icon.
*/
public ImageWrapperIcon(InputStream inputStream, int w, int h) {
this.imageInputStream = inputStream;
this.width = w;
this.height = h;
this.listenerList = new EventListenerList();
this.cachedImages = new LinkedHashMap<String, BufferedImage>() {
@Override
protected boolean removeEldestEntry(
Map.Entry<String, BufferedImage> eldest) {
return size() > 5;
}
};
this.renderImage(this.width, this.height);
}
/**
* Creates a new resizable icon based on SVG content.
*
* @param inputStream
* Input stream with uncompressed SVG content.
* @param initialDim
* Initial dimension.
* @throws IOException
* in case any I/O operation failed.
*/
private SvgBatikResizableIcon(InputStream inputStream,
final Dimension initialDim) throws IOException {
super(inputStream, initialDim.width, initialDim.height);
this.listenerList = new EventListenerList();
this.addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
@Override
public void gvtRenderingCompleted(GVTTreeRendererEvent e) {
fireAsyncCompleted(Boolean.TRUE);
}
@Override
public void gvtRenderingFailed(GVTTreeRendererEvent arg0) {
fireAsyncCompleted(Boolean.FALSE);
}
});
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.borderStroke = SerialUtilities.readStroke(stream);
this.borderPaint = SerialUtilities.readPaint(stream);
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.progressListeners = new EventListenerList();
this.changeListeners = new EventListenerList();
this.renderingHints = new RenderingHints(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
// register as a listener with sub-components...
if (this.title != null) {
this.title.addChangeListener(this);
}
for (int i = 0; i < getSubtitleCount(); i++) {
getSubtitle(i).addChangeListener(this);
}
this.plot.addChangeListener(this);
}
/**
* Creates a new instance of ZoomManager.
*
* @param scene the scene to be managed.
*/
public ZoomManager(Scene scene) {
this.scene = scene;
listeners = new EventListenerList();
scene.addSceneListener(new Scene.SceneListener(){
public void sceneRepaint() {
}
public void sceneValidating() {
}
public void sceneValidated() {
int newZoomPercentage = (int)(getScene().getZoomFactor()*100);
if(newZoomPercentage != zoomPercentage) {
zoomPercentage = newZoomPercentage;
fireZoomEvent(zoomPercentage);
}
}
});
}
private void readObject(ObjectInputStream in)
throws ClassNotFoundException, IOException
{
this.acc = AccessController.getContext();
ObjectInputStream.GetField f = in.readFields();
EventListenerList newListenerList = (EventListenerList)
f.get("listenerList", null);
if (newListenerList == null) {
throw new InvalidObjectException("Null listenerList");
}
listenerList = newListenerList;
int newInitialDelay = f.get("initialDelay", 0);
checkDelay(newInitialDelay, "Invalid initial delay: ");
initialDelay = newInitialDelay;
int newDelay = f.get("delay", 0);
checkDelay(newDelay, "Invalid delay: ");
delay = newDelay;
repeats = f.get("repeats", false);
coalesce = f.get("coalesce", false);
actionCommand = (String) f.get("actionCommand", null);
}
private void readObject(ObjectInputStream in)
throws ClassNotFoundException, IOException
{
this.acc = AccessController.getContext();
ObjectInputStream.GetField f = in.readFields();
EventListenerList newListenerList = (EventListenerList)
f.get("listenerList", null);
if (newListenerList == null) {
throw new InvalidObjectException("Null listenerList");
}
listenerList = newListenerList;
int newInitialDelay = f.get("initialDelay", 0);
checkDelay(newInitialDelay, "Invalid initial delay: ");
initialDelay = newInitialDelay;
int newDelay = f.get("delay", 0);
checkDelay(newDelay, "Invalid delay: ");
delay = newDelay;
repeats = f.get("repeats", false);
coalesce = f.get("coalesce", false);
actionCommand = (String) f.get("actionCommand", null);
}
/**
* Creates a new title.
*
* @param position the position of the title (<code>null</code> not
* permitted).
* @param horizontalAlignment the horizontal alignment of the title (LEFT,
* CENTER or RIGHT, <code>null</code> not
* permitted).
* @param verticalAlignment the vertical alignment of the title (TOP,
* MIDDLE or BOTTOM, <code>null</code> not
* permitted).
* @param padding the amount of space to leave around the outside of the
* title (<code>null</code> not permitted).
*/
protected Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment, RectangleInsets padding) {
ParamChecks.nullNotPermitted(position, "position");
ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
ParamChecks.nullNotPermitted(padding, "padding");
this.visible = true;
this.position = position;
this.horizontalAlignment = horizontalAlignment;
this.verticalAlignment = verticalAlignment;
setPadding(padding);
this.listenerList = new EventListenerList();
this.notify = true;
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.zoomFillPaint = SerialUtilities.readPaint(stream);
this.zoomOutlinePaint = SerialUtilities.readPaint(stream);
// we create a new but empty chartMouseListeners list
this.chartMouseListeners = new EventListenerList();
// register as a listener with sub-components...
if (this.chart != null) {
this.chart.addChangeListener(this);
}
}
/**
* Creates a new plot.
*/
protected Plot() {
this.parent = null;
this.insets = DEFAULT_INSETS;
this.backgroundPaint = DEFAULT_BACKGROUND_PAINT;
this.backgroundAlpha = DEFAULT_BACKGROUND_ALPHA;
this.backgroundImage = null;
this.outlineVisible = true;
this.outlineStroke = DEFAULT_OUTLINE_STROKE;
this.outlinePaint = DEFAULT_OUTLINE_PAINT;
this.foregroundAlpha = DEFAULT_FOREGROUND_ALPHA;
this.noDataMessage = null;
this.noDataMessageFont = new Font("SansSerif", Font.PLAIN, 12);
this.noDataMessagePaint = Color.black;
this.drawingSupplier = new DefaultDrawingSupplier();
this.notify = true;
this.listenerList = new EventListenerList();
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.borderStroke = SerialUtilities.readStroke(stream);
this.borderPaint = SerialUtilities.readPaint(stream);
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.progressListeners = new EventListenerList();
this.changeListeners = new EventListenerList();
this.renderingHints = new RenderingHints(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
// register as a listener with sub-components...
if (this.title != null) {
this.title.addChangeListener(this);
}
for (int i = 0; i < getSubtitleCount(); i++) {
getSubtitle(i).addChangeListener(this);
}
this.plot.addChangeListener(this);
}
/**
* Create a new image-wrapper icon.
*
* @param image The original image.
* @param w The width of the icon.
* @param h The height of the icon.
*/
public ImageWrapperIcon(Image image, int w, int h) {
this.imageInputStream = null;
this.image = image;
this.width = w;
this.height = h;
this.listenerList = new EventListenerList();
this.cachedImages = new LinkedHashMap<String, BufferedImage>() {
@Override
protected boolean removeEldestEntry(
Map.Entry<String, BufferedImage> eldest) {
return size() > 5;
}
;
};
this.renderImage(this.width, this.height);
}
/**
* Creates a new title.
*
* @param position the position of the title (<code>null</code> not
* permitted).
* @param horizontalAlignment the horizontal alignment of the title (LEFT,
* CENTER or RIGHT, <code>null</code> not
* permitted).
* @param verticalAlignment the vertical alignment of the title (TOP,
* MIDDLE or BOTTOM, <code>null</code> not
* permitted).
* @param padding the amount of space to leave around the outside of the
* title (<code>null</code> not permitted).
*/
protected Title(RectangleEdge position,
HorizontalAlignment horizontalAlignment,
VerticalAlignment verticalAlignment, RectangleInsets padding) {
ParamChecks.nullNotPermitted(position, "position");
ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment");
ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment");
ParamChecks.nullNotPermitted(padding, "padding");
this.visible = true;
this.position = position;
this.horizontalAlignment = horizontalAlignment;
this.verticalAlignment = verticalAlignment;
setPadding(padding);
this.listenerList = new EventListenerList();
this.notify = true;
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.zoomFillPaint = SerialUtilities.readPaint(stream);
this.zoomOutlinePaint = SerialUtilities.readPaint(stream);
// we create a new but empty chartMouseListeners list
this.chartMouseListeners = new EventListenerList();
// register as a listener with sub-components...
if (this.chart != null) {
this.chart.addChangeListener(this);
}
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.paint = SerialUtilities.readPaint(stream);
this.basePaint = SerialUtilities.readPaint(stream);
this.fillPaint = SerialUtilities.readPaint(stream);
this.baseFillPaint = SerialUtilities.readPaint(stream);
this.outlinePaint = SerialUtilities.readPaint(stream);
this.baseOutlinePaint = SerialUtilities.readPaint(stream);
this.stroke = SerialUtilities.readStroke(stream);
this.baseStroke = SerialUtilities.readStroke(stream);
this.outlineStroke = SerialUtilities.readStroke(stream);
this.baseOutlineStroke = SerialUtilities.readStroke(stream);
this.shape = SerialUtilities.readShape(stream);
this.baseShape = SerialUtilities.readShape(stream);
this.itemLabelPaint = SerialUtilities.readPaint(stream);
this.baseItemLabelPaint = SerialUtilities.readPaint(stream);
this.baseLegendShape = SerialUtilities.readShape(stream);
this.baseLegendTextPaint = SerialUtilities.readPaint(stream);
// listeners are not restored automatically, but storage must be
// provided...
this.listenerList = new EventListenerList();
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.noDataMessagePaint = SerialUtilities.readPaint(stream);
this.outlineStroke = SerialUtilities.readStroke(stream);
this.outlinePaint = SerialUtilities.readPaint(stream);
// backgroundImage
this.backgroundPaint = SerialUtilities.readPaint(stream);
this.listenerList = new EventListenerList();
}
/**
* Constructs a new marker.
*
* @param paint the paint ({@code null} not permitted).
* @param stroke the stroke ({@code null} not permitted).
* @param outlinePaint the outline paint ({@code null} permitted).
* @param outlineStroke the outline stroke ({@code null} permitted).
* @param alpha the alpha transparency (must be in the range 0.0f to
* 1.0f).
*
* @throws IllegalArgumentException if {@code paint} or
* {@code stroke} is {@code null}, or {@code alpha} is
* not in the specified range.
*/
protected Marker(Paint paint, Stroke stroke, Paint outlinePaint,
Stroke outlineStroke, float alpha) {
ParamChecks.nullNotPermitted(paint, "paint");
ParamChecks.nullNotPermitted(stroke, "stroke");
if (alpha < 0.0f || alpha > 1.0f) {
throw new IllegalArgumentException(
"The 'alpha' value must be in the range 0.0f to 1.0f");
}
this.paint = paint;
this.stroke = stroke;
this.outlinePaint = outlinePaint;
this.outlineStroke = outlineStroke;
this.alpha = alpha;
this.labelFont = new Font("SansSerif", Font.PLAIN, 9);
this.labelPaint = Color.black;
this.labelBackgroundColor = new Color(100, 100, 100, 100);
this.labelAnchor = RectangleAnchor.TOP_LEFT;
this.labelOffset = new RectangleInsets(3.0, 3.0, 3.0, 3.0);
this.labelOffsetType = LengthAdjustmentType.CONTRACT;
this.labelTextAnchor = TextAnchor.CENTER;
this.listenerList = new EventListenerList();
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.paint = SerialUtilities.readPaint(stream);
this.stroke = SerialUtilities.readStroke(stream);
this.outlinePaint = SerialUtilities.readPaint(stream);
this.outlineStroke = SerialUtilities.readStroke(stream);
this.labelPaint = SerialUtilities.readPaint(stream);
this.listenerList = new EventListenerList();
}
/**
* Clones the object, and takes care of listeners.
* Note: caller shall register its own listeners on cloned graph.
*
* @return A clone.
*
* @throws CloneNotSupportedException if the chart is not cloneable.
*/
@Override
public Object clone() throws CloneNotSupportedException {
JFreeChart chart = (JFreeChart) super.clone();
chart.renderingHints = (RenderingHints) this.renderingHints.clone();
// private boolean borderVisible;
// private transient Stroke borderStroke;
// private transient Paint borderPaint;
if (this.title != null) {
chart.title = (TextTitle) this.title.clone();
chart.title.addChangeListener(chart);
}
chart.subtitles = new ArrayList();
for (int i = 0; i < getSubtitleCount(); i++) {
Title subtitle = (Title) getSubtitle(i).clone();
chart.subtitles.add(subtitle);
subtitle.addChangeListener(chart);
}
if (this.plot != null) {
chart.plot = (Plot) this.plot.clone();
chart.plot.addChangeListener(chart);
}
chart.progressListeners = new EventListenerList();
chart.changeListeners = new EventListenerList();
return chart;
}
/**
* Constructs an axis, using default values where necessary.
*
* @param label the axis label ({@code null} permitted).
*/
protected Axis(String label) {
this.label = label;
this.visible = DEFAULT_AXIS_VISIBLE;
this.labelFont = DEFAULT_AXIS_LABEL_FONT;
this.labelPaint = DEFAULT_AXIS_LABEL_PAINT;
this.labelInsets = DEFAULT_AXIS_LABEL_INSETS;
this.labelAngle = 0.0;
this.labelLocation = AxisLabelLocation.MIDDLE;
this.axisLineVisible = true;
this.axisLinePaint = DEFAULT_AXIS_LINE_PAINT;
this.axisLineStroke = DEFAULT_AXIS_LINE_STROKE;
this.tickLabelsVisible = DEFAULT_TICK_LABELS_VISIBLE;
this.tickLabelFont = DEFAULT_TICK_LABEL_FONT;
this.tickLabelPaint = DEFAULT_TICK_LABEL_PAINT;
this.tickLabelInsets = DEFAULT_TICK_LABEL_INSETS;
this.tickMarksVisible = DEFAULT_TICK_MARKS_VISIBLE;
this.tickMarkStroke = DEFAULT_TICK_MARK_STROKE;
this.tickMarkPaint = DEFAULT_TICK_MARK_PAINT;
this.tickMarkInsideLength = DEFAULT_TICK_MARK_INSIDE_LENGTH;
this.tickMarkOutsideLength = DEFAULT_TICK_MARK_OUTSIDE_LENGTH;
this.minorTickMarksVisible = false;
this.minorTickMarkInsideLength = 0.0f;
this.minorTickMarkOutsideLength = 2.0f;
this.plot = null;
this.listenerList = new EventListenerList();
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.attributedLabel = SerialUtilities.readAttributedString(stream);
this.labelPaint = SerialUtilities.readPaint(stream);
this.tickLabelPaint = SerialUtilities.readPaint(stream);
this.axisLineStroke = SerialUtilities.readStroke(stream);
this.axisLinePaint = SerialUtilities.readPaint(stream);
this.tickMarkStroke = SerialUtilities.readStroke(stream);
this.tickMarkPaint = SerialUtilities.readPaint(stream);
this.listenerList = new EventListenerList();
}
/**
* Constructs an axis, using default values where necessary.
*
* @param label the axis label ({@code null} permitted).
*/
protected Axis(String label) {
this.label = label;
this.visible = DEFAULT_AXIS_VISIBLE;
this.labelFont = DEFAULT_AXIS_LABEL_FONT;
this.labelPaint = DEFAULT_AXIS_LABEL_PAINT;
this.labelInsets = DEFAULT_AXIS_LABEL_INSETS;
this.labelAngle = 0.0;
this.labelLocation = AxisLabelLocation.MIDDLE;
this.axisLineVisible = true;
this.axisLinePaint = DEFAULT_AXIS_LINE_PAINT;
this.axisLineStroke = DEFAULT_AXIS_LINE_STROKE;
this.tickLabelsVisible = DEFAULT_TICK_LABELS_VISIBLE;
this.tickLabelFont = DEFAULT_TICK_LABEL_FONT;
this.tickLabelPaint = DEFAULT_TICK_LABEL_PAINT;
this.tickLabelInsets = DEFAULT_TICK_LABEL_INSETS;
this.tickMarksVisible = DEFAULT_TICK_MARKS_VISIBLE;
this.tickMarkStroke = DEFAULT_TICK_MARK_STROKE;
this.tickMarkPaint = DEFAULT_TICK_MARK_PAINT;
this.tickMarkInsideLength = DEFAULT_TICK_MARK_INSIDE_LENGTH;
this.tickMarkOutsideLength = DEFAULT_TICK_MARK_OUTSIDE_LENGTH;
this.minorTickMarksVisible = false;
this.minorTickMarkInsideLength = 0.0f;
this.minorTickMarkOutsideLength = 2.0f;
this.plot = null;
this.listenerList = new EventListenerList();
}
/**
* Creates a new series with the specified key and description.
*
* @param key the series key (<code>null</code> NOT permitted).
* @param description the series description (<code>null</code> permitted).
*/
protected Series(Comparable key, String description) {
ParamChecks.nullNotPermitted(key, "key");
this.key = key;
this.description = description;
this.listeners = new EventListenerList();
this.propertyChangeSupport = new PropertyChangeSupport(this);
this.vetoableChangeSupport = new VetoableChangeSupport(this);
this.notify = true;
}
public CloseableTabbedPane() {
super();
listenerList = new EventListenerList();
addMouseListener(this);
addMouseMotionListener(this);
if (getUI() instanceof MetalTabbedPaneUI) {
setUI(new CloseableMetalTabbedPaneUI(SwingUtilities.LEFT));
}
popMenuTab = new SikuliIDEPopUpMenu("POP_TAB", this);
if (!popMenuTab.isValidMenu()) {
popMenuTab = null;
}
}
/**
* Create a new SVG icon.
*
* @param inputStream
* The input stream to read the SVG document from.
* @param w
* The width of the icon.
* @param h
* The height of the icon.
*/
public IcoWrapperIcon(InputStream inputStream, int w, int h) {
this.icoInputStream = inputStream;
this.width = w;
this.height = h;
this.listenerList = new EventListenerList();
this.cachedImages = new LinkedHashMap<String, BufferedImage>() {
@Override
protected boolean removeEldestEntry(
Map.Entry<String, BufferedImage> eldest) {
return size() > 5;
}
};
this.renderImage(this.width, this.height);
}
/**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.paint = SerialUtilities.readPaint(stream);
this.basePaint = SerialUtilities.readPaint(stream);
this.fillPaint = SerialUtilities.readPaint(stream);
this.baseFillPaint = SerialUtilities.readPaint(stream);
this.outlinePaint = SerialUtilities.readPaint(stream);
this.baseOutlinePaint = SerialUtilities.readPaint(stream);
this.stroke = SerialUtilities.readStroke(stream);
this.baseStroke = SerialUtilities.readStroke(stream);
this.outlineStroke = SerialUtilities.readStroke(stream);
this.baseOutlineStroke = SerialUtilities.readStroke(stream);
this.shape = SerialUtilities.readShape(stream);
this.baseShape = SerialUtilities.readShape(stream);
this.itemLabelPaint = SerialUtilities.readPaint(stream);
this.baseItemLabelPaint = SerialUtilities.readPaint(stream);
this.baseLegendShape = SerialUtilities.readShape(stream);
this.baseLegendTextPaint = SerialUtilities.readPaint(stream);
// listeners are not restored automatically, but storage must be
// provided...
this.listenerList = new EventListenerList();
}
public StateTransitionTracker(final JComponent component, ButtonModel model) {
this.component = component;
this.model = model;
this.modelStateInfo = new ModelStateInfo();
this.modelStateInfo.currState = ComponentState.getState(model, component);
this.modelStateInfo.currStateNoSelection = ComponentState.getState(model, component, true);
this.modelStateInfo.clear();
this.repaintCallback = () -> new SwingRepaintCallback(component);
this.isAutoTrackingModelChanges = true;
this.eventListenerList = new EventListenerList();
this.focusTimeline =
AnimationConfigurationManager.getInstance().timelineBuilder(this.component)
.addCallback(this.repaintCallback.getRepaintCallback())
.addCallback(new TimelineCallbackAdapter() {
@Override
public void onTimelineStateChanged(TimelineState oldState,
TimelineState newState, float durationFraction,
float timelinePosition) {
// notify listeners on focus state transition
SwingUtilities.invokeLater(
() -> fireFocusStateTransitionEvent(oldState, newState));
}
})
.build();
this.focusLoopTimeline =
AnimationConfigurationManager.getInstance().timelineBuilder(this.component)
.addCallback(this.repaintCallback.getRepaintCallback())
.build();
this.iconGlowTracker = new IconGlowTracker(this.component);
this.name = "";
}