First the gui question

Right now I have:

class ExportGUI extends JFrame implements ActionListener{
	JTextField fileIN; //Text Field Bull
	//JLabel fInHelp;//Labels time
	JFileChooser BpsFile = new JFileChooser(); 	//File Chooser
	JCheckBox Check;
	JButton expButton; 	//reference button object
	JButton opnButton;
	JButton reset;
	JButton all;
	
	//Panels
	
	List<JCheckBox> checkList = new ArrayList<JCheckBox>();
	
	JPanel inOut = new JPanel();
	JPanel ChckBx= new JPanel();
	
 ExportGUI(String title, String[] chkNms){ // Constructor 
	//Name Window  
	super(title);
	//construct TextField	//Set what to do
	fileIN = new JTextField(15);
	fileIN.addActionListener(this);
	fileIN.setEditable(false);
	//Label constructor
//	fInHelp =  new JLabel("OPen- Choose File to export");
	
	// construct all JButton & Actions
	expButton = new JButton("Export");
	expButton.setActionCommand("export");
	opnButton = new JButton("Open");
	opnButton.setActionCommand("Open");
	reset = new JButton("Reset");
	reset.setActionCommand("reset");
	all = new JButton("Check All");
	all.setActionCommand("all");
	
	// set the layout manager
	setLayout( new FlowLayout()); 
	inOut.add(fileIN);
	inOut.add(opnButton);
	inOut.add(expButton);
	ChckBx.setLayout(new GridLayout());
//	ChckBx.add(Check);
	
//	ChckBx.setLayout(new GridLayout());
//	ChckBx.add(Check);

	//Add Text Field
	add(fileIN);
	
	//add buttons and check boxes
	add(opnButton);
	add(expButton);
	add(all);
	add(reset);
	
	//CheckBox Creator
	for(String name : chkNms) {
		
		Check = new JCheckBox(name);
	    
		Check.setMnemonic(KeyEvent.VK_C);
		Check.setSelected(false);
	    Check.setActionCommand(name);
		add(Check);
	    checkList.add(Check);
	}

	//register listener to buttons
	expButton.addActionListener(this);
	opnButton.addActionListener(this);
	//Set what happens on hitting x(close) button- top right
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );   
  }

When Ran it looks messy. I want to clean up the check box area a bit more, but the methods I've tried result in nothing. I know I want a grid layout of something like 4 columns and 7 rows. but using Jpanel didn't net me the effect I wanted, is there a better way to have a flow layout for my buttons and then a gridlayout for the check boxes?

My reset button doesn't work and I"m not sure I tackled it right. I currently have:

ArrayList<String> filter = new ArrayList<String>();
	  
	  if(evt.getActionCommand().equals("reset")){
		  for(int i = 0; i < checkList.size(); i++){
				JCheckBox cb = checkList.get(i);
				if(cb.isSelected()){
				 checkList.setSelected(false);
				}
		  }
	  }

I have tried checking the checkList variable; after the if(cb.is..) section to any of the variables that hold the check boxes created in the creation loop, but every attempt has failed at "resetting" any thing that is checked. and Even though its commented out, I tried doing the same for the check all statement, but commented it out figuring once I get the reset to work the all is just a flip of that.

what do you mean: it looks messy? since you haven't posted your complete code, we can't just 'run and look'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.