I have created a Frame which has some checkboxes , a button and text field. when i check some checkboxes and press the Button (ie in my program Metrics level Button ) it should display the result as number of checkboxes that are checked divided by total number of chechboxes. ie if i check some 6 check boxes and press the Metrics level button it should display 6 divided by 12 ie 0.5 in the Result Textfield.
Well, you told us what it should do and even pointed out in your code where you need to start making these calculations. However, you never really said what you needed help with. Does the code you have not work? Do you not know how to use operators in Java (+ * - /)? Do you not know how to get the number of checked check boxes? In other words, ask a question.
There are a couple of ways. Either way you need to keep some sort of counter.
1. Add an ItemListener to your checkboxes. When the checkbox's are checked or unchecked, have your listener update your counter accordingly. Then your counter will always be == the current number of checked boxes.
2. JCheckbox has a method, isSelected(). When you click the calculate button, the first thing to do would be to check all your checkboxes with this method and update your counter accordingly.
Option #1 would be my preferred way of doing it. You can find some good information on JCeckboxes on Sun's Swing Tutorial and it shows how to handle the ItemListener.