You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "francesco.80" <fr...@libero.it> on 2007/01/05 16:14:32 UTC
Problem with AutoShape.....
hi to all... I am new of the forum...
I am trying to extract the autoshapes from a slide for then to paint them in
a Graphics2D......
the code that I used ...
for (int a=0;a<VectorAutoShape.size();a++){
java.awt.Rectangle anchor = VectorAutoShape.elementAt(a).getAnchor();
Color color = VectorLine.elementAt(a).getLineColor();
if (color != null){
g2.setColor(color);
float width = (float)VectorAutoShape.elementAt(a).getLineWidth();
Stroke stroke = new BasicStroke(width);
g2.setStroke(stroke);
EscherSpRecord spRecord =
VectorAutoShape.elementAt(a).getSpContainer().getChildById(EscherSpRecord.RECORD_ID);
boolean flipped = (spRecord.getFlags() &
EscherSpRecord.FLAG_FLIPVERT) != 0;
if (flipped)
g2.drawLine(anchor.x, anchor.y+anchor.height,
anchor.x+anchor.width, anchor.y);
else
g2.drawLine(anchor.x, anchor.y, anchor.x+anchor.width,
anchor.y+anchor.height);
}
}
But the bug is this......
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
at java.util.Vector.elementAt(Unknown Source)
at DisegnaComponenti.Disegna(DisegnaComponenti.java:72)
at Convert.main(Convert.java:97)
What's my error?
thanks
--
View this message in context: http://www.nabble.com/Problem-with-AutoShape.....-tf2926012.html#a8179662
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Problem with AutoShape.....
Posted by "francesco.80" <fr...@libero.it>.
the bug is not present yet......the vector wasn't initialized well......
i have seen the tutorial (how to work....) but i must to work on the object
of Java2D......i must create a object Graphics2D.......so how can draw all
the possible object (arrows,stars,flow charts,shape..........) that I
extract from the slide???
--
View this message in context: http://www.nabble.com/Problem-with-AutoShape.....-tf2926012.html#a8181240
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: Problem with AutoShape.....
Posted by Yegor Kozlov <ye...@dinom.ru>.
See the tutorial on how to work with shapes in HSLF:
http://jakarta.apache.org/poi/hslf/how-to-shapes.html
Yegor
f8> hi to all... I am new of the forum...
f8> I am trying to extract the autoshapes from a slide for then to paint them in
f8> a Graphics2D......
f8> the code that I used ...
f8> for (int a=0;a<VectorAutoShape.size();a++){
f8> java.awt.Rectangle anchor = VectorAutoShape.elementAt(a).getAnchor();
f8> Color color = VectorLine.elementAt(a).getLineColor();
f8> if (color != null){
f8> g2.setColor(color);
f8> float width = (float)VectorAutoShape.elementAt(a).getLineWidth();
f8> Stroke stroke = new BasicStroke(width);
f8> g2.setStroke(stroke);
f8> EscherSpRecord spRecord =
f8> VectorAutoShape.elementAt(a).getSpContainer().getChildById(EscherSpRecord.RECORD_ID);
f8> boolean flipped = (spRecord.getFlags() &
f8> EscherSpRecord.FLAG_FLIPVERT) != 0;
f8> if (flipped)
f8> g2.drawLine(anchor.x, anchor.y+anchor.height,
f8> anchor.x+anchor.width, anchor.y);
f8> else
f8> g2.drawLine(anchor.x, anchor.y, anchor.x+anchor.width,
f8> anchor.y+anchor.height);
f8> }
f8> }
f8> But the bug is this......
f8> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 >= 1
f8> at java.util.Vector.elementAt(Unknown Source)
f8> at DisegnaComponenti.Disegna(DisegnaComponenti.java:72)
f8> at Convert.main(Convert.java:97)
f8> What's my error?
f8> thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/