Mam taką aplikacje do wyswietlania adresu MAC i za cholerę nie mogę poradzić sobie z tym aby przerobić to na aplet.
-------
import java.net.InetAddress;
import java.net.NetworkInterface;
public class testmac
{
private static final long serialVersionUID = 1L;
public static void main(String[] args) throws Exception {
InetAddress addr = InetAddress.getLocalHost();
NetworkInterface ni = NetworkInterface.getByInetAddress(addr);
byte[] maca = ni.getHardwareAddress();
for (int k = 0; k < maca.length; k++) {
System.out.format("%02X%s", maca[k], (k < maca.length - 1) ? "-" : "");
}
}
}
-----
Próbowałem to przerobić w ten sposób ale w przeglądarce nic się nie wyświetla;/
-------
import java.net.InetAddress;
import java.net.NetworkInterface;
import javax.swing.JApplet;
public class testmac extends JApplet
{
private static final long serialVersionUID = 1L;
public static void init(String[] args) throws Exception {
InetAddress addr = InetAddress.getLocalHost();
NetworkInterface ni = NetworkInterface.getByInetAddress(addr);
byte[] maca = ni.getHardwareAddress();
for (int k = 0; k < maca.length; k++) {
System.out.format("%02X%s", maca[k], (k < maca.length - 1) ? "-" : "");
}
}
}
-----
