rendered paste body private void jComboBox1_actionPerformed(ActionEvent e) { int start; String ext; String content = ""; String parser = "-"; jComboBox2.removeAllItems(); File dir=new File(kodBankDBPath); File[] list=dir.listFiles(); for(int i=0;i<list.length;i++){ // System.out.println(list[i].getName()); start = list[i].getName().indexOf(parser); ext= list[i].getName().substring(0,start); int index = jComboBox1.getSelectedIndex(); //JOptionPane.showMessageDialog(this,index); //JOptionPane.showMessageDialog(this,ext); switch (index) { case 0: if(ext.equals("php")) { String name = list[i].getName().substring(start+1,list[i].getName().length()); jComboBox2.addItem(name); FileReader fileR; try { fileR = new FileReader(list[i].getName()); } catch (FileNotFoundException f) { System.out.println(f.getMessage()); } BufferedReader in=new BufferedReader(fileR); String line; try { while((line = in.readLine())!= null) { content += line+"\n"; } } catch (IOException f) { System.out.println(f.getMessage()); } jTextArea1.setText(content); } break;