コード例 #1
0
 public void setSelectionInterval(int anchor, int lead) {
   super.setSelectionInterval(anchor, lead);
   int min = Math.min(anchor, lead);
   int max = Math.max(anchor, lead);
   // Table may be showing 0 bytes, but we're showing 1 row header
   if (max < table.getRowCount()) {
     table.setSelectedRows(min, max);
   }
 }
コード例 #2
0
 /**
  * Constructor.
  *
  * @param table The table displaying the hex content.
  */
 public HexEditorRowHeader(HexTable table) {
   this.table = table;
   model = new RowHeaderListModel();
   setModel(model);
   setFocusable(false);
   setFont(table.getFont());
   setFixedCellHeight(table.getRowHeight());
   setCellRenderer(new CellRenderer());
   setBorder(new RowHeaderBorder());
   setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
   syncRowCount(); // Initialize to initial size of table.
   table.getModel().addTableModelListener(this);
 }
コード例 #3
0
 private void syncRowCount() {
   if (table.getRowCount() != model.getSize()) {
     // Always keep 1 row, even if showing 0 bytes in editor
     model.setSize(Math.max(1, table.getRowCount()));
   }
 }
コード例 #4
0
 public void removeSelectionInterval(int index0, int index1) {
   super.removeSelectionInterval(index0, index1);
   int anchor = getAnchorSelectionIndex();
   int lead = getLeadSelectionIndex();
   table.setSelectedRows(Math.min(anchor, lead), Math.max(anchor, lead));
 }
コード例 #5
0
 public void addSelectionInterval(int anchor, int lead) {
   super.addSelectionInterval(anchor, lead);
   int min = Math.min(anchor, lead);
   int max = Math.max(anchor, lead);
   table.setSelectedRows(min, max);
 }