Hi All,
I had developed an application that displays several images in a JList . The images are displayed vertically. Below is the outline of my code:
The problem:Code:JPanel imgpanel1=new JPanel(); JPanel imgpanel2=new JPanel(); ..... ImageIcon img1=new ImageIcon("bookimages/img1.jpg"); ImageIcon img2=new ImageIcon("bookimages/img2.jpg"); .... imgpanel1.add(new JLabel(img1)); imgpanel2.add(new JLabel(img2)); ....... JList list=new JList(); list.setCellRenderer(new CustomCellRenderer()); // implements ListCellRenderer Vector data=new Vector(); vector.addElement(imgpanel1); vector.addElement(imgpanel2); .... list.setListData(data); Panel mypanel=new Panel(); mypanel.add(list,BorderLayout.WEST);
I am unable to display images horizontally in a JList. I've even used the method
setLayoutOrientation(JList.HORIZONTAL_WRAP).
I am new to Swing development, please give me an idea to display images horizontally in a JList. . Please help me guys.
Thanks in advance


Reply With Quote


Bookmarks