I have a homework assignment dealing with graphics.
I need a little bit of feedback on how to get started!
D:
If someone could please help explain a little, I would appreciate it.Attachment 1753
i attached the graphic i am supposed to make
Printable View
I have a homework assignment dealing with graphics.
I need a little bit of feedback on how to get started!
D:
If someone could please help explain a little, I would appreciate it.Attachment 1753
i attached the graphic i am supposed to make
Please ask as specific a question as possible. Right now it's hard to know what you need to do, or more importantly exactly where your stuck. Also show what you've tried and explain how it's not working.
I'm not even sure how to go about doing a graphic... I tried to follow my professors examples, but I cannot get anything to work.
He gave us an example of a rectangle :/ and i cannot even get it to compile correctly.
--- Update ---
For my assignment, this picture is all he gave us.
Take a look at the tutorial:
Lesson: Performing Custom Painting (The Java™ Tutorials > Creating a GUI With JFC/Swing)
I will take a look at this, thank you!
--- Update ---
I try to follow the tutorial.
package painting;
import javax.swing.SwingUtilities;
import javax.swing.JFrame;
public class Bus {
public static void main(String[]args){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
createAndShowGUI();
}
});
}
private static void createAndShowGUI(){
System.out.println("Create GUI on EDT"+
SwingUtilities.isEventDispatchThread());
JFrame f=new JFrame("Swing Paint Demo");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(250,250);
f.setVisible(true);
}
}
i typed this in notepad...
but i get the compiler error of
C:\Users\aml46720\Documents\bus.java:5: class Bus is public, should be declared in a file named Bus.java
public class Bus {
^
1 error
Tool completed with exit code 1
A public class must be in a file with a name the same as the class name.Quote:
should be declared in a file named Bus.java
Please edit your post and wrap your code with
[code=java]
<YOUR CODE HERE>
[/code]
to get highlighting and preserve formatting.