How to listen to user actions in child class from parent class?

Hi,
I have a basic custom class ChildCustomForm that include a JTextField. In order to know what user types, I add a listener to
this textbox:
textField.addKeyListener( new KeyAdapter()
            @Override
            public void keyPressed( final KeyEvent e )
                //user typed something
                userTyped = true;
         });Now I have another parent class that uses ChildCustomForm, and parent class has to know once user types, then set
its own userTyped flag.
My problem is: since I added listener in child class, I cannot get textfield and add listener again in parent class, so parent class will not be able to know as soon as user types (polling is not a good solution here).
I am wondering if there is a way to do this?
regards,

jack_wns wrote:
I have a basic custom class ChildCustomForm that include a JTextField. In order to know what user types, I add a listener to
this textbox:You want to listen for input into the textbox, correct? This may take the form of keyboard input, or could be a paste-text event in which case your keylistener will miss it. I recommend that you look into a DocumentListener here so you will catch any changes, be they keyboard or cut or paste.
My problem is: since I added listener in child class, I cannot get textfield and add listener again in parent class, so parent class will not be able to know as soon as user types (polling is not a good solution here).The observer pattern may work here.

Similar Messages

  • Problems accessing child swf from parent class

    First off: Hi. I'm new - to the forum and to Flash.
    I'm currently writing a flash app that requests a XML feed
    from a Java controller and loads child swfs into various parts of
    the stage based on the settings/URL details received from the XML
    feed.
    Its nearly there and I've got my head round a couple of weird
    things, but theres one thing left that I've found impossible to
    solve. Once the loader class has loaded the swf, it can't access
    its methods or set its variables and the child can't access the
    parent either (or access the parent's variables full stop). From
    what I've read this should be possible. Heres some of my code plus
    pseudo code:
    Note the Panel class is not linked to a symbol and uses
    composition to act like a movie clip, rather than inheritance.
    quote:
    class Panel{
    function Panel(owner:MovieClip, insName:String,
    depth:Number){
    initiates properties etc....
    panelMovie = owner.createEmptyMovieClip(insName,depth);
    listener.onLoadComplete = mx.utils.Delegate.create(this,
    scheduleModule);
    loader.addListener(listener);
    loader.loadClip(moduleX.url, panelMovie);
    function scheduleModule(){
    trace(panelMovie.key);
    trace(panelMove.keyTest());
    panelMovie.key = "dave";
    trace(panelMovie.key);
    Child swf:
    quote:
    var key:String = "test";
    As you can see I create an empty movieclip which I store a
    reference to in this class under the field "panelMovie". I then use
    this (instead of target_mc like you might do with an event handler)
    to try to access the child swf. The output is:
    trace(panelMovie.key); = "test" (Works fine)
    trace(panelMove.keyTest()); = (Nothing returned)
    panelMovie.key = "dave";
    trace(panelMovie.key); = "test" (Previous line = no effect)
    Is this something related to using a class? Really would be
    preferentially to keep all code outside of the fla.
    I've also tried a lot of different combinations of _root,
    _parent and _levelx. None of which I truly understand.
    Any help would be much appreciated! Plus any good tutorial
    links on timeline and referring to objects in it!
    (Couldn't find the code tag/button...)

    >>trace(panelMove.keyTest()); = (Nothing returned)
    You have panelMove here instead of panelMovie
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Calling a function in child window from parent window

    Hi,
    How can I call a method in child window from parent window in adobe air using javascript. In the following example I need to call mytest() function in
    child.html from parent.html file.
    Thanks,
    ASM
    //parent.html
    <HTML><HEAD>
    <script>
    var initOptions = new air.NativeWindowInitOptions();
    initOptions.type = air.NativeWindowType.NORMAL;
    initOptions.systemChrome = air.NativeWindowSystemChrome.STANDARD;
    var bounds = new air.Rectangle(300, 300, 600, 500);
    var html2 = air.HTMLLoader.createRootWindow(false, initOptions, false, bounds);
    var urlReq2 = new air.URLRequest("child.html");
    html2.load(urlReq2);
    html2.stage.nativeWindow.activate();
    html2.window.mytest();       //NOT WORKING
    </script>
    </HEAD><body></body></HTML> 
    // child.html
    <HTML><HEAD>
    <script>
    function mytest()
      air.trace("in child window");
    </script>
    </HEAD> <body></body></HTML>

    I suspect your problem is that the child window hasn't been created by the time you call the function in the parent.Loading the content is an asynchronous processes -- AIR doesn't stop executing your code until the window has finished loading child.html. So, you will need to add an eventlistener to html2 and call the function from there:
    html2.addEventListener( "complete", onChildLoaded );
    function onChildLoaded( event )
         html2.window.mytest();

  • How to access objects in the Child Form from Parent form.

    I have a requirement in which I have to first open a Child Form from a Parent Form. Then I want to access objects in the Child Form from Parent form. For example, I want to insert a record into a block present in Child Form by executing statements from a trigger present in Parent Form.
    I cannot use object groups since I cannot write code into Child Form to first create object groups into Child Form.
    I have tried to achieved it using the following (working of my testcase) :
    1) Created two new Forms TESTFORM1.fmb (parent) and TESTFORM2.fmb (child).
    2) Created a block named BLK1 manually in TESTFORM1.
    3) Created two items in BLK1:
    1.PJC1 which is a text item.
    2.OPEN which is a push button.
    4) Created a new block using data block wizard for a table EMPLOYEE_S1. Created items corresponding to all columns present in EMPLOYEE_S1 table.
    5) In WHEN-NEW-FORM-INSTANCE trigger of TESTFORM1 set the first navigation block to BLK1. In BLK1 first navigable item is PJC1.
    6) In WHEN-NEW-ITEM-INSTANCE of PJC1, code has been written to automatically execute the WHEN-BUTTON-PRESSED trigger for the "Open" button.
    7) In WHEN-BUTTON-PRESSED trigger of OPEN item, TESTFORM2 is opened using the following statement :
    open_form(‘TESTFORM2',no_activate,no_session,SHARE_LIBRARY_DATA);
    Since its NO_ACTIVATE, the code flows without giving handle to TESTFORM2.
    8) After invoking OPEN_FORM, a GO_FORM(‘TESTFORM2’) is now called to set the focus to TESTFORM2
    PROBLEM AT HAND
    ===============
    After Step 8, I notice that it passes the focus to TESTFORM2, and statements after go_form (in Parent Form trigger) doesnot executes.
    I need go_form with no_activate, similar to open_form.
    Edited by: harishgupt on Oct 12, 2008 11:32 PM

    isn't it easier to find a solution without a second form? If you have a second window, then you can navigate and code whatever you want.
    If you must use a second form, then you can handle this with WHEN-WINDOW-ACTIVATED and meta-data, which you have to store in global variables... ( I can give you hints if the one-form-solution is no option for you )

  • How to create child part from Parent Item - BLOW UP Master - Automatically

    Hi to All,
    Have any one defined this process?
    To create child part from Parent Item - BLOW UP Master - Automatically ie. we receive FG from customer which we need to blow up to its child part. In that case, FG should be consumed & child parts should be generated in stock.
    We tried with recursive, but the stock of FG was again generating with recursive.
    Ex. FG after receiving from customer in stock 1
    Child parts (with offtake 1) X1, X2, X3 in stock zero.
    After processing, FG stock should be zero & X1, X2, X3 = 1.
    Regards
    Nitin

    Create a BOM for one of the "child" parts that has the "FG from customer" as a component and all the other child parts are negative quantity components (by products).
    To make it simple have all the components backflushed and auto goods receipt the child in the BOM header.  Create a production order, then process the confirmation (this will auto goods receipt the 1st child, consume by backflush the "FG from customer" and put the other child parts into stock as by products.
    You will need to get your material prices correct first so that there is minimal variance in the production order.

  • How to find Class's parent Classes

    Hi guys
    Does anybody know how can I find the Class's parent Classes. Thanks in advance.
    Regards,
    Mark.

    Hey Mark,
    From the child class, call getClass().getSuperClass() This will return the Class object of the parent of this class.
    -- Bud

  • How Do I Run A Class From Another Class?

    Hiya everyone, id like to know how to run a class from another class.
    Ive got a Login class which extends a JFrame and a Personnel class which also extends a JFrame. When i press the login button (in Login class), ive got it to decide if password/login are acceptable and if they are, I want the Login class to close then run the Personnel class.
    Im just after the code which says to close this class and run the Personnel class. How do i do that?
    Ive researched this but couldnt get an understandable answer!
    Help would be much appreciated, Ant...

    This is the Login Class:
    public class MainMenu extends javax.swing.JFrame {
        Statement statement = null;
        int currentRecord;
        ResultSet rs = null;
        String name = null, job = null, mission = null, login = null, password = null;
        String loginVal;
        String passwordVal;
        /** Creates new form MainMenu */
        public MainMenu() {
            initComponents();
            try{
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                String filename = System.getProperty("user.dir") + "/src/Personnel.mdb";
                String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + filename;
                Connection conn = DriverManager.getConnection( database , "","");
                statement = conn.createStatement();
                System.out.println("Connected...ok");
            } catch (Exception e) {
                System.err.println("Got a connection Problem!");
                System.err.println(e.getMessage());
        private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {                                        
            loginVal = txtLogin.getText();
            passwordVal = txtPassword.getText();
            String name = null, job = null, mission = null, login = null, password = null;
            try{
                rs = statement.executeQuery("SELECT Login,Password FROM Personnel WHERE Login = '" + loginVal + "' ");
                System.out.println("TRYING SELECT CLAUSE");
                if(rs.next()){
                    System.out.println("THERE IS A NEXT RECORD");
                    login = rs.getString(1);
                    password = rs.getString(2);
                    System.out.println("GOT THE NEXT RECORD");
                    System.out.println(login + password);
                System.out.println("Query Complete");
            }catch(Exception s){
                //s.printStackTrace();
                System.out.println("NO RECORDS EXIST FOR THIS LOGIN ID");
            if(passwordVal.equals(password)){
                System.out.println("Access Granted"); //CLOSE MAIN AND RUN CONTROL CLASS
            } else{
                System.out.println("Access Denied"); //RE-RUN CLASS
        }                 

  • Spawning child program from parent concurrent program.

    Hi All,
    I am trying to spawn multiple child programs from Parent concurrent program, Parent concurrent program is having execution method as HOST.
    Here is how I designed it.
    1. Parent Concurrent program (Parent Conc program with execution method as HOST).
    2. Host file is abc.prog calls PLSQL package xyz.main.
    3. xyz.main has logic to launch multiple child programs - (Child Conc program with execution method as PLSQL stored proc) using fnd_request.submit_request utility.
    All the child programs are getting launched but are in INACTIVE/NOMANAGER state. Could you please let me know how to overcome this issue.
    Both Parent and child programs are added to standard concurrent manager. This issue is only coming when parent program as execution method as HOST if parent program execution method is PLSQL stored procedure then child programs are running fine..
    I also tired initializing apps in HOST file (abc.prog) before calling PLSQL package xyz.main.
    Thanks.
    Sham.

    hi,
    even i was facing the same issue. while submitting the child requests through fnd_request.submit_request i tried the following:
    FND_REQUEST.submit_request (
    application => 'Application Short Name',
    program => 'Program Executable Name',
    description => 'Program Description',
    start_time => NULL,
    sub_request => FALSE,
    argument1 => 'Input 1',
    argument2 => 'Input 2' );
    After this the Programs were submitted successfully.

  • How can I casting from parent class to children class

    Dear,
    Could someone help me to casting from parent class to children class.
    I have class like this
    class parent{
    String name;
    String id;
    public String getId() {
    return id;
    public void setId(String id) {
    this.id = id;
    public String getName() {
    return name;
    public void setName(String name) {
    this.name = name;
    class children extends parent{
    String address;
    public String getAddress() {
    return address;
    public void setAddress(String address) {
    this.address = address;
    public children() {
    public children(parent p) {
    //Do init super class here
    In the constructor
    public children(parent p) {
    //Do init super class here
    I like to init super class by object p (this is instance of parent class). The way to do is using:
    public children(parent p) {
    super.setId(p.getId());
    super.setName(p.getName());
    But I don't like this, because, for example I have parent class with over 30 proberties, it take time to do like that.
    There are any way to use super operation to init parent class, for example super = p;
    Could you show me the way.
    Thanks alot

    If I understand your question correctly, you are in need of a copy constructor for you class Parent. A copy constructor behaves like this:
       Parent one = new Parent();
       one.setName("...");
       //... and all other properties of interest
       Parent two = new Parent(one);
       //Now two != one, but one.getName().equals(two.getName) for property name and all othersThe copy constructor is programmed in the Parent class, more later. Then for your child class you can use it as follows
       public class Children extends Parent {
           public Children(Parent p) {
              super(p);
       }There are at least 3 ways of programming a copy constructor:
    1. Just bite the bullet: type the assignment for each field this.name = p.getName()
    2. Use reflection to find all common setters/getters dynamically and assign using them
    3. Use a code generator that uses 2 to give you the code for solution 1 for you to paste in.
    If you find doing this a lot, there are frameworks that can do these mappings, like Dozer
    (PS be carefull with Date fields, don't copy the reference but create a new and equals instance, the dirty way would be this.birthdate = new Date(p.getBirthdate.getTime()); )

  • How to find the arguments of a static method from the class file

    Hi,all !
    How to find the arguments of a static method from the class file? for example, when we meet a bytecode "invokestatic", how can I know the arguments of this static method?

    Hi,all !
    How to find the arguments of a static method from the
    class file? for example, when we meet a bytecode
    "invokestatic", how can I know the arguments of this
    static method?You mean
    1. The values?
    2. Argument names?
    3. Argument signatures.
    I would suppose for the last that the easiest way would be to parse the signature string.
    The first is not possible - not from the class file.
    The second is only in the debug information stored in the optional part of the class file. And figuring out the format for that is going to be a problem.

  • How does EF Distinguish Regular Classes from Entity Classes?

    I'm newbie to EF, just read a couple of short articles on it the other day.  When reading them I didn't pick up on what criteria EF has for distinguishing regular classes from EF classes. Suppose for instance I wrote up a class for internal use only
    (but which happened to have the same name as one of my Sql Server tables).  Aside from reading my mind, how would EF know that I never intended this class for entity purposes?

    What are you talking about here? It's back to the namespaces.
    If you are making folders in a VS project, then that's a namespace. You crate a class in that namespace, then it should be decelerated with a namespace attribute specifying what namespace the class is in, and you woud have to use an Imports in VB or a Using
    statement in C# pointing to the namesapce where the class is located in the class that needs to use a class in another namespace. Or you don't use Import or Using and you give the full namespace path to the class in code of namespace.classname.The below DB
    first, only a part of the code in  namespace, the usage was installed into the DAL.Model namespace where I have a project called DAL and within the DAL  project I made a folder, a namespace,  named Model and pointed EF to that folder in doing
    an add of a new Item in VS. And everything about EF is in the DAL.MODEL namespace. You can have Jal2 class in the namespace and Jal2 in some other namespace. Ef could care less about Jal2 in the other not DAL.Model namespace.
    I don't care how you do it. I don't care if you are using EF DB first, Model first, Code first,  any other kind of first or you start making your own classes for data yourself, but you need to understand Namespaces in .NET, what they are for,and how
    to use them effectively in creating  .NET solutions. 
    Comon man, this is .NET 101 you should have figured out long ago.
    https://msdn.microsoft.com/en-us/library/ms973231.aspx#assenamesp_topic5
    using System;
    using System.Data.Objects;
    using System.Data.Objects.DataClasses;
    using System.Data.EntityClient;
    using System.ComponentModel;
    using System.Xml.Serialization;
    using System.Runtime.Serialization;
    [assembly: EdmSchemaAttribute()]
    #region EDM Relationship Metadata
    [assembly: EdmRelationshipAttribute("PublishingCompanyModel", "FK_Article_Author", "Author", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(DAL.Model.Author), "Article", System.Data.Metadata.Edm.RelationshipMultiplicity.Many,
    typeof(DAL.Model.Article), true)]
    [assembly: EdmRelationshipAttribute("PublishingCompanyModel", "FK_Payroll_Author", "Author", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(DAL.Model.Author), "Payroll", System.Data.Metadata.Edm.RelationshipMultiplicity.Many,
    typeof(DAL.Model.Payroll), true)]
    #endregion
    namespace DAL.Model
        #region Contexts
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public partial class PublishingCompanyEntities : ObjectContext
            #region Constructors
            /// <summary>
            /// Initializes a new PublishingCompanyEntities object using the connection string found in the 'PublishingCompanyEntities' section of the application configuration file.
            /// </summary>
            public PublishingCompanyEntities() : base("name=PublishingCompanyEntities", "PublishingCompanyEntities")
                this.ContextOptions.LazyLoadingEnabled = true;
                OnContextCreated();

  • How to listen to the action in the action performed inside

    I have a code in actionperformed inside that add the listener, how the listener work or listen?
    public void actionPerformed(ActionEvent e){
           JMenuItem item = (JMenuItem)e.getSource();
            String ac = item.getActionCommand();
            if (ac.equals("Reset User Login Status"))
                         p1.removeAll();
                         p1.add(label1);
                      p1.add(menuBar);
                    display dis = new display();
                      table=dis.display();
                         table.setBounds(new Rectangle(10, 50, x-120, y-160));
                         table.getTableHeader().setBounds(new Rectangle(10, 30, x-20,20));
                         table.getModel().addTableModelListener(this);
                         btn_update = new JButton("Update");
                         btn_update.setBounds(new Rectangle(x-110, y-100, 90, 40));
                         //*****This below the listener, how it work???
                         btn_update.addActionListener( this );  
                         p1.add(btn_update); 
                         p1.add(table);
                         p1.add(table.getTableHeader());
                         p1.repaint();
                         p1.revalidate();
                         dis.close();
                    }

    To be simple i have attached the full code and try to higlighted the part with comment:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    import javax.swing.table.*;
    import java.text.ParseException;
    import java.io.*;
    import javax.swing.AbstractButton;
    import java.util.StringTokenizer;
    import javax.swing.event.*;
    public class gui extends JFrame implements ActionListener,TableModelListener{
    JLabel label1,label2,label3,label4,errlabel;
    JButton btn1,btn2,btn3;
    JTable table;
    JPasswordField passFld;
    JButton btn_update;
    static JFormattedTextField idFld;
    JFormattedTextField custFld;
    JMenuBar menuBar;
    JMenu menu;
    JMenuItem menuItem;
    DefaultTableModel tabModel;
    StringTokenizer tokenizer;
    static String id;
    static String userRole;
    JPanel p1;
    int x;
    int y;
    display d1;
    String [] arg;
    public gui(String args) {
                    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
                    x = (screen.width);
                    y = (screen.height);
                    StringTokenizer tokenizer = new StringTokenizer (args, ";");
                    id = tokenizer.nextToken();
                    userRole = tokenizer.nextToken();
                    System.out.println(userRole+""+id);
                    this.setDefaultLookAndFeelDecorated(true);
                    this.setTitle("FOREX Trading System");
                    this.setSize(new Dimension(x, y));
                    //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    addWindowListener(new WindowAdapter(){
                    public void windowClosing(WindowEvent we){
                    update.main("UPDATE System_user SET LOGIN_STATUS = 0 WHERE USER_ID ='"+id+"'");
                    System.exit(-1);
                    p1 = new JPanel();
                     //Create the menu bar.
                    menuBar = new JMenuBar();
                        menuBar.setBounds(new Rectangle(0, 0, x, 25));
                     //Build the first menu tab.
                     menu = new JMenu("Dealer");
                     menu.setMnemonic(KeyEvent.VK_D);
                     menu.getAccessibleContext().setAccessibleDescription(
                     "For Dealer Acess Only");
                     menuBar.add(menu);
                     //Assign access right
                     if(userRole.equals("Dealer"))
                     menu.setEnabled(true);
                     else
                     menu.setEnabled(false);
                     menuItem= new JMenuItem("Key Deal");
                     menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_K);
                    menu.add(menuItem);
                    menuItem= new JMenuItem("Amend Deal");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_A);
                    menu.add(menuItem);
                    menuItem = new JMenuItem("Cancel Deal");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_C);
                    menu.add(menuItem);
                    menuItem = new JMenuItem("Close Position");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_P);
                    menu.add(menuItem);
                    //Another Menu tab
                    menu = new JMenu("Teller");
                     menu.setMnemonic(KeyEvent.VK_T);
                     menu.getAccessibleContext().setAccessibleDescription(
                     "For Teller Acess Only");
                     menuBar.add(menu);
                     //Assign access right
                     if(userRole.equals("Teller"))
                     menu.setEnabled(true);
                     else
                     menu.setEnabled(false);
                     menuItem = new JMenuItem("Settle Deal");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_S);
                    menu.add(menuItem);
                    menuItem = new JMenuItem("Create Customer Profile");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_C);
                    menu.add(menuItem);
                    menuItem = new JMenuItem("Close Position");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_P);
                    menu.add(menuItem);
                    menuItem = new JMenuItem("Daily Balance");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_D);
                    menu.add(menuItem);
                     //Another Menu tab
                    menu = new JMenu("Settlement");
                     menu.setMnemonic(KeyEvent.VK_S);
                     menu.getAccessibleContext().setAccessibleDescription(
                     "For Settlement Acess Only");
                     menuBar.add(menu);
                     //Assign access right
                     if(userRole.equals("Settlement"))
                     menu.setEnabled(true);
                     else
                     menu.setEnabled(false);
                     menuItem = new JMenuItem("GL Audit Trail");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_G);
                    menu.add(menuItem);
                    menuItem = new JMenuItem("Generate Payment Report");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_P);
                    menu.add(menuItem);
                    menuItem= new JMenuItem("Create/Edit Payment mode ");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_C);
                    menu.add(menuItem);
                    //Another Menu tab
                    menu = new JMenu("View");
                     menu.setMnemonic(KeyEvent.VK_V);
                     menu.getAccessibleContext().setAccessibleDescription(
                     "For View Only");
                     menuBar.add(menu);
                      //Assign access right
                     if(userRole.equals("Dealer")||userRole.equals("Teller"))
                     menu.setEnabled(true);
                     else
                     menu.setEnabled(false);
                     menuItem = new JMenuItem("Customer Profile");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_C);
                    menu.add(menuItem);
                    menuItem= new JMenuItem("Contrated Deal");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_D);
                    menu.add(menuItem);
                    //Another Menu tab
                    menu = new JMenu("Administrator");
                     menu.setMnemonic(KeyEvent.VK_A);
                     menu.getAccessibleContext().setAccessibleDescription(
                     "For Teller Acess Only");
                     menuBar.add(menu);
                       //Assign access right
                     if(userRole.equals("Administrator"))
                     menu.setEnabled(true);
                     else
                     menu.setEnabled(false);
                     menuItem= new JMenuItem("Set Currency & Rate");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_S);
                    menu.add(menuItem);
                     menuItem= new JMenuItem("Create/Remove User");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_C);
                    menu.add(menuItem);
                    menuItem= new JMenuItem("View Login Status");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_V);
                    menu.add(menuItem);
                    menuItem = new JMenuItem("Reset User Login Status");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_U);
                    menu.add(menuItem);
                    menuItem= new JMenuItem("Reset Daily Report");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_R);
                    menu.add(menuItem);
                    //Another Menu tab
                    menu = new JMenu("Logout");
                     menu.setMnemonic(KeyEvent.VK_O);
                     menu.getAccessibleContext().setAccessibleDescription(
                     "For Logout");
                     menuItem= new JMenuItem("Exit");
                    menuItem.addActionListener( this );
                    menuItem.setMnemonic(KeyEvent.VK_X);
                    menu.add(menuItem);
                     menuBar.add(menu);
                     label1= new TimeLabel()     ;
                     label1.setBounds(new Rectangle(x-80, 0, 80, 30));
                     p1.setLayout(null);
                     p1.add(label1);
                     p1.add(menuBar);
                     getContentPane().add(p1);
        public void actionPerformed(ActionEvent e){
             JMenuItem item = (JMenuItem)e.getSource();
            String ac = item.getActionCommand();
                   //---Below this btn_update is not working            
                    if (e.getSource()==btn_update)
                    System.out.println("A");
           if(ac.equals("Key Deal"))
                     label2 = new JLabel("Customer Name:");
                     label2.setBounds(new Rectangle(40, 40, 200, 30));
                     try{
                     MaskFormatter mf1 = new MaskFormatter("????");
                     custFld= new JFormattedTextField(mf1);
                     custFld.setBounds(new Rectangle(250, 40, 140, 30)); 
                    catch(java.text.ParseException exc)
                     //Error message
                     p1.add(label2);
                     p1.add(custFld);
                     p1.repaint(); 
             if (ac.equals("View Login Status"))
                         p1.removeAll();
                         p1.add(label1);
                      p1.add(menuBar);
                    display dis = new display();
                      table=dis.display();
                         table.setBounds(new Rectangle(10, 50, x-120, y-160));
                         table.getTableHeader().setBounds(new Rectangle(10, 30, x-20,20));
                         table.setEnabled(false);
                         table.setRowSelectionAllowed(false);
                         table.setColumnSelectionAllowed(false);
                         p1.add(table);
                         p1.add(table.getTableHeader());
                         p1.repaint();
                         p1.doLayout();
                         dis.close();
                 if (ac.equals("Reset User Login Status"))
                         p1.removeAll();
                         p1.add(label1);
                      p1.add(menuBar);
                    display dis = new display();
                 table=dis.display();
                         table.setBounds(new Rectangle(10, 50, x-120, y-160));
                         table.getTableHeader().setBounds(new Rectangle(10, 30, x-20,20));
                         table.getModel().addTableModelListener(this);
                         btn_update = new JButton("Update");
                         btn_update.setBounds(new Rectangle(x-110, y-100, 90, 40));
                         //--this the button created
                         btn_update.addActionListener( this );  
                         p1.add(btn_update); 
                         p1.add(table);
                         p1.add(table.getTableHeader());
                         p1.repaint();
                         p1.revalidate();
                         dis.close();
            if (ac.equals("Exit"))
               {    update.main("UPDATE System_user SET LOGIN_STATUS = 0 WHERE USER_ID ='"+id+"'");
                    System.exit(-1);
        public void tableChanged( TableModelEvent ev){
        System.out.println("Changed");
       }

  • How to track child instances in parent class

    I have a **simple** design question about a good way to implement LV OO.
    I have a parent class (multiple instances) with a single child class. The parent class needs to keep track of all "active" instances of the child class because some parent methods must be applied to all children. Is there a way for this to happen automatically in LV? I'm not aware of any, so I assume I will have to use some "register" and "unregister" actions for creation and destruction of child class instances. But how do I track them; where do I store the list?
    It would be easiest to simply add an array of child class references to the private class data of the parent. However, LV seems to not support this due to "circular referencing". I am not familiar enough with OO, nor it's implementation in LV to know what is a good design approach to accomplish this task.
    Any suggestions?

    What I am trying to do:
    I have one or more TCP connections that I am using. The parent class is the TCP connection. The private data for the class is a queue reference. The queue data type is a type def cluster of relevant parameters. The queue has a maximum of 1 element. The reason for this abstraction is that our applications use many TCP connections "simultaneously." As such, we want almost all of the TCP support VIs to be reentrant. This means that we need semaphore action when connection parameters are changed, and we use the queue to achieve this.
    The TCP standard guarantees that each message is delivered intact, but does not guarantee message order. Sending large waveforms (or data from a continuously measuring process) requires additional work to ensure that the messages are correctly reordered on the receive end. We created an Ordered Data Stream (ODS) construct to accomplish this. That is the child class. Each TCP connection has 0 or more ODS. Each ODS inherits all the TCP settings from the parent, and can use the parent communication functions. It seems this is a textbook example of the usefulness of inheritance.
    However, all good parents are able to keep track of their children. The TCP class needs to be able to track all active ODS instances on that TCP connection. We are struggling with the best method to use for the TCP class to keep track of all ODSs. Adding an array of ODS class instances to the TCP "private data" does not work, due to circular referencing between parent and child classes.
    In response to trying a grandparent class:
    We tried using a grandparent class. We added an array of grandparent classes, from which the TCP class inherited. The array is actually ODS instances that have been (2X) upcast from ODS to grandparent (more general class) to be stored in the TCP class data. We found that adding the array of grandparent classes to the TCP class created a VI that could not compile when we attempted to place the type def cluster ("class data") on the block diagram of a VI in the TCP class.

  • How to get actual user name without admin rights from AD?

    Hi,
    I have set up WebLogic Portal 8.1.2 to point to Active Directory, using ActiveDirectoryAuthenticatorMBean I'm trying to retrieve the actual user name e.g. John English. Can someone give me some advise what is the proper function to use. I tried getUserDescription but it requires AD admin rights. I can't get admin rights! Is there any workarounds?
    Thank you very much.
    Regards,
    Damon

    You might use GLOBAL_NAME, but the result could be not what you need. If you can login to DB server you can use "lsnrctl services" to see how the DB is registered with the listener. See this example :
    SQL> sho user
    USER is "TEST"
    SQL> select * from v$instance;
    select * from v$instance
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> col GLOBAL_NAME for a60
    SQL> select * from global_name;
    GLOBAL_NAME
    ORA9.US.ORACLE.COM
    SQL> exit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.4.0 - Production
    $ lsnrctl services
    LSNRCTL for Linux: Version 9.2.0.4.0 - Production on 25-FEB-2008 18:21:10
    Copyright (c) 1991, 2002, Oracle Corporation.  All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
    Services Summary...
    Service "foo" has 1 instance(s).
      Instance "ora9", status READY, has 1 handler(s) for this service...
        Handler(s):
          "DEDICATED" established:1 refused:0 state:ready
             LOCAL SERVER
    The command completed successfully
    $in this case "foo" is what you'd need.
    Of course you can always grant SELECT ANY DICTIONARY privilege to that user....

  • How to get initial value of Child View from Parent View in ADF?

    Hi,
    I am typically from a Oracle forms background and new to ADF.
    In ADF,how can I populate the initial value for a new record in child view from the parent view?
    For example.. using standard Departments and Employees tables which has parent child relation ship.
    If I want to create a new employee.. how do I get the initial value for department_id of my employee record(employee table) from departments table in ADF?
    Thanks in advance
    Vishnu

    USer, please tell us your jdev version!
    If  you have setup the data model in a way that it reflects this relationship (should be automatic if you use the 'create business components from table' wizard) this is pretty easy.
    To check this, open the application module and select the data model. On the right side you see departments view and under it indented the employees view. This indent shows you that the employees view is a child of the departments view. This is all you nee for the model layer.
    In the UI you open the datacontrol and open the departments view. One node it the employees view (as child). Now, if you work on a department (e.g. you drag the department view onto a page and drop it as form), you can add a button to create a new child (employee) by opening the employee node in department and drag the createInsert operation onto the page and drop it as button.
    Then create a new page and drop the employees view (the child from departments view) on to the page and drop it as form. This form will then display the new row for thew employee of hte department.
    Last thing to do is to add anavigation case from the departments page to the employees page and select this on the CreateInsert button.
    The form should have the DepartmentId pre-selected.
    Timo

Maybe you are looking for

  • Calendar no longer syncing properly after 3.0 update

    Anyone run into this problem? Any solutions? After the 3.0 update, any events that I've entered into the iPhone's calendar are not showing up in iCal. As well as that, all of my iCal events have been duplicated on the iPhone... I use Mobileme, but ha

  • How to install classic in a PowerBook G4 without erasing OS 10.4.8

    Please help....I just replaced my PowerBook G4 with a new MacBook and would like to pass the G4 down to my daughter. Most of the games that she uses are in classic from her old Imac. My G4 came with classic but I had to reinstall OSX a while ago and

  • Web ADI - Creating FSG's

    Hi, My client is looking at installing Web ADI. They currently use the Define Report functionality in client ADI to upload FSG reports and would like to use this functionality in Web ADI. They are on e-business suite version 11.5.10 ru2. Is this func

  • FBL3N standard program to ZCOPY program issue

    When I take a ZCOPY of standard program ‘RFITEMGL’ of transaction code FBL3N and put break point over Function Module “FI_ITEMS_DISPLAY’ and look into the table it_pos the material number and vendor numbers are not getting populated but without takin

  • Regarding shared file system requirement in endeca server cluster

    Hi, Our solution involves running a single data domain in an endeca server cluster. As per the documentation, endeca server cluster requires shared file system for keeping index file for follower node to read. My questions are, Can I run the endeca c