本文整理汇总了Java中org.jdesktop.swingx.painter.AbstractPainter类的典型用法代码示例。如果您正苦于以下问题:Java AbstractPainter类的具体用法?Java AbstractPainter怎么用?Java AbstractPainter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractPainter类属于org.jdesktop.swingx.painter包,在下文中一共展示了AbstractPainter类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initPainterSupport
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
private void initPainterSupport() {
foregroundPainter = new AbstractPainter<JXLabel>() {
protected void doPaint(Graphics2D g, JXLabel label, int width, int height) {
Insets i = getInsets();
g = (Graphics2D) g.create(-i.left, -i.top, width, height);
try {
label.paint(g);
} finally {
g.dispose();
}
}
//if any of the state of the JButton that affects the foreground has changed,
//then I must clear the cache. This is really hard to get right, there are
//bound to be bugs. An alternative is to NEVER cache.
protected boolean shouldUseCache() {
return false;
}
@Override
public boolean equals(Object obj) {
return obj != null && this.getClass().equals(obj.getClass());
}
};
}
开发者ID:sing-group,项目名称:aibench-project,代码行数:26,代码来源:JXLabel.java
示例2: setBackgroundPainter
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Sets a Painter to use to paint the background of this JXPanel.
*
* @param p the new painter
* @see #getBackgroundPainter()
*/
@Override
public void setBackgroundPainter(Painter p) {
Painter old = getBackgroundPainter();
if (old instanceof AbstractPainter) {
((AbstractPainter<?>) old).removePropertyChangeListener(painterChangeListener);
}
backgroundPainter = p;
if (backgroundPainter instanceof AbstractPainter) {
((AbstractPainter<?>) backgroundPainter).addPropertyChangeListener(getPainterChangeListener());
}
firePropertyChange("backgroundPainter", old, getBackgroundPainter());
repaint();
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:20,代码来源:JXPanel.java
示例3: initPainterSupport
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
private void initPainterSupport() {
foregroundPainter = new AbstractPainter<JXLabel>() {
@Override
protected void doPaint(Graphics2D g, JXLabel label, int width, int height) {
Insets i = getInsets();
g = (Graphics2D) g.create(-i.left, -i.top, width, height);
try {
label.paint(g);
} finally {
g.dispose();
}
}
//if any of the state of the JButton that affects the foreground has changed,
//then I must clear the cache. This is really hard to get right, there are
//bound to be bugs. An alternative is to NEVER cache.
@Override
protected boolean shouldUseCache() {
return false;
}
@Override
public boolean equals(Object obj) {
return obj != null && this.getClass().equals(obj.getClass());
}
};
((AbstractPainter<?>) foregroundPainter).setAntialiasing(false);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:JXLabel.java
示例4: setLineWrap
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Enables line wrapping support for plain text. By default this support is disabled to mimic default of the JLabel.
* Value of this property has no effect on HTML text.
*
* @param b the new value
*/
public void setLineWrap(boolean b) {
boolean old = isLineWrap();
this.multiLine = b;
if (isLineWrap() != old) {
firePropertyChange("lineWrap", old, isLineWrap());
if (getForegroundPainter() != null) {
// XXX There is a bug here. In order to make painter work with this, caching has to be disabled
((AbstractPainter) getForegroundPainter()).setCacheable(!b);
}
//repaint();
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:JXLabel.java
示例5: interactiveFancyFilter
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Example of how-to apply filters to the label's foreground.
*/
@SuppressWarnings("unchecked")
public void interactiveFancyFilter() {
JXLabel label = new JXLabel("that's the real text");
label.setFont(new Font("SansSerif", Font.BOLD, 80));
AbstractPainter<?> fg = new MattePainter(Color.RED);
fg.setFilters(new BlurFilter());
label.setForegroundPainter(fg);
JXFrame frame = wrapInFrame(label, "fancy filter");
show(frame,400, 400);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:JXLabelVisualCheck.java
示例6: testDefaultForegroundNotAntialiasing
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Issue #1164-swingx: do not interfere with core antialiased handling.
*/
@Test
public void testDefaultForegroundNotAntialiasing() {
JXLabel label = new JXLabel();
AbstractPainter<?> painter = (AbstractPainter<?>) label.getForegroundPainter();
assertFalse("foreground painter must not be antialiasing", painter.isAntialiasing());
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:10,代码来源:JXLabelTest.java
示例7: installPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Installs a listener to the painter if appropriate. This implementation
* registers its painterListener if the Painter is of type AbstractPainter.
*/
protected void installPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter<?>) getPainter())
.addPropertyChangeListener(getPainterListener());
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:11,代码来源:MatchingTextHighlighter.java
示例8: uninstallPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Uninstalls a listener from the painter if appropriate. This
* implementation removes its painterListener if the Painter is of type
* AbstractPainter.
*/
protected void uninstallPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter<?>) getPainter())
.removePropertyChangeListener(painterListener);
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:12,代码来源:MatchingTextHighlighter.java
示例9: setPainter
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
public void setPainter(Painter<?> painter) {
releaseBaseBindings();
releaseAlignBindings();
releaseAreaBindings();
this.painter = painter;
setBaseEnabled(painter instanceof AbstractPainter<?>);
setAlignEnabled(painter instanceof AbstractLayoutPainter<?>);
setAreaEnabled(painter instanceof AbstractAreaPainter<?>);
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:10,代码来源:PainterDemo.java
示例10: installPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Installs a listener to the painter if appropriate. This
* implementation registers its painterListener if the Painter is of
* type AbstractPainter.
*/
protected void installPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter) getPainter())
.addPropertyChangeListener(getPainterListener());
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:12,代码来源:RelativePainterHighlighter.java
示例11: uninstallPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Uninstalls a listener from the painter if appropriate. This
* implementation removes its painterListener if the Painter is of type
* AbstractPainter.
*/
protected void uninstallPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter) getPainter())
.removePropertyChangeListener(painterListener);
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:12,代码来源:RelativePainterHighlighter.java
示例12: installPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Installs a listener to the painter if appropriate. This
* implementation registers its painterListener if the Painter is of
* type AbstractPainter.
*/
protected void installPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter) getPainter())
.addPropertyChangeListener(getPainterListener());
}
}
开发者ID:dbunibas,项目名称:BART,代码行数:12,代码来源:RelativePainterHighlighter.java
示例13: uninstallPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Uninstalls a listener from the painter if appropriate. This
* implementation removes its painterListener if the Painter is of type
* AbstractPainter.
*/
protected void uninstallPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter) getPainter())
.removePropertyChangeListener(painterListener);
}
}
开发者ID:dbunibas,项目名称:BART,代码行数:12,代码来源:RelativePainterHighlighter.java
示例14: JXMapViewer
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Create a new JXMapViewer. By default it will use the EmptyTileFactory
*/
public JXMapViewer() {
factory = new EmptyTileFactory();
//setTileFactory(new GoogleTileFactory());
MouseInputListener mia = new PanMouseInputListener();
setRecenterOnClickEnabled(false);
this.addMouseListener(mia);
this.addMouseMotionListener(mia);
this.addMouseWheelListener(new ZoomMouseWheelListener());
this.addKeyListener(new PanKeyListener());
// make a dummy loading image
try {
URL url = this.getClass().getResource("mapviewer/resources/loading.png");
this.setLoadingImage(ImageIO.read(url));
} catch (Throwable ex) {
System.out.println("could not load 'loading.png'");
BufferedImage img = new BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = img.createGraphics();
g2.setColor(Color.black);
g2.fillRect(0,0,16,16);
g2.dispose();
this.setLoadingImage(img);
}
//setAddressLocation(new GeoPosition(37.392137,-121.950431)); // Sun campus
setBackgroundPainter(new AbstractPainter<JXPanel>() {
protected void doPaint(Graphics2D g, JXPanel component, int width, int height) {
doPaintComponent(g);
}
});
}
开发者ID:3dcitydb,项目名称:swingx-ws,代码行数:36,代码来源:JXMapViewer.java
示例15: JXMapViewer
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Create a new JXMapViewer. By default it will use the EmptyTileFactory
*/
public JXMapViewer() {
factory = new EmptyTileFactory();
//setTileFactory(new GoogleTileFactory());
MouseInputListener mia = new PanMouseInputListener();
setRecenterOnClickEnabled(false);
this.addMouseListener(mia);
this.addMouseMotionListener(mia);
this.addMouseWheelListener(new ZoomMouseWheelListener());
this.addKeyListener(new PanKeyListener());
// make a dummy loading image
try {
URL url = this.getClass().getResource("mapviewer/resources/loading.png");
this.setLoadingImage(ImageIO.read(url));
} catch (Throwable ex) {
System.out.println("could not load 'loading.png'");
BufferedImage img = new BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = img.createGraphics();
g2.setColor(Color.black);
g2.fillRect(0,0,16,16);
g2.dispose();
this.setLoadingImage(img);
}
//setAddressLocation(new GeoPosition(37.392137,-121.950431)); // Sun campus
setBackgroundPainter(new AbstractPainter<JXPanel>() {
protected void doPaint(Graphics2D g, JXPanel component, int width, int height) {
doPaintComponent(g);
}
});
}
开发者ID:griffon-legacy,项目名称:griffon-swingx-ws-plugin,代码行数:36,代码来源:JXMapViewer.java
示例16: savePainterToFile
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
static public void savePainterToFile(Painter compoundPainter, File file, URL baseURL) throws IOException {
//System.setErr(null);
// u.p("writing out to: " + file.getCanonicalPath());
setTransient(ImagePainter.class, "image");
setTransient(ImagePainter.class, "imageString");
//setTransient(CompoundPainter.class,"antialiasing");
//setTransient(AbstractPainter.class,"antialiasing");
//setTransient(AbstractPainter.class,"renderingHints");
//setPropertyDelegate();
XMLEncoder e = new XMLEncoder(new FileOutputStream(file));
e.setOwner(new PersistenceOwner(baseURL));
//p("owner = " + e.getOwner());
//e.setOwner(compoundPainter);
// serialize the enums
//e.setPersistenceDelegate(AbstractPainter.Antialiasing.class, new TypeSafeEnumPersistenceDelegate());
e.setPersistenceDelegate(AbstractPainter.Interpolation.class, new TypeSafeEnumPersistenceDelegate());
// e.setPersistenceDelegate(AbstractPainter.FractionalMetrics.class, new TypeSafeEnumPersistenceDelegate());
e.setPersistenceDelegate(RectanglePainter.Style.class, new TypeSafeEnumPersistenceDelegate());
e.setPersistenceDelegate(AbstractLayoutPainter.HorizontalAlignment.class, new TypeSafeEnumPersistenceDelegate());
e.setPersistenceDelegate(AbstractLayoutPainter.VerticalAlignment.class, new TypeSafeEnumPersistenceDelegate());
e.setPersistenceDelegate(AbstractPainter.class, new AbstractPainterDelegate());
e.setPersistenceDelegate(ImagePainter.class, new ImagePainterDelegate());
e.setPersistenceDelegate(RenderingHints.class, new RenderingHintsDelegate());
e.setPersistenceDelegate(GradientPaint.class, new GradientPaintDelegate());
e.setPersistenceDelegate(Arc2D.Float.class, new Arc2DDelegate());
e.setPersistenceDelegate(Arc2D.Double.class, new Arc2DDelegate());
e.setPersistenceDelegate(CubicCurve2D.Float.class, new CubicCurve2DDelegate());
e.setPersistenceDelegate(CubicCurve2D.Double.class, new CubicCurve2DDelegate());
e.setPersistenceDelegate(Ellipse2D.Float.class, new Ellipse2DDelegate());
e.setPersistenceDelegate(Ellipse2D.Double.class, new Ellipse2DDelegate());
e.setPersistenceDelegate(Line2D.Float.class, new Line2DDelegate());
e.setPersistenceDelegate(Line2D.Double.class, new Line2DDelegate());
e.setPersistenceDelegate(Point2D.Float.class, new Point2DDelegate());
e.setPersistenceDelegate(Point2D.Double.class, new Point2DDelegate());
e.setPersistenceDelegate(QuadCurve2D.Float.class, new QuadCurve2DDelegate());
e.setPersistenceDelegate(QuadCurve2D.Double.class, new QuadCurve2DDelegate());
e.setPersistenceDelegate(Rectangle2D.Float.class, new Rectangle2DDelegate());
e.setPersistenceDelegate(Rectangle2D.Double.class, new Rectangle2DDelegate());
e.setPersistenceDelegate(RoundRectangle2D.Float.class, new RoundRectangle2DDelegate());
e.setPersistenceDelegate(RoundRectangle2D.Double.class, new RoundRectangle2DDelegate());
e.setPersistenceDelegate(Area.class, new AreaDelegate());
e.setPersistenceDelegate(GeneralPath.class, new GeneralPathDelegate());
e.setPersistenceDelegate(AffineTransform.class, new AffineTransformDelegate());
e.setPersistenceDelegate(RadialGradientPaint.class, new RadialGradientPaintDelegate());
e.setPersistenceDelegate(LinearGradientPaint.class, new LinearGradientPaintDelegate());
e.setPersistenceDelegate(Insets.class, new InsetsDelegate());
e.writeObject(compoundPainter);
e.close();
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:55,代码来源:PainterUtil.java
示例17: installPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Installs a listener to the painter if appropriate.
* This implementation registers its painterListener if
* the Painter is of type AbstractPainter.
*/
protected void installPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter) getPainter()).addPropertyChangeListener(getPainterListener());
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:11,代码来源:PainterHighlighter.java
示例18: uninstallPainterListener
import org.jdesktop.swingx.painter.AbstractPainter; //导入依赖的package包/类
/**
* Uninstalls a listener from the painter if appropriate.
* This implementation removes its painterListener if
* the Painter is of type AbstractPainter.
*/
protected void uninstallPainterListener() {
if (getPainter() instanceof AbstractPainter) {
((AbstractPainter) getPainter()).removePropertyChangeListener(painterListener);
}
}
开发者ID:RockManJoe64,项目名称:swingx,代码行数:11,代码来源:PainterHighlighter.java
注:本文中的org.jdesktop.swingx.painter.AbstractPainter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论