java.awt.Point#equals ( )源码实例Demo

下面列出了java.awt.Point#equals ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Dayon   文件: MouseEngine.java
@java.lang.SuppressWarnings("squid:S2189")
private void mainLoop() throws InterruptedException {
    long start = System.currentTimeMillis();
    int captureCount = 0;

    Point previous = new Point(-1, -1);

    //noinspection InfiniteLoopStatement
    while (true) {
        final Point current = MouseInfo.getPointerInfo().getLocation();

        ++captureCount;

        if (!current.equals(previous) && fireOnLocationUpdated(current)) {
            previous = current;
        }

        final int delayedCaptureCount = syncOnTick(start, captureCount);

        captureCount += delayedCaptureCount;
    }
}
 
源代码2 项目: brModelo   文件: Forma.java
@Override
public void mouseReleased(MouseEvent e) {
    dragging = false;

    boolean bkp = isRaiseMuda();
    if (bkp) {
        setRaiseMuda(false);
    }
    super.mouseReleased(e);
    if (bkp) {
        setRaiseMuda(true);
    }

    if (jaSel) {
        boolean combine = (getMaster().isShiftDown() || getMaster().isControlDown());
        if (combine) {
            getMaster().DiagramaDoSelecao(this, true, false);
        }
    }
    Point enddown = new Point(e.getX(), e.getY());
    if (!enddown.equals(getIniDown())) {
        DoMuda();
    }
}
 
源代码3 项目: jdk8u60   文件: MutterMaximizeTest.java
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
源代码4 项目: jdk8u-dev-jdk   文件: MutterMaximizeTest.java
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
源代码5 项目: jdk8u_jdk   文件: MutterMaximizeTest.java
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
源代码6 项目: openjdk-jdk8u   文件: MutterMaximizeTest.java
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
源代码7 项目: hottub   文件: MutterMaximizeTest.java
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
源代码8 项目: jdk8u-jdk   文件: MutterMaximizeTest.java
private static Thread startRegTest(final Frame f) {
    Thread robot = new Thread(new Runnable() {
        public void run() {
            Robot r = Util.createRobot();
            dragWindow(f, 100, 100, r);
            // wait for the location to be set.
            sleepFor(2000);

            final Point l2 = f.getLocationOnScreen();

            // double click should maximize the frame
            doubleClick(r);

            // wait for location again.
            sleepFor(2000);
            final Point l3 = f.getLocationOnScreen();
            if (l3.equals(l2)) {
                throw new RuntimeException("Bad location after maximize. Window location has not moved");
            }
        }
    });
    return robot;
}
 
源代码9 项目: brModelo   文件: PreEspecializacao.java
@Override
public void setDirecaoTriangulo(Direcao direcaoTriangulo) {
    Point[] pts = getPontosDoTriangulo();

    //evita outras formas de direção.
    if (direcaoTriangulo.ordinal() > 3) {
        direcaoTriangulo = Direcao.Up;
    }
    setDirecaoNaoNotifique(direcaoTriangulo);
    DestruaRegiao();

    Point[] pts2 = getPontosDoTriangulo();

    ArrayList<PontoDeLinha> btns = getListaDePontosLigados();
    for (PontoDeLinha pdl : btns) {
        Point atual = pdl.getCentro();
        int i = 0;
        for (Point p : pts) {
            if (atual.equals(p)) {
                pdl.setCentro(pts2[i]);
                break;
            }
            i++;
        }
    }
    SendNotificacao(Constantes.Operacao.opReposicione);
    InvalidateArea();
}
 
源代码10 项目: brModelo   文件: FormaElementar.java
@Override
public void mouseReleased(MouseEvent e) {
    isMouseDown = false;
    DoRaizeReenquadreReposicione();
    if (isPontosIsHide()) {
        getMaster().HidePontosOnSelecao(false);
    }
    Point enddown = new Point(e.getX(), e.getY());
    if (!enddown.equals(inidown)) {
        DoMuda();
    }
    super.mouseReleased(e);
}
 
源代码11 项目: TencentKona-8   文件: DiagramScene.java
public void stateChanged(ChangeEvent e) {
    Point p = DiagramScene.this.getScrollPane().getViewport().getViewPosition();
    if (oldPosition == null || !p.equals(oldPosition)) {
        for (Widget w : relativePositions.keySet()) {
            Point curPoint = relativePositions.get(w);
            Point newPoint = new Point(p.x + curPoint.x, p.y + curPoint.y);
            w.setPreferredLocation(newPoint);
            DiagramScene.this.validate();
        }
        oldPosition = p;
    }
}
 
源代码12 项目: openjdk-8   文件: DiagramScene.java
public void stateChanged(ChangeEvent e) {
    Point p = DiagramScene.this.getScrollPane().getViewport().getViewPosition();
    if (oldPosition == null || !p.equals(oldPosition)) {
        for (Widget w : relativePositions.keySet()) {
            Point curPoint = relativePositions.get(w);
            Point newPoint = new Point(p.x + curPoint.x, p.y + curPoint.y);
            w.setPreferredLocation(newPoint);
            DiagramScene.this.validate();
        }
        oldPosition = p;
    }
}
 
源代码13 项目: jdk8u-jdk   文件: MultiScreenLocationTest.java
public static void main(String[] args) throws AWTException
{
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    if (gds.length < 2) {
        System.out.println("It's a multiscreen test... skipping!");
        return;
    }

    for (int i = 0; i < gds.length; ++i) {
        GraphicsDevice gd = gds[i];
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        Rectangle screen = gc.getBounds();
        Robot robot = new Robot(gd);

        // check Robot.mouseMove()
        robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
        Point mouse = MouseInfo.getPointerInfo().getLocation();
        Point point = screen.getLocation();
        point.translate(mouseOffset.x, mouseOffset.y);
        if (!point.equals(mouse)) {
            throw new RuntimeException(getErrorText("Robot.mouseMove", i));
        }

        // check Robot.getPixelColor()
        Frame frame = new Frame(gc);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
        frame.setBackground(color);
        frame.setVisible(true);
        robot.waitForIdle();
        Rectangle bounds = frame.getBounds();
        if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
            throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
        }

        // check Robot.createScreenCapture()
        BufferedImage image = robot.createScreenCapture(bounds);
        int rgb = color.getRGB();
        if (image.getRGB(0, 0) != rgb
            || image.getRGB(image.getWidth() - 1, 0) != rgb
            || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
            || image.getRGB(0, image.getHeight() - 1) != rgb) {
                throw new RuntimeException(
                        getErrorText("Robot.createScreenCapture", i));
        }
        frame.dispose();
    }

    System.out.println("Test PASSED!");
}
 
源代码14 项目: openjdk-jdk9   文件: ChangeWindowResizabiltyTest.java
public static void main(String[] args) throws Exception {
    Robot robot = new Robot();
    for(int i = 0; i < 10; i++) {
        Dialog dialog = new Dialog((Frame) null);
        dialog.setLocation(100, 100);
        Component panel = new Panel();
        panel.setPreferredSize(new Dimension(200, 100));
        dialog.add(panel);
        dialog.pack();
        dialog.setVisible(true);
        robot.waitForIdle();
        robot.delay(200);

        Point frameLoc = dialog.getLocationOnScreen();
        Point contentLoc = panel.getLocationOnScreen();

        System.out.println("Decor location " + frameLoc);
        System.out.println("Content location " + contentLoc);

        dialog.setResizable(false);
        robot.waitForIdle();
        robot.delay(200);

        Point l = dialog.getLocationOnScreen();
        if (!l.equals(frameLoc)) {
            dialog.dispose();
            throw new RuntimeException("Decorated frame location moved " +
                    "after setResizable(false)" + l);
        }

        l = panel.getLocationOnScreen();
        if (!l.equals(contentLoc)) {
            dialog.dispose();
            throw new RuntimeException("Content location moved after " +
                    "setResizable(false)" + l);
        }

        if (panel.getLocationOnScreen().y <
                  dialog.getLocationOnScreen().y + dialog.getInsets().top) {
            dialog.dispose();
            throw new RuntimeException(
                        "Wrong content position after setResizable(false)");
        }

        dialog.setResizable(true);
        robot.waitForIdle();
        robot.delay(200);

        l = dialog.getLocationOnScreen();
        if (!l.equals(frameLoc)) {
            dialog.dispose();
            throw new RuntimeException("Decorated frame location moved " +
                    "after setResizable(true)" + l);
        }

        l = panel.getLocationOnScreen();
        if (!l.equals(contentLoc)) {
            dialog.dispose();
            throw new RuntimeException("Content location moved after " +
                    "setResizable(true)" + l);
        }
        if (panel.getLocationOnScreen().y <
                  dialog.getLocationOnScreen().y + dialog.getInsets().top) {
            dialog.dispose();
            throw new RuntimeException(
                         "Wrong content position after setResizable(true)");
        }

        dialog.dispose();
    }
}
 
源代码15 项目: TrakEM2   文件: AreaWrapper.java
/** For best smoothness, each mouse dragged event should be captured!*/
public void run() {
	final AffineTransform at_inv;
	try {
		 at_inv = source.getAffineTransform().createInverse();
	} catch (NoninvertibleTransformException nite) {
		IJError.print(nite);
		return;
	}
	// create brush
	while (!isInterrupted()) {
		// detect mouse up (don't use 'flags': was recorded on starting up)
		if (0 == (dc.getModifiers() & leftClick)) {
			//Utils.log2("--------->>  Quit brushing from inside loop");
			quit();
			return;
		}
		final Point p = dc.getCursorLoc(); // as offscreen coords
		if (p.equals(previous_p) /*|| (null != previous_p && p.distance(previous_p) < brush_size/5) */) {
			try { Thread.sleep(3); } catch (InterruptedException ie) {}
			continue;
		}
		if (!dc.getSrcRect().contains(p.x, p.y)) {
			// Ignoring point off srcRect
			continue;
		}
		final Runnable task = new Runnable() {
			public void run() {
				final AffineTransform aff = new AffineTransform(1, 0, 0, 1, p.x, p.y);
				aff.preConcatenate(at_inv);
				final Area slash = slashInInts(brush.createTransformedArea(aff));
				synchronized (arealock) {
					if (0 == (flags & alt)) {
						// no modifiers, just add
						area.add(slash);
					} else {
						// with alt down, subtract
						area.subtract(slash);
					}
				}
				synchronized (pointslock) {
					points.add(p);
				}
				final Rectangle copy = new Rectangle(p.x - brush_size/2, p.y - brush_size/2, brush_size, brush_size);
				// repaint only the last added slash
				Display.repaint(la, 3, copy, false, false); 
				// accumulate rectangle for repainting out the brush circle
				synchronized (arealock) {
					if (null != r_old) copy.add(r_old);
					r_old = copy;
				}
			}
		};
		
		try {
			accumulator.submit(task);
		} catch (Throwable t) {
			// will happen when quit() calls accumulator.shutdown(),
			// which will then refuse to run any task.
			// Only the jobs completed up to this time point
			// will be finished, so the trace may finish earlier
			// than the mouse release point in slow computers.
			return;
		}

		previous_p = p;
	}
}
 
源代码16 项目: pumpernickel   文件: TextHighlightSheet.java
@Override
protected void paintComponent(Graphics g) {
	super.paintComponent(g);

	Point topLeft = new Point(0, 0);
	topLeft = SwingUtilities.convertPoint(this, topLeft, jtc);

	if (topLeft.equals(lastTopleft) == false) {
		// sometimes, for whatever reason: updateHighlights() isn't
		// called before a repaint comes in. To be fair:
		// updateHighlights WILL be called, but a split-second later, which
		// may result in the highlights jumping around on the page
		// in front of the user ever so briefly.
		// So instead here we may manually call updateHighlights() if we
		// have evidence that this component has moved.
		updateHighlights();
	}
	lastTopleft.setLocation(topLeft);

	Graphics2D g2 = (Graphics2D) g;
	g2.setComposite(
			AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
	Color background = getBackground();
	if (background != null) {
		g2.setColor(background);
		g2.fill(shadow);
	}

	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
			RenderingHints.VALUE_ANTIALIAS_ON);
	g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
			RenderingHints.VALUE_STROKE_PURE);

	if (isBorderActive()) {
		g2.translate(0, 1f);
		g2.setColor(new Color(0, 0, 0, 40));
		g2.setStroke(shadowStroke);
		g2.draw(highlightShape);
		g2.translate(0, -1f);
	}

	g2.setColor(getHighlightColor());
	g2.fill(highlightShape);

	if (isBorderActive()) {
		g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
				RenderingHints.VALUE_STROKE_NORMALIZE);
		g2.setColor(borderColor);
		g2.setStroke(borderStroke);
		g2.draw(highlightShape);
	}

	g2.clip(clippingShape);
	g2.translate(0, -topLeft.y);

	Graphics2D g3 = FilteredGraphics2D.createTextFilter(g2,
			getForeground());
	jtc.paint(g3);
	g3.dispose();
}
 
源代码17 项目: TencentKona-8   文件: MultiScreenLocationTest.java
public static void main(String[] args) throws AWTException
{
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    if (gds.length < 2) {
        System.out.println("It's a multiscreen test... skipping!");
        return;
    }

    for (int i = 0; i < gds.length; ++i) {
        GraphicsDevice gd = gds[i];
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        Rectangle screen = gc.getBounds();
        Robot robot = new Robot(gd);

        // check Robot.mouseMove()
        robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
        Point mouse = MouseInfo.getPointerInfo().getLocation();
        Point point = screen.getLocation();
        point.translate(mouseOffset.x, mouseOffset.y);
        if (!point.equals(mouse)) {
            throw new RuntimeException(getErrorText("Robot.mouseMove", i));
        }

        // check Robot.getPixelColor()
        Frame frame = new Frame(gc);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
        frame.setBackground(color);
        frame.setVisible(true);
        robot.waitForIdle();
        Rectangle bounds = frame.getBounds();
        if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
            throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
        }

        // check Robot.createScreenCapture()
        BufferedImage image = robot.createScreenCapture(bounds);
        int rgb = color.getRGB();
        if (image.getRGB(0, 0) != rgb
            || image.getRGB(image.getWidth() - 1, 0) != rgb
            || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
            || image.getRGB(0, image.getHeight() - 1) != rgb) {
                throw new RuntimeException(
                        getErrorText("Robot.createScreenCapture", i));
        }
        frame.dispose();
    }

    System.out.println("Test PASSED!");
}
 
源代码18 项目: openjdk-jdk8u   文件: MultiScreenLocationTest.java
public static void main(String[] args) throws AWTException
{
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice[] gds = ge.getScreenDevices();
    if (gds.length < 2) {
        System.out.println("It's a multiscreen test... skipping!");
        return;
    }

    for (int i = 0; i < gds.length; ++i) {
        GraphicsDevice gd = gds[i];
        GraphicsConfiguration gc = gd.getDefaultConfiguration();
        Rectangle screen = gc.getBounds();
        Robot robot = new Robot(gd);

        // check Robot.mouseMove()
        robot.mouseMove(screen.x + mouseOffset.x, screen.y + mouseOffset.y);
        Point mouse = MouseInfo.getPointerInfo().getLocation();
        Point point = screen.getLocation();
        point.translate(mouseOffset.x, mouseOffset.y);
        if (!point.equals(mouse)) {
            throw new RuntimeException(getErrorText("Robot.mouseMove", i));
        }

        // check Robot.getPixelColor()
        Frame frame = new Frame(gc);
        frame.setUndecorated(true);
        frame.setSize(100, 100);
        frame.setLocation(screen.x + frameOffset.x, screen.y + frameOffset.y);
        frame.setBackground(color);
        frame.setVisible(true);
        robot.waitForIdle();
        Rectangle bounds = frame.getBounds();
        if (!Util.testBoundsColor(bounds, color, 5, 1000, robot)) {
            throw new RuntimeException(getErrorText("Robot.getPixelColor", i));
        }

        // check Robot.createScreenCapture()
        BufferedImage image = robot.createScreenCapture(bounds);
        int rgb = color.getRGB();
        if (image.getRGB(0, 0) != rgb
            || image.getRGB(image.getWidth() - 1, 0) != rgb
            || image.getRGB(image.getWidth() - 1, image.getHeight() - 1) != rgb
            || image.getRGB(0, image.getHeight() - 1) != rgb) {
                throw new RuntimeException(
                        getErrorText("Robot.createScreenCapture", i));
        }
        frame.dispose();
    }

    System.out.println("Test PASSED!");
}
 
