Jump to content

How to size a graphics window using the ACM library?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
Blue Indian

Blue Indian

    Learning Programmer

  • Members
  • PipPipPip
  • 67 posts
I am using the ACM library to do a project for school. The project is to code the old game Breakout. I want to be able to start with a graphics window that's 400x600 pixels. I know that the GraphicsProgram class has a getWidth() and getHeight(), but I can't find a setWidth() or setHeight().

Thanks in advance!!

Robert

#2
kmhosny

kmhosny

    Programmer

  • Members
  • PipPipPipPip
  • 133 posts
i am sorry but what is the ACM library do you mean ACM=Association for Computing Machinery??
"Recursion is just a line of code"
-Karim Hosny-
My flickr

#3
Blue Indian

Blue Indian

    Learning Programmer

  • Members
  • PipPipPip
  • 67 posts
Yes, I mean the Association of Computing Machinery. I am sorry for not clarifying earlier.

#4
kmhosny

kmhosny

    Programmer

  • Members
  • PipPipPipPip
  • 133 posts
i searched over this library but i couldnt find anything, why would you use a library for GUI while the java has the swing library which is a great library by Sun?
"Recursion is just a line of code"
-Karim Hosny-
My flickr

#5
Blue Indian

Blue Indian

    Learning Programmer

  • Members
  • PipPipPip
  • 67 posts
Ok, thanks for looking for me. I will check out the swing library. Thanks again!!

Robert

#6
Blue Indian

Blue Indian

    Learning Programmer

  • Members
  • PipPipPip
  • 67 posts
Can you please direct me to a good web page where I can learn about resizing graphics windows?

Thanks in advance!!!!!!!

Robert

#7
kmhosny

kmhosny

    Programmer

  • Members
  • PipPipPipPip
  • 133 posts
Trail: Creating a GUI With JFC/Swing (The Java™ Tutorials) here you can find a swing tutorial.
about resizing there is a component in the swing called JFrame that creates the window, the class that you want to be GUI for you application can extend the JFrame class and you can call set size in your class constructor and pass the desired size.
public class GUI extends JFrame
{
      int width=500,height=500;
     public GUI()
     {
        super();
        setSize(width,height);
     }
}

"Recursion is just a line of code"
-Karim Hosny-
My flickr