usb detection

Ads

 
 
 

Share on Google+Share on Google+

sabeer
usb detection
3 Answer(s)      6 years and 4 months ago
Posted in : Java Beginners

i want to detect usb device using javacode

Ads
View Answers

June 9, 2012 at 4:50 PM


try this:

import java.io.*;
import javax.swing.*;
public class DetectWin extends JFrame
{
    JPanel loginPnl = new JPanel();
    JTextField Dfield = new JTextField("", 20);
    
    DetectWin()
    {
        super("AUTHORIZATION");
        setSize(350, 100);
        setLocation(400, 300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        add(loginPnl);
        setVisible(true);
        setResizable(false);
        
        loginPnl.add(Dfield);
        String[] letters = new String[]{ "A", "B", "C", "D", "E", "F", "G", "H", "I", "Z"};
        File[] drives = new File[letters.length];
        boolean[] isDrive = new boolean[letters.length];

        for ( int i = 0; i < letters.length; ++i )
            {
            drives[i] = new File(letters[i]+":/");

            isDrive[i] = drives[i].canRead();
            }

         Dfield.setText("Waiting for devices....");

         while(true)
            {
            for ( int i = 0; i < letters.length; ++i )
                {
                boolean pluggedIn = drives[i].canRead();

                if ( pluggedIn != isDrive[i] )
                    {
                    if ( pluggedIn )
                    	Dfield.setText("Drive "+letters[i]+" has been plugged in");
                    else
                    	Dfield.setText("Drive "+letters[i]+" has been unplugged");

                    isDrive[i] = pluggedIn;
                    }
                }

            try { Thread.sleep(100); }
            catch (InterruptedException e) { }
            }
    }
    public static void main(String args[])
    {
        DetectWin AUTHORIZATION = new DetectWin();
    }
}



January 30, 2013 at 7:30 AM


hiii...

i tried this program but cannot read or detect my USB device. can you explain me, why...?

tq



February 25, 2013 at 8:40 AM


Hiii, nice posting...

i tried this code and running more than 5 minutes but can not read or detect my USB device. i'm using windows 7-64 bit, netbeans 7.1.2 and my device using USB type B connected to PC using USB type A.

can you explain me, why...?

best regards

-kiper-


Ads









Related Tutorials/Questions & Answers:
usb detection
usb detection  i want to detect usb device using javacode
JMF WebCam detection problem - Framework
JMF WebCam detection problem  Hello friends, I am using JMF to operate my web cam.My usb webcam works perfectly with JMF, I used it in JMStudio... = CaptureDeviceManager.getDeviceList( null ); my USB "webcam" is detected however when i
Advertisements
unique manufacturing id of a usb flash drive.
unique manufacturing id of a usb flash drive.  I need code for java application to read the unique manufacturing id of a usb flash drive. Please help me ? thanking you
face detection and face recognition
face detection and face recognition   hi,i will create a project detection and recognition of face in java , i create the face detection using opne... will send the part of face detection if you want help me please
VoIP USB Phone
VoIP USB Phone          A Corinex VoIP USB Phone A USB phone which can... included in the USB phone packaging to be able to use this software
php browser detection script - PHP
php browser detection script   I need a browser detection script in PHP. I am creating my application compatible to firefor, mozila and IE too
Java Circle to Circle collision detection
Java Circle to Circle collision detection  Java Circle to Circle collision detection
detection of the operating system on the client machine
detection of the operating system on the client machine  How to detect the operating system on the client machine
java collision detection between two images
java collision detection between two images  java collision detection between two images
Collision Detection between two images in Java
Collision Detection between two images in Java  Collision Detection between two images in Java
how to run java program that has several classes under package from usb drive?
how to run java program that has several classes under package from usb drive?  I have an assignment where I have to submit my code in flash drive. I did all coding in eclipse and getting all output. I tried running it through
error detection - Java Beginners
{ public static void main (string[] args) { Queue q=new
Flex event phase detection example
Flex event phase detection example       With example below an introduction of phases in flex is demonstrated. In flex there are three phases. capturing, targeting and bubbling
What is eToken?
. It looks similar to pen drive and fixes in the USB port of the computer... with USB interface that attaches in the USB Port. As it fixes in the USB port
VoIP Headsets
wireless headset for VoIP applications with remote call detection and answer... comfortable wearing options, and hands-free convenience via your USB port. A complete wireless VoIP softphone solution that quickly connects to your USB port
jUSB api
jUSB api  How can i access the USB using jUSB api and also hw to add this api to the netbeans
Mobile phones in 2011
, USB, Geo-tagging, touch focus, face and smile detection OS: Android...: GPRS, EDGE, 3G, Bluetooth, USB Memory: Internal 90 MB, external up to 8 GB..., RSS, Geo tagging, and Face Detection features OS: Android OS, v2.1
VoIP Adapters
number with an area code and a unique number.      USB Telebox Adapter for VoIP The telebox adapter connects to your PC via USB.... There are some features of USB telebox adapter is following here's
VoIP Modem
cancellation, high-pass filter, and voice activity detection (VAD) * Issuing redundant... * Differentiating modem signals from voice and fax signals, indicating the detection... to a computer through either a 10/100Base-T Ethernet or a USB data port.  
ajay
ajay  can anyone tell me how intrusion detection system works. and how it can be developed by using java
We are providing Knoppix 3.6 Live Linux CD's
. It auto-detects hardware and supports many graphics cards, sound cards, USB... update - FreeNX-Server package from Fabian Franz - hardware detection updates &... or IMPS/2-compatible USB-mouse * If your computer doesn't have that much RAM
Objective C resize UIImage
Objective C resize UIImage  i just want to resize the image on the touch detection. That means if a user double clicks on the UIImage it must resize the image
can anyone help me to implement strength of the password - Security
can anyone help me to implement strength of the password  hi.. i have to implement password strength detection algorithm. How can i use dictionary in linux system
VoIP Router
and a USB printer port and support for all current ADSL technologies... standard broadband ADSL connectivity using USB, Ethernet and Wireless and now... it direct into your PC via USB. If you?re using Windows XP/2000, Mac OS X or Linux
C Language - Java Beginners
. What is USB ? 9. What is Computer Network? What is the necessary of using
What is WiFi Finder?
the direction of the signal. Some models come with built in USB ports. This way you... configured. Further, the models automatically recharge once they connect with the USB.... Another important factor to check is the USB standards of the WiFi finder
Tutorials   
Java Spring Hibernate Struts Training java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java Java Example Codes and Tutorials in 2017 How do I read a large file quickly in Java? Is learning Java worthwhile?

Ads

 
Advertisement null

Ads