Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: gui to make a flow chart.

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Location
    Pilani, Rajasthan, India
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default gui to make a flow chart.

    I need to build a java application which supports drag and drop feature to build flow charts. The application is supposed to work like this :- there should be shapes which need to be dragged and dropped on to a separate area where all these shapes are put to form flow chart.

    I just need to know how should I begin and what libraries I should use. I am new to java and I have searched the net for related stuff but could not succeed.

    Please help.

    Thanks and regards

    Abhinav Varma


  2. #2
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: gui to make a flow chart.

    First, you will need to decide what kind of objects you are going to be dragging and dropping. Next, you will want to see if there's an existing Swing (or AWT) component that can be used to represent that object. Some common ones are:

    JLabel, JTextField, JTree, JList, etc. etc.

    All JComponents by standard have the framework to support drag and drop, but some don't have the TransferHandler implemented to actually perform the action once the object has been dragged/dropped, and even if they do have a default TransferHandler, if you want to be able to transfer your own type of data (or transfer a type of data to a JComponent that doesn't support that type by default) you will need to implement your own TransferHandler.

    The default objects Java can transfer to some components are: files, images, and strings. If you want your own data types, you will need to create an object that is transferable, as well as Serializable. Please note that the Serializable needs to be applied to all fields of that object, as well as any fields it's fields have, etc. etc. (primitives are default serializable). You will also need a DataFlavor so java knows how to retrieve data back/send data out.

    Drag and drop is quite an intensive piece of code that involves a lot of java standard API components. I don't think there are any libraries created for this purpose specifically other than the one provided with the standard API.

    If you want to see an example of an implementation of Drag and Drop I did using JTrees (note: the code I posted is currently being revised, but it does work until you try to transfer data into/out of the application), see this post.

Similar Threads

  1. What programs shall i make?
    By DarrenReeder in forum Java Theory & Questions
    Replies: 1
    Last Post: December 27th, 2009, 08:31 AM
  2. How to make it???
    By Subhasis Banerjee in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: October 29th, 2009, 03:49 PM
  3. How to create pie or other diagrams in jsp page?
    By sundarjothi in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: July 8th, 2009, 07:44 AM
  4. Tips or suggestion to learn java
    By tj23 in forum Java Theory & Questions
    Replies: 1
    Last Post: February 2nd, 2009, 06:05 AM
  5. Java algorithm for bank program to connect database
    By araujo3rd in forum Algorithms & Recursion
    Replies: 1
    Last Post: December 10th, 2008, 01:34 PM

Tags for this Thread