Skip to main content

Recordset with audio and JTextArea...

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2012-08-03

hello averybody....

i'm creatibg one program....
in this program i have one db and in table i have nome, basi, testo.

in JList show only "nome"

but in doubleCick on "nome" i want show song and with jmf and text in JTextArea...

in my code when click on song i can listen and to see always the first recordset....

i want open base, testo relative "nome"

thi is cod.

try {	            			 
            conn = DriverManager.getConnection("jdbc:mysql://localhost/basi?user=root&password=root");
            stmt = conn.createStatement();
            //per visualizzare il db
            String sql = "SELECT base, testo FROM "+combo2.getSelectedItem();
            rs = stmt.executeQuery(sql);
            String testo = "" ;
            String base = "";

                        if (  {
                        testo = rs.getString("testo"); 
                        base = rs.getString("base");
                        file = new File(base);                        
                        MediaLocator mrl = new MediaLocator( file.toURI().toURL() );                            
                            player = Manager.createPlayer(mrl);
                            player.addControllerListener( new EventHandler() );
            File f = new File(testo);
            br = new BufferedReader(new FileReader(f));
            String st = "";
                    while((st=br.readLine()) != null){
                    if (!st.startsWith(">")) {
                    textArea.append(st + "\n");
                    textArea.setFont(new Font("times new roman", Font.BOLD, 30));                   
            catch (Exception exc) {
            System.out.println("Errore: "+ exc.getMessage());

i hope you can understand my english.....