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.

Results 1 to 2 of 2

Thread: Drawing a rectangle

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Drawing a rectangle

    Hi,
    Im new to android but ive followed some beginner tutorials.
    They always expain how to make a message box or input box.
    But my question is: how do I create a rectangle?
    Ive done some research, this "should" be it:

    Paint myPaint = new Paint();
    myPaint.setColor(Color.rgb(0, 0, 0));
    myPaint.setStrokeWidth(10);
    c.drawRect(100, 100, 200, 200, myPaint);
    But the variable c is not defined.
    Im guessing c is bitmap.
    If so, then:
    createBitmap(int width, int height, Bitmap.Config config)
    Should be it, but I have no idea what Config.config is.
    How can i make this work?


  2. #2
    Junior Member
    Join Date
    May 2013
    Posts
    2
    My Mood
    Amused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Drawing a rectangle

    I think it would be smart for you to buy a book and study the basics of object oriented programming in Java. Your question contains so many wrong assumptions that it is impossible to answer.

Similar Threads

  1. getPerimeter of a rectangle
    By JlovesJava in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 22nd, 2013, 03:12 PM
  2. Rectangle + Origo
    By NeewBieGeKo in forum Java Theory & Questions
    Replies: 1
    Last Post: November 27th, 2012, 01:51 PM
  3. what's wrong with code? Rectangle
    By OKJ in forum Java Code Snippets and Tutorials
    Replies: 2
    Last Post: November 9th, 2012, 12:27 AM
  4. Graphics Drawing Images/Rectangle Detecting/Deleting
    By Massaslayer in forum AWT / Java Swing
    Replies: 2
    Last Post: December 17th, 2011, 07:19 AM
  5. Rectangle questions
    By stacksofamber in forum Java Theory & Questions
    Replies: 3
    Last Post: September 5th, 2011, 12:43 PM

Tags for this Thread