aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes can not find methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "can not find methods" Watch "can not find methods" New topic
Author

can not find methods

Ben Hultin
Ranch Hand

Joined: Aug 17, 2009
Posts: 135
now I am sure this is a tiny problem, but I cant figure it out.

here are the errors I am getting:



GUI_Event_Handler.java:11: cannot find symbol
symbol : method setDefaultCloseOperation(int)
location: class GUI_Event_Handler_Sub
guiEvent.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
^
GUI_Event_Handler.java:12: cannot find symbol
symbol : method setSize(int,int)
location: class GUI_Event_Handler_Sub
guiEvent.setSize(350, 100);
^
GUI_Event_Handler.java:13: cannot find symbol
symbol : method setVisible(boolean)
location: class GUI_Event_Handler_Sub
guiEvent.setVisible(true);
^
.\GUI_Event_Handler_Sub.java:18: Object() in java.lang.Object cannot be applied
to (java.lang.String)
super("the title");
^
.\GUI_Event_Handler_Sub.java:21: cannot find symbol
symbol : method setLayout(java.awt.FlowLayout)
location: class GUI_Event_Handler_Sub
setLayout(new FlowLayout());
^
.\GUI_Event_Handler_Sub.java:25: cannot find symbol
symbol : method add(javax.swing.JTextField)
location: class GUI_Event_Handler_Sub
add(item1);
^
.\GUI_Event_Handler_Sub.java:29: cannot find symbol
symbol : method add(javax.swing.JTextField)
location: class GUI_Event_Handler_Sub
add(item2);
^
.\GUI_Event_Handler_Sub.java:35: cannot find symbol
symbol : method add(javax.swing.JTextField)
location: class GUI_Event_Handler_Sub
add(item3);
^
.\GUI_Event_Handler_Sub.java:39: cannot find symbol
symbol : method add(javax.swing.JPasswordField)
location: class GUI_Event_Handler_Sub
add(passwordField);
^
.\GUI_Event_Handler_Sub.java:73: cannot find symbol
symbol : variable JOptionpane
location: class GUI_Event_Handler_Sub.thehandler
JOptionpane.showMessageDialog(null, string);
^
10 errors




Here is my driver class:




here is my driven class:




Thanks a lot for the help
Pushkar Choudhary
Rancher

Joined: May 21, 2006
Posts: 425

Are you sure your GUI_Event_Handler_Sub class is not supposed to extend any other class? The compile complains because your GUI_Event_Handler_Sub class uses methods like setLayout() or add() for which, it cannot find any definitions.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10266
    
    8

Pushkar is correct.
Check out the API to see which class these methods belong to. (You can use the "index" and "search" in your api docs to find this out)
After that, you will have two options
1) Make your class extend the original class you find
2) Provide your own implementation for these methods.

I personally would choose #1


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Ben Hultin
Ranch Hand

Joined: Aug 17, 2009
Posts: 135
Thanks a lot for that, fixed all my errors
 
Consider Paul's rocket mass heater.
 
subject: can not find methods