-------------------전체 코드입니다--------------------
import java.awt.*;
import javax.swing.*;
class Control extends JFrame{
public Control(){
setSize(600,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Game_Control");
JPanel panel=new JPanel();
JPanel panel1=new JPanel();
JPanel panel2=new JPanel();
JPanel panel3=new JPanel();
JPanel panel4=new JPanel();
panel1.setLayout(new BorderLayout()); // panel1
JButton up,down,left,right;
up=new JButton("↑");
panel1.add(up,"North");
down=new JButton("↓");
panel1.add(down,"South");
left=new JButton("←");
panel1.add(left,"West");
right=new JButton("→");
panel1.add(right,"East");
panel2.setLayout(new FlowLayout()); // panel2
JButton select,menu,start;
select=new JButton("select");
panel2.add(select);
menu=new JButton("menu");
panel2.add(menu);
start=new JButton("start");
panel2.add(start);
panel3.setLayout(new GridLayout(2,2)); // panel3
JButton punch,kick,jump,block;
punch=new JButton("punch");
panel3.add(punch);
kick=new JButton("kick");
panel3.add(kick);
jump=new JButton("jump");
panel3.add(jump);
block=new JButton("block");
panel3.add(block);
panel4.setLayout(null); // panel4 <---출력x
JLabel coin = new JLabel("추가코인:");
JTextField maunal = new JTextField(10);
panel4.add(coin);
coin.setBounds(200, 100,60,50);
panel4.add(maunal);
maunal.setBounds(260, 115,60,20);
panel.add(panel1); // panel에 1~4 add
panel.add(panel2);
panel.add(panel3);
panel.add(panel4);
add(panel); // 1~4가 add된 panel 출력
setVisible(true);
}
}
public class ControlTest {
public static void main(String[] args) {
Control control = new Control();
}
}
-----------------------코드 끝---------------------
panel4.setLayout(null); 이후로 잘못한건가 해서
마지막에 add(panel);를 add(panel4);로 출력을 했더니 아래처럼 panel4 단독으로는 출력이 됩니다