Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Implement this constructor

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic