public static String[] getSerialPortList() {
        Enumeration portList;
        portList = CommPortIdentifier.getPortIdentifiers();

        int serialPortCount = 0;
        while (portList.hasMoreElements()) {
            CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement();
            if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                serialPortCount++;
            }
        }

        String[] retVal = new String[serialPortCount];

        serialPortCount = 0;
        portList = CommPortIdentifier.getPortIdentifiers();
        while (portList.hasMoreElements()) {
            CommPortIdentifier portId = (CommPortIdentifier) portList.nextElement();
            if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                retVal[serialPortCount++] = portId.getName();
            }
        }

        return retVal;
    }
public static String [ ] getSerialPortList ( ) { Enumeration portList ; portList = CommPortIdentifier . getPortIdentifiers ( ) ; int serialPortCount = 0 ; while ( portList . hasMoreElements ( ) ) { CommPortIdentifier portId = ( CommPortIdentifier ) portList . nextElement ( ) ; if ( portId . getPortType ( ) == CommPortIdentifier . PORT_SERIAL ) { serialPortCount ++ ; } } String [ ] retVal = new String [ serialPortCount ] ; serialPortCount = 0 ; portList = CommPortIdentifier . getPortIdentifiers ( ) ; while ( portList . hasMoreElements ( ) ) { CommPortIdentifier portId = ( CommPortIdentifier ) portList . nextElement ( ) ; if ( portId . getPortType ( ) == CommPortIdentifier . PORT_SERIAL ) { retVal [ serialPortCount ++ ] = portId . getName ( ) ; } } return retVal ; }
Zwraca liste portow szeregowych

@return Zwraca liste portow szeregowych. Zwracana jest tablica string�w.
Stringi te mo�na u�y� w funkcji getSerialPort