Bluetooth port programming in JAVA to control a stepper-mo

dear friends,
i would like to know how to use the bluetooth port using JAVA code to control a stepper-motor? please give me some sample code with explanations.

dear friends,
i would like to know how to use
the bluetooth port using JAVA code to control a
stepper-motor? please give me some sample code with
explanations.Do you have a link to the assignment ?

Similar Messages

  • Parallel port programming in java

    anyone please help me!!
    I have to send binary data(of numbers 1-255) to parallel port in 8 bit format.
    If you have code please send me or help me how to do so...

    One post is sufficient.
    Next time try "New to Java".
    Google ( [url http://www.google.com/search?q=java+rxtx+parallel+port]java rxtx parallel port )

  • Java Port Programming

    Hello,
    I am a Graduate Student at University of South Florida, Tampa, FLorida. I am working on a project which involves Controlling an Industrial Robot through Internet.
    This project, controlling industrial robot online, I have divided in 2 parts:
    one - sending data over Internet from any PC to the Robot PC.
    I am confident about this first part of the project and plan to do that in Java. And, now I am working on the second part** - sending signals to Robot Controller once we receive the data at Robot PC.
    We have a Robot s/w installed on Robot PC called ATS (Advanced Terminal s/w, DOS Based s/w) through which we can send commands to the Robot Controller. The controller is programmed using ACL (Advanced
    Control Language). And then the controller generates appropriate signals for the motors to drive the Robot. Also, We have a Robot Interface card installed in Robot PC.
    I have thought of 2 ways to achieve the second part** of my project -
    one - once we receive instructions from Internet user at Robot PC, give input to the DOS-Based s/w in appropriate format and execute that.
    two - once we receive instructions from Internet user at Robot PC, give input directly to Robot Controller in ASCII format (Controller accepts ASCII Chars.)
    We don't have any s/w developement kit available for the Robot s/w from the company, so I have to talk to the controller directly, bypassing the s/w.
    Our robot (SCORBOT-ER 9, Industrial Robot, # of axes = 5 + Gripper), its controller, and robot s/w, all are manufactured/developed by the same company - Eshed Robotec.com (Now, Intelitek.com)
    The PC is connected to the controller through RS232 - serial port, and the controller sends signals to the motors of the robot.
    From the PC, ASCII characters are sent to the controller. I have to do 2 things - find out the ASCII characters which are sent to the controller, and then write a Java or C or C++ program to write those
    ASCII characters to the serial port. I will find out the ASCII characters going to the controller, with the help of Serial Data Analyzer device or s/w. So, after that, my task is to write a code to write those ASCII characters to the serial port. I am using Java, Java Servlets for the networking part (for getting instructions from the Internet user), so would it be a good idea to do the program of writing ASCII characters to serial port in Java?, so that all the system will be developed in the same language? or C/C++/VC++ are better options for the serial port part? If we choose C/C++/VC++, then interfacing of this with Java is possible?
    I would really appreciate your guidance in this regard.
    Thanking you in anticipation !
    Mayur Pangrekar

    Hello Michael,
    Thank you !!
    I went to site you specified, I will get more information about port programming from sun site.
    Mayur

  • Oops - meant to say "Controlling Legacy DOS program from Java ..."

    Sorry - don't know what I wasn't thinking - muddled up my post title!
    As part of my final year project, I'm trying to control a camera mount automatically using stepper motors. This will then be used for robotic navigattion. Most of my code is written in Java, but I have been given some old C code to control the motors with. One loaded, it sits in an infinite loop that waits for keyboard input, resonds, loops, and so on ...
    I'm trying desperately to find a way of issuing commands to this program from my Java programs. I tried to implement a listening server in the C code but got a bit bogged down. Now wonder if I can use the
    exec and getOutputStream methods in Java to control the Dos program...?
    Any ideas very very welcome. I've reached hair pulling out time!
    Ben Barker

    Everything is now woeking...ish:
    I can now make the below java program bring up, for instance, windows calculator or notepad.
    I can't test it on the main code yet at I don't have the right computer in front of me. However, I decided to try to test it by runing cmd using ...exec("cmd"), then printing a command to the output stream to make windows calculator run. This caused precisely nothing to happen ...
    Any ideas?
    import java.io.*;
    class java_test
    public static void main(String[] args)
              try
              Process p= Runtime.getRuntime().exec("cmd");
              InputStream is= p.getInputStream();
              OutputStream os= p.getOutputStream();
              PrintStream printStr = new PrintStream(os);     
              printStr.println("calc.exe");
              catch (Throwable t)
              t.printStackTrace();
    }

  • How to run and control any program by java

    hi everyone ,
    I wonder that how to execute and control some menus or how to use some property of any program by java, not for the whole program, it's just only a few features of program.
    Is there any idea?
    if it's impossible to do with java , how can I do it? which way?
    thanks a lot..

    No. Applications have to be specifically built to be able to be controlled by other programs; for example office applications allow you to communicate with them through a special protocol. To be able to communicate you need to know the protocol and write specific code for specific tasks.
    The software world is not as simple as they show in movies, where hackers just press two buttons and take control over entire buildings and applications.

  • Parallel Port Programming

    After series of trials and searching the forum i was able to get the commapi and install it. i want to design a simple program that can control circuits (i.e to on leds) . the problem is how to write a 1 or 0 bit to a particular pin. i saw different posts on this issue but still haven't got the real solution.
    i also got to know about parport api and have downloaded and istalled it. but when i run the SimpleIO.java that comes with the package i get this error:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : EXCEPTION_PRIV_INSTRUCTION occurred at PC=0x10001057
    Function=[Unknown.]
    Library=C:\Program Files\Java\j2re1.4.1_02\bin\parport.dll
    NOTE: We are unable to locate the function name symbol for the error
    just occurred. Please refer to release documentation for possible
    reason and solutions.
    Current Java thread:
    at parport.ParallelPort.readOneByte(Native Method)
    at parport.ParallelPort.read(ParallelPort.java:37)
    at SimpleIO.main(SimpleIO.java:8)
    plz i want to know what's the cause of this problem, really can't go further on my own and i know nothing on native interface.
    I would be grateful if i can achieve my objective without the parport also.
    How can i write bits to the parallel port plz???????????????
    Thanx in advance

    Why not communicate with the parallel port using the COMM API 2.0?

  • Audio, bluetooth, & port configurations

    I configured my computer to connect to an in-car Bluetooth device.  the in-car device is primarily used to connect mobile phones via Bluetooth  but also has built-in features for Skype calling.  so, as I make calls using skype via the Bluetooth connection I can also hear any audio, such as music, playing the background (during the call).  When the call ends, however, the music can no longer be heard via the Bluetooth in-car connection and transfers back to my computer.  Since my Bluetooth device does not necessarily support connections that will allow me to play music without being on a skype call I was wondering what port is opened when a Skype call is made or more specifically what actually takes place when a call is made and how could I, for example, open up the specified port permanently--to allow me to listen to music through the Bluetooth device at anytime without being on a call?  How could i open the port or configure the function permanently (or automatically)? 
    i use windows XP. 

    dear friends,
    i would like to know how to use
    the bluetooth port using JAVA code to control a
    stepper-motor? please give me some sample code with
    explanations.Do you have a link to the assignment ?

  • New "Windows Programming Using Java" Website

    Our newly created "Windows Programming Using Java" website (http://fivedots.coe.psu.ac.th/~ad/winJava/) is for programmers who want to extend Java's capabilities on Windows XP and/or Vista, but aren't sure where to start. One of the drawbacks of Java's portability is that many Java programmers have a rather sketchy knowledge of Windows-specific programming.
    We plan to explain how Java applications can utilize Windows application software, OS features, and hardware beyond the reach of Java's standard libraries. A variety of Java/Windows programming techniques will be explained, including:
    * Java's employment of the Win32 API via C, JNI, and J/Invoke.
    * Java's utilization of Window's Command Line Interface (CLI) and batch files, accessed through Java's Runtime, ProcessBuilder, and Process classes.
    * Java and Windows object-based scripting, centered around the use of VBScript, Windows Script Host (WSH), and Windows Management Instrumentation (WMI).
    * Java interoperability with COM, including hosting of ActiveX controls in Swing containers using jacoZoom.
    This website is a work in progress, with four chapters available for download at the moment. We'll be adding more regularly, and would love feedback on what we're doing.
    Thanks,
    Gayathri Singh and Andrew Davison
    [email protected] and [email protected]
    Edited by: AndrewDavison on Jun 20, 2008 1:36 AM

    Hi, I am looking the similar kind of requirement that you had done.. Do you have any more details on the code that is working for you . All i need is if the user logs in successfully in windows, the the app should be accessible. Please let me know if you have the code with you on this problem.
    Thanks in advance
    "what i meant is the we b applications running in my system, when i access the application iam able to to login automatically with windows authentication and now in case of other users following process happened:"

  • Can we write X.25 program in Java

    hello friends
    can we write X.25 (protocal) program in Java , like we write socket program in Java.
    If we write means, kindly give a note, how to write.
    thank you
    seenu

    X.25 is connection oriented in that the sending party must initiate a connection to the receiving party. This connection
    establishes a virtual circuit that remains throughout the session. Because the virtual circuit is established at the time of
    connection, it is a switched virtual circuit (SVC).
    JTAPI is the set of classes, interfaces, and principles of operation that constitute a Java extension package in the javax.* name space. JTAPI implementations are the interface between Java computer telephony applications and telephony services, whether those services are implemented as software, as in the case of a soft PBX, or hardware. JTAPI defines the access to one or more of the following areas of functionality: Call Control, Telephone Physical Device
    Control,X.25
    my advice would be read and use JavaTM Telephony API
    it is at http://java.sun.com/products/jtapi/

  • Kernel programming using Java

    I'm currently doing a research in computer security and would like to develop a system which can deal directly to linux kernel in order to enhance the security. During my research I found that Java is a type-safe language which is more secure if I develop my system compare to C language which is lack of type-safe. So I decided to use Java to develop my security system which will enhance resources management in Linux. My question is, does anyone know whether Java could be used in kernel programming or not? Where could I get some sort of references related to my work especially tutorial about kernel programming using Java. I would appreciate if anyone of you could help me in this matter. TQ

    I'm currently doing a research in computer security ...You might want to do a bit more research into the languages.
    What you are discussing has nothing to do with security.
    If you are writing kernel services then java is probably ill suited because the normal implementations use garbage collection which is not under your control. This makes it hard (if not impossible) to control timing.
    If your sole desire is type safety then C++ provides better type safety and provides more control over types as well.

  • Can we run EXE file/ Another Java Program from Java Application? How?

    Can we run EXE file and another java program from java application?
    Thanks in advance

    Example running adobe acrobat
    String command = "C:\\Program Files\\Adobe\\Acrobat 5.0\\Reader\\AcroRd32.exe /t "+selectedDocument+" \\\\CONTROL\\HP LaserJet 4L";
    Runtime rn = Runtime.getRuntime();
    Process process = rn.exec(command);
    process.waitFor();rykk

  • How to creat a Dialer Program in Java

    Help me in creating a Dialer program which dials to a specifie ISP.It should work like the Dialer provided in windows.Help!! Can we code such a program in JAVA.If yes, HOW!!!!
    Abhishek([email protected])

    Get the Java Communications package - javax.comm (comm.jar)
    This will give you access to Windows/Solaris serial (and parallel) ports from Java.
    You then need some simple modem handling to perform the dial and initial handshake.
    Steve

  • Port Programming Using Netbeans

    Hello everybody,
    I am working on Serial port communication, and I have used Netbeans for GUI designing.
    I am able access the port, but failed to set Event for the same.
    I am getting error like............
    D:\NetBeansProjects\MySerialPort\src\readserialport\MyComport.java:20: readserialport.MyComport is not abstract and does not override abstract method serialEvent(javax.comm.SerialPortEvent) in javax.comm.SerialPortEventListener
    Please help me to resolve this problem...............
    My code:
    * MyComport.java
    * Created on March 18, 2008, 5:43 PM
    package readserialport;
    import java.awt.*;
    import java.io.*;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.comm.*;
    import java.util.*;
    * @author pbagde
    class MyComport extends javax.swing.JFrame
    implements SerialPortEventListener{
    /** How long to wait for the open to finish up. **/
    public static final int TIMEOUTSECONDS = 30;
    /** The chosen Port Identifier **/
    CommPortIdentifier thePortID;
    /** The chosen Port itself **/
    CommPort thePort;
    /** A mapping from names to CommPortIdentifiers. **/
    protected HashMap map = new HashMap();
    /** The name of the choice the user made. **/
    protected String selectedPortName;
    /** The CommPortIdentifier the user chose. **/
    //SerialEvent Mytest;
    //PortChooser MyPort = new PortChooser(null);
    SerialPortEventListener SEvent;
    InputStream inputStream;
    OutputStream outputStream;
    protected CommPortIdentifier selectedPortIdentifier;
    /** Creates new form MyComport */
    public MyComport(){
    initComponents();
    InitializeComponentValues();
    public void InitializeComponentValues(){
    // get list of ports available on this particular computer,
    // by calling static method in CommPortIdentifier.
    Enumeration pList = CommPortIdentifier.getPortIdentifiers();
    // Process the list, putting serial and parallel into ComboBoxes
    while (pList.hasMoreElements()) {
    CommPortIdentifier cpi = (CommPortIdentifier) pList.nextElement();
    System.out.println("Port " + cpi.getName());
    map.put(cpi.getName(), cpi);
    if (cpi.getPortType() == CommPortIdentifier.PORT_SERIAL) {
    comportCMB.addItem(cpi.getName());
    } else if (cpi.getPortType() == CommPortIdentifier.PORT_PARALLEL) {
    //parallelPortsChoice.setEnabled(true);
    //parallelPortsChoice.addItem(cpi.getName());
    } else {
    //other.addItem(cpi.getName());
    public void SerialPortEvent(SerialPortEvent SEvent){
    switch(SEvent.getEventType()){
    case SerialPortEvent.BI:
    case SerialPortEvent.CD:
    case SerialPortEvent.CTS:
    case SerialPortEvent.DSR:
    case SerialPortEvent.FE:
    case SerialPortEvent.OE:
    case SerialPortEvent.PE:
    case SerialPortEvent.RI:
    case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
    break;
    case SerialPortEvent.DATA_AVAILABLE:
    StringBuffer readBuffer = new StringBuffer();
    System.out.println(readBuffer);
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    jPanel1 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    comportCMB = new javax.swing.JComboBox();
    jLabel2 = new javax.swing.JLabel();
    baudCMB = new javax.swing.JComboBox();
    jLabel3 = new javax.swing.JLabel();
    databitsCMB = new javax.swing.JComboBox();
    jLabel4 = new javax.swing.JLabel();
    parityCMB = new javax.swing.JComboBox();
    jLabel5 = new javax.swing.JLabel();
    stopbitsCMB = new javax.swing.JComboBox();
    jLabel6 = new javax.swing.JLabel();
    flowconCMB = new javax.swing.JComboBox();
    connectBTN = new javax.swing.JButton();
    disconnectBTN = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    receiveTBX = new javax.swing.JTextArea();
    jPanel4 = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    sendTBX = new javax.swing.JTextArea();
    sendBTN = new javax.swing.JButton();
    menuBar = new javax.swing.JMenuBar();
    fileMenu = new javax.swing.JMenu();
    openMenuItem = new javax.swing.JMenuItem();
    saveMenuItem = new javax.swing.JMenuItem();
    saveAsMenuItem = new javax.swing.JMenuItem();
    exitMenuItem = new javax.swing.JMenuItem();
    editMenu = new javax.swing.JMenu();
    cutMenuItem = new javax.swing.JMenuItem();
    copyMenuItem = new javax.swing.JMenuItem();
    pasteMenuItem = new javax.swing.JMenuItem();
    deleteMenuItem = new javax.swing.JMenuItem();
    helpMenu = new javax.swing.JMenu();
    contentsMenuItem = new javax.swing.JMenuItem();
    aboutMenuItem = new javax.swing.JMenuItem();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Serial Port");
    setMinimumSize(new java.awt.Dimension(552, 351));
    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Serial Port Configuration", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12)));
    jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
    jLabel1.setText("Connect Using :");
    comportCMB.setFont(new java.awt.Font("Verdana", 0, 11));
    jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
    jLabel2.setText("Bits Per Second :");
    baudCMB.setFont(new java.awt.Font("Verdana", 0, 11));
    baudCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "110", "300", "1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200", "230400", "460800", "921600" }));
    jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
    jLabel3.setText("Data Bits :");
    databitsCMB.setFont(new java.awt.Font("Verdana", 0, 11));
    databitsCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "5", "6", "7", "8" }));
    jLabel4.setFont(new java.awt.Font("Verdana", 0, 11));
    jLabel4.setText("Parity :");
    parityCMB.setFont(new java.awt.Font("Verdana", 0, 11));
    parityCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Even", "Odd", "None", "Mark", "Space" }));
    jLabel5.setFont(new java.awt.Font("Verdana", 0, 11));
    jLabel5.setText("Stop Bits :");
    stopbitsCMB.setFont(new java.awt.Font("Verdana", 0, 11));
    stopbitsCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "1.5", "2" }));
    jLabel6.setFont(new java.awt.Font("Verdana", 0, 11));
    jLabel6.setText("Flow Control :");
    flowconCMB.setFont(new java.awt.Font("Verdana", 0, 11));
    flowconCMB.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Xon/Xoff In", "Xon/Xoff Out", "RTS/CTS In", "RTS/CTS Out", "None" }));
    connectBTN.setFont(new java.awt.Font("Verdana", 0, 11));
    connectBTN.setLabel("Connect");
    connectBTN.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    connectBTNActionPerformed(evt);
    disconnectBTN.setFont(new java.awt.Font("Verdana", 0, 11));
    disconnectBTN.setLabel("Disconnect");
    disconnectBTN.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    disconnectBTNActionPerformed(evt);
    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel1)
    .addComponent(jLabel2)
    .addComponent(jLabel3)
    .addComponent(jLabel4)
    .addComponent(jLabel5)
    .addComponent(jLabel6))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addComponent(disconnectBTN, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(flowconCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(stopbitsCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(parityCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(databitsCMB, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(baudCMB, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(comportCMB, 0, 86, Short.MAX_VALUE)
    .addComponent(connectBTN, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel1Layout.createSequentialGroup()
    .addContainerGap(19, Short.MAX_VALUE)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(comportCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel1))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(baudCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel2))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(databitsCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel3))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(parityCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel4))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(stopbitsCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel5))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(flowconCMB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel6))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(connectBTN)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(disconnectBTN))
    jLabel1.getAccessibleContext().setAccessibleName("");
    jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Data Communication", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12)));
    jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Receive Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 0, 12)));
    receiveTBX.setColumns(20);
    receiveTBX.setRows(5);
    jScrollPane1.setViewportView(receiveTBX);
    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel3Layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
    .addContainerGap())
    jPanel3Layout.setVerticalGroup(
    jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel3Layout.createSequentialGroup()
    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE)
    .addContainerGap())
    jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Send Data", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 0, 12)));
    sendTBX.setColumns(20);
    sendTBX.setRows(5);
    jScrollPane2.setViewportView(sendTBX);
    sendBTN.setLabel("Send");
    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(
    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel4Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 214, Short.MAX_VALUE)
    .addComponent(sendBTN, javax.swing.GroupLayout.Alignment.TRAILING))
    .addContainerGap())
    jPanel4Layout.setVerticalGroup(
    jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel4Layout.createSequentialGroup()
    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(sendBTN))
    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(jPanel2Layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addContainerGap())
    jPanel2Layout.setVerticalGroup(
    jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
    .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    fileMenu.setText("File");
    openMenuItem.setText("Open");
    fileMenu.add(openMenuItem);
    saveMenuItem.setText("Save");
    fileMenu.add(saveMenuItem);
    saveAsMenuItem.setText("Save As ...");
    fileMenu.add(saveAsMenuItem);
    exitMenuItem.setText("Exit");
    exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    exitMenuItemActionPerformed(evt);
    fileMenu.add(exitMenuItem);
    menuBar.add(fileMenu);
    editMenu.setText("Edit");
    cutMenuItem.setText("Cut");
    editMenu.add(cutMenuItem);
    copyMenuItem.setText("Copy");
    editMenu.add(copyMenuItem);
    pasteMenuItem.setText("Paste");
    editMenu.add(pasteMenuItem);
    deleteMenuItem.setText("Delete");
    editMenu.add(deleteMenuItem);
    menuBar.add(editMenu);
    helpMenu.setText("Help");
    contentsMenuItem.setText("Contents");
    helpMenu.add(contentsMenuItem);
    aboutMenuItem.setText("About");
    helpMenu.add(aboutMenuItem);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addGap(18, 18, 18)
    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap())
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    pack();
    }// </editor-fold>
    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                            
    System.exit(0);
    private void connectBTNActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:
    // Get the CommPortIdentifier.
    thePortID = getSelectedIdentifier();
    System.out.println("Trying to open " + thePortID.getName() + "...");
    try{
    thePort = thePortID.open("DarwinSys DataComm", TIMEOUTSECONDS * 1000);
    SerialPort myPort = (SerialPort) thePort;
    SEvent = (SerialPortEventListener) thePort;
    //SEvent.serialEvent();
    myPort.setSerialPortParams(getBaud(), getDataBits(), getStopBits(), getParity());
    myPort.getFlowControlMode();
    myPort.notifyOnDataAvailable(true);
    myPort.addEventListener(this);
    inputStream = myPort.getInputStream();
    } catch (TooManyListenersException ex) {
    Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
    Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
    } catch (UnsupportedCommOperationException ex) {
    Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
    } catch (PortInUseException ex) {
    Logger.getLogger(MyComport.class.getName()).log(Level.SEVERE, null, ex);
    } //catch(TooManyListenersException e) {}
    System.out.println("Trying to open with BAUD " + getBaud());
    System.out.println("Trying to open with DataBits " + getDataBits());
    System.out.println("Trying to open with Parity " + getParity());
    System.out.println("Trying to open with StopBits " + getStopBits());
    System.out.println("Trying to open with FlowControl " + getFlowControlMode());
    /* The public "getter" to retrieve the selection by CommPortIdentifier. */
    public CommPortIdentifier getSelectedIdentifier() {
    selectedPortName = (String) comportCMB.getSelectedItem();
    // Get the given CommPortIdentifier
    selectedPortIdentifier = (CommPortIdentifier)map.get(selectedPortName);
    return selectedPortIdentifier;
    private void disconnectBTNActionPerformed(java.awt.event.ActionEvent evt) {                                             
    // TODO add your handling code here:
    thePortID = getSelectedIdentifier();
    thePort.close();
    System.out.println("Closed " + thePortID.getName() + "...");
    public int getBaud(){
    int baud;
    baud = Integer.parseInt((String) baudCMB.getSelectedItem()) ;
    return baud;
    public int getDataBits(){
    int databits;
    databits = Integer.parseInt((String) databitsCMB.getSelectedItem());
    return databits;
    public int getParity(){
    String parity;
    parity = (String) parityCMB.getSelectedItem();
    if(parity.equals("Even"))
    return SerialPort.PARITY_EVEN;
    else if(parity.equals("Odd"))
    return SerialPort.PARITY_ODD;
    else if(parity.equals("Mark"))
    return SerialPort.PARITY_MARK;
    else if (parity.equals("Space"))
    return SerialPort.PARITY_SPACE;
    else
    return SerialPort.PARITY_NONE;
    public int getStopBits(){
    String stopbits;
    stopbits = (String) stopbitsCMB.getSelectedItem();
    if(stopbits.equals("1"))
    return SerialPort.STOPBITS_1;
    else if(stopbits.equals("1.5"))
    return SerialPort.STOPBITS_1_5;
    else
    return SerialPort.STOPBITS_2;
    public int getFlowControlMode(){
    String flowcontrol;
    flowcontrol = (String)flowconCMB.getSelectedItem();
    if(flowcontrol.equals("Xon/Xoff In"))
    return SerialPort.FLOWCONTROL_XONXOFF_IN;
    else if(flowcontrol.equals("Xon/Xoff Out"))
    return SerialPort.FLOWCONTROL_XONXOFF_OUT;
    else if(flowcontrol.equals("RTS/CTS In"))
    return SerialPort.FLOWCONTROL_RTSCTS_IN;
    else if(flowcontrol.equals("RTS/CTS Out"))
    return SerialPort.FLOWCONTROL_RTSCTS_OUT;
    else
    return SerialPort.FLOWCONTROL_NONE;
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new MyComport().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JComboBox baudCMB;
    public javax.swing.JComboBox comportCMB;
    private javax.swing.JButton connectBTN;
    private javax.swing.JMenuItem contentsMenuItem;
    private javax.swing.JMenuItem copyMenuItem;
    private javax.swing.JMenuItem cutMenuItem;
    private javax.swing.JComboBox databitsCMB;
    private javax.swing.JMenuItem deleteMenuItem;
    private javax.swing.JButton disconnectBTN;
    private javax.swing.JMenu editMenu;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JComboBox flowconCMB;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem openMenuItem;
    private javax.swing.JComboBox parityCMB;
    private javax.swing.JMenuItem pasteMenuItem;
    private javax.swing.JTextArea receiveTBX;
    private javax.swing.JMenuItem saveAsMenuItem;
    private javax.swing.JMenuItem saveMenuItem;
    private javax.swing.JButton sendBTN;
    private javax.swing.JTextArea sendTBX;
    private javax.swing.JComboBox stopbitsCMB;
    // End of variables declaration
    }

    Thank you, for your kind reply......
    I tried for plain java coding, it is worling fine.
    It is receiving data on events from my harware.
    But problem while I implement SerialPorteventHandler.
    I am working on Netbeans 6.0.1
    MyCODE : -------
    class MyComport extends javax.swing.JFrame implements SerialPortEventListener{
              // My CODE
    }This give error like.....
    readserialport.MyComport is not abstract and does not override abstract method serialEvent(javax.comm.SerialPortEvent) in javax.comm.SerialPortEventListener
    If I remove this SerialPortEventListener then it doesn't allow me to add event listener.....
    myport.addeventlistner(this);I tried to solve this problem other way, but failed...
    Please help me to sola this problem....

  • Where is Taligent's 'Porting C++ to Java'?

    I have spent several hours searching the Web for
    'Porting C++ Java' and similar as search key.
    I have found and downloaded three:
    1. Moving C and C++ code to Java (in Java Tricks of the
    Programming Gurus) by Glenn L. Vanderburg. et al.
    2. Porting a C++ Application to Java Danny Kalev (in C++ user's Journal)
    3. How to Convert C to Java published on Jazillian's (a
    C to Java converter program) web site.
    I have seen numerous references to Taligent's 'Porting C++ to Java'
    or 'Cookbook for porting C++ to Java', so I believe this must be
    important. Most of the references lead to an IBM Developer's page,
    but I have not been able to find Taligent's document there.
    Maybe it has been removed.
    Any other ways of getting hold of it?
    Are there any other documents about porting C/C++ to Java?

    IBM I'm sure would rather forget about Taligent, so I'd say you are probably out of luck.
    It may be going around under the guise of a different name, or you may find it on a fan site, but you won't be finding it on an IBM site.

  • Selecting a port number in java????

    I'm trying to select a port number for a data connection. Any nonprivileged port number I like can be used(numbered 1024 or greater), but my server must catch the appropriate exception if the port is already in use and I have to select a different one.
    How do I do this???? Does anyone know?

    You can scan all ports using this program:
    import java.net.*;
    public class LocalScan {
      public static void main(String [] args) {
       for (int i=1;i<65535;i++) {
         testPort(i);
       System.out.println("Completed");
      private static void testPort(int i) {
        try {
          ServerSocket sock=new ServerSocket(i);
        catch (java.io.IOException e) {
          System.out.println("Port " + i + " in use.");
    }

Maybe you are looking for

  • How to use JSSE HttpsURLConnection in WL 5.1

    I am trying to POST, from a jsp within weblogic, to an outside https URL. It appears to me that weblogic.net.http.HttpsURLConnection cannot POST to a connection. I am now trying to use Sun's JSSE 1.0.3. I've installed jcert.jar, jnet.jar and jsse.jar

  • Can I use a Apple TV which I purchased in the USA abroad

    I recently purchased an Apple Tv & Time capsule in the USA.Can I use them outside the USA(in UK or worldwide).I was just wondering if I need an adapter for the power supply etc. Or products purchased in the US cannot be used outside the country??

  • How to get automatic plant and shipping point and storage location

    hi, sap gurus, how to get automatic plant and shipping point and storage location automatically into the sales order i have done all the config settings for that but its not appearing automatically. regards, balaji.t

  • Need help fixing my Power Supply (delta 710W)

         My Power Mac G5 had been acting strange lately in the form of not turning until I waited a day after turning it off. Thankfully, I have determined the cause to be the power supply after using the apple hardware test and reading other posts. When

  • CUCM 9 vs CUCM 10 License

    Hi Everyone I wanted to know can anyone tell me  what is the difference between ELM which is used in CUCM 9 and PLM which is used in CUCM 10. Is it just a name change and they are the same or is there really a big difference between them. Thanks in a