我有大小问题......因为我将Jpanel 和JFrame设置为特定大小,但是当我绘制图像时,就像窗口大小不同:
public GameView(){
//System.out.println("hey");
JFrame container= new JFrame("Loderunner");
JPanel panel= (JPanel) container.getContentPane();
panel.setPreferredSize(new Dimension(115,115));
panel.setMinimumSize(new Dimension(115,115));
panel.setLayout(null);
setBounds(0,0,115,115);
panel.add(this);
setIgnoreRepaint(true);
//requestFocus();
//addKeyListener(new KeyHandle());
//container.addKeyListener(new KeyHandle());
requestFocus();
container.setResizable(false);
container.pack();
container.setVisible(true);
container.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
createBufferStrategy(2);
strategy=getBufferStrategy();
loadLevel("livel.txt");
}
这是我的问题的图像: