Java Code Examples for java.util.TooManyListenersException#printStackTrace()

The following examples show how to use java.util.TooManyListenersException#printStackTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DarkTabbedPaneUI.java    From darklaf with MIT License 5 votes vote down vote up
protected void installDragSupport() {
    tabPane.setTransferHandler(TRANSFER_HANDLER);
    try {
        DropTarget target = tabPane.getDropTarget();
        if (target != null) {
            target.addDropTargetListener(TRANSFER_HANDLER);
            target.setActive(dndEnabled);
        }
    } catch (TooManyListenersException e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: DarkTabFrameUI.java    From darklaf with MIT License 5 votes vote down vote up
protected void installDnD() {
    tabFrame.setTransferHandler(TRANSFER_HANDLER);
    try {
        DropTarget dropTarget = tabFrame.getDropTarget();
        if (dropTarget != null) {
            dropTarget.addDropTargetListener(TRANSFER_HANDLER);
            dropTarget.setActive(tabFrame.isDndEnabled());
        }
    } catch (TooManyListenersException e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: SerialPortManager.java    From SerialPortDemo with Apache License 2.0 5 votes vote down vote up
/**
 * 添加监听器
 * 
 * @param port
 *            串口对象
 * @param listener
 *            串口存在有效数据监听
 */
public static void addListener(SerialPort serialPort, DataAvailableListener listener) {
	try {
		// 给串口添加监听器
		serialPort.addEventListener(new SerialPortListener(listener));
		// 设置当有数据到达时唤醒监听接收线程
		serialPort.notifyOnDataAvailable(true);
		// 设置当通信中断时唤醒中断线程
		serialPort.notifyOnBreakInterrupt(true);
	} catch (TooManyListenersException e) {
		e.printStackTrace();
	}
}
 
Example 4
Source File: MenuEditLayer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void configureGlassLayer() {
    try {
        glassLayer.setDropTarget(new DropTarget());
        glassLayer.getDropTarget().addDropTargetListener(new GlassLayerDropTargetListener());
    } catch (TooManyListenersException ex) {
        ex.printStackTrace();
    }
}
 
Example 5
Source File: AbstractPatchedTransferHandler.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@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);
	}
}