Add listener

HI All,
I want to configure rman.listener is giving error in
target .first listener is fine,but when i try to add one more and
start listener it gives error.
my listener.ora is
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.97)(PORT = 1521))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
# (GLOBAL_DBNAME = APSRTCDB)
# (ORACLE_HOME = /opt/app/oracle/product/11.2.0/db_home1)
(SID_NAME = SID1)
# (SID_DESC =
# (SID_NAME = SID1)
(ORACLE_HOME = /opt/app/oracle/product/11.2.0/dbhome_2)
ADR_BASE_LISTENER = /opt/app/oracle
list_dba213 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.97)(PORT = 1521))
SID_LIST_list_dba213 =
(SID_LIST =
(SID_DESC =
#(GLOBAL_DBNAME = APSRTCDB)
(ORACLE_HOME = /opt/app/oracle/product/11.2.0/db_home2)
(SID_NAME =SID1)
listener by listener is ok but listener by name list_dba213 is not starting.
anyone help me out.
thanks
srinivas

srinivas wrote:
HI All,
I want to configure rman.listener is giving error in
target .first listener is fine,but when i try to add one more and
start listener it gives error.
my listener.ora is
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.97)(PORT = 1521))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
# (GLOBAL_DBNAME = APSRTCDB)
# (ORACLE_HOME = /opt/app/oracle/product/11.2.0/db_home1)
(SID_NAME = SID1)
# (SID_DESC =
# (SID_NAME = SID1)
(ORACLE_HOME = /opt/app/oracle/product/11.2.0/dbhome_2)
ADR_BASE_LISTENER = /opt/app/oracle
list_dba213 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.40.97)(PORT = 1521))
SID_LIST_list_dba213 =
(SID_LIST =
(SID_DESC =
#(GLOBAL_DBNAME = APSRTCDB)
(ORACLE_HOME = /opt/app/oracle/product/11.2.0/db_home2)
(SID_NAME =SID1)
listener by listener is ok but listener by name list_dba213 is not starting.
anyone help me out.
thanks
srinivasYou don't need two listeners. One single listener, with the default name of LISTENER, using the default port of 1521, is quite capable of --- indeed, was designed to --- service multiple instances of multiple versions running from multiple homes. And you most certainly don't need multiple listeners for the same instance. the listener is like a telephone switchboard. The phone company doesn't build a switchboard for every telephone customer. (analogous to a listener for every db instance) and they sure don't build one for every handset (a listener for every client application)

Similar Messages

  • Add listener to Grid Infrastructure using srvctl.

    Hi,
    We have a two node 11.2.0.3 Grid Infra cluster running on SLES11 Linux.
    Everything is ok with the SCAN and standard listeners.
    However we have a listener running on each node which is used by Oracle Gateway. These listeners were created manually using info provided by Oracle (i.e. definition copied to $ORACLE_HOME/network/admin/listener.ora and started using lsnrctl). This all works.
    These listeners are currently not managed by Grid Infra. We would like them to be.
    I thought this was easy enough using srvctl to register them with Grid Infra using...
    srvctl add listener -n mynode1 -l LISTENER_MYNODE1_GW -o $ORACLE_HOME -p 1529
    srvctl add listener -n mynode2 -l LISTENER_MYNODE2_GW -o $ORACLE_HOME -p 1529
    These commands worked but did give a warning stating that the -n flag is deprecated and will be ignored.
    This has left us with the following listener config....
    grid@MYNODE1:~> srvctl status listener -n mynode1 | grep mynode
    Listener LISTENER_MYNODE1_GW is enabled on node(s): mynode1
    Listener LISTENER_MYNODE1_GW is not running on node(s): mynode1
    Listener LISTENER_MYNODE2_GW is enabled on node(s): mynode1
    Listener LISTENER_MYNODE2_GW is not running on node(s): mynode1
    grid@MYNODE1:~> srvctl status listener -n mynode 2 | grep mynode
    Listener LISTENER_MYNODE1_GW is enabled on node(s): mynode2
    Listener LISTENER_MYNODE1_GW is not running on node(s): mynode2
    Listener LISTENER_MYNODE2_GW is enabled on node(s): mynode2
    Listener LISTENER_MYNODE2_GW is not running on node(s): mynode2
    You can see that Grid Infra knows about the listeners but they are available on both nodes. What we would like is a result like the following example....
    grid@MYNODE1:~> srvctl status listener -n mynode1 | grep mynode
    Listener LISTENER_MYNODE1_GW is enabled on node(s): mynode1
    Listener LISTENER_MYNODE1_GW is not running on node(s): mynode1
    grid@MYNODE1:~> srvctl status listener -n mynode 2 | grep mynode
    Listener LISTENER_MYNODE2_GW is enabled on node(s): mynode2
    Listener LISTENER_MYNODE2_GW is not running on node(s): mynode2
    i.e one listener registered with just the node it is running on. This used to be possible with using the -n flag but no longer works. Does anyone have any advice on how to achive this in 11gR2.
    Any input appreciated,
    Regards
    ma365

    Hi get the info of the listener and the scan -[listeners]
    Execute the statements from the GRID infrastructure.
    srvctl config listener [-l listener_name] [-a] this gives the info how the listener is register in to the OCR.
    alternative:
    Execute the steps to add a listener.
    srvctl add listener -l crmlistener -p TCP:1533 -o {CRS_HOME}
    srvctl enable listener -l crmlistener
    srvctl start listener -l crmlistener
    srvctl config listener -l crmlistener -a
    lsnrctl status crmlistener
    See what the result of this exercise is, working then convert to this method
    Cheers,
    Jos van den Oord
    Blog : [Joords Oracle DBA blog|http://joordsblog.vandenoord.eu/]
    Company : [Transfer-solutions.com|http://www.transfer-solutions.com/]

  • Add listener to 10g RAC manually

    Hi RAC Expert,
    Currently thinking to build RAC standby site. I believe that NETCA can be use to configure network services and it will automatically add to OCR.
    If I put the tnsnsames.ora and listener.ora manually to $ORACLE_HOME/network/admin and start the listener manually (lsrnctl start)..etc
    I only able to see srvctl configure listener ... (query the listener configuration), but there has no srvctl add listener....
    How can I register the listener in ocr manually by using srvctl?
    Thanks
    Best Regards,
    Vbeer

    Hi,
    I Need help here. Somehow netca cannot add listener to crs. Is there any other way to do it?say crs_register?
    When I put listener.ora file that I use to start listener on one node, netca recognizes the listener for the instance and can delete it. However when I ask it to add, it hungs at registering the listener with the name listener ( suppose it should be listener_hostname).
    my /crs_stat -t will never show the lsnr resource being registered)
    Thanks

  • Add listener to work with weblogic

              hi
              i make a administration question:
              now i work with the weblogic into the default port,7001.
              and i would like to work whith another port , such us port 80 . I find into documentation in weblogic into the section Setting WebLogic properties , the sub secction Setting up WebLogic to listen on port 80 , but this not talk about add listener, only how to listen by the other port.
              is there any document to solve my problem
              or knowing somebody the solution?
              any help will be appreaciated
              

    weblogic.system.listenPort=80
              Or are you asking how to get it to listen on both ports at the same time?
              If so, I do not believe that feature is supported. What are you trying to
              accomplish?
              Peace,
              Cameron Purdy
              Tangosol, Inc.
              http://www.tangosol.com
              +1.617.623.5782
              WebLogic Consulting Available
              "ruben" <[email protected]> wrote in message
              news:3a1e6bb9$[email protected]..
              >
              > hi
              > i make a administration question:
              > now i work with the weblogic into the default port,7001.
              > and i would like to work whith another port , such us port 80 . I find
              into documentation in weblogic into the section Setting WebLogic properties
              , the sub secction Setting up WebLogic to listen on port 80 , but this not
              talk about add listener, only how to listen by the other port.
              > is there any document to solve my problem
              > or knowing somebody the solution?
              > any help will be appreaciated
              

  • JComboBox - how to get popup or add listener

    Hi,
    Using a JComboBox I want to add a mouse listener so I can detect when a user press mouse on it. It seems that the popup may be getting the mouse event though. Is there a way to add a mouse listener to it so I can catch mousepressed event? perhaps a way to get the actual ComboPopup??
    ...hopefully it can be done without subclassing the combobox UI, or popup, or jcombobox itself.
    thanks

    It occurs to me that what you are probably asking is not 'how do I add a MouseListener
    to the popup menu', but rather, 'how do I add a MouseListener to the ComboBox itself'.
    Camickr suggestion is spot on if your combo box is editable. If it is not, you should add
    it to the renderer. However, I'm not sure if that will still catch mouse events on the arrow
    button which pops the list, and that doesn't seem to be accessible from the UI.
    Hmmm. Probably your best bet is to iterate through the combo box's child components
    and add the listener to each of those.
    : jay

  • Add listener / remove listener

    hi,
    when I add a listener on a clip or button (like the CLICK Event) that exists in the timeline do I allways have to remove the listener if the Clip is removed from stage? Or will it be removed automaticly by the garbage collection?
    TIA

    It will only be removed automatically if you use a weak reference:
    clip.addEventListener(MouseEvent.CLICK, clickHandler, false, 0, true); //weak ref
    vs:
    clip.addEventListener(MouseEvent.CLICK, clickHandler); //strong ref
    the second version is only removed if you removeEventListener on it.

  • Add Listener to Unknown Number of JMenuItems

    How can I add an ActionListener to each JMenuItem by cycling through an unknown number of menu items?
    I have a program that prompts the user for a database, then creates a JMenu of table names based on whatever database the user selects.
    This means that I don't know the table names or number of tables that will be added to the JMenu.
    I need to add an ActionListener to EACH JMenuItem. The problem is that I am only able to select one table from the menu. Subsequent menu clicks (on different table names) have no affect on the output.
    Here is an excerpt of my code:
    ResultSet rs = md.getTables(null, null, null, types);
    while (rs.next()) {
    tables.add(rs.getString("table_name"));
    for (Iterator i = tables.iterator(); i.hasNext(); )
    String table = (String) i.next();
    JMenuItem mi = new JMenuItem(table);
    j1.add(mi);
    mi.addActionListener(this);
    [END CODE]
    Thanks for any help you can give!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    I got it. It turns out that I WAS setting the listeners correctly. My additonal output was "hidden" in the window. I found it by pure luck when I expanded the window size.
    I added a line to remove all components from the JPanel before adding a new one and this "refresh" worked.
    Thanks fot the help anyway! It is greatly appreciated.

  • Add listener in HTMLPANE BEAN AREA

    I have a Java class which interprets the HTML code (based on http://forms.pjc.bean.over-blog.com/article-1896785.html).
    On the other hand I have another class that captures the key down (based on the exemple keypressed.zip in the same web page http://forms.pjc.bean.over-blog.com).
    Both classes are in the same jar.
    In my form I have a bean area that implements the HTML class, but if the focus is on this element ignores the key pressed.
    The same thing happened with the buttons and adding the following code in the KEY class has been fixed.
    protected void getTextItems(Component component, int iter)
    if (component.getClass().getName().equals("oracle.forms.ui.VTextField"))
    oracle.forms.ui.VTextField vt = (oracle.forms.ui.VTextField)component ;
    vt.addKeyListener(kl);
    else if (component.getClass().getName().equals("oracle.forms.ui.VTextArea"))
    oracle.forms.ui.VTextArea ta = (oracle.forms.ui.VTextArea)component ;
    ta.addKeyListener(kl);
    else if (component.getClass().getName().equals("oracle.forms.ui.VBean"))
    oracle.forms.ui.VBean abe = (oracle.forms.ui.VBean)component ;
    abe.addKeyListener(kl);
    else if (component.getClass().getName().equals("oracle.forms.ui.VButton"))
    oracle.forms.ui.VButton btn = (oracle.forms.ui.VButton)component ;
    btn.addKeyListener(kl);
    if (component instanceof Container)
    Component components[] = ((Container)component).getComponents();
    iter++;
    for (int i = 0; i < components.length; i++)
    { if (components[i] != null)
    { getTextItems(components[i],iter);}
    The HTML class implements VBean, i don't understand why the next code hasn't effect
    else if (component.getClass().getName().equals("oracle.forms.ui.VBean"))
    oracle.forms.ui.VBean abe = (oracle.forms.ui.VBean)component ;
    abe.addKeyListener(kl);
    Some idea?
    Regards

    Hi,
    you will have to register this function as a custom ID and then handle the call in the set_property() method of the PJC.
    If this method is supposed to only return a value, then use the get_property() method.
    protected static final ID mTest = ID.registerProperty("MYTEST");
    public Object getProperty(ID p0){
    if (ID== mTest) then {
    return "my string";
    else
    return super.getProperty(p0);
    variable1 := get_custom_property('block.beanitem',1,'MYTEST');
    Note that the code could contain typos as I was writing it from the top of my head.
    Frank

  • Can we add listener to some component using reflection ?

    Hi,
    I have a third party swing application. I am trying to invoke it from my application by calling its main() method using reflection and it works!
    Then I try to attach the mouseMotionListener to its components using reflection but cannot succeed. Is it possible to do that?? If yes then how?
    Thanks in advance

    You shouldn't need reflection for this. Assuming it's a JFrame, JDialog or JWindow (any RootPaneConatiner), just call getContentPane() and recursively iterate through its children, adding MouseListeners along the way (or wherever you find a component of a type you're interested in, for example ignore things like JPanels, JLabels, etc.).
    FYI - you also shouldn't need reflection to call an application's main() method, assuming you already know what the class is that contains that main() method.

  • How can I add action listener to a cell or row in a table?

    hi there
    I need to be able to click on one cell or one row in a table, and perform some action, like openning a dialog or something. how can i add listener?

    // See How to Use Tables in tutorial. You will get one idea about Table Renderer and Editors.
    // If u understand the concept, ur problem is very easy to solve by adding Editor to your column.
    "You can think of the renderer as a configurable ink stamp that the table uses to stamp appropriately formatted data onto each cell. When the user starts to edit a cell's data, a cell editor takes over the cell, controlling the cell's editing behavior.
    Here, While tabing thru the table row, default all cell editors are JLabels. (Not editables)
    So u can make it those cells are editable JTextFields or JComboBoxes based on the column while tabbing. And you can add Listeners to that fields too. So those editable fields are called Editor Components.
    // see javax.swing.DefaultCellEditor class for more description
    Here i am adding my own JTextField editor to 3rd column of a table by using
    mytable.getColumnModel().getColumn(2).setCellEditor(editor );
    Here editor is a obj of below class. (Not complete..class)
    public class JbuiEditor extends DefaultCellEditor implements // any listener {
    public JbuiEditor(JTextField tField) {
    super(tField);
    setClickCountToStart(1);
    tField.addFocusListener(this);
    this.editorComponent = tField;
    public Component getComponent(){
         return editorComponent;
    public Component getTreeCellEditorComponent(JTree tree, Object value,
                                  boolean isSelected,
                                  boolean expanded,
                                  boolean leaf, int row) {
         String StringValue = tree.convertValueToText(value, isSelected,
                             expanded, leaf, row, false);
         delegate.setValue(stringValue);
         return editorComponent;
    public Object getCellEditorValue() {
    return super.getCellEditorValue();
    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected,int row, int column) {
    super.getTableCellEditorComponent(table,value,isSelected,row,column);
    ((JTextField)editorComponent).setText(value.toString());
    //Here u can add any type of listener to this Editor component.like..
    ((JTextField)editorComponent).addActionListener(..);
    ((JTextField)editorComponent).addFocusListener(..);
    return editorComponent;
    Hope gives some idea.

  • Is that possible to add a listener to a class that bind with a image?

    Hello, I am trying to add listener to a class that binds with image.  For example, I want to add listener to customDividerSkin(see example below, i bold and underline the text), so when user click the customdividerSkin image haloGreen box will be hided. Thanks,
    <?xml version="1.0" encoding="utf-8"?>
    <!-- http://blog.flexexamples.com/2008/09/18/customizing-the-divider-skin-on-a-dividedbox-conta iner-in-flex/ -->
    <mx:Application name="HDividedBox_dividerSkin_test"
    xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    verticalAlign="middle"
    backgroundColor="white"
    initialize="init();">
    <mx:Script>
    <![CDATA[
    [Embed("arrowLeft.png")]
    private const customDividerSkin:Class;
    private function init():void
    dividedBox.setStyle("dividerSkin", customDividerSkin);
    ]]>
    </mx:Script>
    <mx:HDividedBox id="dividedBox"
    horizontalGap="24"
    width="100%"
    height="100%">
    <mx:ViewStack id="AddFormViewStack"
      width="100%"
      height="100%">
    <mx:Box id="box1"
    backgroundColor="haloGreen"
    width="100%"
    height="100%"
    minWidth="100"/>
    <mx:Box id="box2"
    backgroundColor="haloBlue"
    width="100%"
    height="100%"
    minWidth="100"/>
    </mx:ViewStack>
    </mx:HDividedBox>
    </mx:Application>

    Set the class as the source for an mx:Image and set the listener to the  Image

  • ADD A SECOND LISTENER USING SRVCTL COMMAND

    Hi All,
    My RAC has w nodes (10g 10.2.0.4)
    it already has a default listener (NODE1_LISTENER1 in ASM home port 1521) register with the CRS and i already create a second listener manually on both nodes.
    My question is how to add this listener (NODE1_listener1) using srvctl command not the netca
    Thanks in advance.
    Regard,
    Tom

    srvctl add listener is not support in 10g ,
    but in 11g you can add listener using srvctl
    10g:
    http://download.oracle.com/docs/cd/B19306_01/rac.102/b14197/srvctladmin.htm#RACAD5002
    11g:
    http://download.oracle.com/docs/cd/B28359_01/rac.111/b28254/srvctladmin.htm#CDCEECFB
    So, You need to use netca to help on 10g

  • How to add own Listener?

    Hi!
    The problem is that I have inherited the class MyTrayIcon from TrayIcon with implementing of MouseListener interface to handle mouse double click. But TrayIcon doesn't have method 'addMouseListener' as MyTrayIcon doesn't. So, how can I add listener is this case?

    How about looping through the array of listeners and
    removing it if it's an instance of ListListener?
    if (eventListeners[index] instanceof ListListener)
    removeMouseListener(eventListeners[index]);I thought of that, but as I said i my post, eventListeners[] is protected.
    How about writing your own ListListener in the
    appropriate package which does precisely nothing, and
    making sure it goes in the CLASSPATH before the
    package you're supposed to use?Nice idea, but unfortunately, when I submit the assignment I have no way of making sure that it does go into the classpath before the package.
    Thanks for your help, but I think I'll have to stick with the workaround.
    It's not too hard:  public static void setListData(DefaultListModel model, Object data[])
        model.clear();
        for (int i = 0; i < data.length; i++)
          model.addElement(data);

  • How to add a Listener to the JLabel

    Hi,
    I am doing a Designer module in which i want to Listen Focus gained event on JLabel. For that i have added FocusListener to the JLabel but it does not listen to this event. (i think because of JLabels extraodinary property).
    So How to add listener to the JLabel?

    Set the label to be focusable. This will allow it to gain focus from the
    keyboard (from pressing TAB, for example), but not from being clicked on.
    It's easy to give some demo code than to explain it:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class LabelListening extends MouseAdapter implements FocusListener {
        private static final String TEXT_KEY = "jlabel_text_key";
        public void focusGained(FocusEvent e) {
            JLabel label = (JLabel) e.getComponent();
            String text = (String) label.getClientProperty(TEXT_KEY);
            label.setText("<html><u>" + text + "</u></html>");
        public void focusLost(FocusEvent e) {
            JLabel label = (JLabel) e.getComponent();
            String text = (String) label.getClientProperty(TEXT_KEY);
            label.setText(text);
        public void mousePressed(MouseEvent e) {
            e.getComponent().requestFocusInWindow();
        public static void main(String[] args) {
            LabelListening app = new LabelListening();
            JPanel contentPane = new JPanel();
            for(int i=0; i<4; ++i) {
                String text = "label " + i;
                JLabel label = new JLabel(text);
                label.putClientProperty(TEXT_KEY, text);
                label.setFocusable(true);
                label.addFocusListener(app);
                label.addMouseListener(app);
                contentPane.add(label);
            JButton btn = new JButton("a button");
            btn.setBorderPainted(false);
            btn.setContentAreaFilled(false);
            btn.setMargin(new Insets(0,0,0,0));
            contentPane.add(btn);
            final JFrame f = new JFrame("");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(contentPane);
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }In this example, I have the focused label underlined. I don't
    know what your context is, but it may be simpler just to work with
    buttons instead. I "undecorate" a button in this example to make it look
    similar to a label.

  • Adding an event listener to combo box

    I am working on a mortgage calculator and I cannot figure out how to add an event listener to a combo box.
    I want to get the mortgage term and interest rate to calucate the mortgage using the combo cox. Here is my program.
    Modify the mortgage program to allow the user to input the amount of a mortgage
    and then select from a menu of mortgage loans: 7 year at 5.35%, 15 year at 5.50%, and
    30 year at 5.75%. Use an array for the different loans. Display the mortgage payment
    amount. Then, list the loan balance and interest paid for each payment over the term
    of the loan. Allow the user to loop back and enter a new amount and make a new
    selection, with resulting new values. Allow user to exit if running as an application
    (can't do that for an applet though).
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.text.NumberFormat;
    import java.util.Locale;
    //creates class MortgageCalculator
    public class MortgageCalculator extends JFrame implements ActionListener {
    //creates title for calculator
         JPanel row = new JPanel();
         JLabel mortgageCalculator = new JLabel("MORTGAGE CALCULATOR", JLabel.CENTER);
    //creates labels and text fields for amount entered          
         JPanel firstRow = new JPanel(new GridLayout(3,1,1,1));
         JLabel mortgageLabel = new JLabel("Mortgage Payment $", JLabel.LEFT);
         JTextField mortgageAmount = new JTextField(10);
         JPanel secondRow = new JPanel();
         JLabel termLabel = new JLabel("Mortgage Term/Interest Rate", JLabel.LEFT);
         String[] term = {"7", "15", "30"};
         JComboBox mortgageTerm = new JComboBox(term);
         JPanel thirdRow = new JPanel();
         JLabel interestLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
         String[] interest = {"5.35", "5.50", "5.75"};
         JComboBox interestRate = new JComboBox(interest);
         JPanel fourthRow = new JPanel(new GridLayout(3, 2, 10, 10));
         JLabel paymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
         JTextField monthlyPayment = new JTextField(10);
    //create buttons to calculate payment and clear fields
         JPanel fifthRow = new JPanel(new GridLayout(3, 2, 1, 1));
         JButton calculateButton = new JButton("CALCULATE PAYMENT");
         JButton clearButton = new JButton("CLEAR");
         JButton exitButton = new JButton("EXIT");
    //Display area
         JPanel sixthRow = new JPanel(new GridLayout(2, 2, 10, 10));
         JLabel displayArea = new JLabel(" ", JLabel.LEFT);
         JTextArea textarea = new JTextArea(" ", 8, 50);
    public MortgageCalculator() {
         super("Mortgage Calculator");                     //title of frame
         setSize(550, 350);                                             //size of frame
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container pane = getContentPane();
         GridLayout grid = new GridLayout(7, 3, 10, 10);
         pane.setLayout(grid);
         pane.add(row);
         pane.add(mortgageCalculator);
         pane.add(firstRow);
         pane.add(mortgageLabel);
         pane.add(mortgageAmount);
         pane.add(secondRow);
         pane.add(termLabel);
         pane.add(mortgageTerm);
         pane.add(thirdRow);
         pane.add(interestLabel);
         pane.add(interestRate);
         pane.add(fourthRow);
         pane.add(paymentLabel);
         pane.add(monthlyPayment);
         monthlyPayment.setEnabled(false);
         pane.add(fifthRow);
         pane.add(calculateButton);
         pane.add(clearButton);
         pane.add(exitButton);
         pane.add(sixthRow);
         pane.add(textarea); //adds texaarea to frame
         pane.add(displayArea);
         setContentPane(pane);
         setVisible(true);
         //Adds Listener to buttons
         calculateButton.addActionListener(this);
         clearButton.addActionListener(this);
         exitButton.addActionListener(this);
         mortgageTerm.addActionListener(this);
         interestRate.addActionListener(this);
    public void actionPerformed(ActionEvent event) { 
         Object command = event.getSource();
         JComboBox mortgageTerm = (JComboBox)event.getSource();
         String termYear = (String)mortgageTerm.getSelectedItem();
    if (command == calculateButton) //calculates mortgage payment
         int year = Integer.parseInt(mortgageTerm.getText());
         double rate = new Double(interestRate.getText()).doubleValue();
         double mortgage = new Double(mortgageAmount.getText()).doubleValue();
         double interest = rate /100.0 / 12.0;
         double monthly = mortgage *(interest/(1-Math.pow(interest+1,-12.0 * year)));
                   NumberFormat myCurrencyFormatter;
                   myCurrencyFormatter = NumberFormat.getCurrencyInstance(Locale.US);
                   monthlyPayment.setText(myCurrencyFormatter.format(monthly));
         if(command == clearButton) //clears all text fields
                   mortgageAmount.setText(null);
                   //mortgageTerm.setText(null);
                   //interestRate.setText(null);
                   monthlyPayment.setText(null);
              if(command == exitButton) //sets exit button
                        System.exit(0);
         public static void main(String[] arguments) {
              MortgageCalculator mor = new MortgageCalculator();

    The OP already did this to both JComboBoxes.
    mochatay, here is a new actionPerformed method for you to use.
    I've improved a few things here and there...
    1) You can't just cast the ActionEvent's source into a JComboBox!
    What if it was a JButton that fired the event? Then you would get ClassCastExceptions (I'm sure you did)
    So check for all options, what the source of the ActionEvent actually was...
    2) You can't assume the user will always type in valid data.
    So enclose the Integer and Double parse methods in try-catch brakcets.
    Then you can do something when you know that the user has entered invalid input
    (like tell him/her what a clumsy idiot they are !)
    3) As soon as user presses an item in any JComboBox, just re-calculate.
    I did this here by programmatically clicking the 'Calculate' button.
    Alternatively, you could have a 'calculate' method, which does everything inside the
    if(command==calculateButton) if-block.
    This will be called when:
    a)calculateButton is pressed
    b)when either of the JComboBoxes are pressed.
    public void actionPerformed (ActionEvent event)
            Object command = event.getSource ();
            if (command == calculateButton) //calculates mortgage payment
                int year = 0;
                double rate = 0;
                double mortgage = 0;
                double interest = 0;
                /* If user has input invalid data, tell him so
                and return (Exit from this method back to where we were before */
                try
                    year = Integer.parseInt (mortgageTerm.getSelectedItem ().toString ());
                    rate = new Double (interestRate.getSelectedItem ().toString ()).doubleValue ();
                    mortgage = new Double (mortgageAmount.getText ()).doubleValue ();
                    interest = rate / 100.0 / 12.0;
                catch (NumberFormatException nfe)
                    /* Display a message Dialogue box with a message */
                    JOptionPane.showMessageDialog (this, "Error! Invalid input!");
                    return;
                double monthly = mortgage * (interest / (1 - Math.pow (interest + 1, -12.0 * year)));
                NumberFormat myCurrencyFormatter;
                myCurrencyFormatter = NumberFormat.getCurrencyInstance (Locale.US);
                monthlyPayment.setText (myCurrencyFormatter.format (monthly));
            else if (command == clearButton) //clears all text fields
                /* Better than setting it to null (I think) */
                mortgageAmount.setText ("");
                //mortgageTerm.setText(null);
                //interestRate.setText(null);
                monthlyPayment.setText ("");
            else if (command == exitButton) //sets exit button
                System.exit (0);
            else if (command == mortgageTerm)
                /* Programmatically 'clicks' the button,
                As is user had clicked it */
                calculateButton.doClick ();
            else if (command == interestRate)
                calculateButton.doClick ();
            //JComboBox mortgageTerm = (JComboBox) event.getSource ();
            //String termYear = (String) mortgageTerm.getSelectedItem ();
        }Hope this solves your problems.
    I also hope you'll be able to learn from what I've indicated, so you can use similar things yourself
    in future!
    Regards,
    lutha

Maybe you are looking for

  • Looking for a replacement for iTool

    I have been using iTool with 10.5.x to run daily, weekly and monthly scripts, as well as cache cleanup, permissions repair, disc verify and repair, etc. I also was using Applejack. I recently upgraded to 10.6 (updated to 10.6.2 now) and upon opening

  • Attaching files on SD card on phone memory in emai...

    I need urgent help on how to attach document in emails or web forms with Lumia 520. Each time I try attaching document by pressing the browse button on web forms, nothing happens and when I press the attach button on email clients, in only takes me t

  • ERROR report when backing up of ipad

    I get repeated error reports when backing ipad only when trying to update to ios 5. when I back up without update option it works fine i have version 4.3.1 and want to update it.help!

  • Missing Itunes Help Files?

    When I search for subjects within Itunes Help nothing shows up (just a blank dialog box with Help headers at the top). When I select Itunes & Itunes Store Help from the Help menu I used to get a Help guide as the first dialog window telling me partic

  • V_V2 ignores batch search strategies

    Hi SD Experts, We use V_V2 as a nightly rescheduling run. Unfortunately the batch search strategies, which for example restrict the allowed batch splits, are totally ignored. This causes issues on the delivery creation side. Is there a way to enable