0

I'm trying to create an array of two radio buttons.
but with the code i have right now it just wont show up on my jframe.
Can anyone tell me what I might be doing wrong? Help please..
Here is a snippet of my code .....I'm only working on the gui part right now, so htas why i have not used the listeners yet. but i just need to get the radio buttons to show up on the frame.

int howMany;
	String[] optStrings = {"Exempt","Tax Rate", " "};
	ButtonGroup grpOperator = new ButtonGroup();
	JRadioButton[] optSelections = new JRadioButton[3];

JPanel pnlDesc = new JPanel();

public HudsonHillsProjectJKSample()
{

	for (int i = 0; i < howMany; i++)
	{
		optSelections[i] = new JRadioButton(optStrings[i]);
		optSelections[i].addItemListener(this);
		grpOperator.add(optSelections[i]);
		pnlDesc.add(optSelections[i]);
	}

       add (pnlDesc, BorderLayout. WEST );


	public static void main (String[] arg)
	{
		HudsonHillsProjectJKSample  f = new HudsonHillsProjectJKSample ();
 		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 		f.setTitle("Hudson Hills");
 		f.setSize(560,410);
 		f.setLocation(375,200);
 		f.setVisible(true);

	}//End MAIN
}

Edited by jko2326: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Ezzaral
1

The code you posted won't compile - improper structure - which will certainly affect the visibility of those buttons.

You also haven't set howMany to any value.

Edited by Ezzaral: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.