protected void createGUI() { setTitle(app.getPlain("Substitute") + " - " + app.getCommand("Row") + " " + (editRow + 1)); setResizable(true); GeoCasCell cell = casView.getConsoleTable().getGeoCasCell(editRow); HashSet<GeoElement> vars = cell.getInputVE().getVariables(); Vector<String> row; if (vars != null) { data = new Vector<Vector<String>>(vars.size() + 1); Iterator<GeoElement> iter = vars.iterator(); while (iter.hasNext()) { row = new Vector<String>(2); GeoElement var = iter.next(); String nextVar = var.getLabel(); int i = 0; for (i = 0; i < data.size(); i++) { if (data.get(i).firstElement().compareTo(nextVar) >= 0) { break; } } if (i == data.size() || !data.get(i).firstElement().equals(nextVar)) { row.add(nextVar); row.add(""); data.insertElementAt(row, i); } } } else { data = new Vector<Vector<String>>(1); } row = new Vector<String>(2); row.add(""); row.add(""); data.add(row); Vector<String> header = new Vector<String>(); header.add(app.getPlain("OldExpression")); header.add(app.getPlain("NewExpression")); replaceTable = new JTable(data, header); replaceTable.setDefaultEditor(Object.class, new MathTextCellEditor()); replaceTable.getTableHeader().setReorderingAllowed(false); double fontFactor = Math.max(1, app.getGUIFontSize() / DEFAULT_FONT_SIZE); replaceTable.setRowHeight((int) (DEFAULT_TABLE_CELL_HEIGHT * fontFactor)); replaceTable.setPreferredScrollableViewportSize( new Dimension( (int) (DEFAULT_TABLE_WIDTH * fontFactor), (int) (DEFAULT_TABLE_HEIGHT * fontFactor))); scrollPane = new JScrollPane(replaceTable); captionPanel = new JPanel(new BorderLayout(5, 0)); captionPanel.add(scrollPane, BorderLayout.CENTER); replaceTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); replaceTable .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { addRow(false); } }); replaceTable.addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent e) { if (e.getKeyChar() != KeyEvent.CHAR_UNDEFINED && e.getKeyChar() != '\t') addRow(true); } }); // buttons btEval = new JButton("="); btEval.setToolTipText(app.getCommandTooltip("Evaluate")); btEval.setActionCommand("Evaluate"); btEval.addActionListener(this); btNumeric = new JButton("\u2248"); btNumeric.setToolTipText(app.getCommandTooltip("Numeric")); btNumeric.setActionCommand("Numeric"); btNumeric.addActionListener(this); btSub = new JButton(app.getPlain("\u2713")); btSub.setToolTipText(app.getCommandTooltip("Substitute")); btSub.setActionCommand("Substitute"); btSub.addActionListener(this); btPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); btPanel.add(btEval); btPanel.add(btNumeric); btPanel.add(btSub); // Create the JOptionPane. optionPane = new JPanel(new BorderLayout(5, 5)); // create object list optionPane.add(captionPanel, BorderLayout.CENTER); optionPane.add(btPanel, BorderLayout.SOUTH); optionPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // Make this dialog display it. setContentPane(optionPane); }