protected void updateStatus() { checkButtons(); updateTable(); labelCurrent_.setText(makeLabelCurrent()); String led = ledList_.get(currentIdx_); lastExecutedDecision_.setText(led); lastExecutedDecision_.setCaretPosition(0); List<String> details = new Vector<String>(); StringTokenizer tok = new StringTokenizer(led, ":"); while (tok.hasMoreTokens()) details.add(tok.nextToken()); // TODO: put in Swing thread? ledTable_.setModel(Util.makeTableModel(details, new String[] {"toString"})); }
protected void updateTable() { // TODO: put in Swing thread? odTable_.setModel(Util.makeTableModel(odList_.get(currentIdx_), new String[] {"toString"})); }
public OpenDecisionsPanel() { odList_ = new Vector<List<String>>(); snList_ = new Vector<Integer>(); ledList_ = new Vector<String>(); currentIdx_ = -1; labelTotal_ = new JLabel(makeLabelTotal(), SwingConstants.CENTER); labelCurrent_ = new JLabel(makeLabelCurrent(), SwingConstants.CENTER); JPanel btnPanel = new JPanel(new FlowLayout()); btnPrev_ = new JButton("<<"); btnPrev_.addActionListener(this); btnPrev_.setActionCommand("prev"); btnNext_ = new JButton(">>"); btnNext_.addActionListener(this); btnNext_.setActionCommand("next"); checkButtons(); JButton btn; btn = new JButton("Go To Step"); btn.addActionListener(this); btn.setActionCommand("goto"); gotoIdx_ = new JTextField(6); btnPanel.add(btnPrev_); btnPanel.add(btnNext_); btnPanel.add(btn); btnPanel.add(gotoIdx_); lastExecutedDecision_ = new JTextArea(5, 10); lastExecutedDecision_.setLineWrap(true); JPanel topPanel = new JPanel(new BorderLayout()); JPanel p = new JPanel(new GridLayout(3, 1)); p.add(labelTotal_); p.add(btnPanel); p.add(new JLabel("Last Executed Decision", SwingConstants.CENTER)); ledTable_ = new JTable(); ledTable_.setTableHeader(null); ledTable_.setPreferredScrollableViewportSize(new Dimension(500, 70)); JTabbedPane tp = new JTabbedPane(); tp.addTab("As Table", new JScrollPane(ledTable_)); tp.addTab("As Text", new JScrollPane(lastExecutedDecision_)); topPanel.add(BorderLayout.NORTH, p); topPanel.add(BorderLayout.CENTER, tp); odTable_ = new JTable(Util.makeTableModel(odList_, new String[] {"toString"})); odTable_.setTableHeader(null); odTable_.setPreferredScrollableViewportSize(new Dimension(500, 70)); setLayout(new BorderLayout()); add(BorderLayout.NORTH, topPanel); JPanel odPanel = new JPanel(new BorderLayout()); odPanel.add(BorderLayout.NORTH, labelCurrent_); odPanel.add(BorderLayout.CENTER, new JScrollPane(odTable_)); add(BorderLayout.CENTER, odPanel); }