• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

compiled but not running

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just written this code for calculating the perimeter and area of Rectangle, i was able to compile it but still couldn't run it, could anyone please help me have a look at it.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens when you run it? What should it do that it is not doing? Are there runtime errors? A stacktrace perhaps?
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
these go together
public class periArea extends JFrame {
Container pane = getContentPane();
pane.add(row1);
pane.add(row2);
pane.add(row3);


and these go together
JFrame frame;
frame.setTitle("Area and Perimeter");
frame.setSize(400,400);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setVisible(true);

the two are not the same JFrame - you should be able to work out the fix.

when fixed, your next question will be "only row3 shows" - JFrame's default
LayoutManager is BorderLayout - read the apidocs for BorderLayout to see how
multiple components should be added.
 
That is a really big piece of pie for such a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic