Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes why i'm not getting graph (output)? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

why i'm not getting graph (output)?

vishnu vardhan brundavanam
Greenhorn

Joined: Nov 13, 2010
Posts: 11
hi...everyone....
I created an applet which contains a manubar .In that menubar only one manuitem " load file..."(menu item) is there. Which is used to browse the a file which contains a number of values to draw the graph. By that values i want to draw a line graph .
my aim is that when ever i browse a new file , take the values form that and to draw new graph base on the old scale.(if i browsed two files ,then the graph should contain two line graphs ) ...
here is the calling one...

when we browse a file ,then it is reading the file data but,graph was displaying.......
here is the code....



a blank applet with menubar is appearing ....
could you tellme whats wrong with my code ...?
than you ....


Vishnu Vardhan Brundavanam.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
The applet does nothing by itself - what did you expect? If you're performing any UI actions, tell us what those are, what you expected to happen in response, and what actually happened.

By the way, this:

is almost never a good idea. At least print a message somewhere that an exception occurred.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

After you load the data, you need to tell your canvas to draw the graphs. Invoke a repaint() on it.

Canvas is an AWT component. JApplet is a swing component. You will be better off using JPanel instead of Canvas. In case of Swing components, the recommended way is to override paintComponent() instead of paint()


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
vishnu vardhan brundavanam
Greenhorn

Joined: Nov 13, 2010
Posts: 11
In this program my intention is to draw a graph with the help of GUI. Means when i click "load file"menuitem it should tacke a file and should draw a graph with the value which are in that file...
When i'm clicking "Load flie" menuitem,it is tacking file,but not drawing graph....that is my problem....
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Maneesh Godbole wrote:After you load the data, you need to tell your canvas to draw the graphs. Invoke a repaint() on it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why i'm not getting graph (output)?
 
Similar Threads
how my scrollbar works?
why does my viewport gets accumulated?
why graph is not appearing?
why i'm getting nullpointer exception here?
Need help on graphics 2d plot to add functions