本文整理汇总了Java中java.util.TooManyListenersException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java TooManyListenersException.printStackTrace方法的具体用法?Java TooManyListenersException.printStackTrace怎么用?Java TooManyListenersException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.TooManyListenersException
的用法示例。
在下文中一共展示了TooManyListenersException.printStackTrace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureGlassLayer
import java.util.TooManyListenersException; //导入方法依赖的package包/类
private void configureGlassLayer() {
try {
glassLayer.setDropTarget(new DropTarget());
glassLayer.getDropTarget().addDropTargetListener(new GlassLayerDropTargetListener());
} catch (TooManyListenersException ex) {
ex.printStackTrace();
}
}
示例2: exportAsDrag
import java.util.TooManyListenersException; //导入方法依赖的package包/类
@Override
public void exportAsDrag(JComponent comp, InputEvent e, int action) {
int srcActions = getSourceActions(comp);
// only mouse events supported for drag operations
if (!(e instanceof MouseEvent)
// only support known actions
|| !(action == COPY || action == MOVE || action == LINK)
// only support valid source actions
|| (srcActions & action) == 0) {
action = NONE;
}
if (action != NONE && !GraphicsEnvironment.isHeadless()) {
if (recognizer == null) {
recognizer = new SwingDragGestureRecognizer();
}
DragHandler dgl = new DragHandler();
try {
recognizer.addDragGestureListener(dgl);
} catch (TooManyListenersException e1) {
e1.printStackTrace();
}
recognizer.gestured(comp, (MouseEvent) e, srcActions, action);
recognizer.removeDragGestureListener(dgl);
} else {
exportDone(comp, null, NONE);
}
}
示例3: makeDropTarget
import java.util.TooManyListenersException; //导入方法依赖的package包/类
private void makeDropTarget( final PrintStream out, final Component c, boolean recursive )
{
// Make drop target
final DropTarget dt = new DropTarget();
try
{ dt.addDropTargetListener( dropListener );
} // end try
catch(TooManyListenersException e )
{ e.printStackTrace();
log(out, "FileDrop: Drop will not work due to previous error. Do you have another listener attached?" );
} // end catch
// Listen for hierarchy changes and remove the drop target when the parent gets cleared out.
c.addHierarchyListener( new HierarchyListener()
{ public void hierarchyChanged( HierarchyEvent evt )
{ log( out, "FileDrop: Hierarchy changed." );
Component parent = c.getParent();
if( parent == null )
{ c.setDropTarget( null );
log( out, "FileDrop: Drop target cleared from component." );
} // end if: null parent
else
{
new DropTarget(c, dropListener);
log( out, "FileDrop: Drop target added to component." );
} // end else: parent not null
} // end hierarchyChanged
}); // end hierarchy listener
if( c.getParent() != null )
new DropTarget(c, dropListener);
if( recursive && (c instanceof Container ) )
{
// Get the container
Container cont = (Container) c;
// Get it's components
Component[] comps = cont.getComponents();
// Set it's components as listeners also
for( int i = 0; i < comps.length; i++ )
makeDropTarget( out, comps[i], recursive );
} // end if: recursively set components as listener
}
示例4: TextureGraphEditorPanel
import java.util.TooManyListenersException; //导入方法依赖的package包/类
public TextureGraphEditorPanel() {
graph = new TextureGraph();
graph.graphListener = this;
setBackground(Color.darkGray);
setLayout(null);
addMouseListener(this);
addMouseWheelListener(this);
addMouseMotionListener(this);
createPopupMenus();
paramEditorPanel = new ChannelParameterEditorPanel();
DropTarget t = new DropTarget();
try {
t.addDropTargetListener(new TextureGraphDropTarget());
} catch (TooManyListenersException e) {
e.printStackTrace();
}
setDropTarget(t);
setPreferredSize(new Dimension(512, 512));
}
示例5: addListener
import java.util.TooManyListenersException; //导入方法依赖的package包/类
public void addListener(SerialPortEventListener serialPortEventListener) {
try {
serialPort.addEventListener(serialPortEventListener);
serialPort.notifyOnDataAvailable(true);
} catch (TooManyListenersException e) {
e.printStackTrace();
}
}
示例6: makeDropTarget
import java.util.TooManyListenersException; //导入方法依赖的package包/类
private void makeDropTarget(final PrintStream out, final Component c,
boolean recursive) {
final DropTarget dt = new DropTarget();
try {
dt.addDropTargetListener(dropListener);
} catch (TooManyListenersException e) {
e.printStackTrace();
log(out, "FileDrop: Drop will not work due to previous error. Do you have another listener attached?");
}
c.addHierarchyListener(new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent evt) {
log(out, "FileDrop: Hierarchy changed.");
Component parent = c.getParent();
if (parent == null) {
c.setDropTarget(null);
log(out, "FileDrop: Drop target cleared from component.");
} else {
new DropTarget(c, dropListener);
log(out, "FileDrop: Drop target added to component.");
}
}
});
if (c.getParent() != null)
new DropTarget(c, dropListener);
if (recursive && (c instanceof Container)) {
Container cont = (Container) c;
Component[] comps = cont.getComponents();
for (int i = 0; i < comps.length; i++)
makeDropTarget(out, comps[i], recursive);
}
}