CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012
    Posts
    1

    I need two combo boxes in a singel frame

    Hi guys am trying to add two comboboxes in a frame. but am getting the problem in that. Kindly help me. i have tried many things but couldn't rectify the problem.


    Code:
    public class IndexPerformanceView extends JFrame implements ActionListener {
        private static final long serialVersionUID = 1L;
        private IndexPerformanceControl model;
        private Box filter;
        private JComboBox xchg;
        private JComboBox chgtype;
        private JFrame jframe;
        private Object ContentPane;
        public static int selectedindex;
    public IndexPerformanceView() {
    
                   this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
            this.setIconImage(Images.LoadImage("icon.gif"));
            model = new IndexPerformanceControl();
            this.getContentPane().add(model, BorderLayout.SOUTH);
            xchg = new JComboBox(new String[] { "NSE" });
            xchg.addActionListener(this);
            this.getContentPane().add(xchg, BorderLayout.CENTER);
            chgtype = new JComboBox(new String[] { "Change%", "Change" });
            chgtype.addActionListener(this);
            labelpanel.add(chgtype);
            this.getContentPane().add(chgtype, BorderLayout.EAST);
            this.pack();
            this.setTitle("IDX Performance");
            this.setBounds(100, 100, 600, 480);
        }
    I am trying to add two comboboxes xchg and chgtype at the top of the frame. but when i do it am getting the problem. I will send you the screenshot..
    Attached Images Attached Images  

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    Re: I need two combo boxes in a singel frame

    Why are you adding chgtype to both labelpanel and to the root pane and what is labelpanel, it isn't declared anywhere.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured