Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

can not find methods

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ben Hultin
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for that, fixed all my errors
 
Rototillers convert rich soil into dirt. Please note that this tiny ad is not a rototiller:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic