To align your Images to the Middle of the JEditorPane, you can use something like this :
editPane.setText("<html><p style = \"text-align:center;\"><img src = " +
"\"http://gagandeepbali.uk.to/gaganisonline/images/" +
"editsystemvariable2.png\" alt = \"pic\" /></p></html>\n");
Here the text-align property can do that trick for you. And about that thing that image should not affect the size of the row, I am not sure about your intentions on that, but if I understood you right then you can provide a fixed width and height to your images in the <img>
tag.
Here I used this code, and tell me if you desire something else, other than what you find in this code. Wish I could help,
import java.awt.*;
import javax.swing.*;
public class EditorPaneTest extends JFrame
{
public EditorPaneTest()
{
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationByPlatform(true);
JEditorPane editPane = new JEditorPane();
JScrollPane scrollPane = new JScrollPane(editPane);
editPane.setContentType("text/html");
editPane.setText("<html><p style = \"text-align:center;\">Hello there, How you doing ?<img src = " +
"\"http://s018.radikal.ru/i504/1202/03/c01a2e35713f.gif" +
"\" alt = \"pic\" width = \"15\" height = \"15\" />I guess all is good!!" +
"<br />I hope this is what you wanted!! " +
"<img src = \"http://s018.radikal.ru/i504/1202/03/c01a2e35713f.gif" +
"\" alt = \"pic\" width = \"15\" height = \"15\" /> Hope this works for you :-)</p></html>\n");
add(scrollPane, BorderLayout.CENTER);
setSize(400, 300);
setVisible(true);
}
public static void main(String... args)
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
new EditorPaneTest();
}
});
}
}
And here is the output image :

MoreOver use this
. I had removed the extra bottom space from the image for you.
aaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
"); JEditorPane.setText(str); – user1221483 Feb 20 '12 at 18:45