Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
public class GUI {
private static GUI instance = null;
static JFrame f;
protected static CardLayout cards;
private JPanel menue,anleitung,info,spiel,score, spielfeld;
Container contentPane;
public GUI(){..
contentPane = f.getContentPane();
cards = new CardLayout();
contentPane.setLayout(cards);
contentPane.add(menue,"eins");
contentPane.add(anleitung,"zwei");
}
public static GUI getInstance(){
if(instance == null)
instance = new GUI;
return instance;
}
public void show(Container contentPane, String zwei) {
cards.show(contentPane,"zwei");
}
public class GUIListener extends GUI implements ActionListener{
public GUI karten; // So geändert !
public void actionPerformed(ActionEvent event) {
String a = event.getActionCommand();
if(a.equals("neu"))
{
karten.show(contentPane, "zwei");
}
public void show(String string) {
cards.show(contentPane,string);
}
public class GUIListener extends GUI implements ActionListener{
private GUI karten = GUI.getInstance(); // So geändert !
public void actionPerformed(ActionEvent event) {
String a = event.getActionCommand();
if(a.equals("neu"))
{
karten.show("zwei");
}
public class Start {
public static void main(String[] args) {
GUI.getInstance();
}
}
public class Start {
public static void main(String[] args) {
GUI.getInstance();
public class GUI {
private static GUI instance = null;
static JFrame f;
protected static CardLayout cards;
private JPanel menue,anleitung,info,spiel,score, spielfeld;
Container contentPane;
public GUI(){
.... // CardLayout erschaffen
}
public static GUI getInstance(){
if(instance == null)
instance = new GUI();
return instance;
}
public void show(String string) {
cards.show(contentPane,string);
}
public class GUIListener extends GUI implements ActionListener{
private GUI karten = GUI.getInstance();
public void actionPerformed(ActionEvent event) {
String a = event.getActionCommand();
if(a.equals("neu"))
{
karten.show("zwei");
}
public class Menue extends JPanel {
static GUIListener action = new GUIListener();
public Menue(){...}
JButton neuesSpiel = new JButton("Neues Spiel");
neuesSpiel.setActionCommand("neu");
neuesSpiel.addActionListener(action);
public class GUI {
private static GUI instance = null;
public static GUI getInstance(){
if(instance == null)
instance = new GUI();
return instance;
private GUI karten = GUI.getInstance();