Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7549761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:01:53+00:00 2026-05-30T10:01:53+00:00

I am writing a mutlientry dialog box using the gridbag layout manager, when I

  • 0

I am writing a mutlientry dialog box using the gridbag layout manager, when I am trying to run this program it is showing me some weird error which I never encountered.

 public class MultiEntryDlg extends JDialog {
    private static final long serialVersionUID = 1L;
   private final JPanel             contentPanel    = new JPanel() ;
   private DButton          pb_OK                   = null ;  
   private DButton          pb_CANCEL               = null ;  
   private JLabel           lb_Name                 = null ;
   private JTextField       ef_name                 = null ;
   private JLabel           lb_taxonomyValue        = null;
   private JTextField       ef_taxonomyValue        = null ;
   private JLabel           lb_subscriptionKey      = null ;
   private JTextField       ef_subscriptionKey      = null ;
   private JCheckBox        cb_subscribable         = null ;
   private JTextField       ef_alias                = null ;
   private JLabel           lb_alias                = null ;
   private JLabel           lb_orderNumber          = null ;
   private JTextField       ef_orderNum             = null ;
   private JTextAreaCounter mle_DESCRIPTION_COUNTER = null ;               
   private SpellCheckPanel  spellCheckPanel         = null ;
   private JLabel    lb_contentLocation             = null ;
   private JComboBox contentlocCombo                = null ;
   private JLabel    lb_brandSubGrp                 = null ;
   private JComboBox brandSubGrpCombo               = null ;
   private JLabel    lb_fixedLocation               = null ;
   private JComboBox fixedlocCombo                  = null ;
   private JLabel    lb_taxonomyType                = null ;
   private JComboBox taxonomyCombo                  = null ;
   private NoTabJTextArea mle_DESCRIPTION           = null ;

   private MultiEntryDlg(){
       creatAndShowGUI();
   }

   public void actionPerformed ( ActionEvent e ) {

      if ( ( e.getSource() == pb_OK )
          dispose();
      else if (e.getSource() ==pb_CANCEL)
          dispose();
   }
   private void creatAndShowGUI(){
       initializeBasicProperty();
       addComponents();
   }

private void addComponents() {
    // TODO Auto-generated method stub
    lb_Name = new JLabel("Name (Max 75 char)");
    addLeftAlign(lb_Name, 0, 1);
    ef_name = new JTextField(10);
    addMergeColumn(ef_name, 1, 1, 2);
    spellCheckPanel = new SpellCheckPanel();
    spellCheckPanel.setTextComponent(ef_name);
    addCenterAlign(spellCheckPanel, 3, 1);
    lb_alias = new JLabel("Alias");
    addLeftAlign(lb_alias, 0, 2);
    ef_alias = new JTextField(10);
    addMergeColumn(ef_alias, 1, 2, 3);
    lb_orderNumber = new JLabel("Order Number");
    addLeftAlign(lb_orderNumber, 0, 3);
    ef_orderNum = new JTextField(10);
    addCenterAlign(ef_orderNum, 1, 3);
    lb_contentLocation = new JLabel("Content Location");
    addCenterAlign(lb_contentLocation, 2, 3);
    contentlocCombo = new JComboBox();
    addCenterAlign(contentlocCombo, 3, 3);
    lb_brandSubGrp = new JLabel("Brand Sub Group");
    addLeftAlign(lb_brandSubGrp, 0, 4);
    brandSubGrpCombo = new JComboBox();
    addCenterAlign(brandSubGrpCombo, 1, 4);
    lb_fixedLocation = new JLabel("Fixed Location");
    addLeftAlign(lb_fixedLocation, 2, 4);
    fixedlocCombo  = new JComboBox();
    addCenterAlign(fixedlocCombo, 3, 4);
    lb_taxonomyValue = new JLabel("Taxonomy Value");
    addLeftAlign(lb_taxonomyValue, 0, 5);
    ef_taxonomyValue = new JTextField(10);
    addCenterAlign(ef_taxonomyValue, 1, 5);
    lb_taxonomyType  = new JLabel ("Taxonomy Type");
    addLeftAlign(lb_taxonomyType, 2, 5);
    taxonomyCombo = new JComboBox();
    addCenterAlign(taxonomyCombo, 3, 5);
    cb_subscribable = new JCheckBox("Subscribable");
    addLeftAlign(cb_subscribable, 0, 6);
    lb_subscriptionKey = new JLabel("Subscription Key");
    addCenterAlign(lb_Name, 2, 6);
    ef_subscriptionKey = new JTextField(10);
    addCenterAlign(ef_subscriptionKey, 3, 6);
    addControlButton();
}

public static void main(String[] args) {
    try {
        MultiEntryDlg dialog = new MultiEntryDlg();
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        dialog.setVisible(true);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

private void addControlButton() {
    // TODO Auto-generated method stub
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPanel,BorderLayout.SOUTH);
    pb_OK = new DButton(Str.getStr(STR_OK));
    pb_CANCEL = new DButton(Str.getStr(STR_CANCEL));

    pb_OK.addActionListener(this);
    pb_CANCEL.addActionListener(this);

    buttonPanel.add(pb_OK);
    buttonPanel.add(pb_CANCEL);

}

private void addLeftAlign (Component component , int x, int y){
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(0, 0, 5, 5);
    constraints.anchor = GridBagConstraints.WEST;
    constraints.gridx = x;
    constraints.gridy = y;
    contentPanel.add(component, constraints);

}

private void addCenterAlign (Component component , int x ,int y){
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(0, 0, 5, 0);
    constraints.anchor = GridBagConstraints.HORIZONTAL;
    constraints.gridx = x;
    constraints.gridy = y;
    contentPanel.add(component, constraints);
}

private void addMergeColumn (Component component , int x, int y, int weight){
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(0, 0, 5, 5);
    constraints.anchor = GridBagConstraints.HORIZONTAL;
    constraints.gridx = x;
    constraints.gridy = y;
    constraints.gridwidth = weight;
    contentPanel.add(component, constraints);
}


private void initializeBasicProperty() {
    // TODO Auto-generated method stub
    setBounds(100, 100, 500, 250);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);    
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[]{0, 0, 0};
    gbl_contentPanel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0};
    gbl_contentPanel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
    gbl_contentPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
    contentPanel.setLayout(gbl_contentPanel);
}
} 

