public void addSearchResult(String str) { layoutCount++; /*if(layoutCount>=layoutMaxCount){ layout.setRows(layoutMaxCount+20); layoutMaxCount+=20; }*/ MyPanel temp = new MyPanel(); temp.setFullAddress(str); temp.setFileType(str.substring(0, 1).equalsIgnoreCase("1") ? 1 : 2); // temp.setBounds(0, layoutCount * 90 +10, 585, 90); if (layoutCount % 2 == 0) temp.toggleBackground(); this.resultPanel.add(temp); this.repaint(); }