Results 1 to 6 of 6
  1. #1
    gaston7eze is offline Member
    Join Date
    May 2012
    Posts
    3
    Rep Power
    0

    Default I cant do this.Whats wrong?

    Hello guys,im new to the forum!I have been trying to make a sharp appear on the screen but i cant.It says that there is no main method or something.What should i do?
    Here is the code:
    Code:
    package asd;

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


    @SuppressWarnings("serial")
    public class Lama extends JFrame {
    public void run{




    public void paint( Graphics g )
    {


    Graphics2D to = ( Graphics2D ) g;


    to.setPaint( new GradientPaint( 5, 30, Color.BLUE, 35, 100,
    Color.YELLOW, true ) );
    to.fill( new Ellipse2D.Double( 5, 30, 65, 100 ) );
    to.getColor();


    }
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: I cant do this.Whats wrong?

    Forum Rules
    Guide For New Members
    BB Code List - Java Programming Forum

    Quote Originally Posted by gaston7eze View Post
    It says that there is no main method or something.What should i do?
    Learn Java before attempting GUIs and custom painting: Lesson: The "Hello World!" Application (The Java™ Tutorials > Getting Started)

    Once you're past that, learn to do it the right way: Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    gaston7eze is offline Member
    Join Date
    May 2012
    Posts
    3
    Rep Power
    0

    Default Re: I cant do this.Whats wrong?

    I did all the "Hello world " lessons.I made a calculator a application form etc.Im just lost as i dont know where to go.What should i do?Thanks in advance.

  4. #4
    gaston7eze is offline Member
    Join Date
    May 2012
    Posts
    3
    Rep Power
    0

    Default Hola gente!Estoy perdido!

    Hola muchachos,estoy completamente perdido,no se por donde seguir.Ya eh seguido los tutoriales de "hello world" etc,es mas,hice una calculadora y un formulario, y otros proyectos del mismo tipo.Con que deberia seguir ahora?Creo que yo como tantos otros se encuentran en esta situacion de sentirse perdidos.Estaria bueno que nos hechen una mano.Desde ya ,gracias.

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Hola gente!Estoy perdido!

    Quote Originally Posted by Yahoo!BABELFISH
    Hello boys, I am completely lost, not by where following. Already eh followed the tutorials of " hello world" etc, is but, I made a calculator and a form, and other projects of the same type. Whereupon deberia to follow now? I believe that I eat so many others are in this situation to feel lost. Good Estaria that they hechen a hand to us. From already, thanks.
    Quote Originally Posted by Google Translate
    Hi guys, I'm completely lost, do not know where eh seguir.Ya followed the tutorials of "hello world" etc, is more, I made a calculator and a form, and other similar projects that should follow tipo.Con now? I think I like many others are in this situation to feel good that we Hechen perdidos.Estaria a mano.Desde already, thanks.
    Looks like the same question as posted earlier. Please use one thread per question: Forum Rules

    I'm merging this in the other thread.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    PRW56 is offline Member
    Join Date
    Mar 2012
    Posts
    75
    Rep Power
    0

    Default Re: I cant do this.Whats wrong?

    I have never gotten paint() to work in a JFrame or Frame if it is not done onto a panel, but dude why do you have a run method there? you need a constructor for this JFrame class, here is a really basic example of one:

    Java Code:
    import javax.swing.*;
    import java.awt.*;
    public class MYFrame extends JFrame
    {
    	JPanel base = new JPanel();
    	MYFrame()
    	{
    	    super("MYFrame");
    		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           	setContentPane(base);
            setSize(500,500);
    		setVisible(true);
    	}
    	public static void main(String[] args)
    	{
    		MYFrame a = new MYFrame();
    	}
    }

Similar Threads

  1. Whats wrong with this?
    By Alkor in forum AWT / Swing
    Replies: 7
    Last Post: 04-03-2012, 05:49 AM
  2. Whats wrong with my program?
    By jwb4291 in forum New To Java
    Replies: 7
    Last Post: 12-12-2010, 04:40 AM
  3. whats wrong
    By atenv in forum New To Java
    Replies: 6
    Last Post: 06-15-2010, 01:55 PM
  4. whats is wrong with this app??
    By mrajan in forum New To Java
    Replies: 4
    Last Post: 06-09-2010, 10:56 PM
  5. Database help... whats wrong?
    By neosnokia in forum JDBC
    Replies: 4
    Last Post: 06-09-2009, 11:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •