private void guardedPaint(Graphics g) { if (firstPaint) { firstPaint = false; calcRowHeight(g); //This will generate a repaint, so don't bother continuing with super.paint() //but do paint the background color so it doesn't paint gray the first time g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); return; } try { ExplorerTree.super.paint(g); } catch (NullPointerException ex) { // #139696: Making this issue more acceptable by not showing a dialog // still it deserves more investigation later LOG.log(Level.INFO, "Problems while painting", ex); // NOI18N } }
private void repaintSelection () { int first = getSelectionModel().getMinSelectionRow(); int last = getSelectionModel().getMaxSelectionRow(); if (first != -1) { if (first == last) { Rectangle r = getRowBounds(first); repaint (r.x,r.y,r.width,r.height); } else { Rectangle top = getRowBounds(first); Rectangle bottom = getRowBounds(last); Rectangle r = new Rectangle(); r.x = Math.min (top.x, bottom.x); r.y = top.y; r.width = getWidth(); r.height = bottom.y + bottom.height - top.y; repaint(r.x,r.y,r.width,r.height); } } }
private void repaintSelection () { int first = getSelectionModel().getMinSelectionRow(); int last = getSelectionModel().getMaxSelectionRow(); if (first != -1) { if (first == last) { Rectangle r = getRowBounds(first); repaint (r.x,r.y,r.width,r.height); } else { Rectangle top = getRowBounds(first); Rectangle bottom = getRowBounds(last); Rectangle r = new Rectangle(); r.x = Math.min (top.x, bottom.x); r.y = top.y; r.width = getWidth(); r.height = bottom.y + bottom.height - top.y; repaint(r.x,r.y,r.width,r.height); } } }
private void repaintSelection() { int first = getSelectionModel().getMinSelectionRow(); int last = getSelectionModel().getMaxSelectionRow(); if (first != -1) { if (first == last) { Rectangle r = getRowBounds(first); if (r == null) { repaint(); return; } repaint(r.x, r.y, r.width, r.height); } else { Rectangle top = getRowBounds(first); Rectangle bottom = getRowBounds(last); if (top == null || bottom == null) { repaint(); return; } Rectangle r = new Rectangle(); r.x = Math.min(top.x, bottom.x); r.y = top.y; r.width = getWidth(); r.height = (bottom.y + bottom.height) - top.y; repaint(r.x, r.y, r.width, r.height); } } }