Hi Alex,
Das funktioniert auch überall.
Das glaube ich nicht. Zeige mal ;-).
Ok, stimmt, das hatte plötzlich nicht mehr funktioniert. *achselzuck*
Allerdings wüsste ich nicht, dass ich noch etwas verändert und danach nicht mehr getestet habe, bevor ich den Quellcode veröffentlicht hab... :)
Was dagegen nicht funktioniert, ist die Darstellung von Buttons im Firefox.
Doch, das funktioniert:
Bei mir funkt das auch nicht, bei Dir schon? :)
Momentan schaut der Sourcecode mal so aus:
Stromkreis.java:
___________________________________________________________________________
import java.applet.*;
import java.awt.*;
public class Stromkreis extends Applet
{
Image MyImage;
Canvas Grafik;
public void init()
{
try
{
this.setBounds ( 0, 0, 600, 600 );
this.setLayout( new BorderLayout () );
Container buttonFrame1 = new Container ();
buttonFrame1.setBounds ( 0, 0, 300, 300 );
buttonFrame1.setLayout ( new FlowLayout () );
Container buttonFrame2 = new Container ();
buttonFrame2.setBounds ( 0, 0, 300, 300 );
buttonFrame2.setLayout ( new FlowLayout () );
Grafik = new ImgShowComponent (this, "leitergrafik.jpg" );
this.add ( BorderLayout.CENTER, Grafik );
String labeled1 = new String ( "Farbe wechseln 1" );
Button click1 = new Button(labeled1);
buttonFrame1.add ( click1 );
String labeled2 = new String ( "Farbe wechseln 2" );
Button click2 = new Button(labeled2);
buttonFrame2.add ( click2 );
this.add ( BorderLayout.NORTH, buttonFrame1 );
this.add ( BorderLayout.SOUTH, buttonFrame2 );
this.setVisible ( true );
}
catch ( Exception e )
{
System.out.println ( e );
}
}
}
___________________________________________________________________________
Stromkreis.html:
___________________________________________________________________________
<HTML>
<BODY>
<APPLET CODE=Stromkreis.class WIDTH=800 HEIGHT=800>
</APPLET>
</BODY>
</HTML>
___________________________________________________________________________
Im Eclipse und IE gehts wieder, während der Firefox sagt: "Fehler beim Laden des Java-Applets", allerdings erteilt der catch-Teil über System.out.println keine konkrete Auskunft dazu (was in Applets womöglich generell nicht gehen mag).
Schönen Sonntag noch! ;)
Michi