Results 1 to 6 of 6
Thread: I cant do this.Whats wrong?
- 05-26-2012, 04:52 PM #1
Member
- Join Date
- May 2012
- Posts
- 3
- Rep Power
- 0
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();
}
}
}
- 05-26-2012, 05:41 PM #2
Re: I cant do this.Whats wrong?
Forum Rules
Guide For New Members
BB Code List - Java Programming Forum
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)
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 05-26-2012, 05:52 PM #3
Member
- Join Date
- May 2012
- Posts
- 3
- Rep Power
- 0
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.
- 05-26-2012, 06:17 PM #4
Member
- Join Date
- May 2012
- Posts
- 3
- Rep Power
- 0
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.
- 05-26-2012, 08:07 PM #5
Re: Hola gente!Estoy perdido!
Originally Posted by Yahoo!BABELFISH Looks like the same question as posted earlier. Please use one thread per question: Forum Rules
Originally Posted by Google Translate
I'm merging this in the other thread.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 05-30-2012, 12:34 AM #6
Member
- Join Date
- Mar 2012
- Posts
- 70
- Rep Power
- 0
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
-
Whats wrong with this?
By Alkor in forum AWT / SwingReplies: 7Last Post: 04-03-2012, 05:49 AM -
Whats wrong with my program?
By jwb4291 in forum New To JavaReplies: 7Last Post: 12-12-2010, 04:40 AM -
whats wrong
By atenv in forum New To JavaReplies: 6Last Post: 06-15-2010, 01:55 PM -
whats is wrong with this app??
By mrajan in forum New To JavaReplies: 4Last Post: 06-09-2010, 10:56 PM -
Database help... whats wrong?
By neosnokia in forum JDBCReplies: 4Last Post: 06-09-2009, 11:17 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks