Set table size to image size.
Posted: Thu Jun 23, 2011 10:35 pm
I am currently modifying DocBook InsertTable operation. One of the common tables to insert is a table that has mediaobject with imagedata as the body instead of the tgroup. I want to set the table width to the width of the image. I am having trouble getting the image width in Java. Currently I have:
TableInfo.java constructor
Is there a utility class in Author API that I can use for finding out the image size?
TableInfo.java constructor
Code: Select all
Image image = Toolkit.getDefaultToolkit().getImage(img_filename);
MediaTracker mTracker = new MediaTracker(the_table_dialog_object);
mTracker.addImage(image, 1);
try
{
mTracker.waitForID(1);
}
catch(InterruptedException e){}
image.getWidth(null); // returns -1
image.getHeight(null); // returns -1