Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7536207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:30:44+00:00 2026-05-30T06:30:44+00:00

_https://i.stack.imgur.com/W2We5.gif <img src=\file:b:/smile.gif\ align=\middle\> _https://i.stack.imgur.com/VPHzw.gif <img src=\file:b:/smile.gif\> Required: _https://i.stack.imgur.com/WlMhG.gif I need to align the

  • 0

_https://i.stack.imgur.com/W2We5.gif

<img src=\"file:b:/smile.gif\" align=\"middle\">"

_https://i.stack.imgur.com/VPHzw.gif

<img src=\"file:b:/smile.gif\">

Required:
_https://i.stack.imgur.com/WlMhG.gif

I need to align the image in the JEditorPane and the image should not affect the height of rows. If I use align=middle – the picture is not aligned and retained influence on the height of rows.

To a solution of similar problems in html I use:

<span style=\"background-image: url('file:b:/smile.gif') 50% 50% no-repeat\"> &nbsp;&nbsp;&nbsp;&nbsp;</span>

But this method does not work in JEditorPane. How can I solve this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:30:45+00:00Added an answer on May 30, 2026 at 6:30 am

    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 :

    EditorPane's View

    MoreOver use this Smiley Image. I had removed the extra bottom space from the image for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to take something like x^2+5 and have it generate this: https://i.stack.imgur.com/a0f8Q.gif
https://i.stack.imgur.com/ARbfh.jpg So I've got a large flat file database which I need to normalize.
Here is a PNG file: https://i.stack.imgur.com/AHOgE.png (Yes, never mind that it's a funny penguin
https://i.stack.imgur.com/FZyiq.jpg I've designed this layout and it works fine in my mind, but when
https://i.stack.imgur.com/3T1rj.jpg So I know how to recursively print a tree with 1 l and
I can't post images yet: https://i.stack.imgur.com/dJio5.jpg Using Actionscript 3 I'm drawing multiple Shapes onto
I have a plot like this: https://i.stack.imgur.com/zdike.png I need the data coordinates of points
I'm having a problem with layout structure. Here is a mockup: https://i.stack.imgur.com/PFMLi.jpg And code:
Here is a screenshot of what I'm working with at the moment... https://i.stack.imgur.com/45GX9.png The
https://i.stack.imgur.com/JU3e2.jpg So I am uploading some images but when I run it against some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.