aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Is it possilbe to create Gantt chart without any tool 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 "Is it possilbe to create Gantt chart without any tool" Watch "Is it possilbe to create Gantt chart without any tool" New topic
Author

Is it possilbe to create Gantt chart without any tool

shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
HI,

I want to create a Gantt chart for scheduling in applet...Can anyone say me,how to create it without any tool and is there any sample program avilable..Help me,guys!!!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
Assuming by "without tools" you mean without some 3rd party library, this boils down to drawing text, lines and boxes in a GUI component. It doesn't make a difference whether this happens in an applet or an application, provided the code can get at the data somehow.

Have you used Swing (or AWT) before? If not, the Swing chapter of the Java Tutorial will get you going. Since you'll be doing custom painting, this section is highly relevant.


Ping & DNS - my free Android networking tools app
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
Thanks for your reply...
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I want to draw the line inside the tabel i.e., in a particular cell of a tabel..How can i achieve it?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
What do you mean by table - a JTable object? If so, you can use a custom TableCellRenderer for it. If you mean something else, tell us what objects/components you're using.
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
yes,i mean JTabel...Thank you...
I don't want my Cell and column lines to visible...how can i do it
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
JTable has a "show grid on/off" feature; check the javadocs for the correct method names.
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
Thanks for your reply...
I used Table for displaying the gantt chart thinking that the lines will not overlap...Is there any other way for displaying the chart...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
Is there any other way for displaying the chart...[/QB]

You can use graphics to draw boxes, lines, text, etc. using the Graphics object in the paintComponent method of a JPanel, as I mentioned earlier.
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I want to draw lines inside the rectangle with equal spaces along with a string..How can i?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
I can't really picture what you're describing; can you show us an image of it?

Neither text nor lines nor rectangles are difficult to draw using the Graphics object; what makes the composition difficult?
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Is it possible to create Gantt chart without any tool ?


Yes, of course. I believe the tools are using the same JDK available to you.
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
If then can please show me some sample program..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
What Roseanne was getting it is that -since a library like JFreeChart, which can produce Gantt charts, is written in Java- it's certainly possible to do the same in your code without using the library. Obviously, that involves duplicating a lot of effort that has gone into the library. Which brings us to the question: why don't you want to use the library?

As to your question about sample code: tell us in detail -if possible with an image- what it is you're struggling to accomplish. As I said, I'm having a hard time picturing what "lines inside the rectangle with equal spaces along with a string" would look like.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Originally posted by shalini gnana:
If then can please show me some sample program..


Easy, take a look at source code of jFreeChart. It is a tool, and also it can be used as a teacher too.

jFreeChart is open source, do you know what does that mean?
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
Thanks alot,for your effort in answering...
If i use it..I doesn't make any difference?How can i use that library functions in my IDE?
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I want to draw the chart for Scheduling...I use rectangle for displaying the dates on the top of the graph..within the rectangle i want to display the time by marking small lines
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I need to add tree to be displayed at the left..But my tree is not showing..


[ October 19, 2007: Message edited by: Ulf Dittmer ]
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Originally posted by shalini gnana:

If i use it..I doesn't make any difference?How can i use that library functions in my IDE?


Put jfreechart.jar in your classpath.

Check your IDE classpath/buildpath options.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
The tree you're adding is empty - the code never does anything with rootnode, nor is createNodes() ever called.


Don't ever call the constructor of an applet. If you need a reference to the applet object, pass the reference "this" around.
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
Where should i have to add my "rootnode" and "createNode()"?
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I'm using NetBeans..I tried to add,Jfreechart..But i couldn't..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
Originally posted by shalini gnana:
I'm using NetBeans..I tried to add,Jfreechart..But i couldn't..


Let's keep questions about this out of this thread. If you need help with NetBeans, start a new thread in the IDE forum.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42286
    
  64
It's often best to start simple to get something going. The following code snippet demonstrates how to get something running without the JScrollPane. Have a look at it to understand what it does. If you then have questions on how to proceed, start a new thread; this one is getting a bit long.

shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
Thank you...
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I'm creating a gantt chart..when i expand the tree the task coresponding to the leaf node have to show and if i close the leaf node,the corresponding task should not show..
How can i do it..I have created a tree..
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
IS there any method to do it?
shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
IS there any method to do it?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possilbe to create Gantt chart without any tool