这是我在 Eclipse 上使用的代码,我不明白我哪里出错了。我是Java初学者,所以我对这个主题不太熟悉。任何帮助将非常感激。当我尝试通过运行程序查看我已经走了多远时,错误总是会出现,请缓解计算机术语,我是这个大声笑的新手。
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
public class CBombRombot extends JFrame implements ActionListener, ChangeListener {
private JPanel panel;
private JPanel bottompanel;
private JPanel rightpanel;
private static void main(String[] args) {
CBombRombot frame = new CBombRombot();
frame.setTitle("CBombRobot Application");
frame.setSize(875, 550);
frame.show();
frame.setResizable(false);
frame.setLocationRelativeTo(null);
}
private void createGUI() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container window = getContentPane();
window.setLayout(new BorderLayout());
panel = new JPanel();
panel.setPreferredSize(new Dimension(650, 450));
panel.setBackground(Color.white);
window.add(panel);
rightpanel = new JPanel();
rightpanel.setPreferredSize(new Dimension(200, 180));
rightpanel.setBackground(Color.lightGray);
window.add(rightpanel, BorderLayout.EAST);
bottompanel = new JPanel();
bottompanel.setPreferredSize(new Dimension(400, 50));
bottompanel.setBackground(Color.lightGray);
window.add(bottompanel, BorderLayout.SOUTH);
}
@Override
public void stateChanged(ChangeEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
}