本文整理匯總了Java中javax.swing.JComponent.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.contains方法的具體用法?Java JComponent.contains怎麽用?Java JComponent.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.contains方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: canDrag
import javax.swing.JComponent; //導入方法依賴的package包/類
public Point canDrag(MouseEvent e, JComponent table)
{
Point p2 = table.getLocationOnScreen();
Point p1 = directory.getLocationOnScreen();
Point p = e.getPoint();
Point p3 = new Point();
p3.x = p1.x + p.x - p2.x;
p3.y = p1.y + p.y - p2.y;
if( table.contains(p3) && dragString.length() != 0 )
{
return p3;
}
else
{
return null;
}
}
示例2: paint
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public void paint(Graphics g, JComponent c) {
LAFUtilities.setProperties(g, c);
if (c.isOpaque()) {
ImageLibrary.drawTiledImage("image.background.FreeColButton", g, c, null);
}
super.paint(g, c);
AbstractButton a = (AbstractButton) c;
if (a.isRolloverEnabled()) {
Point p = MouseInfo.getPointerInfo().getLocation();
SwingUtilities.convertPointFromScreen(p, c);
boolean rollover = c.contains(p);
if (rollover) {
paintButtonPressed(g, (AbstractButton) c);
}
}
}