當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。