Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 20th, 2007, 6:13 PM   #1
henry11
Newbie
 
Join Date: Oct 2007
Posts: 3
Rep Power: 0 henry11 is on a distinguished road
can u help

Problem1
import java.awt.*;
import javax.swing.*;
/** Paneli e krijon nje panel me ngjyra */
public class Paneli extends JPanel
   { /** paintComponent e mbush panelin me gjerat qe do te paraqiten
                    * @param g - "penda" grafike qe i vizaton gjerat */   
   public void paintComponent(Graphics g)
      { int gjeresia_e_kornizes = 300;
        int lartesia_e_kornizes = 200;
        g.setColor(Color.white);
        g.fillRect(0,0, gjeresia_e_kornizes, lartesia_e_kornizes);
        g.setColor(Color.red);
        int skaji_majtas = 105;
        int lart = 70;
        // vizatoje nje drejtkendesh
        int gjeresia = 90;
        int lartesia = 60;
        g.drawRect(skaji_majtas, lart, gjeresia, lartesia);
        // vizatoje nje rreth te mbushur
        int diametri = 40;
        g.fillOval(skaji_majtas + gjeresia - diametri, lart, diametri, diametri);
      }
   }
i can compajl and i dont have error but when i interprer java JPanel i have errorr
Exception in thread "main" java.lang.NoSuch.Method.Error: main
can u help me?
Problemi 2


import javax.swing.*;
import java.awt.*;

   public class KornizeTest
      { public static void main (String [] args)
         { JFrame korniza_ime = new JFrame();
         // fute nje panel ne kulmin e kornizes (frame):
          korniza_ime.getContentPane().add(new Paneli());
         // vere titullin ne kulmin e kornizes
         korniza_ime.setTitle("VizatuesiIKornizesSime");
         // nje menyre e lehte per ta ngjyrosur tere prapavijen e kornizes
         int gjeresia_e_kornizes = 300;
         int lartesia_e_kornizes = 200;
         korniza_ime.setSize(gjeresia_e_kornizes, lartesia_e_kornizes);
         korniza_ime.setVisible(true);
         System.out.println("Korniza u paraqit!");
         }
      }
and in this i have metod "main" but i cant compajl

henry11 is offline   Reply With Quote
Old Oct 20th, 2007, 6:47 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: can u help

It says that you are missing "main". In the code that you have posted, there is no "main". That seems to be relatively straightforward. In other words, it seems to be missing. Do you have other code that you are not showing us, or Java?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 20th, 2007, 7:03 PM   #3
henry11
Newbie
 
Join Date: Oct 2007
Posts: 3
Rep Power: 0 henry11 is on a distinguished road
Re: can u help

How can i fix this problem ? Can you help me in a way ?
henry11 is offline   Reply With Quote
Old Oct 20th, 2007, 7:13 PM   #4
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 841
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Re: can u help

The code you posted compiles and runs fine on my computer.

From the screenshot you provided it would appear that you accidentally put a semicolon after the declaration of the main method, but that is not the case in the code you posted. Try compiling again and see what happens.
titaniumdecoy is offline   Reply With Quote
Old Oct 20th, 2007, 7:39 PM   #5
henry11
Newbie
 
Join Date: Oct 2007
Posts: 3
Rep Power: 0 henry11 is on a distinguished road
Re: can u help

i cant compajl bro, have same errorr
can you show me your results that you have compiled
henry11 is offline   Reply With Quote
Old Oct 20th, 2007, 7:58 PM   #6
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 841
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Re: can u help

I compiled it the same way you did in the screenshot using javac. Try erasing those two files, then creating new ones by copying and pasting what you posted on this forum. That might do the trick. Otherwise I have no idea why you are getting that error.
titaniumdecoy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:28 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC