Here you can find the source of isAtScrollPaneRightBorder(Component c, int x)
public static boolean isAtScrollPaneRightBorder(Component c, int x)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://w w w . ja va2 s .c om * BSI Business Systems Integration AG - initial API and implementation ******************************************************************************/ import java.awt.Component; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; public class Main { /** * @return true if the pixel coordinate is just one pixel left of the * scrollpanes right border. This can be used to avoid double-border * line aliasing effeect where single-lines are needed */ public static boolean isAtScrollPaneRightBorder(Component c, int x) { JScrollPane sp = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, c); if (sp != null) { int localX = SwingUtilities.convertPoint(c, x, 0, sp).x; if (localX + 1 == sp.getWidth()) { return true; } } return false; } }