True or False using RadioCheckbox - need help ASAP

So I've been working my way through java with self-study. Our teacher gave us knoweldge not applicable to what he's asked us for our project (except logic). Basically, he wants us to present questions, have the user answer them, then show the number of correct answers.
I'm now using checkboxes in a True or False 10-item test. I once used buttons, but I gave up and went to checkboxes. I managed to display them using this:
Parameters:
tofp = true or false panel
tofql = true or false question label
tofqp = true or false question panel
     if(e.getActionCommand().equals("True or False"))
          f2.hide();
          JPanel tofp = new JPanel();
          JPanel tofp2 = new JPanel();
          JPanel tofqp = new JPanel();
          JPanel tofqp2 = new JPanel();
          JPanel tofqp3 = new JPanel();
          JPanel tofqp4 = new JPanel();
          JPanel tofqp5 = new JPanel();
          JPanel tofqp6 = new JPanel();
          JPanel tofqp7 = new JPanel();
          JPanel tofqp8 = new JPanel();
          JPanel tofqp9 = new JPanel();
          JPanel tofqp10 = new JPanel();
          FormPanel3 = new JPanel();
          JLabel tof = new JLabel("<html><Font size=5>TRUE OR FALSE</font> </html>");
          JLabel tofql1 = new JLabel("<html>1. CFC, found in refrigerator and <P> aircons , means Chlorofluorinechloride.</html>");
          JLabel tofql2 = new JLabel("<html>2. Endangered species are species <P> that are less in number and are nearly extinct.</html>");
          JLabel tofql3 = new JLabel("<html>3. The smallest fish in the world <P>is the sardines. </html>");
          JLabel tofql4 = new JLabel("<html>4. The agents of soil erosion are <P>wind, water, and human.</html>");
          JLabel tofql5 = new JLabel("<html>5. One way of conversing energy is <P> by using fluorescent light.</html>");
          JLabel tofql6 = new JLabel("<html>6. The use of dynamite is a legal method <P> of fishing.</html>");
          JLabel tofql7 = new JLabel("<html>7. Windmill is an example of a potential <P>energy.</html>");
          JLabel tofql8 = new JLabel("<html>8. Tamaraws are found in Mindanao.</html>");
          JLabel tofql9 = new JLabel("<html>9. Mining causes minimum destruction to <P> our environment.</html>");
          JLabel tofql10 = new JLabel("<html>10. The Philippines is called the Pacific <P>Ring of Fire because of the many <P> volcanoes surrounding it.</html>");
            b4 = new JButton("Submit");
            b4.addActionListener(this);
          tofp.setPreferredSize(new Dimension(400,550));
          tofqp.add(tofql1);
          tofqp2.add(tofql2);
          tofqp3.add(tofql3);
          tofqp4.add(tofql4);
          tofqp5.add(tofql5);
          tofqp6.add(tofql6);
          tofqp7.add(tofql7);
          tofqp8.add(tofql8);
          tofqp9.add(tofql9);
          tofqp10.add(tofql10);
          tofp.add(tof);
          tofp.setBackground(Color.yellow);
          tofp.add(tofqp);
          tofp.add(tofqp2);
          tofp.add(tofqp3);
          tofp.add(tofqp4);
          tofp.add(tofqp5);
          tofp.add(tofqp6);
          tofp.add(tofqp7);
          tofp.add(tofqp8);
          tofp.add(tofqp9);
          tofp.add(tofqp10);
          tofp.add(b4);
     JRadioButton True = new JRadioButton("True");
         True.setActionCommand("True");
         True.setSelected(false);
     JRadioButton False = new JRadioButton("False");
         False.setActionCommand("False");
         False.setSelected(false);      
         ButtonGroup group = new ButtonGroup();
         group.add(True);
         group.add(False);
         JRadioButton True2 = new JRadioButton("True");
         True.setActionCommand("True");
         True.setSelected(false);
     JRadioButton False2 = new JRadioButton("False");
         False.setActionCommand("False");
         False.setSelected(false);      
         ButtonGroup group2 = new ButtonGroup();
         group2.add(True2);
         group2.add(False2);
         tofqp.add(True);
         tofqp.add(False);
           tofqp2.add(True2);
         tofqp2.add(False2);
          FormPanel3.add(tofp);
          FormPanel3.add(tofp2);
          FormPanel3.add(tofp2);
          f3.setContentPane(FormPanel3);
          f3.pack();
          f3.show();     
          f3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f3.setResizable(false);I intentionally just have 2 groups of radio button displayed to test if I could tally the right answer. No luck.
