本文整理汇总了Java中gnu.kawa.models.Paintable类的典型用法代码示例。如果您正苦于以下问题:Java Paintable类的具体用法?Java Paintable怎么用?Java Paintable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Paintable类属于gnu.kawa.models包,在下文中一共展示了Paintable类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ReplEditorKit
import gnu.kawa.models.Paintable; //导入依赖的package包/类
public ReplEditorKit(final ReplPane pane)
{
this.pane = pane;
styledFactory = super.getViewFactory();
factory = new ViewFactory ()
{
public View create(Element elem)
{
String kind = elem.getName();
if (kind == ReplPane.ViewableElementName)
{
return (new ComponentView(elem)
{
@Override
protected Component createComponent()
{
AttributeSet attr = getElement().getAttributes();
JPanel panel = new JPanel();
Viewable v = (Viewable) attr.getAttribute(ReplPane.ViewableAttribute);
Component comp;
// A kludge: We create a panel, and then since all current
// Viewables just create a Component and put it in the
// panel, we get rid of the useless JPanel.
v.makeView(SwingDisplay.getInstance(), panel);
if (panel.getComponentCount() == 1)
{
comp = panel.getComponent(0);
panel.removeAll();
}
else
{
panel.setBackground(pane.getBackground());
comp = panel;
}
return comp;
}
});
}
else if (kind == ReplPane.PaintableElementName)
{
AttributeSet attr = elem.getAttributes();
return new PaintableView(elem, (Paintable) attr.getAttribute(ReplPane.PaintableAttribute));
}
return styledFactory.create(elem);
}
};
}
示例2: PaintableView
import gnu.kawa.models.Paintable; //导入依赖的package包/类
public PaintableView (Element elem, Paintable paintable)
{
super(elem);
this.p = paintable;
this.bounds = paintable.getBounds2D();
}
示例3: ReplEditorKit
import gnu.kawa.models.Paintable; //导入依赖的package包/类
public ReplEditorKit(final ReplPane pane)
{
this.pane = pane;
styledFactory = super.getViewFactory();
factory = new ViewFactory ()
{
public View create(Element elem)
{
String kind = elem.getName();
if (kind == ReplPane.ViewableElementName)
{
return (new ComponentView(elem)
{
protected Component createComponent()
{
AttributeSet attr = getElement().getAttributes();
JPanel panel = new JPanel();
Viewable v = (Viewable) attr.getAttribute(ReplPane.ViewableAttribute);
Component comp;
// A kludge: We create a panel, and then since all current
// Viewables just create a Component and put it in the
// panel, we get rid of the useless JPanel.
v.makeView(SwingDisplay.getInstance(), panel);
if (panel.getComponentCount() == 1)
{
comp = panel.getComponent(0);
panel.removeAll();
}
else
{
panel.setBackground(pane.getBackground());
comp = panel;
}
return comp;
}
});
}
else if (kind == ReplPane.PaintableElementName)
{
AttributeSet attr = elem.getAttributes();
return new PaintableView(elem, (Paintable) attr.getAttribute(ReplPane.PaintableAttribute));
}
return styledFactory.create(elem);
}
};
}