Пример #1
0
    @Override
    public Component getTableCellRendererComponent(
        JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      //        //System.out.println(table.getModel().getClass().getSimpleName());
      Object tmp = table.getModel().getValueAt(row, 0);
      //        //System.out.println(Visualizer.findNode(tmp).getClass().getSimpleName());
      LabelSniffer ls = Visualizer.findNode(tmp).getLookup().lookup(LabelSniffer.class);
      try {
        if (ls != null) {
          //                    //System.out.println(actualCols[(column-1) * 2]);
          LabelProvider label;
          if ((label = ls.findLabelProvider(actualCols[(column - 1) * 2])) != null) {
            JLabel lab = label.getLabel();
            lab.setOpaque(isSelected);
            if (isSelected) {
              lab.setBackground(table.getSelectionBackground());
            }
            return label.getLabel();
          }
        }
      } catch (Exception ex) {
        ex.printStackTrace();
      }

      return new JLabel("tmp");
      //            //System.out.println("bez labela dla "+actualCols[(column-1) * 2]);
      //            Component comp = rend.getTableCellRendererComponent(table, value, isSelected,
      // hasFocus, row, column);
      //            return comp;
    }
Пример #2
0
 @Override
 public void mouseClicked(MouseEvent e) {
   int row = outline.rowAtPoint(e.getPoint());
   int col = outline.columnAtPoint(e.getPoint());
   if (prevCol == col && prevRow == row && System.currentTimeMillis() - time < 500) {
     Node node = Visualizer.findNode(outline.getValueAt(row, 0));
     time = 0;
     node.getPreferredAction().actionPerformed(null);
   } else {
     time = System.currentTimeMillis();
   }
   prevRow = row;
   prevCol = col;
 }