本文整理匯總了Java中javax.swing.JComponent.setAutoscrolls方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.setAutoscrolls方法的具體用法?Java JComponent.setAutoscrolls怎麽用?Java JComponent.setAutoscrolls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.setAutoscrolls方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dragGestureRecognized
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void dragGestureRecognized(DragGestureEvent dge) {
JComponent c = (JComponent)dge.getComponent();
DefaultTransferHandler th
= (DefaultTransferHandler)c.getTransferHandler();
Transferable t = th.createTransferable(c);
if (t == null) {
logger.warning("Unable to create transferable for: " + dge);
th.exportDone(c, null, NONE);
return;
}
this.scrolls = c.getAutoscrolls();
c.setAutoscrolls(false);
try {
Cursor cursor = getCursor(c);
dge.startDrag(cursor, t, this);
} catch (RuntimeException re) {
c.setAutoscrolls(this.scrolls);
}
}
示例2: dragDropEnd
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* as the operation completes
*/
@Override
public void dragDropEnd(DragSourceDropEvent dsde) {
DragSourceContext dsc = dsde.getDragSourceContext();
JComponent c = (JComponent) dsc.getComponent();
if (dsde.getDropSuccess()) {
((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(),
dsde.getDropAction());
} else {
((AbstractPatchedTransferHandler) c.getTransferHandler()).exportDone(c, dsc.getTransferable(), NONE);
}
c.setAutoscrolls(scrolls);
fireDragEnded();
}
示例3: dragDropEnd
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void dragDropEnd(DragSourceDropEvent dsde) {
DragSourceContext dsc = dsde.getDragSourceContext();
JComponent c = (JComponent)dsc.getComponent();
if (dsde.getDropSuccess()) {
((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
dsc.getTransferable(), dsde.getDropAction());
} else {
((DefaultTransferHandler)c.getTransferHandler()).exportDone(c,
null, NONE);
}
c.setAutoscrolls(scrolls);
}
示例4: setupForDragging
import javax.swing.JComponent; //導入方法依賴的package包/類
private void setupForDragging(MouseEvent e)
{
source.addMouseMotionListener( this );
// Determine the component that will ultimately be moved
if (destinationComponent != null)
{
destination = destinationComponent;
}
else if (destinationClass == null)
{
destination = source;
}
else // forward events to destination component
{
destination = SwingUtilities.getAncestorOfClass(destinationClass, source);
}
pressed = e.getLocationOnScreen();
location = destination.getLocation();
if (changeCursor)
{
originalCursor = source.getCursor();
source.setCursor( Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR) );
}
// Making sure autoscrolls is false will allow for smoother dragging of
// individual components
if (destination instanceof JComponent)
{
JComponent jc = (JComponent)destination;
autoscrolls = jc.getAutoscrolls();
jc.setAutoscrolls( false );
}
}