Java Programming Tutorial – 84 – Drawing Graphics

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

32 responses to “Java Programming Tutorial – 84 – Drawing Graphics”

  1. starseer73 Avatar

    how do you use gpen

  2. Programing Nation Avatar

    OH YES, Those Sweat Graphics!

  3. Nikoloz Avatar

    any difference between canvas class and jpanel class as far as making a window with some images goes? I've been told jpanel is a component of a jframe (or a window as i understand it in layman terms) and a canvas object is added to that component. So so far i think that you use .add(canvas) on a jframe with the canvs having an overriden paint method. but by simply changing class extension from canvas to JPanel, and paint() method to paintComponent() I see the same result. can anyone explain why? does this video's way make replace an existing default jpanel from the jframe and paintComponent() puts a canvas on there for us? or am I completely off the rails?

  4. Danny Semakov Avatar

    Hi! Just a confused beginner from video 37! Hope to get to this video some time!

  5. Fajol Miah Avatar

    can some explain the code below please, why do we have x,y in constructor parameter initialised with axes of the top ones.

     int x=10;
     int y=10;
       
       public  Constructor(int x, int y){
       
            this.x=x;
            this.y=y;

    }

  6. Redstone Flash Avatar

    If i were 20 i'd have a job by now, but i'm only 13 🙁

  7. cyclops Avatar

    Does anyone know how the drawComponent automatically gets called?

  8. Srijan Poudel Avatar

    But that peach class do not have a Constructor. So how are all those executed????

  9. Anurag Avatar

    Why do we need to add a JFrame object in the main class.? We never did that before. Is it because in all earlier GUIs we extend to JFrame but here we extended to JPanel?

  10. sandstonewater Avatar

    Thank you so much! Clear, simple intro to Java drawing!

  11. JeDi Avatar

    Hi, i tried to run the program but i only got a white screen, not rectangles ; there is a problem and its about the p component, it tells me "null" or something like i did not initialize the component called p

  12. Christopher Angulo Avatar

    @thenewboston

    I'm a bit confused. This looks a bit like a recursive method:

    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    }

  13. Oliver Naesh H Avatar

    can you draw a blue rectangle, and then change the color to red when you click it?

  14. Omio Rahman Avatar

    regarding 2d character movements If my sprite sheet is horizontal would it cause problems?

  15. Elias Bouhout Avatar

    If your program doesn't work maybe you could resolve that writing:
    "public class Example extends jFrame" instead of the
    "public class Example extends Jpanel" that he shows in the video,if that doesn't work try
    "public class Example extends JComponent".

    If you get an error "The serializable class Example does not declare a static final serialVersionUID field of type long" simply click on that error icon on the Eclipse IDE and click on "Add default serial version ID".

  16. Tim Kilduff Avatar

    "You should know this if you ever took a math class if your life" – Bucky

  17. Mindaugas Kolesnikovas Avatar

    hi, i need to draw standard normal diviation, whats the easiest way to draw that line? o do i actually have to make 100ths of drawLine statements and then sort each dot on the line?

  18. Marlon Constance Avatar

    you never showed us how to download the java 2D library when i go on the site i am seeing lots of links and still cant access the libraries pls help it;s firetrucking frustrating man????

  19. Marlon Constance Avatar

    hi bucky i did exactly what u did and no rectangle this fukin thing driving up z wall

  20. Marlon Constance Avatar

    hi bucky for the fill Rect Function do i have to specify int for the variables??????i

  21. New Bee Avatar

    i wrote down the program & I've got no errors but when i run it nothing comes out .. help me out !!

  22. D.K. Gonzales Avatar

    You just saved me, Bucky. I've been watching your videos since I started programming. It's 3:36am and I'm still awake 'cause I didn't pay attention on our last Java class. THANK YOU VERY MUCH.

  23. Netflicks Avatar

    For anyone that gets the error with super.paintComponent(g); you have to make sure that you're inheriting JPanel and not JFrame.

  24. Kees Hottinga Avatar

    In bucky.java:
    f.setLocationRelativeTo(null); // Pop up window in the middle.

  25. Rohan Khanna Avatar

    can we write g in the place of this ?? both will do same work or theres some diff.

  26. Donovan So Avatar

    I don't understand the use of the line "super.paintComponent(g);"
    My program runs fine without this line.
    Also, I tried changing all the "paintCompenent"s to "paint" and the program also runs fine. Why is that? Thanks in advance for any help! <3

  27. Aldo Gonzalez Avatar

    When I try to run it, it displays peach.Peach class was not found in Peach project and there wasn't a main class found.

  28. OverShockTV Avatar

    Thanks! Helped me a lot 😀

  29. Peter Tietler Avatar

    really goog, thanks

Leave a Reply

Your email address will not be published. Required fields are marked *