text area

Hi..
I need to know how to get text area to have a title in large font in the first line(centered)
then have a border of some sort horizontally.

then more text in normal font for a few lines ..then how to add a picture in the next line..then more text below the picture

I need an example please
thanks
SamooramadAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
CEHJConnect With a Mentor Commented:
You'd be better off with a JEditorPane + html
0
 
sudhakar_koundinyaConnect With a Mentor Commented:
try {
        String url = "some html.html";
        JEditorPane editorPane = new JEditorPane(url);
        editorPane.setEditable(false);
   
        JFrame frame = new JFrame();
        frame.getContentPane().add(editorPane, BorderLayout.CENTER);
        frame.setSize(width, height);
        frame.setVisible(true);
    } catch (IOException e) {
    }
0
 
sudhakar_koundinyaCommented:
if you use this constructor

public JEditorPane(String type,
                   String text)


 try {
        String url = "some html.html";
        JEditorPane editorPane = new JEditorPane("text/html","<H1>Test</h1><br><h2>Test2</h2>");
        editorPane.setEditable(false);
   
        JFrame frame = new JFrame();
        frame.getContentPane().add(editorPane, BorderLayout.CENTER);
        frame.setSize(width, height);
        frame.setVisible(true);
    } catch (IOException e) {
    }
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
CEHJCommented:
<html><body><h3><center>Caption</center></h3><hr>alksjdlaksdlkajsld<img src="yourfile.jpg"></img>slkdjfslkdjfls</body></html>
0
 
SamooramadAuthor Commented:
where do I declare and use the editor pane?
0
 
CEHJCommented:
Well that's a bit of a 'how long's a piece of string?' question ;-)
0
 
SamooramadAuthor Commented:
:) sorry CEHJ .. I must be tired..but I don't seem to get it (how to use the code posted)
0
 
CEHJCommented:
Just put the String i posted into sudhakar's JEditorPane ctor and use the rest of his example
0
 
SamooramadAuthor Commented:
is
public JEditorPane(String type,String text)

supposed to be a class?
0
 
SamooramadAuthor Commented:
never mind..I just got it..I do need a break..I will get back to you tomorrow

thanks
0
 
SamooramadAuthor Commented:
hey CEHJ I got an error under the image file name that said: ) expected..
I had to remove: <img src="yourfile.jpg"></img>
to get rid of the error

also sudhakar, I had to change IOException to Exception because of another error
0
 
SamooramadAuthor Commented:
It works I just need to know how to add the image
0
 
CEHJCommented:
8-)

>>hey CEHJ I got an error ...

That doesn't tell us anything - please post it
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.