为什么我的小地图面板不在 JFrame 的右侧?
我的代码似乎是正确的,但我一定是犯了一个愚蠢的错误。请帮帮我:)
private static void loadResources() {
minimap.setMaximumSize(new Dimension(minimapWidth, minimapHeight));
minimap.setMinimumSize(new Dimension(minimapWidth, minimapHeight));
minimap.setPreferredSize(new Dimension(minimapWidth, minimapHeight));
panel.setMaximumSize(new Dimension(width, height));
panel.setMinimumSize(new Dimension(width, height));
panel.setPreferredSize(new Dimension(width, height));
minimap.setBackground(Color.red);
panel.setBackground(Color.GRAY);
panel.setLayout(new FlowLayout(FlowLayout.CENTER));
panel.add(minimap);
minimap.setLayout(new FlowLayout(FlowLayout.RIGHT));
Character.createCharacter();
frame.add(panel);
}