Anything simple I can add to a GUI for some extra credit?

I had to write a GUI for my COMP class this time, and if we add anything extra, we can get some extra points..which would be quite nice.
I have the GUI made and working as we were shown how to do, and now I would like to add some extra things to make it better.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Tuition extends JFrame
    private JLabel stateResL, credsL, typeL, tuitFeeL, actFeeL;
    private JTextField stateResTF, credsTF, typeTF, tuitFeeTF, actFeeTF;
    private JButton calculateB, exitB;
    private CalculateButtonHandler cbHandler;
    private ExitButtonHandler ebHandler;
    public Tuition()
        stateResL = new JLabel ("Is Student a TN State Resident? 1 = yes, 0 = no ", SwingConstants.RIGHT);
        credsL = new JLabel ("Enter number of credits presently being taken: ", SwingConstants.RIGHT);
        typeL = new JLabel ("Is student an undergraduate = 0, or graduate student = 1? ", SwingConstants.RIGHT);
        actFeeL = new JLabel ("Activity Fee: ", SwingConstants.RIGHT);
        tuitFeeL = new JLabel ("Tuition amount owed = $", SwingConstants.RIGHT);
        //text fields
        stateResTF = new JTextField(10);
        credsTF = new JTextField(10);
        typeTF = new JTextField(10);
        actFeeTF = new JTextField(10);
        tuitFeeTF = new JTextField(10);
         //calculate button
        calculateB = new JButton ("Calculate Tuition");
        cbHandler = new CalculateButtonHandler();
        calculateB.addActionListener(cbHandler);
        //exit button
        exitB = new JButton ("Exit");
        ebHandler = new ExitButtonHandler();
        exitB.addActionListener(ebHandler);
        //set title of window
        setTitle("Tuition and extra Fees");
        //get container
        Container pane = getContentPane();
        //set layout
        pane.setLayout (new GridLayout (6, 2));
        //place components in pane
        pane.add (stateResL);
        pane.add (stateResTF);
        pane.add (credsL);
        pane.add (credsTF);
        pane.add (typeL);
        pane.add (typeTF);
        pane.add (tuitFeeL);
        pane.add (tuitFeeTF);
        pane.add (actFeeL);
        pane.add (actFeeTF);
        pane.add (calculateB);
        pane.add (exitB);
        setSize (WIDTH, HEIGHT);
        setVisible (true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    private class CalculateButtonHandler implements ActionListener
        public void actionPerformed (ActionEvent e)
            //computes activity fee and tuition and sets them to respective variables
            double tuition = 0;
            double actFee = 0;
            int credits, stateRes, type;
            type = Integer.parseInt(typeTF.getText());
            stateRes = Integer.parseInt(stateResTF.getText());
            credits = Integer.parseInt(credsTF.getText());
            if (credits >= 6)
                   actFee = 44;
            else
                actFee = 6 * credits;
            if (stateRes == 0)
                    if (type == 1 || type == 0)
                        tuition = ((448 * credits) + actFee);
            else if (stateRes == 1)
                    if (type == 0)
                        tuition = ((241 * credits ) + actFee);
                    else if (type == 1)
                        tuition = ((343 * credits ) + actFee);
                actFeeTF.setText ("" + actFee);
                tuitFeeTF.setText ("" + tuition);
        private class ExitButtonHandler implements ActionListener
            public void actionPerformed (ActionEvent e)
                System.exit(0);
}I don't care for something way out of my league (I'm only in my second semester of actually doing "tough" stuff. Maybe something that would change the colors of the text fields where the questions are, or change the color of the font printed, or change the font type, maybe add a logo or something for a school (it's a tuition calculator).
I looked through the API but reading over class names doesn't do much for me, and I searched Google a bit but most of the stuff I found seemed pretty difficult/beyond my knowledge.

alright...I fixed the messy issue, but I don't know how to setup the action listeners or whatever...
I need my calculate tuition method to work using the radio buttons, and I don't know how to set up the listeners correctly.
I can't find a single example on the internet that does anything like what I'm doing that I can use as a reference. I need something using radio buttons that calculates another number based on the results of the radio buttons...like what mine should do.
This has got to be a noob question, but I just can't get it to work....
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Tuition extends JFrame
    private JLabel stateResL, credsL, typeL, tuitFeeL, actFeeL;
    private JTextField stateResTF, credsTF, typeTF, tuitFeeTF, actFeeTF;
    private JButton gradB, calculateB, exitB;
    private CalculateButtonHandler cbHandler;
    private ExitButtonHandler ebHandler;
    private StateResButtonHandler srbHandler;
    private NonStateResButtonHandler nsrbHandler;
    private UndGradButtonHandler ugbHandler;
    private GradButtonHandler gbHandler;
    /** extra */
    JScrollBar scrollbar_h_1;
    JScrollBar scrollbar_v_1;
    JRadioButton undGradRB, gradRB, stateResRB, nonStateResRB;
    ButtonGroup radioGroup1, radioGroup2;
    static String stateResString = "Resident";
    static String nonResString = "Non-Resident";
    static String undGradString = "Undergraduate";
    static String gradString = "Graduate";
    public Tuition()
        getContentPane().setFont(new Font("Arial", Font.ITALIC, 12));
        getContentPane().setBackground(Color.blue);
        stateResL = new JLabel ("Is Student a TN State Resident? ", SwingConstants.RIGHT);
        credsL = new JLabel ("Enter number of credits presently being taken: ", SwingConstants.RIGHT);
        typeL = new JLabel ("Is student an undergraduate, or graduate student? ", SwingConstants.RIGHT);
        actFeeL = new JLabel ("Activity Fee: ", SwingConstants.RIGHT);
        tuitFeeL = new JLabel ("Tuition amount owed = $", SwingConstants.RIGHT);
        //text fields
        credsTF = new JTextField(10);
        actFeeTF = new JTextField(10);
        tuitFeeTF = new JTextField(10);
         //calculate button
        calculateB = new JButton ("Calculate Tuition");
        cbHandler = new CalculateButtonHandler();
        calculateB.addActionListener(cbHandler);
        //exit button
        exitB = new JButton ("Exit");
        ebHandler = new ExitButtonHandler();
        exitB.addActionListener(ebHandler);
        radioGroup1 = new ButtonGroup();
        JRadioButton stateResButton = new JRadioButton(stateResString);
        stateResButton.setMnemonic(KeyEvent.VK_B);
        stateResButton.setActionCommand(stateResString);
        stateResButton.setSelected(true);
        JRadioButton nonResButton = new JRadioButton(nonResString);
        nonResButton.setMnemonic(KeyEvent.VK_B);
        nonResButton.setActionCommand(nonResString);
        radioGroup1.add (stateResButton);
        radioGroup1.add (nonResButton);
        radioGroup2 = new ButtonGroup();
        JRadioButton undGradButton = new JRadioButton(undGradString);
        undGradButton.setMnemonic(KeyEvent.VK_B);
        undGradButton.setActionCommand(undGradString);
        undGradButton.setSelected(true);
        JRadioButton gradButton = new JRadioButton(gradString);
        gradButton.setMnemonic(KeyEvent.VK_B);
        gradButton.setActionCommand(gradString);
        radioGroup2.add(undGradButton);
        radioGroup2.add(gradButton);
        srbHandler = new StateResButtonHandler();
        stateResButton.addActionListener(stateResString);
        nrbHandler = new NonResButtonHandler();
        nonResButton.addActionListener(nonResString);
        ugbHandler = new UndGradButtonHandler();
        undGradButton.addActionListener(undGradString);
        gbHandler = new GradButtonHandler();
        gradButton.addActionListener(gradString);
        //set title of window
        setTitle("Tuition and extra Fees");
        //get container
        Container pane = getContentPane();
        //set layout
        pane.setLayout (new GridLayout (6, 2));
        JPanel radioPanel = new JPanel(new GridLayout(0, 1));
        radioPanel.add(stateResButton);
        radioPanel.add(nonResButton);
         JPanel radioPanel2 = new JPanel(new GridLayout(0, 1));
         radioPanel2 = new JPanel (new GridLayout(0, 1));
         radioPanel2.add (undGradButton);
         radioPanel2.add (gradButton);
        //place components in pane
        pane.add (stateResL);
        add(radioPanel);
        pane.add (credsL);
        pane.add (credsTF);
        pane.add (typeL);
        add(radioPanel2);
        pane.add (actFeeL);
        pane.add (actFeeTF);
        pane.add (tuitFeeL);
        pane.add (tuitFeeTF);
        pane.add (calculateB);
        pane.add (exitB);
        setSize (WIDTH, HEIGHT);
        setVisible (true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        /** EXTRA - EXTRA - EXTRA */
        calculateB.setToolTipText("Click this button to calculate tuition and activity fee.");
        exitB.setToolTipText("Click this button to exit the program.");
    private class CalculateButtonHandler implements ActionListener
        public void actionPerformed (ActionEvent e)
            //computes activity fee and tuition and sets them to respective variables
            double tuition = 0;
            double actFee = 0;
            int credits, stateRes, type;
            type = Integer.parseInt(typeTF.getText());
            stateRes = Integer.parseInt(stateResTF.getText());
            credits = Integer.parseInt(credsTF.getText());
            if (credits >= 6)
                   actFee = 44;
            else
                actFee = 6 * credits;
            if (stateRes == 0)
                    if (type == 1 || type == 0)
                        tuition = ((448 * credits) + actFee);
            else if (stateRes == 1)
                    if (type == 0)
                        tuition = ((241 * credits ) + actFee);
                    else if (type == 1)
                        tuition = ((343 * credits ) + actFee);
                actFeeTF.setText ("" + actFee);
                tuitFeeTF.setText ("" + tuition);
        private class ExitButtonHandler implements ActionListener
            public void actionPerformed (ActionEvent e)
                System.exit(0);
        private class StateResButtonHandler implements ActionListener
            public void actionPerformed (ActionEvent e){
        private class NonStateResButtonHandler implements ActionListener
            public void actionPerformed (ActionEvent e){
        private class UndGradButtonHandler implements ActionListener
            public void actionPerformed (ActionEvent e) {
        private class GradButtonHandler implements ActionListener
            public void actionPerformed (ActionEvent e) {
}the calculateB and exitB listeners work, but I have nothing setup for the others that works. And the calculate button doesn't work because it isn't getting any info from the buttons.
I get addActionListener(Java.awt.event.ActionListener) in Javax.swing.AbstractButton cannot be applied to (java.lang.String). on the listeners I attempted to add within the constructor....

Similar Messages

  • Can add folder in movies for ipad

    can add folder in movies for ipad mini

    Not from Apple directly, but you can try Best Buy. They say that they'll accept non-US credit cards as long as the delivery address will be in the US.
    http://www.bestbuy.com/site/Help-Topics/International-Orders/pcmcat204400050019. c?id=pcmcat204400050019
    Regards.

  • Why did I get an OOPS, "Firefox can't load this page for some reason" error message?

    I get this error message: " OOPS. Firefox can't load this page for some reason."
    == This happened ==
    Not sure how often
    == Every time I tried to access my account at Medicare

    "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove the Cookies" from sites that cause problems: Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • How can I get the default value of a particular preference programatically. I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [tiki-view_forum_thread.php?comments_parentId=702631&forumId=1]
    Thanks - c</blockquote>
    == Issue
    ==
    I have a problem with my bookmarks, cookies, history or settings
    == Description
    ==
    How can I get the default value of a particular preference in FireFox?.
    I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.
    I see some that there are values for preferences in firefox.cs but I am not certain that these are being used as the default values for preferences. prefs.js in user's profile only has the updated values and not the default values.
    Any help towards acheiving this programtically is greatly appreciated.
    If the default values are stored in a file, kindly let me know the format in which it is stored for me to parse it programatically.
    == User Agent
    ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    Dear Friend,
    Here when you have the callableSattement as ?=proc(?), the first ? is an output parameter. So you should register it as out parameter using registeroutparameter.
    Then you can get the value from the outparameter using callablestatement.getXXX().
    Try that way.
    For free tral versions of JDBC Drivers go to www.Atinav.com

  • I can't change the volume for some of my musics

    Hi it's me again :/
    Everything is in the title ! I can change the volume of each podcast I download, and some of my musics. But for some other musics, I can't do anything about that, the ipod plays at one level volume only.
    Do you know if it's somehow related to the basic extension (.mp3, .wav, .wmv ...) ?
    I tought Itunes converts music formats if it's necessary but maybe I have to be careful with this ? I can't really pinpoint the problem because I haven't my pc with me for a while now (itunes isn't installed in the computers of university).
    Thanks a lot for any help

    The earphones must be pushed very hard into the iPod. So hard, that the white part of the plug must touch the iPod in order for the external speakers to turn off. You will hear a click.
    If you do a forum search, you will find this same solution. If it does not work, you will need to take your iPod to an Apple store or call the Apple iPod tech support if still under warranty or you have Apple Care.

  • HT5361 Hi Can anyone help me. For some reason I cannot see any messages in my in-box. How can i get them back.

    Hi For some reson when i opened Mail ther are no messages in my inbox. There have all disappeared. Does anyone know how I can get them back please. Thanks

    Back up all data. Rebuild the mailbox.

  • Ipod will not add certain tv epi for some reason!

    i bought this epi of monk, the pilot epi of season one, and it is in two parts. i bought both parts, but for some reason only part two shows up on my ipod....yet it is in my itunes and i can view it there and everything. is there some reason why it is not transferring onto my ipod????

    yes ty i tried this suggestion and posted in that forum and got it resolved! here is the link to it:
    http://discussions.apple.com/message.jspa?messageID=4153419
    in the end, i chose to sync all unwatched epis and the next thing i knew it showed up on my ipod!

  • How can I hide my cam for some applications like messenger, skype, etc.

    Hi,
    How could I hide my cam for some applications?
    Thanks in advance!

    There's a support file in the System/Library/QuickTime folder that you can move elsewhere temporarily: QuickTimeUSBVDCDigitizer.component. Don't delete it, just move it. Any apps you open from that point will not have access to the camera. Move the file back to re-activate it (you may need to reboot).
    There is also an AppleScript to do the same thing, but I can't guarantee it works for 10.8.
    http://techslaves.org/isight-disabler/
    Matt

  • I can't change the country for my new credit card. Help please.

    I stopped family sharing, but I still receive a message that I belong to a family when I try to change the country for my new credit card. Help please.

    Sometimes logging out of iTunes can free up the editing.
    Do you use iTunes Match?

  • Can flash build entire GUIs for gadgets?

    Hey everyone,
    I'm looking for a way to build a GUI (a full screen
    interface) for a device. Has flash been used to do this? For
    example, are there any devices on the market that use flash for
    their user interface?
    Thanks.

    Trying with the same configuration in OSX Yosemite, Flash Builder 4.7, Adobe AIR 16 build 259 resulted compiled successfully, so it's a Windows-only issue.

  • I think I have one of the fast dying batteries 5s. Last 6 hrs and just texting not even a lot. Has iOS 7 on my 5 and was nowhere near this. Brightness 1/3 back grounding off. I would also like to know if I can add if you replace for bigger hard drive. i

    I would also like a 32 none were available I took the first5s I could find. But the batterey is horrible. I barely even use is brightness low and does pretty fast on network. I think may be a bad battery like I read about. It's sb my messages I have none and takes up 3.4gb.... And there's only actually 13gn and 3 is the iOS so why don't you make a external hd or something it's crazy hard to even get the phone.

    Take it to apple store and don't replace it with the new one my son had the same problem he was in there about 10 minutes and walked out with a new phone

  • Is there any way i can add my payment information in profile without credit card information.  The option "none" is not appearing for me

    I am unable to update my payment information in my profile without credit card information.  I do not see "None" option below Visa, Master, Amex & Discover.

    You would have to purchase a 3rd party program ( not supported by Apple).
    The ipod is not a storage/backup device.
    Copy everything from the old computer or your backup copy of your old computer.

  • IPhoto 6 can't find my library for some strange reason...

    Hello everyone,
    I can't explain why or how it happened. One moment I was looking at my screen with the background that's been there forever. I plug in my external hard drive and the background on my screen turns in a simple mac blue design of some sort. My dock is reset to "not hide'.
    I then open my iphoto (6) app. and my library is gone. Long time ago I moved my library to an external hard drive and it has always found it. Now it can't. I did a search on the net and saw that you can "chose" your library from the file list in iphoto, but I guess my version only has an "import library" option which is not what I am looking for. I am assuming that, 1) when importing, those photos imported are duplicated and saved on my internal hard drive and 2) will not place my pictures in albums (Yes, I did import and then deleted it because of that reason). I have 7,000 plus pictures and really don't want to re-create albums again.
    I hope there is a "hey stupid, do this simple thing" answer to my question.

    To select a Library:
    Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library'
    Regards
    TD

  • How can I use jbo:ShowValue for some columns and bc4juix:RenderValue for other co

    Using a UIX/JSP page, how can I get the <jbo:ShowValue> tag to work in the following situation? I've ditched the "AttributeIterate" so that I can manually select the columns I want.
    --- snip ---
    <uix:form name="form1" method="GET">
    <bc4juix:Table datasource="ds1" >
    <uix:columnHeaderStamp>
    <uix:styledText textBinding="LABEL"/>
    </uix:columnHeaderStamp>
    <%--
    <jbo:AttributeIterate id="dsAttributes" datasource="ds1" hideattributes="UixShowHide">
    <bc4juix:RenderValue datasource="ds1" dataitem="<%=dsAttributes.getName()%>" />
    </jbo:AttributeIterate>
    --%>
    <bc4juix:RenderValue datasource="ds1" dataitem="FacilityDesc" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationId" />
    <bc4juix:RenderValue datasource="ds1" dataitem="LocationDesc" />
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>     
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>     
    </uix:rawText>
    <%-- ** THE FOLLOWING DOES NOT DISPLAY ON THE BROWSE_EDIT_PAGE ** --%>
    <uix:contents>
    <uix:rawText>
    <jbo:ShowValue datasource="ds1" dataitem="Notes" ></jbo:ShowValue>     
    </uix:rawText>
    </uix:contents>
    --- snip ---
    What am I doing wrong and how can I fix this?
    Bill G...

    This will not work inside of the bc4juix:table, this tag pulls the data from the data source, it doesn't allow you to add ShowValue tags inside of the table. Take alook at the UIX Developer Guide for more information on the Table tag. The ShowValue tag can be used in a uix hierarchy outside of the tabel tag.

  • I can't figure this out for some reason.

    I want to use a template in DVD studio pro and have the button text fade in at a certain point and have it be highlitghed when it is selected. It seems like it should be a simple thing but I can't figure out how to do it.
    Thank You
    Vincent LeGrow

    You would need to animate the background then bring the overlay in (fade in fade outs as part of movie.)
    Take a look here for how to do it (this example uses some items from DVD SP templates but would work otherwise, you can skip down to step 8 or so)
    http://www.dvdstepbystep.com/ira/

Maybe you are looking for