Layout problem in Swing.

Hi,
I have made an application in Swing containing Grouplayout on the panel.
On that panel I keep on dragging and dropping Swing Components like push button, textboxes etc and then save it using XMLEncoder i.e. I save the complete panel.
After saving, when I recall them using XMLDecoder, the layout is completely different.
I mean when I drag and drop the components to make a login screen and save them and when I open the same file they all appear in different layout.
Can anybody help me solve this issue.
Thanks and Regards,
Hi

If you have a layout that requires drag and drop support then you can't use a layout manager. You need to use a "null" layout so you can randomly position components.

Similar Messages

  • Layout Problem in swings

    I have an Layout problem. My Applications consists of a label and a panel in which some more labels are present.
    The panel should contain the scrollbar in order to view all the label that excced the size of the panel.This label and a panel should be adjacent to each other.
    My problem is, I am not getting the scroll bar to the panel when I am adding the label that excced the size of the panel, when I am adding the label adjacent to this label.

    Did you use JScrollPanel? If not, use it.

  • Grid abck layout problem using swing components

    JScrollPane jsp1 = new JScrollPane(table1,k,i);
    JPanel ja = new JPanel();
    JCheckBox c1 = new JCheckBox();
    JCheckBox c2 = new JCheckBox();
    JCheckBox c3 = new JCheckBox();
    JLabel j = new JLabel("Button");
    GridBagLayout gbl = new GridBagLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    ja.setLayout(gbl);
    gbc.gridwidth = 10;
    gbc.gridheight = 10;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbl.setConstraints(j,gbc);
    add(j);
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbl.setConstraints(c2,gbc);
    add(c2);
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbl.setConstraints(c3,gbc);
    add(c3);
    gbc.gridx = 3;
    gbc.gridy = 3;
    gbl.setConstraints(jsp1,gbc);
    add(jsp1);
    this my code for grid bag layout but when i run this code it is showing only empty panel..no components..
    of course iam not posting entire code of tis class..because it is lenghty..
    regards,
    sam

    Well, you set JPanel ja's layout to GridBagLayout, but it appears your adding the components to the parent, eg. add(j) should be ja.add(j) if you want it on JPanel ja. This is true for all your component adds.
    By the you can combine the setConstraints( ) and add calls: ja.add(j, bgc);
    Hope that helps.
    Cheers
    DB

  • Problem in Swing Component (JComboBox)

    Hello i've got one amazing problem in my Swing Component (JComboBox) while testing for Glasspane..
    Please check this photo http://www.flickr.com/photos/39683118@N07/4483608081/
    Well i used Netbeans Drag n Drop Swing so the code might be messing..any way my code looks like this:
    My code looks like this:
    public class NewJPanel extends javax.swing.JPanel {
        /** Creates new form NewJPanel */
        public NewJPanel() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jTextField1 = new javax.swing.JTextField();
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            jButton1 = new javax.swing.JButton();
            jComboBox1 = new javax.swing.JComboBox();
            jCheckBox1 = new javax.swing.JCheckBox();
            setOpaque(false);
            jTextField1.setText("jTextField1");
            jLabel1.setText("jLabel1");
            jLabel2.setText("jLabel2");
            jLabel3.setText("jLabel3");
            jButton1.setText("jButton1");
            jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            jComboBox1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            jComboBox1.setNextFocusableComponent(jCheckBox1);
            jComboBox1.setOpaque(false);
            jComboBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboBox1ActionPerformed(evt);
            jCheckBox1.setText("jCheckBox1");
            jCheckBox1.setOpaque(false);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
            this.setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(119, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel1)
                        .addComponent(jLabel2)
                        .addComponent(jLabel3))
                    .addGap(51, 51, 51)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jButton1)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jCheckBox1)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(115, 115, 115))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(70, 70, 70)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1))
                    .addGap(15, 15, 15)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(jCheckBox1))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(jButton1)
                    .addContainerGap(93, Short.MAX_VALUE))
            jComboBox1.getAccessibleContext().setAccessibleParent(null);
        }// </editor-fold>
        private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JCheckBox jCheckBox1;
        private javax.swing.JComboBox jComboBox1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JTextField jTextField1;
        // End of variables declaration
    }

    For more help create a [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://sscce.org], that demonstrates the incorrect behaviour.

  • CSS Layout Problem?

    Can someone please help me with a layout problem.
    As far as I can tell the page looks as it should in Netscape,
    Firefox, etc., but IE6 and 7 refuse to work correctly.
    The page I am working on is:
    http://www.vmtampademo.com/localangler/testpage.html
    Most of the picture caption and headline of the middle column
    is behind the picture. I attempted to force the info with a
    seperating div which seems to work sometimes. I doubt that this is
    the correct solution. What am I doing wrong?
    Thank you for the help!

    It looks fine in Firefox 2.0.0.1, Opera 9.10, and IE 7.

  • Layout problem in PDF conversion

    Hi all,
    i am downloading spool data using the function module CONVERT_ABAPSPOOLJOB_2_PDF. But i am facing layout problem. e.g. RFBILA00(financial statement generation program) has written balancesheet data to the spool. This spool data has some 6 columns. but CONVERT_ABAPSPOOLJOB_2_PDF is writing only first 3 columns to the generated PDF file. i used 'GET_PRINT_PARAMETERS' function module also with values like layout as 'X_65_132' and 'X_90_120'. but no success. if anybody knows the answer, please let me know.
    Thanks in advance,
    Naveen

    Hi All,
    i am following the below approach to download the information from spool.
    program/spool output is an ALV List output data having 8 columns. but below approach is converting only first 5 columns in to PDF format. other 3 columns are getting truncated.
    FUNCTION /ngl/download_spoolinfo_as_pdf.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_SPOOL_REQUEST) LIKE  TSP01-RQIDENT
    *"     REFERENCE(I_FILENAME) LIKE  RLGRAP-FILENAME
    *"  EXCEPTIONS
    *"      DOWNLOAD_ERROR
      TABLES tsp01.
      DATA: mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
            mc_filename LIKE rlgrap-filename.
      DATA: mstr_print_parms LIKE pri_params,
            mc_valid(1) TYPE c,
            mi_bytecount TYPE i.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          copies                 = '1'
          cover_page             = space
          destination            = 'locl'
          expiration             = '1'
          immediately            = space
          mode                   = space
          new_list_id            = 'X'
          no_dialog              = 'X'
          user                   = sy-uname
          line_size              = 200
          line_count             = 65
         layout                 = 'X_65_200'
          layout                 = 'X_90_120'
          sap_cover_page         = 'X'
        IMPORTING
          out_parameters         = mstr_print_parms
          valid                  = mc_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid              = i_spool_request
            no_dialog                = 'X'
            dst_device               = mstr_print_parms-pdest
          IMPORTING
            pdf_bytecount            = mi_bytecount
          TABLES
            pdf                      = mtab_pdf
          EXCEPTIONS
            err_no_abap_spooljob     = 1
            err_no_spooljob          = 2
            err_no_permission        = 3
            err_conv_not_possible    = 4
            err_bad_destdevice       = 5
            user_cancelled           = 6
            err_spoolerror           = 7
            err_temseerror           = 8
            err_btcjob_open_failed   = 9
            err_btcjob_submit_failed = 10
            err_btcjob_close_failed  = 11
            OTHERS                   = 12.
        IF sy-subrc EQ 0.
          mc_filename = i_filename.
          DATA: lv_filename TYPE string.
          lv_filename = i_filename.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize = mi_bytecount
              filename     = lv_filename
              filetype     = 'BIN'
            TABLES
              data_tab     = mtab_pdf
            EXCEPTIONS
              OTHERS       = 22.
          IF sy-subrc EQ 0.
            WRITE:/ mc_filename, 'CONVERTED TO PDF AND DOWNLOADED'.
          ELSE.
            WRITE:/ 'PROBLEM WITH DOWNLOAD'.
            RAISE download_error.
          ENDIF.
        ELSE.
          WRITE:/ 'PROBLEM WITH PDF CONVERSION'.
          RAISE download_error.
        ENDIF.
      ELSE.
        WRITE:/ 'PROBLEM GETTING PRINT PARAMETERS'.
        RAISE download_error.
      ENDIF.
    ENDFUNCTION.

  • Layout problem - multiple repeating frames

    Hi, I have a layout problem, pls help!
    Short report description:
    - Repeating Frame1 - gives 1 record, contains all other frames, variable vertical elasticity
    - - Frame2 - contains all frames beneath - variable vertical elasticity
    - - - Frame3 - variable vertical elasticity
    - - - - some boilerplates
    - - - - Repeating Frame 2 - various number of records, fixed vertical elasticity, height 100
    - - - - Repeating Frame 3 - various number of records, fixed vertical elasticity, height 30
    - - - - .. other repeating frames ..
    When reaching the bottom of a page, and there is not enough room to print a record for Repeating frame 2, a record from Repeating frame 3 is printed in the bottom.
    Next page starts with the remaining records from Repeating frame 2.. and then the remaining records from Repeating frame 3.
    For example:
    Page 1:
    Rep frame 2 - Record 1
    Rep frame 2 - Record 2
    Rep frame 2 - Record 3
    Rep frame 3 - Record 1 -- not enough space to print Record 4, so this record is printed
    Page 2:
    Rep frame 2 - Record 4
    Rep frame 2 - Record 5
    Rep frame 3 - Record 2
    How can i ensure that all records from Rep frame 2 is printed before records from Rep frame 3?

    Hi, thanks for helping me out!
    I tried to use anchors, but they had no effect when connecting top of 3 to bottom of 2, got the same layout.
    I then tried to create frames with vertical elasticity expand around both rep frame 2 and rep frame 3, and it seems to do the job.
    - Repeating Frame1 - gives 1 record, contains all other frames, variable vertical elasticity
    - - Frame2 - contains all frames beneath - variable vertical elasticity
    - - - Frame3 - variable vertical elasticity
    - - - - some boilerplates
    - - - - Frame 4 - vertical elasticity expand
    - - - - - - Repeating Frame 2 - various number of records, fixed vertical elasticity, height 100
    - - - - Frame 5 - vertical elasticity expand
    - - - - - - Repeating Frame 3 - various number of records, fixed vertical elasticity, height 30
    and so on..
    Thanks again

  • [solved] layout problem in amarok 2.02

    Hi,
    Here, I have a bad layout problem with amarok 2.02. Amarok does not fit on my screen which is 1400 pixels large! I cannot reduce the part where the collection is shown. So that it is really unpractical to use.
    I uploaded a snapshot to illustrate the problem (it is the full screen!):
    emmanuelfavrenicolin.free.fr/Public/Sna … ok202.jpeg
    Someone have the same problem ?
    I tried to install svn version but I stopped after 3 hours of compilation, it is quite a big application.
    Last edited by manouchk (2009-05-23 06:28:43)

    Well, I tried amarok2-devel 2.0.90-1 but the problem of graphic layout remains similar, no improvement. Is it normall? Maybe amarok is only available for computer with screen >= 1600x1200  or is there an hidden configuration file where I could tweek this?
    Last edited by manouchk (2009-05-18 02:41:03)

  • Urgent: Layout problem in "light inner page"

    Hi Experts,
    I am facing a problem in portal content area on external facing portal. I see a vertical scroll bar which restricts application from being displayed on entire screen.
    I am getting this problem after a patching of EP 7.0, before patching every thing was running fine.
    To me it looks like a layout problem in "light inner page", When I use "Light - 1: column (Full width)" layout I get a vertical scroll bar on portal. When I use default layout then this vertical scroll bar disappears but I see an empty navigation bar on left side which is not required.
    Can some one advise a solution for this.
    -Lave

    hi,
    Similar problem in this thread. check it out
    Desktop inner page lost
    Regardss,
    Ganesh N

  • Div layout problem

    Hi - stuck on what I think should be a fairly basic layout problem:
    I have 2 divs, equal widths but varying heights, one floated to the left and one to the right so that they appear next to eachother on the page.  The one on the left contains varying amounts of text, the one on the right contains a flash player so never varies.
    Where the text for the left div is long, I want it to start off next to the player, but then flow beneath it rather than continuing downwards at the same width as the div.  If I remove the width of the left div, so that it reverts to the container width, the player div positions itself below it, so I can't work out how to get the effect.
    Can anyone help?

    Hi,
    hope I understood in the right way: I used (translated from German DW) "modify table" and so I got one more row and two columns in your Main_Content. In one of the new columns I copied the image and beneath I took the text (you now can replace with image and text of your choice), like this:
    If that's not a help for your question, please ask me again.
    What concerns the width of the pictures, I would format them with PS or a similar program in the same wide.
    Hans-G.

  • Design/Layout Problem in OOTB SP "Docs I'm following" page

    Hello
    The "Docs I'm following" My Sites page in SP 2013 has the following layout problem:
    Long document titles overlap with other elements (see also screenshot).
    Note: This is default SP, i.e. we have not deployed any custom branding.
    I guess this is a problem which can easily be corrected even without having to wait for a SP update. Since I'm not very good with design changes I would be grateful if you could provide
    us with a quick fix, e.g. an updated css file.
    Thanks a lot.
    Best regards
    John

    Hi  ,
    For your issue, you can add the following code into your MySite MasterPage:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    $(".ms-contentFollowing-itemTitle a").each(function(i){
    $(this).text(shorten($(this).text(),32));
    function shorten(text,maxLength) {
    var ret = text;
    if (ret.length > maxLength) {
    ret = ret.substr(0,maxLength-3) + "...";
    return ret;
    </script>
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Using null Layout - Problems

    Hullo - I've written a little app that, because of the nature of what it does, prettymuch requires the use of null layout. It works well enough, but there are a few points where it does strange things that I don't understand. I haven't been able to find any good docs anywhere for how exactly layout/rendering works. The Swing tutorial, for example, almost completely ignores the topic.
    Basically, I set the layout to null, add my components, use setBounds...but then nothing happens. In order for anything to be visible, I have to call pack() before I call show(). What is pack? What does it do? How can Sun's null layout examples work even though most of them don't use it?
    Second, if I create JFrame of a certain size, and add a component that goes off the bottom of the JFrame (on purpose), then expand the size of the JFrame to reveal the bottom part of that component, it doesn't paint - there's just a grey area. No amount of repaint() pack() or anything will cause it to show. The only way I've found to do it is to make the JFrame larger to begin with, add the component so that it's visible, then resize to the smaller size, which is kind of ugly and clunky.
    I basically do not understand why Swing is doing the things it does; why it paints sometimes and not other times, where it paints, when it paints, where it shows objects, how it packs them, etc. I would be very grateful if someone could englighten me!

    Hullo - I've written a little app that, because of the
    nature of what it does, prettymuch requires the use of
    null layout. It works well enough, but there are a
    few points where it does strange things that I don't
    understand. I haven't been able to find any good docs
    anywhere for how exactly layout/rendering works. The
    Swing tutorial, for example, almost completely ignores
    the topic.
    Basically, I set the layout to null, add my
    components, use setBounds...but then nothing happens.
    In order for anything to be visible, I have to call
    pack() before I call show(). What is pack? What
    does it do? How can Sun's null layout examples work
    even though most of them don't use it?
    Second, if I create JFrame of a certain size, and add
    a component that goes off the bottom of the JFrame (on
    purpose), then expand the size of the JFrame to reveal
    the bottom part of that component, it doesn't paint -
    there's just a grey area. No amount of repaint()
    pack() or anything will cause it to show. The only
    way I've found to do it is to make the JFrame larger
    to begin with, add the component so that it's visible,
    then resize to the smaller size, which is kind of ugly
    and clunky.
    I basically do not understand why Swing is doing the
    things it does; why it paints sometimes and not other
    times, where it paints, when it paints, where it shows
    objects, how it packs them, etc. I would be very
    grateful if someone could englighten me!Okay, I think you should call setVisible(true); instead of pack then show. Pack basically organizes the components so they take up the least amount of room, and then it shrinks the frame to as small as it will go without hiding any components. It think if you call revalidate() instead of repaint(), should solve your problem.
    The other thing to do, is (hehe) make your own components

  • Help needed with a layout problem

    I'm trying to build a JTabbedPane where each tab has a grid of buttons. The number of buttons is variable, and I'd like the buttons to flow sort of like with FlowLayout, with four columns. I need all the buttons to be the same size, even across tabs. I tried GridLayout, which doesn't work when I have too few buttons to fill a row. It fails in different ways, depending on how I set things up. If I try to set the layout to GridLayout(0, 4) (four columns), then if one tab has one row and another has two, the buttons on the one-row tab expand vertically to the height of the two-row tab. If I try GridLayout(2,4), then if a tab has only one button, it expands horizontally to the maximum width of any of the tabs. (It also has the further problem that if the maximum number of buttons on any tab is 6, they are placed in a 2x3 array; I'm trying to get them to be 4 buttons on the first row and 2 on the second.)
    I'm hoping there's a standard layout manager that can do the job, but I'm not too familiar with the Swing manager classes. Can I get what I want without writing my own layout manager?
    Thanks,
    Ted Hopp
    [email protected]

    I didn't think it was specifically a Swing question.Well, its either Swing or AWT, people who develop GUIs are the ones who are going to have experience using layout managers.
    but if someone can point the way to how to do this with GridBagLayout, nested containersSince you finished reading the tutorial, what have you tried? You've explained your problems using a single layout manager, so what problems are you having using nested layout managers?
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • Need suggestion regarding Layout Manager using Swing in Java

    I have developed a swing application where i am having problem with selecting the right layout manager.
    I am attaching the file where it contains the method for addingComponents to the Content Pane. But, the code that i have written
    contains lot of spaces between first panel and second panel and so forth.
    Please suggest.
    <<Code>>
    public void addComponentsToPane(Container contentPane) {
              this.contentPane = contentPane;
    //          File Panel
              JPanel jfile1panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              JPanel jfile2panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              JPanel jfile3panel = new JPanel(new FlowLayout(FlowLayout.CENTER));
              JLabel jfile1 = new JLabel("Select File:");
              jtfile1 = new JTextField(50);
              jbfile1 = new JButton("Button1");
              jfile1panel.add(jfile1);
              jfile1panel.add(jtfile1);
              jfile1panel.add(jbfile1);
              jbfile1.addActionListener(this);
              JLabel jfile2 = new JLabel("Select File:");
              jtfile2 = new JTextField(50);
              jbfile2 = new JButton("Button2");
              jfile2panel.add(jfile2);
              jfile2panel.add(jtfile2);
              jfile2panel.add(jbfile2);
              jbfile2.addActionListener(this);
              JLabel jfile3 = new JLabel("Select File:");
              jtfile3 = new JTextField(50);
              jbfile3 = new JButton("Button3");
              jfile3panel.add(jfile3);
              jfile3panel.add(jtfile3);
              jfile3panel.add(jbfile3);
              jbfile3.addActionListener(this);
              //Button Panel
              JPanel jbuttonpanel = new JPanel();
              jbuttonpanel.setLayout(new FlowLayout(FlowLayout.CENTER));
              JButton jbcmd1 = new JButton("Submit");
              JButton jbcmd2 = new JButton("Cancel");
              jbuttonpanel.add(jbcmd1);
              jbuttonpanel.add(jbcmd2);
              jbcmd1.addActionListener(this);
              jbcmd2.addActionListener(this);
              //Content Pane               
              contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
              contentPane.add(jfile1panel);
              contentPane.add(jfile2panel);
              contentPane.add(jfile3panel);
              contentPane.add(jbuttonpanel);
    }

    But, the code that i have written contains lot of spaces between first panel and second panel and so forth.use pack(), see if it makes a difference
    as you're using FlowLayout, make the frame not resizable

  • Box Layout problems

    Hello,
    I am having difficulty with my box layouts in my form applet.
    I have a JFrame with two panels. The left panel will allow the user to enter some parameters via text boxes, drop down menus, etc for a shape, which will appear on the right panel.
    To arrange the form entry boxes on the left panel, I implemented a box layout. Here is where my trouble lies. I am not sure if I am using them correctly.
    In the left panel, I added a box objectentitled entrySideBox, which has a createVerticalBox() orientation. I further added 7 boxes to this box layout, which had a createHorizontalBox() orientation. I have the form elements within the array of horizontal boxes. In summary, I hoped to create a box layout column with 7 horizontal rows to house the form entry elements.
    Can I do this with the Box Layout? My form elements do not appear to be appearing as expected!
    I have my code below. What is wrong?
    //import the necessary java classes
    import java.awt.*;   //for the awt widgets
    import javax.swing.*;  //for the swing widgets
    import java.awt.event.*;  //for the event handler interfaces
    public class DemoShape extends JFrame
        //declare private data members of the DemoShape class
        //requires seven control buttons
        private JTextField xShapeText, yShapeText, messageText, fontSizeText;
        private JComboBox shapeTypeDrop, shapeColorDrop, fontTypeDrop,fontColorDrop;
        //declare the entry and display panel containers
        private Panel entryPanel;
        private Panel displayPanel;
        //declare public data members of the DemoShape class
        //constructor to initialize private data members
        public DemoShape()
            //call the superclass (JFrame) constructor with the name argument
            //this must be done first (as in C++)
            super("DemoShape Applet");
            //arrays of string to be used later in combo boxes
            //some are used more than once
            String fonts[] = {"Dialog", "Dialog Input", "Monospaced",
                                "Serif", "Sans Serif"};
            String shapes[] = {"Rectangle", "Round", "Oval"};   
            String colors[] = {"Black", "Blue", "Cyan", "Dark Gray",
                                "Gray", "Green", "Light Gray", "Magenta", "Orange",
                                "Pink", "Red", "White", "Yellow"};
            //get the content pane of the class outside
            Container entire = this.getContentPane();
            entire.setLayout(new GridLayout(1,2));
            //create the entry panel and add it to the entire pane
            //this will be 7 rows, 1 column
            //each row will have a panel with the form entry elements
            entryPanel = new Panel(new FlowLayout());
            entire.add(entryPanel);
            //create the display panel and add it to the entire pane
            //this will display the output
            displayPanel = new Panel();
            entire.add(displayPanel);       
            //entry panel code
            //use a box layout to add the boxes in a row fashion on the entryPanel
            Box boxes[] = new Box[7];
            //create a main box for the entry side
            Box entrySideBox = Box.createVerticalBox();
            //iterively create a box layout for each row
            for(int b = 0; b < boxes.length; b++)
            {   boxes[b] = Box.createHorizontalBox();  }
            //add the form elements to the boxes
            //the first row should have the shape label
            JLabel shapeHeader = new JLabel("Enter Shape Parameters:");
            boxes[0].add(shapeHeader);
            //second row should have the shape type and color
            JLabel shapeTypeLabel = new JLabel("Select Shape:");
            boxes[1].add(shapeTypeLabel);
            shapeTypeDrop = new JComboBox(shapes);
            boxes[1].add(shapeTypeDrop);
            JLabel shapeColorLabel = new JLabel("Select Shape Color:");
            boxes[1].add(shapeColorLabel);
            shapeColorDrop = new JComboBox(colors);
            boxes[1].add(shapeColorDrop);
            //third row should have the x and y coords
            JLabel xShapeLabel = new JLabel("Enter X:");
            boxes[2].add(xShapeLabel);
            xShapeText = new JTextField("200", 3);
            boxes[2].add(xShapeText);
            JLabel yShapeLabel = new JLabel("Enter Y:");
            boxes[2].add(yShapeLabel);
            yShapeText = new JTextField("200", 3);
            boxes[2].add(yShapeText);
            //fourth row should have the message label
            JLabel messageHeader = new JLabel("Enter Message Parameters:");
            boxes[3].add(messageHeader);
            //the fifth row should have the message       
            JLabel messageLabel = new JLabel("Enter Message:");
            boxes[4].add(messageLabel);
            messageText = new JTextField(50);
            boxes[4].add(messageText);
            //the sixth row should have the font type and size      
            JLabel fontTypeLabel = new JLabel("Select Font:");
            boxes[5].add(fontTypeLabel);
            fontTypeDrop = new JComboBox(fonts);
            boxes[5].add(fontTypeDrop);
            JLabel fontSizeLabel = new JLabel("Enter Font Size:");
            boxes[5].add(fontSizeLabel);
            fontSizeText = new JTextField("12", 2);
            boxes[5].add(fontSizeText);
            //the seventh row should have font color       
            JLabel fontColorLabel = new JLabel("Select Font Color:");
            boxes[6].add(fontColorLabel);
            fontColorDrop = new JComboBox(colors);
            boxes[6].add(fontColorDrop);
            //add the boxes to the entrySideBox
            for(int e = 0; e < boxes.length; e++)
            {   entrySideBox.add(boxes[e]); }
            //add the entrySideBox to the entry panel
            entryPanel.add(entrySideBox);
            //display panel code
            //debugging
            JLabel test = new JLabel("Display Output Here");
            displayPanel.add(test);      
            //set the size of the entire window and show the entire applet
            this.setSize(800,600);
            this.show();
        }   //end the DemoShape constructor
        //call the main class
        public static void main(String args[])
            //create an instance of the DemoShape class
            DemoShape DemoShapeRun = new DemoShape();
            //add the window listener to the applet
            DemoShapeRun.addWindowListener(
                new WindowAdapter()
                    public void windowClosing(WindowEvent e)
                        System.exit(0);
        }   //end main
    }   //end DemoShape class

    The problem with GridLayout is the form elements sizes
    change relative to the size of the panel. I want the
    form elements to remain in a consistent state.
    Should I quit using the box layout?Ok, try to set the layout of the upper content pane to BorderLayout and place the left panel with your components in the WEST part of it (the panel for the drawings goes to CENTER). I don't know if this will produce the result that you want, but it's an idea.
    You should use a GridLayout for this panel and only
    specify 2 columns (don't specify the number of rowsor
    the number of columns will be ignored, see theclass
    documentation for further details).
    Hope this helps,
    Pierre2 Columns? For what?The first column is for the labels (e.g. "Select Font Color") and the second is for the input component (e.g. textarea).

Maybe you are looking for