43 |
43 |
*
|
44 |
44 |
* $Id$
|
45 |
45 |
* $Log$
|
46 |
|
* Revision 1.12 2007-04-19 16:01:27 jaume
|
|
46 |
* Revision 1.13 2007-04-20 07:11:11 jaume
|
47 |
47 |
* *** empty log message ***
|
48 |
48 |
*
|
|
49 |
* Revision 1.12 2007/04/19 16:01:27 jaume
|
|
50 |
* *** empty log message ***
|
|
51 |
*
|
49 |
52 |
* Revision 1.11 2007/04/19 14:21:30 jaume
|
50 |
53 |
* *** empty log message ***
|
51 |
54 |
*
|
... | ... | |
320 |
323 |
}
|
321 |
324 |
|
322 |
325 |
public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) {
|
|
326 |
int xIni = (int) (r.width*0.5);
|
|
327 |
int yIni = (int) (r.height*0.5);
|
|
328 |
g.drawLine(0, yIni, r.width, yIni);
|
|
329 |
g.drawLine(xIni, 0, xIni, r.height);
|
|
330 |
g.translate(xIni, yIni);
|
323 |
331 |
g.rotate(getRotation());
|
324 |
332 |
// Sirve de algo el scaleInstance???
|
325 |
333 |
RenderingHints old = g.getRenderingHints();
|
326 |
334 |
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
327 |
|
double h = r.getHeight();
|
328 |
|
g.setFont(font);
|
329 |
|
g.setColor(getColor());
|
330 |
|
r.y = (int) h;
|
331 |
|
|
332 |
|
int x = r.x;
|
333 |
|
int y = r.y;
|
334 |
|
int width = (int) r.getHeight();
|
335 |
|
int height = (int) r.getWidth();
|
336 |
|
int diff = (width-height);
|
337 |
|
if (diff<0) {
|
338 |
|
x -= diff /2;
|
339 |
|
} else {
|
340 |
|
y += diff /2;
|
341 |
|
}
|
342 |
|
|
343 |
|
// and apply the offset
|
344 |
|
x = x + (int) getOffset().getX(); // TODO scale offset
|
345 |
|
y = y + (int) getOffset().getY(); // TODO scale offset
|
|
335 |
// double h = r.getHeight();
|
|
336 |
// g.setFont(font);
|
|
337 |
// g.setColor(getColor());
|
|
338 |
// r.y = (int) h;
|
|
339 |
//
|
|
340 |
// int x = r.x;
|
|
341 |
// int y = r.y;
|
|
342 |
// int width = (int) r.getHeight();
|
|
343 |
// int height = (int) r.getWidth();
|
|
344 |
// int diff = (width-height);
|
|
345 |
// if (diff<0) {
|
|
346 |
// x -= diff /2;
|
|
347 |
// } else {
|
|
348 |
// y += diff /2;
|
|
349 |
// }
|
|
350 |
//
|
|
351 |
// // and apply the offset
|
|
352 |
// x = x + (int) getOffset().getX(); // TODO scale offset
|
|
353 |
// y = y + (int) getOffset().getY(); // TODO scale offset
|
346 |
354 |
char[] text = new char[] { (char) unicode };
|
347 |
|
g.drawChars(text, 0, text.length, x, y);
|
|
355 |
// g.drawChars(text, 0, text.length, x, y);
|
|
356 |
g.drawChars(text, 0, text.length, (int) getOffset().getX(), (int) getOffset().getY());
|
348 |
357 |
g.setRenderingHints(old);
|
|
358 |
g.rotate(-getRotation());
|
|
359 |
g.translate(-xIni, -yIni);
|
|
360 |
|
349 |
361 |
}
|
350 |
362 |
|
351 |
363 |
public void setUnicode(int symbol) {
|