I am trying to load an Image
into a List
but I can't seem to get it to work. I have tried
ImageIcon pic = new ImageIcon("http://i3.ytimg.com/vi/68X8RUxeXeA/default.jpg");
JLabel picLbl = new JLabel(pic);
Object[] lol = {picLbl, "pic", "length"};
list = new JList(lol);
scrollPane.setViewportView(list);
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
That just puts javax.swing.JLabel[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=8388608,maximumSize=,minimumSize=,preferredSize=,defaultIcon=http://i3.ytimg.com/vi/68X8RUxeXeA/default.jpg,disabledIcon=,horizontalAlignment=CENTER,horizontalTextPosition=TRAILING,iconTextGap=4,labelFor=,text=,verticalAlignment=CENTER,verticalTextPosition=CENTER]
Instead of the actual picture. I have looked around for a while but can't seem to find anything that works. If any of you guys know how to achieve this, any help will be greatly appreciated.
Thanks in advance