0
JDBC를 통해 mysql의 데이터로 채워진 일부 레이블을 매핑했습니다. 테두리 레이아웃에서 North, Center 및 South 데이터를 매핑했습니다.내 경계 레이아웃보기의 남쪽 구역이 보이지 않는 이유는 무엇입니까?
여기 처음에는 SOUTH 섹션이 표시되지 않는 코드
panels = new JPanel();
panels.setBackground(Color.blue);
panels.setLayout(new BoxLayout(panels, BoxLayout.X_AXIS));
statuslabel = new JLabel(company.getDBstatus(1) + " ");
statuslabel.setForeground(Color.white);
statuslabel.setFont(new Font("ANDALUS", Font.BOLD, 16));
statuslabel.setBorder(BorderFactory.createTitledBorder("Status"));
positionlabel = new JLabel(company.getDBposition(1) + " ");
positionlabel.setForeground(Color.white);
positionlabel.setFont(new Font("ANDALUS", Font.BOLD, 16));
positionlabel.setBorder(BorderFactory.createTitledBorder("Open Position"));
referencelabel = new JLabel(company.getDBreference(1));
referencelabel.setForeground(Color.white);
referencelabel.setFont(new Font("ANDALUS", Font.BOLD, 16));
referencelabel.setBorder(BorderFactory.createTitledBorder("Reference"));
panels.add(statuslabel);
panels.add(positionlabel);
panels.add(referencelabel);
contentPane.add(panels, BorderLayout.SOUTH);
}
입니다. 테두리 크기 변경을 주석 처리하면 경계선을 클릭하면 남쪽이 나타나고, 다른 항목을 선택하면 초기 레코드에서도 남쪽이 나타납니다.
어떻게해야합니까?
최상위 창에서'pack()'을 호출합니까? 그렇다면'pack()'과'setResizable (false)'를 호출하는 것과 관련된 명령은 무엇입니까? 다른 말로하면, 당신은 어느 쪽을 먼저 부르고 어떤 쪽을 부릅니까? 주문 교환을 시도 했습니까? –
pack()이 추가되었으며 문제가 해결되었습니다. 뱀장어 문제를 쉽게 풀 수 있기를 바랍니다. – TangibleDream
다행이라면 잘 했어! –