i got how to create the cube, but how do i loop the drawline?
i am supposed to only have one ?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
i got how to create the cube, but how do i loop the drawline?
i am supposed to only have one ?
What this code is supposed to do and your question are not clear. Can you post code that can be compiled and run to demonstrate what you're trying to do and then ask a specific question about that code or the result?
If this is meant to be a Swing GUI, there are many elements missing (like the Swing and the GUI), but even the little bit you've shown is not how painting in a Swing app is correctly done. The Custom Painting Lesson may answer some of your questions.
As GregBrannon correctly pointed out, your are missing many things. Your code is not a standalone GUI application and not even an "applet". You need to write several things to create a minimal but valid infrastructure for a GUI (AWT or Swing) application or applet.
There are tons of examples on the web, in the official tutorial, in articles/blogs and even I have some nice examples.
Andrea, www.andbin.net — SCJP 5 (91%) – SCWCD 5 (94%)
Useful links for Java beginners – My new project Java Examples on Google Code
You need to create a swing or awt to you project. Example code:
import java.awt.*;
import javax.swing.*;
public class SwingVindue extends JFrame
{
public void paint(Graphics g) {
//L�ngde 1
g.drawLine(600, 50, 50, 50);
//L�ngde 2
g.drawLine(600, 500, 70, 500);
//H�jde 1
g.drawLine(50,50,50,80);
//h�jde 2
g.drawLine(600,500,600,70);}
public static void main(String[] arg)
{
SwingVindue vindue = new SwingVindue();
vindue.setSize(1280,800);
vindue.setVisible(true);
}
}
--- Update ---
My own example
--- Update ---
I don't try to create a cube but is wiew you how you can set you draw lines in to a window
ATB (April 6th, 2014)
thanks!