@Override public Class<?> getColumnClass(int column) { return getValueAt(0, column).getClass(); } };
@Override protected void paintComponent(Graphics g) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); int w = image.getWidth(this); int h = image.getHeight(this); if (mode == Flip.VERTICAL) { AffineTransform at = AffineTransform.getScaleInstance(1d, -1d); at.translate(0, -h); Graphics2D g2 = (Graphics2D) g.create(); g2.drawImage(image, at, this); g2.dispose(); } else if (mode == Flip.HORIZONTAL) { AffineTransform at = AffineTransform.getScaleInstance(-1d, 1d); at.translate(-w, 0); AffineTransformOp atOp = new AffineTransformOp(at, null); g.drawImage(atOp.filter(image, null), 0, 0, w, h, this); } else { // if (mode == Flip.NONE) { g.drawImage(image, 0, 0, w, h, this); } } };
@Override public void show(Component c, int x, int y) { System.out.println(c.getClass().getName()); if (check.isSelected()) { Point p = new Point(x, y); Rectangle r = c.getBounds(); Dimension d = getPreferredSize(); if (p.x + d.width > r.width) { p.x -= d.width; } if (p.y + d.height > r.height) { p.y -= d.height; } super.show(c, Math.max(p.x, 0), Math.max(p.y, 0)); } else { super.show(c, x, y); } } };
@Override public void done() { // System.out.println("done() is EDT?: " + EventQueue.isDispatchThread()); if (!isDisplayable()) { cancel(true); return; } anil.stopAnimation(); runButton.setEnabled(true); cancelButton.setEnabled(false); statusPanel.remove(bar); statusPanel.revalidate(); appendLine("\n"); try { if (isCancelled()) { appendLine("Cancelled"); } else { appendLine(get()); } } catch (InterruptedException | ExecutionException ex) { appendLine("Interrupted"); } appendLine("\n\n"); } };
@Override public Class<?> getColumnClass(int column) { return getValueAt(0, column).getClass(); } };
@Override public Class<?> getColumnClass(int column) { return getValueAt(0, column).getClass(); }
@Override protected void process(List<String> chunks) { // System.out.println("process() is EDT?: " + EventQueue.isDispatchThread()); if (isCancelled()) { return; } if (!isDisplayable()) { cancel(true); return; } chunks.forEach(s -> appendLine(s)); }
@Override public Component prepareRenderer(TableCellRenderer tcr, int row, int column) { Component c = super.prepareRenderer(tcr, row, column); if (isRowSelected(row)) { c.setForeground(getSelectionForeground()); c.setBackground(getSelectionBackground()); } else { c.setForeground(getForeground()); c.setBackground(row % 2 == 0 ? evenColor : getBackground()); } return c; } };