Reputation: 597
I should create a list of users as result of a query in twitter like in Google. I'd like to represent the results in the following way:
Since now, I have been using a JTextArea, to which I have been appending the name, the sex, the location of the user and some tweets that match the query (if necessary), but now I'd like to show also the profile image and I think It would be necessary to put all the information about each user in a JPanel, but I need to attach dynamically new JPanels to the same JScrollPane and I don't know how to do this.
Upvotes: 0
Views: 55
Reputation:
Use a JEditorPane with HTML content. For example, the code below will add in your image:
JEditorPane pane = new JEditorPane();
pane.setContentType("text/html");
String urlForImage = "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
pane.setText("<html><img src=\"" + urlForImage + "\" /></html>");
myJframe.add(pane);
Upvotes: 1