I'm a complete beginner to this sort of thing, as in starting from scratch. But if I were to apply what our teacher taught us, this would be a simple boolean program. Unfortunately, this kind of thing isn't too simple for me.
So how do I tally the right answer upon clicking 'submit'. I know you have to have a new frame for that, but it's about tallying. Like the right answer for number 1 is false, for number 2 is true. If you click Submit, I should be able to show "You got 1 correct answer".

Tan-Tan wrote:
I'm now using checkboxes in a True or False 10-item test. I once used buttons, but I gave up and went to checkboxes. I managed to display them using this:I'm confused. So does your code use JRadioButtons (like your code says), or JCheckBoxes (like this sentence says)?
I intentionally just have 2 groups of radio button displayed to test if I could tally the right answer. No luck.How did you attempt to tally the right answer? How do you have the right answers stored? How were you getting the status of each JRadioButton?
So how do I tally the right answer upon clicking 'submit'. I know you have to have a new frame for that, but it's about tallying. Like the right answer for number 1 is false, for number 2 is true. If you click Submit, I should be able to show "You got 1 correct answer".Worry about how you display the tally later. For now just use a System.out.println. I'd use a for loop to get the status of each JRadioButton or JCheckBox, and check that against an array of correct answers.

Similar Messages

  • My Final Cut Pro X quits unexpectantly and shuts down which makes it impossible to use..need help asap

    Went I went to grab some pictures that I had downloaded from the web, FCP X shut down and sent a message to APPLE.  I have tried deleting the pics and this morning it was working for a little while but it shut down again.  I need to get FCP working properly. 

    Same thing happened to me yesterday. It started after there was a sudden electricity shut off when I was playing with FCP X. I do not have Compressor installed. I eventually managed to get FCPX to work again when I manually deleted in Finder the project on which I was working when the electricity went off.
    I hope this information may give you some ideas on your problem.
    Mannnolo

  • Objects outside of workspace show in SWF... Need help ASAP!

    When I export a flash movie (.swf file)And play it on full screen, the objects that are outside of the workspace show. Can anyone tell me how to fish this problem? need help ASAP! Thanks :]

    If what follows isn't sufficient for you to figure out, you'll have to spend some time learning how to work with Flash.  While you'll often get help solving problems in these forums, it's less likely you will get tutoring services.  Google is a very good resource for tutorials.
    To create a mask you draw a shape to the size you want and place it on a layer above all the content you want to mask.  A mask is actually not well named because masks normally hide things, while in the graphics world, masks define the are where things are shown... so when you apply a mask to something, only what is under the mask shows.  To finalize, you right click on the label area of the mask's layer and select Mask from the menu that appears.  You may have to drag lower layers up towards the mask layer to get them included, whicxh is why I mentioned creating the rest of the content as a movieclip (a single layer object).
    To control the visibility of objects you set their visibility to true or false (AS2: mcName._visible = true (or false),  AS3:mcName.visible = true (or false)).
    To create a frame around the stage, add a new layer atop everything and draw a rectangle big enough to hide all the content you don't want showing that is off the stage.  Then draw a rectangle that is the same size as the stage on top of that first rectangle, placing it over the stage, and then deselect anything that is selected.  Then reselect the smaller rectangle you just drew and delete it.  The larger rectangle is now framing your stage.

  • Stuttering flv playback issue- need help asap

    We need help asap. Have a project is due to deliver today (5/14).
    We have a video to go on a dvd-rom, live action with Motion Graphics behind.
    When output is done thru Projector the Motion Graphics stutter as they scroll.
    Here is more technical info:
    Stuttering flv playback issue:
    Prores 422 timeline 29.97fps 1280x720 output from fcp using current settings.
    Mov file is approx 7gb, plays relatively smooth on a mac pro with no raid.
    Frame by frame analysis shows all frames are present with no jumps tears or skips.
    Tried several output paths, programs and settings to create a smooth flv file to no avail.
    We adjusted data rates from 2k, 3.5k, 4k and 8k, no luck
    We adjusted keyframe rates from low to all frames, no luck.
    We tried cs3 flash encoder, cs5 media encoder, squeeze ect, same results.
    Playback in the flash projector seems to choke slightly no matter what we do.
    Have also posted in the Director Forum.
    Any help much appreciated!

    Here are a few ideas off the top of my head:
    Try playing the file using a different xtra, sometimes different ones will work better.  If you have Director 11.5, there is a native flv playback xtra.
    You can build a player easily in Flash using the flvPlayback component, then bring that into Director as a swf.
    Once you have the video in Director, try making the member Direct To Stage (DTS).  If it is already DTS, try making it not DTS.
    Make sure the video is not transparent, and nothing in Director overlaps the video... in fact, when the video is playing, nothing should be moving at all, and try to keep the amount of code that is running to a minimum.
    Try lowering your video's data rate further or try using a different codec.
    Using VBR (Variable Bit Rate) compression often makes the video appear to play smoother.
    Try compressing the flv with different software.  FFMpeg, for example, is free and does a very good job, often better than the Flash Video Encoder that comes with Flash/Creative Suite.

  • How do I reorder songs in a playlist in the new itunes??? I can no longer just click and drag. When I click, it doesn't move!!!! Need help ASAP- trying to prepare for an aerobics class and need songs in a specific order!

    How do I reorder songs in a playlist in the new itunes??? I can no longer just click and drag. When I click, it doesn't move!!!! Need help ASAP- trying to prepare for an aerobics class and need songs in a specific order!

    Vera,
    Use View > View Options, and set 'Sort By" to "Manual Order."
    Then you will be able to drag-n-drop songs up and down the list.

  • My ipod says i have no music on it, but when i plug it into itunes, and look under music on my ipod, its all there. NEED HELP ASAP!!!!! all the music came from a computer which i no longer have, so my ipod is the only place where that music is.

    This morning, i downloaded about 16 songs to put on my ipod, and i manually dragged them over to my ipod to sync that way (like i always do because the music on my ipod came from a different computer which I no longer have) and on my way to work, i realized my ipod says "no content" under Music. However, when I plug my ipod into itunes and click on the music tab under my ipod name, all of my music is there. What happened and how do i get that music back on my ipod? I need help asap.

    You had a glitch and the music files got corrupted. I know of no way to uncorrupt them.
    You can try using a computer app like iFunbox
    http://dl.i-funbox.com/
    to see if yo can get them from the iPod in a usable file.
    Otherwise you will have to re import them to your computer and sync
    You can redownload most iTunes purchases by:                         
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        

  • My pages document wont open NEED HELP ASAP

    when I go to open a pages document on my mac book pro, the document I'm trying to open is pale and i can't open it. I NEED HELP ASAP.

    How did you install Pages & what version? What model of Mac are you using & what version of OS X?
    The answers to those questions will help anyone trying to answer.

  • Error when extracting data with extractor 2lis_04_matnr - NEED HELP ASAP !!

    Hi experts!
    Got an error when extracting data with extractor 2lis_04_matnr.
    System says (short dump):
    DUMP TEXT START----
    Runtime error:    CONNE_IMPORT_WRONG_COMP_TYPE
    Exception:   CX_SY_IMPORT_MISMATCH_ERROR
    Error when attempting to import object "MC04P_0MAT_TAB".
    The current ABAP program "SAPLMCEX" had to be terminated because one of the statements could not be executed. This is probably due to an error in the ABAP program. When attempting to import data, it was discovered that the data type of the stored data was not the same as that specified in the program.
    An exception occurred. This exception is dealt with in more detail below. The exception, which is assigned to the class 'CX_SY_IMPORT_MISMATCH_ERROR', was neither caught nor passed along using a RAISING clause, in the procedure  "MCEX_BW_LO_API" "(FUNCTION)".                                                                             
    Since the caller of the procedure could not have expected this exception      
    to occur, the running program was terminated.                                
    The reason for the exception is:  When importing the object "MC04P_0MAT_TAB", the component no. 5 in the dataset has a different type from the corresponding component of the target object in the program "SAPLMCEX". <b>The data type is "D" in the dataset, but "C" in the program.</b>
    DUMP TEXT END----
    Please, can someone explain me how to solve it? 
    Really need help ASAP!
    Thanks in advance,
    Jaume
    Message was edited by:
            Jaume Saumell
    Message was edited by:
            Jaume Saumell

    Hi,
    Check this note: 328181
    So you need to delete entries in SM13/LBWQ for application and also detup table content.
    And then refill teh set up table.
    If you are in production clear the entries by running collective run no of times for this application 04.
    With rgds,
    Anil Kumar Sharma .P

  • How do you overlap PDF's and finish with one PDF file? Need help ASAP

    how do you overlap PDF's and finish with one PDF file?
    Need help ASAP

    I'm not sure if you can do that with CreatePDF.  Try it; you got one free use when you sign up with Acrobat.com
    If not, you will have to use Adobe Acrobat; there is a full-use 30 days trial.

  • User with a paid CC acct, getting "Print.ai" is an unknown format' when trying to open new file. Computer was recently attacked by ransomeware and wonder if I need to re-install Creative cloud software....need help asap!!

    User with a paid CC acct, getting "Print.ai" is an unknown format' when trying to open new file. Computer was recently attacked by ransomeware and wonder if I need to re-install Creative cloud software....need help asap!!

    First, ask in the forum for the program you are using
    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll
    Second, do a complete scan with a good anti-virus program to be sure your computer is clean... I use Norton, there are others

  • My Curve 9300 lost service need help ASAP

    I lost all serivce on my blackberry curve 9300 and the only way I get service is if I go outside my house. Sometimes I get service in my house but it's for 5 seconds and then I get "searching for network" then it goes to "SOS" I need help ASAP.

    yankeegirl32491 wrote:
    My carrier won't do anything about it because I'm not an authorized user of the account which is stupid. I wasn't having a problem with service for about a year and yesterday my service just cuts out for no apparent reason.
    Hello...well, that's a bit disconcerting...aiding and abetting what could be an unethical use of service...but I'm hopeful that there are further details that mitigate that suspicion. In any event, review this KB for perhaps helpful information:
    KB03448 Network status indicator shows "SOS" on the BlackBerry smartphone
    It is possible that they have a tower out, and you now are receiving service from a more distant tower, which does not have adequate signal strength to work through the walls of your house. But, sadly, there is no way for you to actually find out if such is the case or not.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Premiere Pro CS6 keeps crashing when exporting h.264 (NEED HELP ASAP!)

    Alright, so I have a video that I've probably rendered around 30 times now and it ALWAYS ends up either freezing up, and then Premiere stops working, or it just stops working.
    I have a YouTube channel and I'm going away for 2 days tomorrow and I really need to get my videos up online, but I just can't render them! Does anyone know how to fix this? I really need help ASAP!
    Here are my export settings.
    http://imgur.com/ZgAuI4a,OMz4FEd,B8gjHws

    While there are "some" Adobe employees who read/post here, this is primarily a user to user forum... NOT Adobe support
    You are simply going to have to wait for someone to read your message, and look at your settings, and reply... IF that person has an idea (20 minutes is really not much time)
    While you wait for someone to reply with ideas, some reading about your freezing problem... and questions to help people help you
    1st, what are you editing?
    Codec & Format information, with 2 links inside to read http://forums.adobe.com/thread/1270588
    Report back with the codec details of your file, use the programs below... A screen shot works well to SHOW people what you are doing
    http://forums.adobe.com/thread/592070?tstart=30 for screen shot instructions
    Free programs to get file information for PC/Mac http://mediaarea.net/en/MediaInfo/Download
    2nd, you need to give LOTS more information about your computer
    -PPro Information FAQ http://forums.adobe.com/message/4200840
    3rd, What is your exact brand/model graphics adapter (ATI or nVidia or ???)
    What is your exact graphics adapter driver version?
    Have you gone to the vendor web site to check for a newer driver?
    For Windows, do NOT rely on Windows Update to have current driver information
    -you need to go direct to the vendor web site and check updates for yourself
    ATI Driver Autodetect http://support.amd.com/en-us/download/auto-detect-tool
    nVidia Driver Downloads http://www.nvidia.com/Download/index.aspx?lang=en-us
    4th, do you have Dual video adapters?
    Go to the Windows Control Panel and select Hardware and Sound and then select Device Manager... In Device manager you click the + sign to the left of Display Adapters... and see if 2 are listed
    -http://helpx.adobe.com/premiere-pro/kb/error---preludevideo-play-modules.html
    -http://forums.adobe.com/thread/1001579
    -Use BIOS http://forums.adobe.com/thread/1019004?tstart=0
    -link to why http://forums.adobe.com/message/4685328
    -http://www.anandtech.com/show/4839/mobile-gpu-faceoff-amd-dynamic-switchable-graphics-vs-n vidia-optimus-technology/2

  • Need help ASAP...iPhone activation problems

    Today i bought two verizon iPhones from the apple store. I activated one just fine but I'm having problems with the other one. I used the upgrade for one of my lines on the account to purchase the other phone. I actually bought this for a friend who will use the iPhone on her own personal account. When I went to the apple store they "activated" the phone but didn't hook it up to the computer for iTunes or anything. Are there any steps I need to take before I give the phone to her so she can have a smooth transition in activating the phone because she lives in another state than I do? Do I have to hook the phone up to iTunes and activate it on my line or no? then switch back to old phone? Phone has never been hooked up to the computer. Need help ASAP please.

    What kind of problems?

  • Need Help ASAP!!! So FRUSTRATING!!! text message problems!!!

    I have 2 problems right now with my BB Torch 9810. I need help ASAP.
    1. It only saves 20 text messages. Messages that I received from august 2012. But it seems other messages are not stored. I don't delete messages, so I don't know where my other messages go. And sometimes if you create a new text, text history will show. But not anymore. This have been going on for a long time. 
    2. When I receive text message from some of my contacts, it will show the first few words of the text. But when you click on it, the message is empty. funny thing is, not all of my contacts are like this. 

    Hey iragarcia,
    Welcome to the BlackBerry Support Community Forums.
    Thanks for the question.
    I would suggest performing the following to resolve the issue: 
    1. Create a backup of all your data by using BlackBerry Desktop Software.  In BlackBerry Desktop Software go to Device>Backup and save the file onto your PC or Mac.
    2. On the BlackBerry Torch 9810 smartphone go to Options>Security>Security Wipe and put a checkmark beside 3rd party applications as well.  Type in the word BlackBerry and press wipe data.
    Please Note: You can re-install your applications through BlackBerry World.
    3. Once completed test sending and receiving some SMS messages prior to restoring any data.  If the issue is resolved, then go into BlackBerry Desktop Software and go to Device>Restore and choose custom and only choose contacts.
    Let me know if you have any more questions.
    Cheers.
    -ViciousFerret
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Like! for those who have helped you.
    Click  Accept as Solution for posts that have solved your issue(s)!

  • Need Help ASAP  my State tax form is in a PDF file and the attachment in my email says Please wait

    Need Help ASAP  my State tax form is in a PDF file and the attachment in my email says Please wait...
    I tried downloading updates like it said to but it still will not display the document.  How do I print the PDF file ASAP

    Can you give us a LOT more info?
    What email client? What version of Reader (I can only assume you even have Reader at this point)?
    Please wait? I'm sure it says more than that, right?
    Have you tried simply saving the PDF (it IS a PDF correct?) to your desktop and opening it from there?
    Did you get this form from the IRS or did it come from somewhere else? If the IRS again, what version of Reader?
    Help us help you.

