Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …



  1. I have to draw a cartoon character for a school project and I have a question. How to I pass multiple parameters to the paintComponent method. I tried this:
    public void paintComponent(Graphics g, Graphics g2) {
    Graphics2D pearl = (Graphics2D) g;
    Graphics2D wings = (Graphics2D) g2;
    I wanted to draw the different parts separately, however this printed nothing.
    public void paintComponent(Graphics g) {
    Graphics2D pearl = (Graphics2D) g;
    This however worked just fine. The issue is that I've already drawn a big part of my character, but I need to draw parts behind what I already have, and whenever I do that, things like .rotate() and .translate() will mess up everything that comes after, so I was hoping I could draw them in a separate method or something (I'm still rather new to Java so forgive my possible errors in terminology).
    I'd REALLY appreciate if you could respond asap. Currently drowning in other homework and I had to put this aside!
    I extended JComponent into the class. not JPanel.
    The character I'm drawing is the pokemon Palkia.
    I've already drawn the big shield thing with the pearl in the center on her shoulder, but I now need to draw the three wings that are behind that and that go rightwards. I don't know how to .rotate() those wings without rotating what I have as well.
    Thank you

  2. 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?

  3. 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){


  4. 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?

  5. 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

  6. 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".

  7. 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????

  8. 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.

  9. 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


Please enter your comment!
Please enter your name here