File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Drag & Drop (DnD) & Optimizing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drag & Drop (DnD) & Optimizing" Watch "Drag & Drop (DnD) & Optimizing" New topic
Author

Drag & Drop (DnD) & Optimizing

Kayvon Farvardin
Greenhorn

Joined: Oct 21, 2006
Posts: 4
Hi, I'm new to the Ranch. I would normally ask my friend who is pretty good with Java but he hasn't been online lately and I want the program done by next weekend. (heres his website for the curious ones www.yellowbirdcomputing.com )

Anyway, here are my questions:

1. I have a little 1st program which I want to add DnD to. I want to add DnD to my JList but haven't been able to find instructions on the Java website. ATM all I have so far is model.setDragEnabled(true) which in OS X brings up the green + showing that it is trying to drag somthing which must mean i got it right, cept it won't drop since i haven't defined the dropping part (i wish gravity applied to programs )

2. About optimizing, In my program i have this as my import statements:



And I noticed for a small program it loads a little slow. The 1st working version i had (which was a 4kb .jar) it takes 2 seconds to load on my Win2k, AMD 64 2ghz, 600ish Mb, ATI x300 PC. On my G3, 256Mb iBook it takes longer but thats understandable due to specs. I was wondering if maybe my imports were the problem since they seem to make the computer import the entire library? Would specifying what things to load (like javax.swing.JButton ) make it start faster?

Sorry If I wrote alot, I tried to be as discriptive as possible with my questions.
[ October 21, 2006: Message edited by: Kavon Farvardin ]
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Kavon Farvardin:
...I was wondering if maybe my imports were the problem since they seem to make the computer import the entire library? Would specifying what things to load (like javax.swing.JButton ) make it start faster? ...

No, import statements only open the door for visibility, so the class can be found when needed. They do not "bloat" programs. (See this Sun Tech Tip.)

As for the DnD part of your question, I'm going to move this thread to the Swing forum, so it gets expert attention. Please continue this discussion there.

Welcome to JavaRanch!
[ October 21, 2006: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Kayvon Farvardin
Greenhorn

Joined: Oct 21, 2006
Posts: 4
Thank you for the move and answer to one of them Marc.

Just to clarify, I need DnD support only for within a JList, not complicated outside DnD if thats what any one is thinking. Basicly just the ability to rearrange the list with dragging. Thanks in advance
[ October 21, 2006: Message edited by: Kavon Farvardin ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Drag & Drop (DnD) & Optimizing