Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   can u help (http://www.programmingforums.org/showthread.php?t=14201)

henry11 Oct 20th, 2007 6:13 PM

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

http://img149.imageshack.us/img149/2...problemga0.png

DaWei Oct 20th, 2007 6:47 PM

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?

henry11 Oct 20th, 2007 7:03 PM

Re: can u help
 
How can i fix this problem ? Can you help me in a way ?

titaniumdecoy Oct 20th, 2007 7:13 PM

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.

henry11 Oct 20th, 2007 7:39 PM

Re: can u help
 
i cant compajl bro, have same errorr :$
can you show me your results that you have compiled

titaniumdecoy Oct 20th, 2007 7:58 PM

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.


All times are GMT -5. The time now is 12:43 PM.

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