버튼 그룹이 패널 중간에 있습니다. 유동적 레이아웃 제약 조건에서 패널 맨 위에 배치하려고합니다. 이를 성취하는데 도움이된다면 큰 도움이 될 것입니다. 나는 도크를 시도하고 정렬했지만 아무 것도하지 않았습니다.Miglayout 구성 요소를 셀 위쪽에 정렬
private class ProductPanel extends JPanel {
private JLabel lblProd;
private JButton butAdd;
private JButton butRemove;
private JButton butEdit;
private Product_Table_Model ptm;
private JScrollPane scroll;
private JPanel buttonPanel;
private JTable table;
ProductPanel() {
setLayout(new MigLayout("debug"));
ptm = new Product_Table_Model(
(ArrayList<Product>) client
.receiveObject("Get_Product_Data"));
initComponents();
}
public void initComponents() {
lblProd = new JLabel ("Product List: ");
buttonPanel = new JPanel (new MigLayout());
butAdd = new JButton ("Add");
butRemove = new JButton ("Remove");
butEdit = new JButton ("Edit");
buttonPanel.add(butAdd, "cell 0 0");
buttonPanel.add(butRemove, "cell 0 1");
buttonPanel.add(butEdit, "cell 0 2");
butAdd.setPreferredSize(new Dimension(40, 50));
add(lblProd, "wrap");
table = new JTable(ptm);
table.setFillsViewportHeight(true);
scroll = new JScrollPane(table);
add(scroll);
add(buttonPanel);
}
}
전체 예제를 제공해야합니다. 또 다른 문제가있다. 유동 모드의 버튼은 기본적으로 상단에 정렬됩니다. 코드로 업데이트 된 –
은 이미지 작업을 시도했지만 10 개의 평판이 없습니다. – Grim