public void setTermTablePanel(TermTablePanel ttp) { if (termTablePanel != null) main.remove(termTablePanel); termTablePanel = ttp; main.add(ttp); uacalc.validate(); repaint(); }
public ComputationsPanel(final UACalculator uacalc) { super(JSplitPane.VERTICAL_SPLIT); setOneTouchExpandable(true); Dimension minimumSize = new Dimension(100, 100); Dimension preferredSize = new Dimension(100, 400); this.uacalc = uacalc; // setLayout(new BorderLayout()); main = new JPanel(); main.setMinimumSize(minimumSize); main.setPreferredSize(preferredSize); main.setLayout(new BorderLayout()); JPanel fieldsPanel = new JPanel(); main.add(fieldsPanel, BorderLayout.NORTH); setTopComponent(main); // monitorPanel = new MonitorPanel(uacalc); monitorPanel = uacalc.getMonitorPanel(); // add(monitorPanel, BorderLayout.SOUTH); setBottomComponent(monitorPanel); setDividerLocation(getSize().height - getInsets().bottom - getDividerSize() - 150); /* fieldsPanel.add(new JLabel("Name:")); name_tf.setEditable(false); fieldsPanel.add(name_tf); fieldsPanel.add(new JLabel("Cardinality:")); card_tf.setEditable(false); fieldsPanel.add(card_tf); fieldsPanel.add(new JLabel("Description:")); desc_tf.setEditable(true); fieldsPanel.add(desc_tf); fieldsPanel.add(new JLabel("Operations")); resetOpsCB(); fieldsPanel.add(ops_cb); ops_cb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { OpSymItem item = (OpSymItem)ops_cb.getSelectedItem(); if (item == null) return; OperationSymbol opSym = item.getOperationSymbol(); OperationWithDefaultValue op = opMap.get(opSym); if (op != null) { OperationInputTable opTable = new OperationInputTable(op, uacalc); setOperationTable(opTable); } validate(); repaint(); } }); JButton delOpButton = new JButton("Del Op"); JButton addOpButton = new JButton("Add Op"); fieldsPanel.add(delOpButton); fieldsPanel.add(addOpButton); delOpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int n = JOptionPane.showConfirmDialog( uacalc, "Delete this operation?", "Delete this operatin?", JOptionPane.YES_NO_OPTION); if (n == JOptionPane.YES_OPTION) { removeCurrentOperation(); } } }); addOpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (opTablePanel != null && !opTablePanel.stopCellEditing()) { uacalc.beep(); return; } if (opList == null) { // algebra uacalc.beep(); return; } String name = getOpNameDialog(); if (name == null) return; int arity = getArityDialog(); if (arity == -1) return; addOperation(name, arity); } }); */ // add(main, BorderLayout.CENTER); validate(); }