scrollPane cant get scrollbar

baubsmyth

New Member
Hi i have a scrollPane that i am filling dynamically in my code.the problem is that i cant get it to grow in scoope.ive tried alott of the tips i can find online but nothing gets it to appear.im looping out 10 components but the size always stays the same.\[code\] B = new JScrollPane(); B.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); B.setViewportBorder(null); B.setBounds(12, 53, 330, 400); //making the scrollPane loadArtists(country); // loading the method with the content contentPane.add(B); // the content method public void loadArtists(String country){ ArrayList<Artist> top10A = Methods.getTopArtist(country); // top atrister B.removeAll(); String [] genre =Methods.getGenreArtist(country); Component2[] comp = new Component2[10]; // skriv ut infoh?llare for (int i = 0; i < top10A.size(); i++) { comp = new Component2(this); comp.setBounds(0, 0, 327, 68); comp.setLocation(0, 0 + space2); ImageIcon[] panel= new ImageIcon[10]; int lyssnare = top10A.get(0).getListeners(); try { URL url2 = new URL((top10A.get(i).getImageURL(ImageSize.valueOf("MEDIUM")))); panel= new ImageIcon(url2); } catch (MalformedURLException e) { // TODO Auto-generated catch block panel= new ImageIcon(GUI.class.getResource("/bilder/super.jpg")); e.printStackTrace(); } comp.setInfo(panel,top10A.get(i).getListeners(), top10A.get(i).getName().toString(), String.valueOf(i+1),genre,lyssnare,""); B.add(comp); space2 = space2 + 75; //B.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); B.repaint(); }}\[/code\]
 
Back
Top