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.
private JMenuItem getJMenuItem_aus1() {
if (jMenuItem_aus1 == null) {
jMenuItem_aus1 = new JMenuItem();
jMenuItem_aus1.setText("Anw1");
jMenuItem_aus1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
Anw1 anw1 = new Anw1();
Start.this.getContentPane().add(anw1);
Start.this.repaint();
}
});
}
return jMenuItem_aus1;
}
import java.awt.BorderLayout;
import java.awt.CardLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
public class Start extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JMenuBar jJMenuBar = null;
private JMenu jMenu = null;
private JMenuItem jMenuItem_aus1 = null;
private JMenuItem jMenuItem_aus2 = null;
public Start() {
super();
initialize();
}
private void initialize() {
this.setSize(300, 200);
this.setJMenuBar(getJJMenuBar());
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
Anw1 anw1 = new Anw1();
Anw2 anw2 = new Anw2();
getJContentPane().add("anw1", anw1);
getJContentPane().add("anw2", anw2);
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new CardLayout());
}
return jContentPane;
}
private JMenuBar getJJMenuBar() {
if (jJMenuBar == null) {
jJMenuBar = new JMenuBar();
jJMenuBar.add(getJMenu());
}
return jJMenuBar;
}
private JMenu getJMenu() {
if (jMenu == null) {
jMenu = new JMenu();
jMenu.setText("Auswahl");
jMenu.add(getJMenuItem_aus1());
jMenu.add(getJMenuItem_aus2());
}
return jMenu;
}
private JMenuItem getJMenuItem_aus1() {
if (jMenuItem_aus1 == null) {
jMenuItem_aus1 = new JMenuItem();
jMenuItem_aus1.setText("Anw1");
jMenuItem_aus1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
((CardLayout)getJContentPane().getLayout()).show(getJContentPane(), "anw1");
}
});
}
return jMenuItem_aus1;
}
private JMenuItem getJMenuItem_aus2() {
if (jMenuItem_aus2 == null) {
jMenuItem_aus2 = new JMenuItem();
jMenuItem_aus2.setText("Anw2");
jMenuItem_aus2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
((CardLayout)getJContentPane().getLayout()).show(getJContentPane(), "anw2");
}
});
}
return jMenuItem_aus2;
}
public static void main(String[] args) {
new Start().setVisible(true);
}
}