Maybe you are looking for

  • EDI seeburger interface

    Dear experts, i have a inbound scenario EDI -> XI -> R3 1. I am thinking of going the BIC mapping way like creating a BIC mappign installing in XI and specifing the mapping name in the module section of the sender file adapter as specified in this bl

  • Exporting Specific UCM dB tables - is this possible

    Question.  Is there a way to export specific UCM Data Dictionary tables from the UCM Publisher?  Or am I forced to export the entire dB for analysis?  If I am forced to get the entire dB...the DRS backup is my only means?  From a CLI perspective, I c

  • Big XML document as blob in firebird database

    Hi! I'm having some problems trying to use blob to store an XML document on a Firebird database. I'll try to make this simple: I'm reading a CD and copying the structure to an xml document (org.w3c.dom.Document), and i need to store it on a firebid d

  • Do we need to have workflow in place to send payslip by email?

    Do we need to have workflow in place to send employee monthly payslip by email? And if we can send it without workflow, then, is there is any involvement of ABAP? Can system use the email address maintained in the infotype for an employee?

  • Text From 150 about bill- Not an EE customer

    This morning I recieved a text from 150 saying 'We recently tried to contact you regarding your bill. To avoid interuption of your outbound service please make payment by calling 360 from your handset.' However, I am not an ee customer! I used to be,