当前位置: 首页>>代码示例>>Java>>正文


Java TooManyListenersException类代码示例

本文整理汇总了Java中java.util.TooManyListenersException的典型用法代码示例。如果您正苦于以下问题:Java TooManyListenersException类的具体用法?Java TooManyListenersException怎么用?Java TooManyListenersException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TooManyListenersException类属于java.util包,在下文中一共展示了TooManyListenersException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connect

import java.util.TooManyListenersException; //导入依赖的package包/类
@PostConstruct
public void connect() throws TooManyListenersException, NoSuchPortException {
    log.info("Connection PostConstruct callback: connecting ...");

    serial = new NRSerialPort(serialPortProperties.getPortName(), serialPortProperties.getBaudRate());
    serial.connect();

    if (serial.isConnected()) {
        log.info("Connection opened!");
    } else {
        throw new RuntimeException("Is not possible to open connection in " + serialPortProperties.getPortName() + " port");
    }
    serial.addEventListener(this);
    serial.notifyOnDataAvailable(true);
    input = new BufferedReader(new InputStreamReader(serial.getInputStream()));
}
 
开发者ID:diegosep,项目名称:spring-serial-port-connector,代码行数:17,代码来源:AbstractSpringSerialPortConnector.java

示例2: activate

import java.util.TooManyListenersException; //导入依赖的package包/类
/** Activates or deactivates Drag support on asociated JTree
* component
* @param active true if the support should be active, false
* otherwise
*/
public void activate(boolean active) {
    if (this.active == active) {
        return;
    }

    this.active = active;

    DragGestureRecognizer dgr = getDefaultGestureRecognizer();
    if (dgr == null) {
        return;
    }

    if (active) {
        dgr.setSourceActions(getAllowedDragActions());

        try {
            dgr.removeDragGestureListener(this);
            dgr.addDragGestureListener(this);
        } catch (TooManyListenersException exc) {
            throw new IllegalStateException("Too many listeners for drag gesture."); // NOI18N
        }
    } else {
        dgr.removeDragGestureListener(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:ExplorerDragSupport.java

示例3: connect

import java.util.TooManyListenersException; //导入依赖的package包/类
public void connect(CommPortIdentifier portIdentifier, int baudRate, int timeout) throws IOException {
    if (portIdentifier.isCurrentlyOwned())
        throw new IOException(
                portIdentifier.getName() + " is currently in use (" + portIdentifier.getCurrentOwner() + ")");

    if (portIdentifier.getPortType() != CommPortIdentifier.PORT_SERIAL)
        throw new IOException(portIdentifier.getName() + " is not a serial port");

    try {
        serialPort = (SerialPort) portIdentifier.open("blackbird", timeout);
        serialPort.setSerialPortParams(
                baudRate,
                SerialPort.DATABITS_8,
                SerialPort.STOPBITS_1,
                SerialPort.PARITY_NONE);
        serialPort.notifyOnDataAvailable(true);
        serialPort.addEventListener(this);
    } catch (PortInUseException | TooManyListenersException | UnsupportedCommOperationException e) {
        throw new IOException(e);
    }
}
 
开发者ID:MatzeS,项目名称:blackbird,代码行数:22,代码来源:PJCSerialPort.java

示例4: init

import java.util.TooManyListenersException; //导入依赖的package包/类
public void init() throws PeerUnavailableException, InvalidArgumentException, TransportNotSupportedException, ObjectInUseException, TooManyListenersException {
    SipFactory sipFactory = null;
    mSipStack = null;
    sipFactory = SipFactory.getInstance();
    sipFactory.setPathName("gov.nist");

    Properties properties = new Properties();
    properties.setProperty("javax.sip.STACK_NAME", "SIP_CLIENT");
    properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "sip_client/out/log/debug.txt");
    properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "sip_client/out/log/server.txt");
    properties.setProperty("javax.sip.IP_ADDRESS",mIPAddress);
    mSipStack = (SipStackExt) sipFactory.createSipStack(properties);


    mHeaderFactory = sipFactory.createHeaderFactory();
    mAddressFactory = sipFactory.createAddressFactory();
    mMessageFactory = sipFactory.createMessageFactory();
    ListeningPoint lp = mSipStack.createListeningPoint(mIPAddress, mUdpPort, "udp");


    mSipProvider = mSipStack.createSipProvider(lp);
    mSipProvider.addSipListener(this);

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:26,代码来源:SipClient.java

示例5: addEventListener

import java.util.TooManyListenersException; //导入依赖的package包/类
public void addEventListener(
	SerialPortEventListener lsnr ) throws TooManyListenersException
{
	/*  Don't let and notification requests happen until the
	    Eventloop is ready
	*/

	if (debug)
		z.reportln( "RXTXPort:addEventListener()");
	if( SPEventListener != null )
	{
		throw new TooManyListenersException();
	}
	SPEventListener = lsnr;
	if( !MonitorThreadAlive )
	{
		MonitorThreadLock = true;
		monThread = new MonitorThread();
		monThread.start();
		waitForTheNativeCodeSilly();
		MonitorThreadAlive=true;
	}
	if (debug)
		z.reportln( "RXTXPort:Interrupt=false");
}
 
开发者ID:brok1n,项目名称:SerialAssistant,代码行数:26,代码来源:RXTXPort.java

示例6: installDropTargetHandler

import java.util.TooManyListenersException; //导入依赖的package包/类
/**
 * 
 */
protected void installDropTargetHandler()
{
	DropTarget dropTarget = graphComponent.getDropTarget();

	try
	{
		if (dropTarget != null)
		{
			dropTarget.addDropTargetListener(this);
			currentDropTarget = dropTarget;
		}
	}
	catch (TooManyListenersException tmle)
	{
		// should not happen... swing drop target is multicast
	}
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:21,代码来源:mxGraphHandler.java

示例7: EditorRuler

import java.util.TooManyListenersException; //导入依赖的package包/类
/**
 * Constructs a new ruler for the specified graph and orientation.
 * 
 * @param graph The graph to create the ruler for.
 * @param orientation The orientation to use for the ruler.
 */
public EditorRuler(mxGraphComponent graphComponent, int orientation) {
  this.orientation = orientation;
  this.graphComponent = graphComponent;
  updateIncrementAndUnits();

  graphComponent.getGraph().getView().addListener(mxEvent.SCALE, repaintHandler);
  graphComponent.getGraph().getView().addListener(mxEvent.TRANSLATE, repaintHandler);
  graphComponent.getGraph().getView().addListener(mxEvent.SCALE_AND_TRANSLATE, repaintHandler);

  graphComponent.getGraphControl().addMouseMotionListener(this);

  DropTarget dropTarget = graphComponent.getDropTarget();

  try {
    if (dropTarget != null) {
      dropTarget.addDropTargetListener(this);
    }
  } catch (TooManyListenersException tmle) {
    // should not happen... swing drop target is multicast
  }

  setBorder(BorderFactory.createLineBorder(Color.black));
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:30,代码来源:EditorRuler.java

示例8: open

import java.util.TooManyListenersException; //导入依赖的package包/类
public void open() throws PortInUseException, UnsupportedCommOperationException, TooManyListenersException, IOException
{
	if (open)
	{
		log.info(commId.getName() + " already open, skipping");
		return;
	}

	log.info("Opening port " + commId.getName());
	buffer = new ByteBuffer();

	port = (SerialPort)commId.open("TimerInterface-"+commId.getName(), 30000);
	port.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
	port.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);

	port.addEventListener(this);
	port.notifyOnDataAvailable(true);
	port.enableReceiveTimeout(30);

	os = port.getOutputStream();
	is = port.getInputStream();
	open = true;
   }
 
开发者ID:drytoastman,项目名称:scorekeeperfrontend,代码行数:24,代码来源:SerialDataInterface.java

示例9: TraceTabbedPane

import java.util.TooManyListenersException; //导入依赖的package包/类
public TraceTabbedPane(TracerViewerSetting tracerViewerSetting, RecentFileContainer recentFileContainer) {
	super();

	this.tracerViewerSetting = tracerViewerSetting;
	this.recentFileContainer = recentFileContainer;

	fileTabIndexMap = new LinkedHashMap<String, Integer>();

	setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

	normalBorder = getBorder();

	try {
		DropTarget dt = new DropTarget();
		dt.addDropTargetListener(this);
		setDropTarget(dt);
	} catch (TooManyListenersException e) {
		LOG.error("Error adding drag drop listener", e);
	}
}
 
开发者ID:pegasystems,项目名称:pega-tracerviewer,代码行数:21,代码来源:TraceTabbedPane.java

示例10: LogTabbedPane

import java.util.TooManyListenersException; //导入依赖的package包/类
public LogTabbedPane(LogViewerSetting logViewerSetting, RecentFileContainer recentFileContainer) {
	super();

	this.logViewerSetting = logViewerSetting;
	this.recentFileContainer = recentFileContainer;

	fileTabIndexMap = new LinkedHashMap<String, Integer>();

	tailingFileList = new ArrayList<>();

	setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

	normalBorder = getBorder();

	try {
		DropTarget dt = new DropTarget();
		dt.addDropTargetListener(this);
		setDropTarget(dt);
	} catch (TooManyListenersException e) {
		LOG.error("Error initialising LogTabbedPane.", e);
	}
}
 
开发者ID:pegasystems,项目名称:pega-logviewer,代码行数:23,代码来源:LogTabbedPane.java

示例11: write

import java.util.TooManyListenersException; //导入依赖的package包/类
private void write(byte[] data) {
    try {  
        if (m_out == null) {
            m_PortIdPrinter = CommPortIdentifier.getPortIdentifier(m_sPortScale); // Tomamos el puerto                   
            m_CommPortPrinter = (SerialPort) m_PortIdPrinter.open("PORTID", 2000); // Abrimos el puerto       

            m_out = m_CommPortPrinter.getOutputStream(); // Tomamos el chorro de escritura   
            m_in = m_CommPortPrinter.getInputStream();
            
            m_CommPortPrinter.addEventListener(this);
            m_CommPortPrinter.notifyOnDataAvailable(true);
            
            m_CommPortPrinter.setSerialPortParams(4800, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_ODD); // Configuramos el puerto
        }
        m_out.write(data);
    } catch (NoSuchPortException | PortInUseException | UnsupportedCommOperationException | TooManyListenersException | IOException e) {
    }        
}
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:19,代码来源:ScaleComm.java

示例12: write

import java.util.TooManyListenersException; //导入依赖的package包/类
private void write(byte[] data) {
    try {  
        if (m_out == null) {
            m_PortIdPrinter = CommPortIdentifier.getPortIdentifier(m_sPortScale);                  
            m_CommPortPrinter = (SerialPort) m_PortIdPrinter.open("PORTID", 2000);      

            m_out = m_CommPortPrinter.getOutputStream();  
            m_in = m_CommPortPrinter.getInputStream();
            
            m_CommPortPrinter.addEventListener(this);
            m_CommPortPrinter.notifyOnDataAvailable(true);
            
            m_CommPortPrinter.setSerialPortParams(9600, 
                    SerialPort.DATABITS_7, 
                    SerialPort.STOPBITS_1, 
                    SerialPort.PARITY_EVEN);
        }
        m_out.write(data);
    } catch (NoSuchPortException | PortInUseException | UnsupportedCommOperationException | TooManyListenersException | IOException e) {
    }        
}
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:22,代码来源:ScaleCasioPD1.java

示例13: DropTarget

import java.util.TooManyListenersException; //导入依赖的package包/类
/**
    * Creates a new DropTarget given the <code>Component</code> 
    * to associate itself with, an <code>int</code> representing
    * the default acceptable action(s) to 
    * support, a <code>DropTargetListener</code>
    * to handle event processing, a <code>boolean</code> indicating 
    * if the <code>DropTarget</code> is currently accepting drops, and 
    * a <code>FlavorMap</code> to use (or null for the default <CODE>FlavorMap</CODE>).
    * <P>
    * The Component will receive drops only if it is enabled.
    * @param c 	The <code>Component</code> with which this <code>DropTarget</code> is associated
    * @param ops	The default acceptable actions for this <code>DropTarget</code>
    * @param dtl	The <code>DropTargetListener</code> for this <code>DropTarget</code>
    * @param act	Is the <code>DropTarget</code> accepting drops.
    * @param fm	The <code>FlavorMap</code> to use, or null for the default <CODE>FlavorMap</CODE> 
    * @exception HeadlessException if GraphicsEnvironment.isHeadless()
    *            returns true
    * @see java.awt.GraphicsEnvironment#isHeadless
    */
   public DropTarget(Component c, int ops, DropTargetListener dtl,
	      boolean act, FlavorMap fm)
       throws HeadlessException
   {
       if (GraphicsEnvironment.isHeadless()) {
           throw new HeadlessException();
       }

component = c;

setDefaultActions(ops);

if (dtl != null) try {
    addDropTargetListener(dtl);
} catch (TooManyListenersException tmle) {
    // do nothing!
}

if (c != null) {
    c.setDropTarget(this);
    setActive(act);
}

       if (fm != null) flavorMap = fm;
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:45,代码来源:DropTarget.java

示例14: initListener

import java.util.TooManyListenersException; //导入依赖的package包/类
public void initListener() {
    try
    {
        serialPort.addEventListener(this);
        serialPort.notifyOnDataAvailable(true);
        System.out.println("Listener started.");
    }
    catch (TooManyListenersException e)
    {
        logText = "Too many listeners. (" + e.toString() + ")";
        if(window == null){
                System.out.println(logText);
            }
            else{
                //window.txtLog.setForeground(Color.RED);
                window.txtLog.append(logText + "\n");
            }
    }
}
 
开发者ID:carlfsmith,项目名称:LunaBot,代码行数:20,代码来源:SerialClient.java

示例15: openSerial

import java.util.TooManyListenersException; //导入依赖的package包/类
public void openSerial(String serialPortName, int speed) throws PortInUseException, IOException, UnsupportedCommOperationException, TooManyListenersException {
	
	CommPortIdentifier commPortIdentifier = findPort(serialPortName);
	
	// initalize serial port
	serialPort = (SerialPort) commPortIdentifier.open("Arduino", 2000);
	inputStream = serialPort.getInputStream();
	serialPort.addEventListener(this);

	// activate the DATA_AVAILABLE notifier
	serialPort.notifyOnDataAvailable(true);

	serialPort.setSerialPortParams(speed, SerialPort.DATABITS_8, 
			SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
	serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
}
 
开发者ID:andrewrapp,项目名称:arduino-remote-uploader,代码行数:17,代码来源:SerialSketchUploader.java


注:本文中的java.util.TooManyListenersException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。