Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-05-2008, 10:07 AM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default Getting disk label
The code snippet below gets the label of the disk.

Code:
FileSystemView view = FileSystemView.getFileSystemView();
  File dir = new File(path);
  String name = view.getSystemDisplayName(dir);
  if (name == null) { return null; }
  name = name.trim();
  if (name == null || name.length() < 1) {
   return null;
  }
  int index = name.lastIndexOf(" (");
  if (index > 0) {
    name = name.substring(0, index);
   }
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Example of SWT Label Java Tip Java Tips 0 01-09-2008 01:02 PM
Using java.awt.Label Java Tip Java Tips 0 01-02-2008 07:28 PM
SWT Label JavaForums Java Blogs 0 12-31-2007 05:53 PM
How to set an Icon in a Label? Soda New To Java 2 12-07-2007 01:38 PM


All times are GMT +2. The time now is 01:40 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org