3 Replies Latest reply: Mar 17, 2010 9:59 PM by 793415 RSS

    Setting canvas width and height objectdraw

    843807
      I would like to kno how to set the window height and width so users cannot resize it. I would like the methods to be out of the library objectdraw
      Thanks
        • 1. Re: Setting canvas width and height objectdraw
          793415
          motherboarddude wrote:
          I would like to kno how to set the window height and width so users cannot resize it.
          [Frame.setResizable(boolean)|http://java.sun.com/javase/6/docs/api/java/awt/Frame.html#setResizable(boolean)]
          ..I would like the methods to be out of the library objectdraw
          The what library? Never heard of it. Is it J2SE or 3rd party?
          Thanks
          No worries.
          • 2. Re: Setting canvas width and height objectdraw
            843807
            [http://eventfuljava.cs.williams.edu/library/objectdrawJavadocV1.1.2/index.html] no clue
            • 3. Re: Setting canvas width and height objectdraw
              793415
              motherboarddude wrote:
              [http://eventfuljava.cs.williams.edu/library/objectdrawJavadocV1.1.2/index.html] no clue
              What does 'no clue' mean? That you have no clue if it is J2SE? The answer is no, it is not J2SE (or even a Sun standard extension like JavaHelp or JOGL). We know nothing about that API and can provide no help with it.

              (And in future, try to make your replies specific enough that people do not have to 'guess' what you mean. That becomes irritating, very quickly.)

              OTOH a brief perusal of the JavaDocs suggests the API has no component that extends Frame or JFrame, so the answer to your request that it use one of the methods of your custom library is "No, it provides no functionality to restrict the size of the frame the user is offered - since that frame will come from the J2SE".

              Of course, if you simply wanted to ensure the drawing canvas is never resized, simply add it as a 'no args' element in a GridBagLayout with no other GUI components in it. If the GBL is used as described, the component will be centered within it. Add a JScrollPane to the component in case the user shrinks the frame smaller than the preferred size of the drawing area. In Java 1.6+, call setMinimumSize() after packing, and you can afford to lose the scroll pane.