![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2007
Posts: 3
Rep Power: 0
![]() |
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);
}
}Exception in thread "main" java.lang.NoSuch.Method.Error: main 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!");
}
}![]() |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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 |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Oct 2007
Posts: 3
Rep Power: 0
![]() |
Re: can u help
How can i fix this problem ? Can you help me in a way ?
|
|
|
|
|
|
#4 |
|
Expert Programmer
|
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. |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Oct 2007
Posts: 3
Rep Power: 0
![]() |
Re: can u help
i cant compajl bro, have same errorr
![]() can you show me your results that you have compiled |
|
|
|
|
|
#6 |
|
Expert Programmer
|
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.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|