Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

why i'm not getting graph (output)?

 
vishnu vardhan brundavanam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ....

 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 11085
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
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()
 
vishnu vardhan brundavanam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 11085
13
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Maneesh Godbole wrote:After you load the data, you need to tell your canvas to draw the graphs. Invoke a repaint() on it.
 
    Bookmark Topic Watch Topic
  • New Topic