本文整理匯總了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);
}
};
}