I am getting following error.

strArray in strObject is null. String Index:1  Language Ind:0
strArray in strObject is null. String Index:2  Language Ind:0
Exception in thread "main" java.lang.StackOverflowError
at com.ibm.nzna.projects.qit.gui.MultiEntryDlg.setVisible(MultiEntryDlg.java:523)
at com.ibm.nzna.projects.qit.gui.MultiEntryDlg.setVisible(MultiEntryDlg.java:523)
at com.ibm.nzna.projects.qit.gui.MultiEntryDlg.setVisible(MultiEntryDlg.java:523)
    etc..

Could anyone help me with this error?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:01:55+00:00Added an answer on May 30, 2026 at 10:01 am

    This doesn’t answer your question directly. But really don’t use GridBagLayout.. its a crazy layoutmanager. Look at the amount of code you need to write to layout your components. IMO, thats the reason why many people moved away from not writing Swing application.

    Instead use the jgoodies form layout. Here it is: http://www.jgoodies.com/freeware/forms/

    If you haven’t heard about it.. its a very simple layout manager. You can specify the column and row specs as simple strings. You can use existing PanelBuider or FormBuilder in the library or make one of your own. I have made one here:

    http://code.google.com/p/swingobjects/source/browse/SwingObjects/src/org/aesthete/swingobjects/view/SwingObjFormBuilder.java

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a python program, and I came up with this error while using the
Writing a client / server program and previously was using calls like this: TcpListener.AcceptTcpClient()
Writing something like this using the loki library , typedef Functor<void> BitButtonPushHandler; throws a
Writing some docs with code snippets which I want to be copyable to run
Writing some test scripts in IronPython, I want to verify whether a window is
Writing my first Linq application, and I'm trying to find the best way to
Writing documentation in html requires some code examples. What to do with characters that
Writing an asynchronous Ping using Raw Sockets in F#, to enable parallel requests using
Writing some drag&drop code, I'd like to cancel the click events in my mouseup
Writing some classes for a Framework extension, and I have the following code: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.