Add element to GUI

Hi,
I was wondering if it would be possible to add new elements (eg button) to an app GUI (eg iTunes). I know how to do a script and make it available in scripts menu, but, is it possible to add a new button to the iTunes GUI, and fire the script when the user press this button?
I tried searching UI Scripting associate with some kind of skin/theme modification, but found nothing. I'm not restricted to scripting. Any tip/hint in any language/technology (preferably those compatible with OS X 10.8.x) is welcome.
TIA,
Bob

Whether or not you can add controls (or scripts) for an application is up to the developer - without the original source files you can't change an application.

Similar Messages

  • Add element in dropdown list dynamically

    Hi All,
    I am facing a problem in adding item in a dropdown list dynamically.
    When i get dropdown list through IgetElementById get null.
    var list = document.getElementById("targetgroupname");
    here list comes as null. Now I've to fill this list. I am using below code -
    for(var j=0;j< com.length;j++){
    iist.options[j]= new Option(com[j],com[j]);
    But it is not working. My list is not getting filled with these values.
    I doubt due to var list -> null it does not allow to add element.
    But I am not getting any clue, how to initialize it.
    Please suggest, I am new to javascript.
    Thanks & Regards,
    Sneha.

    Hi,
    Thanks for the reply, yes the select box has that id - targetgroupname.
    actually there are 2 dropdown lists, Based on the selection of first dropdown list another list shd be filled.
    So I've written a script at "onchange" of first dropdown list. It works fine when a value gets changed at first dropdown list.
    In some cases I've to display a preselected value at first list ( which comes from previous page as parameter), in that cases there will be no onchange on first list, so I've called the script function manually after creating the first list,like below :
    <SCRIPT> checkSource();</SCRIPT>
    and in this case it does not work & I get a null when i try to read the 2nd list.
    But I am not sure why it is happening.. may be it is not loaded /created on page when i am calling it.
    If yes, what shd I do ?
    Thanks for your time.
    Regards,
    Sneha

  • Is there a way you can add elements dynamically to an existing array??

    hey guys... i need to add elements to an array dynamically... how do i do that?
    for example... in one of my functions i do..
         for each(var item:Object in fileList){
              fileListArr.push(item);
    and in a later function i need to add one more element to my fileListArr...
    so i tried doing
    fileListArr[indexNum].push({
         key:videoKey
    so i need to have an array which resembles something like this...
    Before adding elements...
    fileListArr:
         [0]:  name:test1
                Size:12K
                caption:testing caption
                number:1
         [1]:  name:test2
                Size:12K
                caption:testing caption
                number:2
    after adding key to array
    fileListArr:
         [0]:  name:test1
                Size:12K
                caption:testing caption
                number:1
                key:xyxyyy11y1yy1y1y2y2u33n
         [1]:  name:test2
                Size:12K
                caption:testing caption
                number:2
                key:iiduudjmenri112jj2n4n3m2j1j21
    any ideas?

    hmm interesting... so i made the changes... i changed the array to arraylist and the code i have is as follows... but i still get an error... the error says ... "ReferenceError: Error #1056: Cannot create property key on flash.net.FileReference."
    public var videoReference:VideoHandler;
    public var fileRef:FileReferenceList = new FileReferenceList();
    [Bindable] public var fileListArr:ArrayList = new ArrayList();
    [Bindable] public var fileNames:ArrayCollection = new ArrayCollection();
    public function selectionHandler(event:Event):void{
         fileRef.removeEventListener(Event.SELECT, selectionHandler);
         var numSelected:int = event.target.fileList.length;
         var fileList:Array = event.target.fileList;
         for each(var item:Object in fileList){
              fileListArr.addItem(item);
              fileNames.addItem({
                   num: fileNames.length + 1,
                   name: item.name,
                   size: formatFileSize(item.size),
                   status: ""
         var newListLength:Number = fileListArr.length;
         if(fileCounter > 0){
              loopList(fileCounter);
         else
              loopList(0);
    public function loopList(value:int):void{
         //trace("looplist -->");
         if(value < fileListArr.length){
              _numCurrentUpload = value;
              file = new FileReference();
              file = FileReference(fileListArr.getItemAt(value));
              file.addEventListener(Event.COMPLETE, loadVideo);
              file.addEventListener(ProgressEvent.PROGRESS, fileProgress);
              file.load();
    public function setUploadKey(event:ResultEvent):void{
         if(event.result.ThereWasAnError){
              Alert.show(event.result.ErrorMessages[0]);
         }else{
              videoKey = event.result.UploadKey;
              if(fileCounter >= fileListArr.length){
                   trace("in if");
                   fileCounter = 0;
                   uploadLoopList(fileCounter);
              }else{
                   trace("in else");
                   //fileListArr[fileCounter - 1]['videoKey'] = videoKey;
    -----> get an error here --->fileListArr.getItemAt(fileCounter - 1).key = videoKey;
                   //fileListArr[fileCounter - 1] = [{key: videoKey}];
                   loopList(fileCounter);

  • How to add elements into Object[][] type of list, in runtime?

    I have Object list, ie.
        final Object[][] data = {
            {"January",   new Integer(150) },
            {"February",  new Integer(500) },
            {"March",     new Integer(54)  },
            {"April",     new Integer(-50) }
        };How can I dynamicly add new elements in it, at the runtime?
    Thank you in advance!

    Do I have to remove 'final' for that, and then add
    elements?
    No. you can't change an array's size.
    You can do this
    Object[][] arr = new Object[numRows][numCols];But once you've created it, its size can't change.*
    I don't know what you're doing, though, and what actual data you're putting in, but Object[][] holding rows of [String, Integer] is almost certainly a poor data structure. Think about creating a class the represents one "row" here and then create a 1D array of that class.
    * Okay, you can kinda sorta effectively "change" the size of second and subsequent dimensions, since a multidimensional array is an array of arrays. I wouldn't recommend it though: int[][] arr = new int[3][2]; // a 3 x 2 rectangular array of int--it's  an array of array of int, with 3 "rows", each of which is an array of int with 2 elements.
    arr[0] = new int[10]; // now it's a jagged array whose first row has 10 elments instead of 2Here we haven't changed an array's size, just replaced one of its elements, which is also an array, with a new, larger array.

  • Records Management - automaticaly add element to record

    Hello,
    I try to add an element to a record using the bapi "bapi_record_addelement", but I get an error-message that the number of poid-parameters is not equal to those in the registry information.
    My ABAP-Code is the following:
    *& Report  Z_RECORD_ADDELEMENT
    REPORT  Z_RECORD_ADDELEMENT.
    *{   INSERT         I50K900139                                        1
    data:
    wa_ELEMENT_SP_POID     type      BAPIPROPTB,
    wa_ELEMENT_PROPERTIES  type      BAPIPROPTB,
    wa_ELEMENT_VISIBILITY  type      BAPIPROPTB,
    element_sp_poid type standard table of BAPIPROPTB,
    element_properties type standard table of BAPIPROPTB,
    wa_insertion_by_modelid type BAPISRMREC_MODELIDINS,
    return like BAPIRET2.
    * Fill SP POID table
    start-of-selection.
    CLEAR element_sp_poid.
    wa_element_sp_poid-NAME  = 'DOC_ID'.
    wa_element_sp_poid-VALUE = '03F65C4630552864E1000000AC15C293'.
    APPEND wa_element_sp_poid TO element_sp_poid.
    wa_element_sp_poid-NAME  = 'VARIANT'.
    wa_element_sp_poid-VALUE = '0'.
    APPEND wa_element_sp_poid TO element_sp_poid.
    wa_element_sp_poid-NAME  = 'VERSION'.
    wa_element_sp_poid-VALUE = '2'.
    APPEND wa_element_sp_poid TO element_sp_poid.
    wa_insertion_by_modelid-MODEL_ID = 'D7F85C462E55770CE1000000AC15C293'.
    wa_insertion_by_modelid-PARENT_NODE_ID = '3'.
    ** add element
    CALL FUNCTION 'BAPI_RECORD_ADDELEMENT'
            EXPORTING
              objectid = 'E1A55C462F0C790CE1000000AC15C293'
              DocumentClass = 'ZRMSR04'
              sps_id = 'Z_RM_MIETAKT'
              anchor = 'Schriftverkehr'
              description = 'Testdokument eingefügt mit ABAP'
             IMPORTING
              return        = return.
    write: return-message,
           return-type.
    *}   INSERT
    I hope someone can help me because I am trying for one week.
    hootzter

    Hey...
    Good information.
    I get an error in trying to add element to record, van you help me out.
    The error reads the following:
    Source: CL_SRM_GENERIC_SP0============CP , CL_SRM_GENERIC_SP0============CM002 ,       102
    General error: Could not connect to repository.
    This is the code Iam using
    *& Report  ZTESTPRG
    REPORT  ZTESTPRG.
    Definition of local data types for DOC_ID
      types: begin of ty_doc_id,
                docclass type bapisrmdoc-docclass,
                objectid type bapisrmdoc-guid,
             end of ty_doc_id.
    Structure of the correct Document-ID
      data: ls_doc_id type ty_doc_id,
            lt_sp_poid type standard table of bapiproptb,
            ls_sp_poid type bapiproptb,
            ls_return like bapiret2,
            ls_insertion_by_anchor type bapisrmrec_anchorins.
        clear: lt_sp_poid, ls_doc_id, ls_doc_id.
        ls_doc_id-docclass = 'ZSNG09'.                    
      Document Class des einzufügenden Dokumentes
        ls_doc_id-objectid = '466E6A24DED600A100000000AC10A015'.     
       Objektid des einzufügenden Dokumentes
        clear: ls_sp_poid. " clear weg und ls_sp_poid clearen
        ls_sp_poid-name  = 'DOC_ID'.
        ls_sp_poid-value = ls_doc_id.                    
       Document Class und Objektid als Struktur des Dokumentes
        append ls_sp_poid to lt_sp_poid.
        clear: ls_doc_id.
        ls_sp_poid-name  = 'VARIANT'.
        ls_sp_poid-value = '0'.
        append ls_sp_poid to lt_sp_poid.
        clear: ls_doc_id.
        ls_sp_poid-name  = 'VERSION'.
        ls_sp_poid-value = '0'.
        append ls_sp_poid to lt_sp_poid.
        clear: ls_insertion_by_anchor.
        ls_insertion_by_anchor-parent_node_id = '5'.
        call function 'BAPI_RECORD_ADDELEMENT'
          exporting
            objectid        = '466E9223F887013A00000000AC10A015'     
           Objectid der Akte
            documentclass   = 'ZSNG08'                    
           Document Class der Akte
            sps_id          = 'ZSCMG_SPS_NUCLEAR_PROCEDURE'               
           Einzufügende Elementart
            anchor          = 'NP02'                    
           Im Aktenmodell hinterlegt beim Modellknoten
            description     = 'Test Document'     
           Beschreibung des Dokumentes in der Akte
            element_type    = 'I'                         
           Instanz
          importing
            return          = ls_return
          tables
            element_sp_poid = lt_sp_poid.
            write: ls_return-message,
                   ls_return-type.

  • In .java add elements to .jsp

    Hello!
    I'm just beginning and can't understand one thing:
    When I create JSPDynPage, system create JSP and JAVA file - it's clear. Then I add elements to form in JSP, for example, Layout.
    Can I add, for example, row into that Layout in .java file?
        .JSP:
    <hbj:form>
             <hbj:formLayout
                 id="myLayout"
                 width="100%">
                 <hbj:formLayoutRow
                         id="Row1">
                         <hbj:formLayoutCell
                                 id="Cell11"
                                 align="LEFT"
                                 width="100%">                
                                 <hbj:textView
                                     id="welcome_message"
                                     text="May the force be with you unknown user"
                                     design="HEADER1" />
                           </hbj:formLayoutCell>
                   </hbj:formLayoutRow>                      
               </hbj:formLayout>            
        </hbj:form>
    .JAVA:
    public void doProcessBeforeOutput() throws PageException {
             this.setJspName("myjsp.jsp");
          Form Reg_Form = null;
          FormLayout RF_All  = new FormLayout();
          Tray Left_Tray1 = new Tray("TrayRules1");
           Reg_Form = (Form)this.getForm();
           RF_All = (FormLayout) this.getComponentByName("myLayout");
           for (int i = 1; i <= 3; i++ ) {     RF_All.addRow(); }
           Left_Tray1.setTitle("Sample Title");
           Left_Tray1.setWidth("100%");
           TextView Left_Tray1_text = new TextView("Left_Tray1_text");
           Left_Tray1_text.setText("Sample Text");
           Left_Tray1_text.setEncode(false);
           Left_Tray1_text.setWrapping(true);
           Left_Tray1.addComponent(Left_Tray1_text);
           RF_All.addComponent(2,1, Left_Tray1);
           Reg_Form.addComponent(RF_All);
    That code don't display Tray in page...

    Paul,
    I suggest you  not to add the your business logic in that auto generated file.
    Instead you can have seperate java file or any Bean.
    Since you are writing the logic for layout you can add the code in the jsp file
    itself.
    If you are using HTMLB Then keep the auto generated code in the jsp otherwise remove the code and keep the file as jsp meaning you use the html, javascript,
    jsp code in the .jsp file itself.
    you can add the java code in the jsp
    <% String strName = "SAP"; %>
    <sc ript>
    al ert("<%=strName%>");
    </sc ript>
    Ram

  • Dynamicall add element in Drop Down

    There is one for in which drop down list is present. I want to add element dynamicall into drop down list when certain event is occur

    trigger a Java script function at the end of the event which will
    add date into the combobox.

  • Adding elements to a node: cannot bind or add element

    Hallo,
    I want add emenents of my phases and subphases to a table, but I get this exception:
    ContextException: Node(RoadMapVIew.phase_subphase_table): cannot bind or add element, because it is already bound to a node
    The code is the following:
    int phaseSize = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase().length;
                     String currentStatus = "";
                     String currentPhaseId = "";
                     String currentSubphaseId = "";
                     String currentNotifyId = "";
                     String lastStatus = "";
                     for (int i = 0; i < phaseSize; i++)
    PhaseT phaseT = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase();
                         IPrivateRoadMapVIew.IPhase_subphase_tableElement tableElement = wdContext.nodePhase_subphase_table().createPhase_subphase_tableElement();
                          tableElement.setPhase_desc(phaseT.getSequenceGroup1().getPhaseDesc());
                          tableElement.setPhase_id(phaseT.getSequenceGroup1().getPhaseId());
                          int subPhaseSize = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase().length;
                          for(int j = 0; j< subPhaseSize; j++)
                               SubPhaseT subPhaseT = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase()[j];
                               tableElement.setSubphase_desc(subPhaseT.getSequenceGroup1().getSubPhaseDesc());
                               tableElement.setSubphase_id(subPhaseT.getSequenceGroup1().getSubPhaseId());
                               String status = subPhaseT.getSequenceGroup1().getStatus();
                               wdContext.nodePhase_subphase_table().addElement(tableElement);
                               lastStatus = status;
                               //le fasi/sotofasi sono ordinate perciò la corrente è l'ultima con uno status valido
                               if (status != null && !status.equals(""))
                                    currentStatus = status;
                                    currentPhaseId = phaseT.getSequenceGroup1().getPhaseId();
                                    currentSubphaseId = subPhaseT.getSequenceGroup1().getSubPhaseId();
                                    if (status.equals(DAConst.STATUS_NOTIFY))
                                         //currentNotifyId = "notifyId"; //subPhaseT.getSequenceGroup1().getNotifyId();
                                         currentNotifyId = subPhaseT.getSequenceGroup1().getNotifyId();
    Can anybody help me please?
    Thanks,
    regards,
    Andrea

    I have solved moving the creation of the reference of the node element and the setting of elements inside the second for loop:
    for (int i = 0; i < phaseSize; i++)
                          PhaseT phaseT = processT.getSequenceGroup1().getPhaseList().getSequenceGroup1().getPhase()<i>;
                          String phaseDesc=phaseT.getSequenceGroup1().getPhaseDesc();
                          String phaseId=phaseT.getSequenceGroup1().getPhaseId();
                          int subPhaseSize = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase().length;
                          for(int j = 0; j< subPhaseSize; j++)
                               SubPhaseT subPhaseT = phaseT.getSequenceGroup1().getSubPhaseList().getSequenceGroup1().getSubPhase()[j];
                               IPrivateRoadMapVIew.IPhase_subphase_tableElement tableElement = wdContext.nodePhase_subphase_table().createPhase_subphase_tableElement();
                               tableElement.setSubphase_desc(subPhaseT.getSequenceGroup1().getSubPhaseDesc());
                               tableElement.setSubphase_id(subPhaseT.getSequenceGroup1().getSubPhaseId());
                               tableElement.setPhase_desc(phaseDesc);
                               tableElement.setPhase_id(phaseId);
                               String status = subPhaseT.getSequenceGroup1().getStatus();
                               wdContext.nodePhase_subphase_table().addElement(tableElement);
                               lastStatus = status;
    Thanks everybody for helps,
    Andrea

  • GeneralException Node(( Context path of node ): cannot bind or add element,

    Hello all,
    Stack trace :
    GeneralException Node((<Context path of node>): cannot bind or add element, because it is already bound to a node
    I am trying to upload data from excel file in web dynpro context.In the process,  when I create and add  an element to the node which I want to populate with excel data, it throws the above mentioned exception.
    Any idea as to wht is causing the problem ?

    Hi,
    GeneralException Node((<Context path of node>): cannot bind or add element, because it is already bound to a node
    It seems that its a mapped node, try to bind or addelements at the source.
    Ex: If this node is mapped from controller to view try to add elements in contoller instead of doing in view.
    Regards
    Ayyapparaj

  • ContextException : cannot bind or add element

    Hi all,
    I can't find an answer to my problem.
    Hope you'll be able to
    Here are the facts :
    Context :
    I'm currently creating a TeamViewer for Managers to be able to select the employees they manage.
    For that, I have a table which lists them all, displaying their infos in specific columns.
    Both columns and data are dynamic and are specified in the SAP back end.
    I use the following bapis to get these informations :
    - HRWPC_RFC_GET_COL_INFO (returns columns informations)
    - HRWPC_RFC_GET_OBJECTS (returns employees personal numbers -> pernr)
    Fact is the second one doesn't return as much informations as needed.
    So I have then to call a third bapi :
    - MYBAPI_USER_INFOS (return informations about an employee)
    which, from an employee pernr, returns a lot more informations about him.
    Fact is I manage to use efficiently both first bapis, so I get columns and pernr data.
    Then I would like to get in a context node the list of enhanced informations of the employees, which is mapped to my view context and applied to a dynamic table.
    My problem :
    While adding programmaticaly the columns to my context node, I get the following exception : "com.sap.tc.webdynpro.progmodel.context.ContextException: Node(TeamViewerApp.MainViewColumns): cannot bind or add element, because it is already bound to a node" error.
    Error summary :
    - com.sap.tc.webdynpro.progmodel.context.ContextException: Node(TeamViewerApp.MainViewColumns): cannot bind or add element, because it is already bound to a node
    -- at com.sap.tc.webdynpro.progmodel.context.Node.prepareAddElement(Node.java:649)
    -- at com.sap.tc.webdynpro.progmodel.context.Node.addElement(Node.java:635)
    -- at com.airfrance.tv1.teamviewer.components.TeamViewerApp.updateMainView(*TeamViewerApp.java:560*)
    -- at com.airfrance.tv1.teamviewer.components.wdp.InternalTeamViewerApp.updateMainView(InternalTeamViewerApp.java:534)
    -- at com.airfrance.tv1.teamviewer.components.views.TeamViewerView.onActionChangeView(TeamViewerView.java:197)
    TeamViewerComp code :
         wdThis.getColumnsMainView(viewId, userLanguage, userId); // get the columns infos
         IGetColumns_ResultNode columns = wdContext.nodeGetColumns_Result();
         for(int i=0; i<columns.size(); i++) {
              IWDNodeElement column = columns.getElementAt(i); // get the #i column
              wdContext.nodeMainViewColumns().addElement(column);  +//add this column to my other context +
    My context :
    Component
    - GetColumns (Model)
    -- GetColumns_Output
    --- GetColumns_Result
    Colname
    Heading
    -- Langu
    -- Uname
    -- Viewid
    - MainViewColumns (Value)
    -- lot of infos
    - SubViewColumns (Value)
    -- lot of infos
    My environment :
    - os : Windows XP SP2
    - procesor : 3GHz
    - memory : 3Gb
    - ide : SAP NWDS 7.0.12
    - server JEE : 7.00 SP12
    - server VM : Java Sun 1.4.2_12
    Any help will be really appreciated
    Thank you for your time!
    Alphonse

    HI,
    com.sap.tc.webdynpro.progmodel.context.ContextException: Node(HrChiefRedressalView.Ctx_FilteredOutput): cannot bind or add element, because it is already bound to a node
    Try to bind or add element from the source of the node instead of mapped one.
    Ex:
    Controller->View
    If your node is mapped from controller to view. bind/add element should be done at controller level not at view level.
    Regards
    Ayyapparaj

  • Add element in to bundle/unbundle Functions

    In the Bundle/Unbundle functions, Add Element is adding the same element.no use of adding same (again need to Select Item).based on the Cluster order if labVIEW adds next element it is usefull.

     I typically just resize the bundle node.

  • Remove element from GUI

    Hi guys,
    I am adding elements to the gui like this:
    var myText = win.add("edittext", undefined, "whatever");
    Later in my code I need to remove this element from UI. Is it possible?

    Use the remove() method: win.remove(myText);
    In general: container.remove(child);
    You can add it later later but then, if you use the autolayout, you'll need to relayout: win.layout.layout(true) otherwise it won't show up

  • Add element in Report Painter

    Hi All,
    I am trying a add an element (to the individual/lowest level) in my existing report in 'GRR2'.
    If I do not explode, element is created as below image,
    If I explode, element is shifted to final level as below image,
    But I want the element to be present at the lowest level as below,
    * 1990
    Note: The test '1990' will be replaced with the actual account name...
    Expert advice is appreciated...
    Thanks
    Rajesh P

    hi
    Report painter
    the below Pdf should help you
    http://www.virtuosollc.com/PDF/Get_Reporter.pdf
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/66/bc7d2543c211d182b30000e829fbfe/frameset.htm
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/eb/1377e443c411d1896f0000e8322d00/frameset.htm
    http://help.sap.com/erp2005_ehp_03/helpdata/EN/5b/d22cee43c611d182b30000e829fbfe/frameset.htm
    nagesh

  • 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....

  • How can we add elements to component at run time  through java

    Hi,
    In my project ,I am using JArrayList to collect urls and I need to add those to JScrollPane(JTextArea) and this to frame. This works fine but I need the process of how the elements added to ArrayList simultaneusly added to JTextArea.
    pls suggest the way

    arrayList.add( someObject );
    textArea.append( someObject.toString() );

Maybe you are looking for

  • GL Balance By Day

    Can someone tell me how I can pull a GL Balance By Day? I can grab the end of period balance by using the GL_BALANCES table and I can calculate to a day with the gl_je_lines table but I can't figure out how to combine the 2. Do I need to just build a

  • Ideas for a final year project

    I am in the final year of my studies. At the moment I can not decide what to do for my project, I have few ideas but I would like to hear from someone else for an idea as well. I would like to know what kind of project I could do in distributed java.

  • Presentation Variable issue in OBIEE 11g

    Hi, I have 2 reports, report 1 and report 2 When i drill down on report 1 column 'Number of id's' will open the details report of Id's report 2 I am using a Presentation variable in report 2 filters (detail report) which is generated in Main report d

  • Edit the default wiki template on Mac OS X Server

    Hello, I'm so new to this, I have a Mac Xserve with Mac OS X Server, I successfully enabled the following services and all up and running smoothly according to the criteria of my company: ical Server, ichat Server, Web Server, MySQL, Podcast Producer

  • I have 10.3.9 and I need to upgrade to 10.4!!

    Hello mac peoples, i got an old mac mini and a power book, and i just purchased some dj equipment (numark stealth control) and all the available dj software requires 10.4 at the least, is there anyone that can possibly provide me with some help/advis