Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implement this constructor

 
Willie Toma
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been unable to run this code. I tried to implement this constructor in a class. Does anyone have any suggenstions? What i've tried hasn't worked.
 
Wilfried LAURENT
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you be more specific when you say you could not "run" this example? What happens? Compilation error? RunTime Error? The result is not what you expected?
W.
 
Bill Krieger
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Willie Toma:
[B]I've been unable to run this code. I tried to implement this constructor in a class. Does anyone have any suggenstions? What i've tried hasn't worked.
[/B]

Your GridbagDemo class doesn't explicitly extend any other class. Therefore super("GridBagLayout") will fail, as Object has no such constructor. Did you intend for this class to extend Frame?
 
Willie Toma
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was an incomplete example that was in a book.
To display the example I tried to place it in the following block of code.
[CODE]
import java.awt.*;
import java.awt.event.*;
class GridBag extends Frame{
public static void main(String[] args){
new GridBagDemo().show();
}
// Example code here
}
Is this the correct way to go about this. Thanks in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic