How to set the cell size in a JFrame

Hello. Is there any way of setting the cell size in a JFrame. The reason why I want to set the cell size is that I want to be sure of their location that when I am placing components on the JFrame. So is there any way of setting the cell size beforehand. Also for the following code.
JFrame frame = new JFrame("Window");
frame.setSize(100,100);is the size 100 by 100 is he size of the cell?

smithbrian wrote:
When I am placing a component on the grid I want to be sure the component is exactly where I place it. In order to do that I would need to know what is the size of the gird and how to change the size of the gird in the JFrame.What grid?? You're assuming that we know much more about your program than we actually do. We actually know zip. Please read this help site which will help you to avoid similar errors in posting questions here. It has helped me in the past: [smart questions|http://www.catb.org/~esr/faqs/smart-questions.html]

Similar Messages

  • How to set the cell size in grid layout where each cell is a panel

    Hi,
    I am using a grid layout where each cell is a panel. Here I want to
    set size of each panel to be equal irrespective of any. But it is not obliging the setSize().
    no of row in grid - 4
    no of columns - 4
    each cell is a panel. each panel has a label.
    panel.setSize(parent.getWidth(), parent.getWidth()/4); // not working. Size is adjusting to the length of the label.
    I want to force the size of the panel to our preferred size.
    Note: In swing we can use JPanel.setPreferredSize(). Unfortunately I cannot use Swing components. Requirement is awt only.
    Any help in this is highly appreciated.
    Thanks
    Kishore

    I observed it is same behavior with gridbag layout. Infact it is gridbag layout only with 4 cells, where first cell should be of constant width (it is base for other cell widths) and other cells are variable (some integer*base width of first cell). I want to set the size of first cell width to be constant.
    Though it is redundant I once again say that it works perfect with setPreferredSize of JComponent.
    But I should not use any swing component/api. This is sytem requirement.
    Any help is appreciated.
    Thanks
    Kishore

  • How to set the minimum size of a JFrame.

    I can user JFrame.setMinimumSize() method with jdk1.6.0. But I can't find this method in jdk1.4.2. How can I do this with jdk1.4.2?

    Try google:
    http://www.google.com/search?q=jframe+minimum+size

  • Hi, I am using Indesign CS6, How to set the page size in Inches.

    Hi, I am using Indesign CS6, How to set the page size in Inches.

    All fields in InDesign can be entered in any measurement system. So, if you want to make an 8"x10" document and go to File>New Document and the window looks like this:
    …you can type either 8 in or 8" into the Width field like this:
    …and when you move to the next field, it will convert the eight inches into the equivalent number in the unit of measure that it is using at the moment, like this:
    … (203.2 milimeters is the same as 8 inches). You can also enter a different measurement unit into other fields once the file is created, such as the width or height of a frame, or the position of an object in the X and Y coordinates.
    If you would rather just work in inches instead of having to type the inches mark or abbreviation, go to InDesign>Preferences>General and select the Units & Increments tab. There you will see Ruler Units for Horizontal and Vertical at the top of the window. Set them to Inches and all of the fields will display in inches. If you do that to an open document, you will change the unit of measure for that document. If you do it while no documents are open, it will change the unit of measure for any new documents you create. To change the unit of measure for existing documents, you will have to open each and make the change.

  • How Do You Set the Maximum Size of a JFrame?

    Can someone show me a quick example? The JFrame can be empty, I just want to know how to set it's maximum size. I tried using setMaximumSize() and it doesn't work for some reason but setMinimumSize() works fine.
    I tried it using a BoxLayout and even using null as a layout manager and can't get it to work. I heard that the other layout managers don't allow you to set the maximum size of a JFrame so that is why I tried it with the layouts that I did.
    I tried the following code (imported the necessary classes), but it does not work...
    public class MyFrame extends JFrame
        public MyFrame()
            super("TestFrame");
            setLayout( new BoxLayout(getContentPane(), BoxLayout.X_AXIS)  );       
            setMaximumSize( new Dimension(400,200));
            setSize(300,150);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setVisible( true );                
    }// end class

    Reposted from
    {color:#0000ff}http://forum.java.sun.com/thread.jspa?threadID=5236259{color}
    @OP:
    When you repost a topic, please always provide a link to the previous post so people can check what suggestions were already offered (and didn't solve the problem).
    Better still, give a short summary of the advice you have already tried.
    I suggested setBackground(...) so you can see whether your MyFrame is actually occupying the entire real estate of the window. Looks as if trying it out (which I would have done for you if I'd been at home, where my JDK is) would have been too much effort for you.
    I'm pretty much a novice in Swing, but I can tell you this: setLayout controls the layout of components added to the JFrame, not the layout of the frame with respect to its parent container.
    Luck, Darryl

  • How to set the screen size with nested Iview screen

    Can someone show me how to set the screen size with nested IView  screen.
    at the moment i only try it with trial and error untill it looks somewhat close. Is there a property in VC to set the size for Height and width.
    The same question is for the form. the form elements inside the form is easy but the actual form is still a challenge.

    Hi,
    Yes you are correct ,Still the Form and iview are not able to change thier Layout Structure using a Propery.
    it is available with VC7.1
    Govindu

  • How to set the frame size?

    Hi,
    Can some one show me how to set the frame size in this program? History: I have created a window and added a button but its to small. So I want to increase the size of the frame to at least 600X400 pixel.
    private static void showGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("ButtonDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            Main newContentPane = new Main();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        }It would be nice if you could show me how to do it.
    Thank you very much for reading this.

    Challenger wrote:
    Simply adding
    frame.setSize(new Dimension(600,400));to the end of your code should work perfectly.Or, if you want to do it correctly, .setPreferredSize() on your frame before you .pack() it. The default layout manager for JFrame is BorderLayout, which uses the preferredSize of each component to calculate sizes during the .pack() call.

  • How to set the page size

    Hi,
    How to set the page size of a B tree node in berkeley db java edition?
    thanks.

    The two systems have different performance characteristics. If you are concerned with the performance characteristics, then the best way to tell is to benchmark them.
    By the way, both BDB and BDB JE are B-trees.

  • How to set the Font size of Label?????

    Hello everyone.
    I want to knoe how to set the Font size of the Label???
    Please help..
    Thanks a lot.
    Gloria

    Label myLabel = new Label("Hello World");
    //Font(String name, int style, int size)
    myLabel.setFont(new Font("Arial", Font.PLAIN, 12));

  • How to set the minimum size of the JDialog.

    Hi Could any one tell me ,
    How to set the minimmum size of the JDailog.
    I am using the JDialog's setMinimumSize(...)
    But it is not working.....
    Regards -
    Vikas Kumar sahu

    That's pretty much all there is, although you could always add a componentlistener and manually not let the size go below your minimum.
    Or you could try overriding setSize...

  • How to set the heap size of JVM

    please let me know that how to set the heap size of JVM

    C:\>java -X
        -Xmixed           mixed mode execution (default)
        -Xint             interpreted mode execution only
        -Xbootclasspath:<directories and zip/jar files separated by ;>
                          set search path for bootstrap classes and resources
        -Xbootclasspath/a:<directories and zip/jar files separated by ;>
                          append to end of bootstrap class path
        -Xbootclasspath/p:<directories and zip/jar files separated by ;>
                          prepend in front of bootstrap class path
        -Xnoclassgc       disable class garbage collection
        -Xincgc           enable incremental garbage collection
        -Xbatch           disable background compilation
        -Xms<size>        set initial Java heap size
        -Xmx<size>        set maximum Java heap size
        -Xss<size>        set java thread stack size
        -Xprof            output cpu profiling data
        -Xrunhprof[:help]|[:<option>=<value>, ...]
                          perform JVMPI heap, cpu, or monitor profiling
        -Xdebug           enable remote debugging
        -Xfuture          enable strictest checks, anticipating future default
        -Xrs              reduce use of OS signals by Java/VM (see documentation)look at the -Xm? lines
        -Xms<size>        set initial Java heap size
        -Xmx<size>        set maximum Java heap sizeThis can be used e.g. like this:java -Xms8M -Xmx32M MyProgwhich runs MyProg in a java VM with the initial heap size of 8 MB and a maximum heap size of 32 MB.
    - Marcus

  • How to set the fix size jframe window

    when I run the jframe ,the jframe window size is very small
    1)how to set the fix size jframe window??
    2)how to set the jframe cannot change the window size??
    thx~~

    1. You can set the size by calling JFrame's method setSize. There are two versions of this method: (1) setSize(int width, int height) and (2) setSize(Dimension d). Note, that when you use this method to set the frame size, you don't have to call JFrame's pack method.
    2. JFrame has a method called setResizable(boolean resizable) which you can call with the argument false.
    Without any ill intent, these questions are regarding something that is very easily answered by looking at the documentation for the JFrame class. I suggest to anyone working with swing to at least look briefly through the base classes they're extending before giving up. In my experience it is always more gratifying to figure things out on my own than asking someone. But please don't take this the wrong way, I respect people who seek out help in order to further their knowledge, instead of just giving up.

  • How to set the stack size for alchemy application?

    Anybody know how to set the stack size for alchemy application?
    If you know, please tell me how to adjust the stack size for alchemy application?

    Hi,
    The stack size is set as public const gstackSize in the alchemy generated code.  You can see this if you build with ACHACKS_TMPS set.  The default is one megabyte.
    One way to change the stack size is to use llvm-dis to disassemble avm2-libc/lib/avm2-libc.l.bc, generating avm2-libc.l.ll, modify the constant, and then use llvm-as to recompile your modified library and overwrite the old one.  These utilities should be in your path if alchemy is set up.

  • How to Set the Paper Size in Smart Forms

    Hi Friends,
                     I need to SET the Paper Size to default A4 in a smart form...and in some other case we need to set to other type 8.5 X 11...How can i set it....?

    Moving this discussion to the Scanning & OCR forum.

  • How to set the paper size when printing to postscript...

    I need help in setting the paper size in the PrintPreference when using either the Postcript File or Adobe PDF printer to generate ps files.
    Here's what I am doing (in c++) and I seem to be getting only 8.5x11 no matter the document page size:
    LPDISPATCH p_Dispatch = Document.DocumentPreferences();
    p_Dispatch = Document.DocumentPreferences();
    if(p_Dispatch)
    DocPreference docPreference(p_Dispatch);
    pgOrientation = (idPrintPageOrientation)docPreference.get_PageOrientation();
    pageW = docPreference.get_PageWidth();
    pageH = docPreference.get_PageHeight();
    paperSize = docPreference.get_PageSize();
    docPreference.ReleaseDispatch();
    p_Dispatch = Document.PrintPreferences();
    if (p_Dispatch)
    { PrintPreference printPreference(p_Dispatch)printPreference.SetPrinter(idPostscriptFile);
    printPreference.PrintFile(outfile);
    printPreference.SetPaperSize(paperSize ); /*I have also tried idCustom but it crashes with invalid parameter for the object type.*/
    printPreference.SetPaperWidth(pageW);
    printPreference.SetPaperHeight(pageH);
    VARIANT vprinterPresetType;
    vprinterPresetType.vt = VT_I4;
    vprinterPresetType.lVal = CInDesignApplication::idCustom;
    Document.PrintOut(FALSE, vprinterPresetType);....
    So how do i pas the document paper size to the print preset or preference?
    I appreciate your input.

    Moving this discussion to the Scanning & OCR forum.

Maybe you are looking for

  • Error while updating CE 7.11 to 7.2 using CEUPDATEMANAGER

    While updating the CE server from 7.11 to 7.2 got the error in Define parameter stage ERROR      2011-08-23 16:11:53.281 [sixxcstepexecute.cpp:988] FCO-00011  The step askJDBCDriver with step key |CE_UpdateManagementService|ind|ind|ind|ind|0|0|CE_get

  • Opening WinZip files on a MAC

    My iMAC will not open WinZip files. How do I resolve this?

  • Itunes wont work after the update 7.1

    it wont open and just says.... itunes cannot run because it has detected a problem with your audio configuration. i have uninstalled it 10x or more and reinstalled with no luck

  • Photoshop Vectors and Smart Objects Create Blurring

    I have been supplied a Photoshop document that has Illustrator Vector files that have been placed in the PSD as Smart objects. When I bring the PSD into InDesign and print it, all the PSD artwork is blurry. How can I get the PSD file to print from In

  • How do you configure DHCP server on OSX Lion Server

    I want to use my Mac Mini Server as a DHCP server on my network.   I cannot find the place under Server to configure it.   Where would I find it?   It is not under Server.