import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.ArrayList;
import java.applet.Applet;
public class MacAddressApplet extends Applet
{
public static String sep = ":";
public static String format = "%02X";
public static String macToString( NetworkInterface ni ) throws SocketException
{
return macToString( ni, MacAddressApplet.sep, MacAddressApplet.format );
}
public static String macToString( NetworkInterface ni, String separator, String format ) throws SocketException
{
byte mac [] = ni.getHardwareAddress();
if( mac != null ) {
StringBuffer macAddress = new StringBuffer( "" );
String sep = "";
for( byte o : mac ) {
macAddress.append( sep ).append( String.format( format, o ) );
sep = separator;
}
return macAddress.toString();
}
return null;
}
public static String getMacAddress()
{
try {
Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
while( nis.hasMoreElements() ) {
String mac = macToString( nis.nextElement() );
if( mac != null )
return mac;
}
} catch( SocketException ex ) {
System.err.println( "SocketException:: " + ex.getMessage() );
ex.printStackTrace();
} catch( Exception ex ) {
System.err.println( "Exception:: " + ex.getMessage() );
ex.printStackTrace();
}
return "undefined";
}
public static String getMacAddressesJSON()
{
try {
String macs [] = getMacAddresses();
String sep = "";
StringBuffer macArray = new StringBuffer( "['" );
for( String mac: macs ) {
macArray.append( sep ).append( mac );
sep = "','";
}
macArray.append( "']" );
return macArray.toString();
} catch( Exception ex ) {
System.err.println( "Exception:: " + ex.getMessage() );
ex.printStackTrace();
}
return "[]";
}
public static String [] getMacAddresses()
{
try {
Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
ArrayList<String> macs = new ArrayList<String>();
while( nis.hasMoreElements() ) {
String mac = macToString( nis.nextElement() );
if( mac != null ) {
macs.add( mac );
}
}
return macs.toArray( new String[0] );
} catch( SocketException ex ) {
System.err.println( "SocketException:: " + ex.getMessage() );
ex.printStackTrace();
} catch( Exception ex ) {
System.err.println( "Exception:: " + ex.getMessage() );
ex.printStackTrace();
}
return new String[0];
}
public static void setSep( String sep )
{
try {
MacAddressApplet.sep = sep;
} catch( Exception ex ) {
}
}
public static void setFormat( String format )
{
try {
MacAddressApplet.format = format;
} catch( Exception ex ) {
}
}
public static void main( String... args )
{
System.err.println( " MacAddress = " + getMacAddress() );
setSep( "-" );
String macs [] = getMacAddresses();
for( String mac : macs )
System.err.println( " MacAddresses = " + mac );
setSep( ":" );
System.err.println( " MacAddresses JSON = " + getMacAddressesJSON() );
}
} Java Applet Mac Adres Alma
7
●1.694
- 24-10-2010, 00:49:41Aşağıda ki kodlar ile istemcinin Mac Adres bilgilerini alabilirsiniz. Applettir.
- 24-10-2010, 01:11:12bunu nasıl çalıştırıcam onu da söyle kaynaklarını da ( örn phpde manual ) javaya giriş yapayım ben ufaktantolgasen adlı üyeden alıntı: mesajı görüntüle
- 24-10-2010, 01:14:26Önce bilgisayarında JDK kurulu olmalı ve bir derleyici (Netbeans, Eclipse gibi..) olmalı. Daha sonra boş Java Class oluştur o kodları yaz.Cycl0ne adlı üyeden alıntı: mesajı görüntüle
Hepsi javanın sitesinde var
- 24-10-2010, 01:53:05tolgasen arkadaşa teşekkür ediyorum http://rapidshare.com/files/42679789...let-1.0.tar.gz buda benden olsun arkadaşlar

Not: Benim kodlamam değildir. - 24-10-2010, 02:01:27derleniyormu bu java direk atmıyormuyuz servere kafam karıştııtolgasen adlı üyeden alıntı: mesajı görüntüle
- 24-10-2010, 11:11:54Eposta Aktivasyonu GerekmekteKaynak kodu derleyip, byte kod haline getiriyorsunuz.Yani gerçek bir derleme değil biraz optimizasyon yapılıyor derlenip düzeltiliyor.Daha sonra bu derlenmiş class lar ise java sanal makinesi tarafından gerçek manasında makine diline çevrilip, çalıştırılıyor.Cycl0ne adlı üyeden alıntı: mesajı görüntüle
Aslında bütün dilleri syntaxı birbirine çok benziyor.Php den sonra java ya kolay alıştım, gerçekten güzel bir dil.Şuan için 2 boyutlu yılan oyunu(masaüstü tabanlı) ve multi thread özelliği olan tcp protokolünü kullanan basit bir server-client yazdım.Clientte swing kullandım.Server konsol tabanlı.
3DzzD diye bir 3D motoru var, bu motor ile applet üzerinden 3 boyutlu uygulamalar yapabiliyorsunuz.Demolarından gördüğüm kadarıyla oldukça iyi bir performansı var.3D modelleri açabiliyor.Tabi bunun gibi birçok motor varda benim gözüme çarpan bu
Bu arada swing ile masaüstü uygulaması geliştirirken, bir müzik dosyasını nasıl çalabiliriz?Appletlerle ilgili bir kaç örnek buldum ama masaüstünde nasıl olabilir acaba?
Teşekkürler..