Exception in thread "main" java.lang.NullPointerException вы водит при таком коде:
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class Clicker {
private static boolean Stage = false;
private static int Coins = 0;
private static JButton button4;
private static JFrame Shop;
private static JFrame Clicker3;
public static void main (String [] args){
Clicker3 = new JFrame("Clicker");
JButton button = new JButton("Click me");
JButton button2 = new JButton("Shop");
JPanel panel = new JPanel(new FlowLayout());
JLabel label = new JLabel("Coins:"+ Coins);
Clicker3.add(panel, BorderLayout.SOUTH);
Clicker3.add(label, BorderLayout.NORTH);
panel.add(button);
panel.add(button2);
Clicker3.setVisible(true);
Clicker3.setSize(350, 350);
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
if(Stage = true){
Coins=Coins + 1;
Update();
}else{
Coins=Coins +2;
Update();
}
}
private void Update() {
label.setText("Coins:"+ Coins);
}
});
button2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg1){
Shop = new JFrame("Shop");
JPanel panel3 = new JPanel(new FlowLayout());
button4 = new JButton("X2");
panel3.add(button4);
Shop.add(panel3, BorderLayout.CENTER);
Shop.setVisible(true);
Shop.setSize(350, 350);
}
});
button4.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg2){
if (Coins !=100 | Coins > 100){
Coins=Coins - 100;
Stage = true;
System.out.println("+");
}else{
System.out.println("-");
}
}
});
}
}