I am a total noob to jpanel and I learned everything from the web so I don't know what I am doing wrong. I have this simple function for a Jpanel setup:
private static void GUI(String TIME, int Action){
    if (Action == 1){
        JFrame EnterMessage = new JFrame("Tester");
        EnterMessage.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        EnterMessage.setSize(190, 80);
        EnterMessage.setVisible(true);
        JPanel Panel = new JPanel();
        Panel.setBackground(Color.WHITE);
        JLabel TextLabel = new JLabel(TIME);
        Panel.add(TextLabel);
        EnterMessage.add(Panel);
    }else {
        Panel.removeAll(); //Comment 1
        }
    }
}
Comment 1: after removing all stuff I still need to refresh but I didn't got to that yet, first I need to fix errors (Otherwise you would be scrolling way to long.)
Basicly when I hover over the 'removeAll();' in eclipse It tels me this: Cannot make a static reference to the non-static method removeAll() from the type Container
What does that mean? And how to fix it?
I did search google and stack for this one but I could not find anything that looked like my code so I could not use that
Full code:
package Main;
import java.awt.Color;
import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.Panel;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import junit.framework.Test;
public class MainClass {
static String TIME = functions.gettime();
private static boolean wPressed = false;
public static boolean isWPressed() {
    synchronized (MainClass.class) {
        return wPressed;
    }
}
public static void main(String[] args) {
    GUI(TIME,1);
    System.out.printf("before key \n");
        KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new     KeyEventDispatcher() {
    @Override
    public boolean dispatchKeyEvent(KeyEvent ke) {
        synchronized (Test.class) {
            switch (ke.getID()) {
            case KeyEvent.KEY_PRESSED:
                if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
                    System.out.printf("Enter Key Detected");
                    TIME = functions.gettime();
                    GUI(TIME,2);
                    break;
                }
                break;
            }
        }
        return false;
    }
});
  JFrame test = new JFrame();
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
test.setVisible(false);
}
private static void GUI(String TIME, int Action){
if (Action == 1){
    JFrame EnterMessage = new JFrame("Tester");
    EnterMessage.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    EnterMessage.setSize(190, 80);
    EnterMessage.setVisible(true);
    JPanel Panel = new JPanel();
    Panel.setBackground(Color.WHITE);
    JLabel TextLabel = new JLabel(TIME);
    Panel.add(TextLabel);
    EnterMessage.add(Panel);
}else {
    Panel.removeAll();
    }
}
}