F
Fran García
I´m developing an application that must access to port serials. I need
execute an applet which reads the information through the port serial. I´m
testing if that is possible with this example:
import javax.comm.*;
import com.sun.comm.*;
import javax.swing.*;
import java.awt.*;
import java.lang.*;
import java.util.*;
import java.io.*;
public class Applet1 extends JApplet{
static Enumeration listaPuertos;
static CommPortIdentifier idPuerto;
public void init() {
//String cadena = new String((new
Integer(CommPortIdentifier.PORT_SERIAL)).toString());
//getContentPane().add(new JLabel(cadena));
listaPuertos = CommPortIdentifier.getPortIdentifiers();
while( listaPuertos.hasMoreElements() ) {
idPuerto = (CommPortIdentifier)listaPuertos.nextElement();
if( idPuerto.getName().equals("COM1") )
getContentPane().add(new JLabel(idPuerto.getName()));
}
}
}
but it doesn´t work. I think that I have problems with the CLASSPATH for the
comm serial extension. Can anybody help me? Can anybody say any tip for this
work?
Regards
Fran García
execute an applet which reads the information through the port serial. I´m
testing if that is possible with this example:
import javax.comm.*;
import com.sun.comm.*;
import javax.swing.*;
import java.awt.*;
import java.lang.*;
import java.util.*;
import java.io.*;
public class Applet1 extends JApplet{
static Enumeration listaPuertos;
static CommPortIdentifier idPuerto;
public void init() {
//String cadena = new String((new
Integer(CommPortIdentifier.PORT_SERIAL)).toString());
//getContentPane().add(new JLabel(cadena));
listaPuertos = CommPortIdentifier.getPortIdentifiers();
while( listaPuertos.hasMoreElements() ) {
idPuerto = (CommPortIdentifier)listaPuertos.nextElement();
if( idPuerto.getName().equals("COM1") )
getContentPane().add(new JLabel(idPuerto.getName()));
}
}
}
but it doesn´t work. I think that I have problems with the CLASSPATH for the
comm serial extension. Can anybody help me? Can anybody say any tip for this
work?
Regards
Fran García