CommandPanel(Commande c) { super(new BorderLayout()); commande = c; commande.addActionEventListener(this); JPanel text = new JPanel(); text.addMouseListener(this); text.add(new JLabel(commande.getName())); add(text, BorderLayout.PAGE_START); itemList = new JPanel(new GridBagLayout()); itemList.addMouseListener(this); itemList.setBackground(Color.WHITE); JScrollPane pane = new JScrollPane(itemList); pane.setPreferredSize(new Dimension(95, 100)); add(pane, BorderLayout.CENTER); drawItems(); }
public UICommande(Tablette handler, Commande commande) { super(handler); this.commande = commande; itemPanel = new JPanel(new GridBagLayout()); JPanel nameHolder = new JPanel(); nameHolder.add(new JLabel(commande.getName())); add(nameHolder); JScrollPane itemPanelView = new JScrollPane(itemPanel); itemPanelView.setPreferredSize(new Dimension(320, 420)); itemPanelView.setBorder(null); add(itemPanelView); JButton addItem = new JButton("Ajouter Item"); addItem.setActionCommand("CAdd"); addItem.addActionListener(getHandler()); JPanel addItemHolder = new JPanel(); addItemHolder.add(addItem); add(addItemHolder); redrawCommande(); }