|
Re: Dialog figure [message #511612 is a reply to message #511591] |
Tue, 02 February 2010 09:34 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
one of the solutions would be to capture an image of the dialog and paint the same on the figure...
off course scaling issues have to be handled...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
|
|
Re: Dialog figure [message #517153 is a reply to message #517143] |
Fri, 26 February 2010 12:09 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
Use ImageFigure instead of label....
And change the scale of that figure to resize...
hope they have handled the scaled painting....
try and tell me...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
[Updated on: Fri, 26 February 2010 12:14] Report message to a moderator
|
|
|
|
Re: Dialog figure [message #517544 is a reply to message #517520] |
Mon, 01 March 2010 09:25 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
try this
class StrechableImageFigure extends Figure
{
private Image m;
public StrechableImageFigure(Image m) {
super();
this.m = m;
}
@Override
public void setBounds(Rectangle rect) {
super.setBounds(rect);
ImageData imageData = m.getImageData();
imageData = imageData.scaledTo(getBounds().width, getBounds().height);
m = new Image(null, imageData);
}
@Override
protected void paintFigure(Graphics graphics) {
graphics.drawImage(m, new Point());
}
}
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
Re: Dialog figure [message #517627 is a reply to message #511591] |
Mon, 01 March 2010 15:02 |
StefanK Messages: 25 Registered: July 2009 |
Junior Member |
|
|
Thanks a lot, vijay. It works just fine!
One little modification in your code:
class StrechableImageFigure extends Figure
{
private Image m;
public StrechableImageFigure(Image m) {
super();
this.m = m;
}
@Override
public void setBounds(Rectangle rect) {
super.setBounds(rect);
ImageData imageData = m.getImageData();
imageData = imageData.scaledTo(getBounds().width, getBounds().height);
m = new Image(null, imageData);
}
@Override
protected void paintFigure(Graphics graphics) {
graphics.drawImage(m, new Point(getBounds().x, getBounds().y));
// x and y coordinates are needed. If the Image is drawn with 0,0 coordinates, will be painted on the top left of the canvas
}
}
Best regards
StefanK
[Updated on: Mon, 01 March 2010 15:02] Report message to a moderator
|
|
|
Re: Dialog figure [message #517801 is a reply to message #517627] |
Tue, 02 March 2010 08:16 |
Vijay Raj Messages: 608 Registered: July 2009 |
Senior Member |
|
|
There is somthing wrong here...
Can any body clearify this please....
cordinates are always relative hence Point(0,0) for a figure
will be its top left not canvas top left....
am i overriding the wrong method or somthing else is missing here or everything is correct?
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
Powered by
FUDForum. Page generated in 0.04043 seconds