Java,如何进入JPanel

Java, how to get into the JPanel

我是 Java 的初学者。我的代码:

public PlanetSimulator() throws InterruptedException {
    JPanel panel = new JPanel();
    panel.setBounds(64, 35, 840, 600);
    Draw view = new Draw();
    panel.add(view);

在面板太阳和星星和黑色背景中绘图。

我怎么说Java"Hey you see that panel? Draw there another thing" 但我说的是 Java 不是来自 PlanetSimulator,而是主要功能。

public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                PlanetSimulator frame = new PlanetSimulator();
                frame.setVisible(true);
                //DrawPlanetOne DrawPlanetOne = new DrawPlanetOne()
                //PlanetSimulator.panel.add(DrawPlanetOne)
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}

但是没用。是的,我知道我是业余的。 Rysowanie / 平局 class http://pastebin.com/RkcTBxrN

我想,这将是一个模拟。而且,如果您想用 30FPS 模拟某些东西,使用 Panel 会很困难。您可以使用像 processing to animate your planets and stuff. It's a lot easier as using a JPane. But you could call the repaint 方法这样的库吗?