源代码19 项目: netbeans   文件: MirrorValuesApp.java
private void mirrors() {
    boolean boo = true;
    byte b = 5;
    char c = 'c';
    short s = 512;
    int i = 10000;
    long l = Long.MAX_VALUE;
    float f = 12.12f;
    double d = 1e150;
    
    int[] iarr = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
    double[][] darr = new double[][] { { 0.1, 0.2, 0.3 }, { 1.1, 1.2, 1.3 }, { 2.1, 2.2, 2.3 } };
    
    String str = "A String";
    Integer integer = new Integer(Integer.MIN_VALUE);
    
    Date date = new Date(1000000000l);
    date.toString(); // This is necessary to initialize the Date.cdate field and Gregorian$Date class.
    Color color = Color.RED;
    Point point = new Point(10, 10);
    File file = new File("/tmp/Foo.txt");
    URL url = createURL("http://netbeans.org");
    URL url2 = createPristineURL();
    
    Color[][] colors = new Color[][] { { Color.WHITE, Color.BLACK }, { Color.YELLOW, Color.GRAY } };
    
    List selfReferencedList = createSelfReferencedList();
    EventObject event = createObjectCircle();
    
    System.currentTimeMillis();             // LBREAKPOINT
    
    boolean newValues = (boo == false) && b == (byte) 255 && c == 'Z' &&
                         s == (short) -1024 && i == -1 && l == 123456789101112l &&
                         f == 2e-2f && d == -3e250 &&
                         Arrays.equals(iarr, new int[] { 9, 7, 5, 3, 1 }) &&
                         Arrays.deepEquals(darr, new double[][] { { 1e100, 2e200 }, { 1.1e100, 2.1e200 }, { 1.2e100, 2.2e200 }, { 1.3e100, 2.3e200 } }) &&
                         str.equals("An alternate sTRING") &&
                         integer.equals(-1048576) &&
                         date.equals(new Date(3333333333l)) &&
                         color.equals(Color.GREEN) &&
                         point.equals(new Point(-100, -100)) &&
                         file.equals(new File("/tmp/Test.java")) &&
                         url.equals(createURL("http://debugger.netbeans.org")) &&
                         url2 == null;
    
    System.currentTimeMillis();             // LBREAKPOINT
}
 
源代码20 项目: dagger-intellij-plugin   文件: ShowUsagesAction.java
private void setSizeAndDimensions(@NotNull JTable table, @NotNull JBPopup popup,
    @NotNull RelativePoint popupPosition, @NotNull List<UsageNode> data) {
  JComponent content = popup.getContent();
  Window window = SwingUtilities.windowForComponent(content);
  Dimension d = window.getSize();

  int width = calcMaxWidth(table);
  width = (int) Math.max(d.getWidth(), width);
  Dimension headerSize = ((AbstractPopup) popup).getHeaderPreferredSize();
  width = Math.max((int) headerSize.getWidth(), width);
  width = Math.max(myWidth, width);

  if (myWidth == -1) myWidth = width;
  int newWidth = Math.max(width, d.width + width - myWidth);

  myWidth = newWidth;

  int rowsToShow = Math.min(30, data.size());
  Dimension dimension = new Dimension(newWidth, table.getRowHeight() * rowsToShow);
  Rectangle rectangle = fitToScreen(dimension, popupPosition, table);
  dimension = rectangle.getSize();
  Point location = window.getLocation();
  if (!location.equals(rectangle.getLocation())) {
    window.setLocation(rectangle.getLocation());
  }

  if (!data.isEmpty()) {
    TableScrollingUtil.ensureSelectionExists(table);
  }
  table.setSize(dimension);
  //table.setPreferredSize(dimension);
  //table.setMaximumSize(dimension);
  //table.setPreferredScrollableViewportSize(dimension);

  Dimension footerSize = ((AbstractPopup) popup).getFooterPreferredSize();

  int newHeight = (int) (dimension.height + headerSize.getHeight() + footerSize.getHeight()) + 4/* invisible borders, margins etc*/;
  Dimension newDim = new Dimension(dimension.width, newHeight);
  window.setSize(newDim);
  window.setMinimumSize(newDim);
  window.setMaximumSize(newDim);

  window.validate();
  window.repaint();
  table.revalidate();
  table.repaint();
}