Activex enums and disabled methods

I am relatively new to using Labview for accessing COM objects. I am trying to use Labview to access an SDK library for controlling a USB ultrasound machine. I am having a couple of problems that I am not sure if I can get around and would appreciate any help.
Firstly, I am having accessing tagged enums which are inputs to methods. This works for some inputs, where the enums are sequential (SCAN_STATE_STOP = 0, SCAN_STATE_ACQUIRE = 1, SCAN_STATE_FREEZE = 2,SCAN_STATE_RUN = 3). When I right click on the input and right click, the appropriate enum list shows. But this does not work for others that are not sequential (e.g. SCAN_MODE_UNKNOWN = 0,SCAN_MODE_B = 1,SCAN_MODE_M = 2,SCAN_MODE_PW = 4,SCAN_MODE_BPW = 7 etc). Is there a way of being able to access these? By just defining the integer value, I seem to be getting errors in some methods (but not all). 
I am also having a problem in that one of the methods of the a specfic class is greyed out and disabled (GetControlObj). The input for this method is 'System.Guid@ riidCtrl', System.UInt32 ScanMode and System.UInt32 streamId. I suspect that the problem is that Labview cannot interfacece GUID object that needs to be input. Is this correct? Is there any way around this?
Regards,
Glen 

Litch09 wrote:
I am sorry if my lingo is not up to speed, I have no formal programming training!
Neither have I, and that's never stopped me... (My "formal training" is as an electrical engineer! )
What you are seeing is behavior by design. Whether or not it's correct is debatable. LabVIEW enums are always consecutive. If you want to use a dropdown that has a text label with non-consecutive values then you can make a ring constant. Unfortunately, you have to do this manually. Basically, you're wanting to create a "sparse enum".If you do search for "spase enum" you'll find some information. A while ago JeanPierre wrote a tool to create an enum typedef and a lookup VI to conver the enum to the sparse value. 

Similar Messages

  • Copy control for dates and disable the input

    Hi All,
    I have the following problem: I'm trying to copy dates in a follow-up order from the source order (which works fine by implementing the CRM_COPY_BADY method DATES) and disable the input of the copied dates in the follow-up order (which doesn't work).
    In the change-parameter CT_INPUT_FIELDS you can specify the fields which have to be copied and furthermore you can control the modifiability of the field in the follow-up order via the parameter CHANGEABLE (e.g. 'A' means field can not be changed). This technique is the same in all methods of the copy BADI.
    Unfortunately it doesn't work for the dates. As I said already, the date is copied but can be changed by the user in the follow-up order.
    Anybody an idea?
    Thanks and best regards, Lutz

    Dear John,
          Actually, I have tried with copy requirement 2.However, it works for copying a different customer with the same sales area as original. Yes, I may need to ask developer to solve my solution. But I would like to keep it to be the last choice. I tried to search "How to copy document between inter-company businees"; but the I still not get what my custome's want.  Anyways, thank you very much for sharing idea.

  • On basis of drop down by key values i want to enable and disable ui elements is wda

    How to enable and disable ui elements on basis of drop down by key values as i show in screen shot i have 3 values in drop down by key on basis of those values i need to enable and disable ui elements in webdynpro abap kindly reply back

    Hi Sreedhara,
    There are many tutorials on SCN for learning Web Dynpro ABAP. If the following steps don't make sense to you, please do a search for some tutorials and read through the tutorial materials. Hopefully the tutorials will help you to become familiar with some of the basics of Web Dynpro ABAP.
    Here is how to enable or disable a UI element upon selection from a DropDownByKey.
    In your view context, create a context attribute of type wdy_boolean. For now, let's call this attribute IS_ENABLED
    In your view layout, bind the enabled property of the UI element to the context attribute IS_ENABLED.
    In your view actions, create an action-- let's call it SET_ENABLED-- and bind this action to the DropDownByKey element's onSelect event in the view layout.
    In the event handler method for the SET_ENABLED action, use the Code Wizard to read the value of the DropDownByKey selected value, then use the Code Wizard again to set the value of context attribute IS_ENABLED to either true or false.
    Now when a value is selected from the DropDownByKey, the SET_ENABLED action will be triggered and the IS_ENABLED context attribute will be set to either true or false. Since your UI element's enabled property is bound to this true or false value via the context binding, the UI element will change to enabled or disabled.
    Good luck!
    Cheers,
    Amy

  • Are enums and inner classes allowed in taglib function signatures??

    Hi,
    I have a taglib with the following function definition:
    <function>
            <description>Determine if viewing a patient attribute is allowed</description>
            <name>isViewingPatientAttributeAllowed</name>
            <function-class>com.example.admin.authorization.UserAuthorizer</function-class>
            <function-signature>boolean isViewingPatientAttributeAllowed(com.example.bean.User, com.example.bean.Patient.PatientAttribute, com.example.bean.Patient)</function-signature>
            <example>
                ${ncvi:isViewingPatientAttributeAllowed(user, patientAttribute, patient)}
            </example>
    </function>Where com.example.bean.Patient.PatientAttribute is an enum (note package names have been changed to protect the innocent;-). When I try to compile my web app I get the following error:
    org.apache.jasper.JasperException: The class com.example.bean.Patient.PatientAttribute specified in the method signature in TLD for the function ncvi:isViewingPatientAttributeAllowed cannot be found. com.example.bean.Patient.PatientAttributeIf I change PatientAttribute to a static inner class of Patient, I still get the error. Are enums and inner classes allowed in function signatures?
    Thx.

    I think that you'll find it easier to define a non-inner abstract class RefBase, that exposes a removeFromQueue() method, then extend that for your Ref class. That way, the queue just deals with RefBase instances (or ? extends RefBase).
    I think that any other approach is going to get the compiler confused, because the compile-time Ref depends on the parameterization of its defining class.

  • Buttons enabling and disabling

    Hello,
    I'm developing a web based project based on JSP 1.2, MySQL and TOMCAT with Java2 SDK these
    days. So,now I had a question reguarding user authentication.I want to do this. I have a login form to log into the system by providing his username and password.If (username & password)=correct then,the system must display the main form.This part is correct.It's working now.But, there are many people who can access this system.Each user has limited permissions. In my mainform, there are buttons to goto the next page. As an eg:there are 4 buttons in the mainform,called
    1.Interview
    2.Mark sheet
    3.System Admin.
    4.Change password
    In this system there are 4 users, who's roles are
    System Administrator(Level 1):System Admin.,Change password
    Administration manager(Level 2):Interview,Change password
    General Manager (Level 3): Mark sheet,Change password
    Eployees(Level 4):Change password
    Only the user who has the permission can click the button and go to that related page.
    (Eg:Only Administration manager can goto the Interview page.) In my UserPassword
    table,there are 4 fields called,(empNo,userName,password,level)
    I don't know how to do this using java.
    Here is my user logon code which I use to check the username and password.This is working.
    <form name="Login" method="POST" action="ProcessLogin.jsp">
         <input type="text" name="username" size="20" style="border: 1px solid      
    #0000FF"></td>
            <input type="password" name="password" size="20" style="border: 1px solid      
    #0000FF"></td>
            <input type="submit" value="LOGIN" name="login" style="border:1px solid #0000FF;      
    font-weight: bold"></b></td>
    </form>.....................................................................................
    ProcessLogin.jsp
    <%@ page language="java" %>
    <%@ page import="com.UserAccManager" %>
    <%@ page session="true" %>
    <jsp:useBean id="useraccount" class="com.UserAccManager"/>
    <jsp:setProperty name="useraccount" property="*"/>
    <%
    String status = useraccount.verify();
    String nextPage = "MainForm.jsp";
    if(status.equals("InvalidU")) nextPage ="InvalidUserName.jsp";
    if(status.equals("InvalidP")) nextPage ="InvalidPassword.jsp";
    if(status.equals("main")) nextPage ="MainForm.jsp";
    %>
    <jsp:forward page="<%=nextPage%>"/>....................................................................................
    Here is my JavaBean "UserAccManager.java"
    package com;
    // some codes.
    public class UserAccManager
         private int empno;
         private String username;
         private String password;
         private int level;
         // Constructor
         public UserAccManager()
         this.empno = empno;
         this.username = username;
            this.password = password;
         this.level = level;
         //Sets the empno.
            public void setEmpno(int empno)
                    this.empno = empno;
         //Gets empno.
         public int getEmpno()
              return empno;
         //Sets the user name.
            public void setUsername(String username)
                    this.username = username;
           //Sets the password.
            public void setPassword(String password)
                    this.password = password;
         //Gets user name.
         public String getUsername()
              return username;
         //Gets password
         public String getPassword()
              return password;
         //Sets the level
            public void setLevel(int level)
                    this.level = level;
         //Gets level
         public int getLevel()
              return level;
          // Initializes the connection and statements
            public void initConnection() {
               if (connection == null) {
             try {
                     String sql;
                     // Open the database
                     Class.forName(DRIVER).newInstance();
                     connection = DriverManager.getConnection(URL);
                     //Login verification     
                  sql="SELECT UserName,password,level FROM UserPassword where                
              UserName= ?;";          
              pstmt3 = connection.prepareStatement(sql);
             catch (Exception ex) {
                System.err.println(ex.getMessage());
       // Closes the connection and statements
       // Method to be called by main class when finished with DB
       public  void closeConnection() {
          try {
          pstmt3.close();
             pstmt2.close();
             pstmt1.close();
             connection.close();
          catch (Exception ex) {
             System.err.println(ex.getMessage());
         public String verify(){
              String usr="xxxx";
              String pass="ffff";     
              try{
                   initConnection();
                   pstmt3.setString(1,username);
                   ResultSet rs3=pstmt3.executeQuery();
                           while(rs3.next()){
                        usr=rs3.getString("UserName");
                        pass = rs3.getString("password");
                    rs3.close();
                catch (Exception ex) {
                       System.err.println(ex.getMessage());
                   if(!usr.equals(username))
                        return "InvalidU";
                   } else if(!pass.equals(password)){
                        return "InvalidP";
                        }else{
                             return "main";
    }Please help to solve this trouble. How to do this using normal java programming and/or JSP.
    Thanks.

    These are HTML buttons you are asking about, right? And your JSP will be generating HTML that includes these buttons that may or may not be disabled, right?
    Your first step is to find out how to disable a button in HTML. Personally I wouldn't do that, I would only generate buttons that actually do something. Anyway I don't even think you can disable an HTML button. To do it that way, you'd just have an if-statement that generated the button only if it applied to the class of user. Here's your JSP design process:
    1. Decide what HTML you want to have.
    2. Write JSP code to produce that HTML.

  • RE: ActiveX control and Active Server Pages?

    Martin, if it works in standalone VB program but not in an .asp page
    through VBScript, I guess the reason may be the type mismatch on the
    parameters of the ActiveX automation methods. VBScript is a subset of VB
    and only supports the OLE data type VARIANT for calling the OLE
    interface. The Conductor ActiveX control probably requires the actual
    data types, such as long, BSTR, and so on, to be used on the parameters.
    As a result, VBScript cannot call the methods on the control. One
    workaround you can try is to create your own ActiveX control which is
    simply a wrapper for calling the Conductor control. Its parameter types
    use VARIANT and you do the data conversion in your wrapper code. Hope
    this helps.
    Lenny Hon
    Descartes Systems Group
    -----Original Message-----
    From: Martin Peters [SMTP:[email protected]]
    Sent: Monday, July 27, 1998 10:50 AM
    To:
    Subject: ActiveX control and Active Server Pages?
    Hello Forte users,
    Did anyone try to use the ActiveX control that ships with Conductor
    1.0G in an Active Server Page?
    I tried to use the ActiveX control without luck, so a sample would be
    appreciated. The code
    works fine in Visual Basic.
    Below the code:
    <HTML>
    <BODY>
    <%
    Set thisDirectory =
    Server.CreateObject("CONDUCTORCLIENT.WFDirectoryServiceCtl.1")
    Set thisEngine = thisDirectory.WFFindEngine("ceengine", "centrale")
    Set thisUser =
    Server.CreateObject("CONDUCTORCLIENT.WFUserProfileDescCtrl.1")
    thisUser.New
    thisUser.ProfileName = "MiniUP"
    thisUser.userName = "martin"
    ' The following call fails: Invalid procedure call or argument:
    'thisEngine.OpenSession'
    Set thisSession = thisEngine.OpenSession("CREATE", thisUser, "martin",
    0)
    Set thisProcess = thisSession.CreateProcess("MiniPD", Empty)
    thisSession.CloseSession (WFSESSION_TERMINATED)
    %>
    </BODY>
    </HTML>
    Martin Peters
    COMPAQ
    NSIS - AD&I - Application Connect
    email <[email protected]>
    phone: +31 (30) 2834902
    fax: +31 (30) 2834980
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive
    <URL:http://pinehurst.sageit.com/listarchive/>-
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    I don't have 6.1 in front of me now. I came up with a workaround for my application when I encounted this problem. I created an attribute node for the container and the tab control. Whenever the tab control was not on the page with the control, I made the container invisible. This then hid the activeX control.

  • Flash player 10.1 Help ( ActiveX control and Download manager)

    I've been trying for several hours to download the new flash player 10.1. I tried everything in the FAQ and still nothing. I tried un-installing the older version that I had (9.3.3),   and still nothing.Then when the download manager gets to the end of the download, it keeps saying Error: Installation failed but Adobe Air was still able to download so the problem is obviously flash 10.1. Then it tries to finish installing it and when its done it says that it couldn't register ActiveX control and that error 19166 occured. I already enabled ActiveX so I dont know what the problem could be.
    Help would be appreciated and could someone explain what error 19166 is and how to register or install activex
    ps. I had this problem a while back but somehow I was able to download flash version 9.3.3, so even if I can't download 10.1, can someone give me a link to download version 9 instead.
    System information: Windows 7
                                  Internet explorer 8
                                  32-bit
                                  Norton 360

    Thanks for your reply.I've tried/done everything on that page and I'm still having issues. And I've already disabled Norton and windows firewall and still nothing works.

  • Web browser and script activeX controls and HTML data

    Hello,
    I'm trying to use the Microsoft Web Browser (IWebBrowser2) and Script (IScriptControl) activeX controls in Labview to evaluate and execute HTML script.  If I wire the web browser control's document object to the object input of the Script control's AddObject method, I can then evaluate/execute script such as "document.f.btnI.focus();" and such (in this case corresponding to Google's home page).  However, there are other expressions that include the "window" object that are proving much more difficult to work with.  Although I can browse the document object's parentWindow object via the property browser, if I try to access that object programatically, I get the error "Error -2147467262 occurred at No such interface supported".  I'm wondering how to include the window object for scripting.
    I'm writing a content-oriented web crawler.  I've been writing it with pretty low level TCP functions, handling 301/302 "object moved" and "<META HTTP-EQUIV="refresh" CONTENT="0; url=http://millercountyliberal.com/">" redirections manually.  But there are other automatic script-based redirections like:
    <script language="JavaScript" type="text/javascript">
    <!-- window.location="http://www.jrnl.com" -->
    </script>
    that I'm still trying to figure out how to work with.  As you can see, to work with that one manually involves the window object.  The reason that I don't just let the Web Browser object handle the redirections is because that object often throws script errors, downloads embedded graphics and other unnecessary components, can't handle some non-standard redirections, and sometimes annoyingly crashes.  Any help would be appreciated.  A code sample is attached.  The Web Browser control should already exist on your machine if you have Internet Explorer installed.  The script control may need to be registered before it can be used as follows:
    regsvr32 "c:\MyDir\XHTTP.dll"
    Thanks.
    Attachments:
    HTML Script Testing.zip ‏773 KB

    Hi Ted,
    This seems to be a problem with the way you are referencing the ActiveX properties.  I would research a little more on the API for these objects.  See http://msdn.microsoft.com/workshop/browser/webbrow​ser/reference/ifaces/iwebbrowser2/document.asp for an explanation of the IWebBrowser2 Document property.  I am suspicious of where you are typecasting the Document variant into the IHTMLDocument2 object and this is where the error is being thrown.
    A search of this error code on Google shows that this is a generic error from the ActiveX object, and not a LabVIEW error, although it is confusing since LabVIEW uses error codes in this same range.
    Hope this helps!
    Doug M
    Applications Engineer
    National Instruments
    For those unfamiliar with NBC's The Office, my icon is NOT a picture of me

  • Enum and restrictions

    Hi,
    Could anybody tell me what are the underlying reasons of not
    letting clone enums (and what has got in common with special
    handling of serialization I believe ...) ? I know that it would break
    the singleton design pattern, but why is it so important ? What would
    the risk be ? Any examples ?
    Thanks,
    Adrian

    Performance, just performance. Note that enums don't have real value
    semantics and that enums are a close friend of the compiler. If you'd
    be able to clone() an enum, its equals() method would have to support
    value semantics (slowing down the thing) and what would the benefit
    be? Now the compiler can simply take an enum's 'ordinal' value,
    generated by the compiler itself and use that simple int instead (for
    switch statements etc.)
    kind regards,
    Jos

  • My daughter forgot her password and disabled her ipod.  we never took the time to synch it to the computer.  how can we fix it without loosing all her stuff

    my daugheter forgot her password and disabled her ipod.  we never took the time to synch it with our computer.  any way to fix it without loosing all her stuff?

    No.
    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device
    1. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    2. iOS- Forgotten passcode or device disabled after entering wrong passcode
    3. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    4. iOS- Understanding passcodes
    5. What to Do If You've Forgotten Your iPhone's Passcode
    6. How to Recover Forgotten iPhone Restrictions Passcode | The iPhone and iPad
    7. Restoring iPod touch after forgotten passcode
    8. RecBoot: Easy Way to Put iPhone into Recovery Mode - if all else fails.
    Forgotten Restrictions Passcode Help
    1. How to Recover Forgotten iPhone, iPad Restrictions Passcode
        If this method does not work, then you will need to fully Restore your
        device as New

  • Difference between 'Always Refresh' and 'Disable Cache Hits'

    We are using clustered application servers with its own cache. We are not doing any cache synchronization. So, for selective objects we should ensure that cache is not returning stale objects.
    I see two options in MWB for refreshing and disabling the cache. Can somebody explain the difference between these two and recommend what I should do to address my problem.
    Thanks in advance.

    These are similar and often used together settings:
    'Disable Cache Hits'
    Is used by TopLink when a ReadObjectQuery is executed with only the PK fields. By default TopLink will short-circuit going to the database and try to find the object in the cache first. This includes 1:1 mapping queries. Turning this on will cause TopLink to go to the database instead of the cache in these cases.
    'Always Refresh'
    Is used to tell TopLink how to handle the results returned from a query against the database. By default TopLink will trust the cached version of any instances already cached. When this is enabled, or the refreshIdentityMapResult is turned on for a specific query the results of the query are used to refresh the values of the cached version.
    The trick with always-refresh is that it does not force all queries to go to the database. It simply forces all returned rows to refresh cached instances.
    These are often selected by customers who never want to trust a cached instance. They are typically used together to get that effect. This configuration will get minimal performance gain from the cache but still require the cache for object-identity (avoid duplicate instances).
    Be careful though because these will have the effect for EVERY query and mapping traversal. I typically prefer to manually turn this on for my specific queries where I need to get the latest version from the database versus turning it on for all queries.
    On the query the methods you will be interested in are:
    query.refreshIdentityMapResult()
    This will force the query to the database and have the results refresh the cached instance if it already exists.
    One setting that is of definite interest is
    descriptor.onlyRefreshIfNewerVersion();
    This must be used in conjunction with the above query refresh and optimistic locking but it will avoid additional unecessary steps if the row has not changed since the cached version was read.
    Doug

  • COM+ Event System failed to fire the StartShell and Logon method after installation of PM 1.43

    Hi Guys,
    After installation of Power Manager 1.43, the following errors were immediate shown at event viewer: COM+ Event System failed to fire the StartShell and Logon method on subscription {F6FE5592-FCBC-44AD-A836-D37F5085ED5B}-{00000000-0000-0000-0000-000000000000}-{00000000-0000-0000-0000-000000000000}.  The subscriber returned HRESULT 80004001.
    Please advice if this is a known issue? Thanks!

    Hello,
    this is a known problem. See this thread
    Follow @LenovoForums on Twitter! Try the forum search, before first posting: Forum Search Option
    Please insert your type, model (not S/N) number and used OS in your posts.
    I´m a volunteer here using New X1 Carbon, ThinkPad Yoga, Yoga 11s, Yoga 13, T430s,T510, X220t, IdeaCentre B540.
    TIP: If your computer runs satisfactorily now, it may not be necessary to update the system.
     English Community       Deutsche Community       Comunidad en Español

  • How to Enable and Disable column in Table Control.

    Hi all,
    I want to make certain column of Table control as Enable or Disable on Button action.
    Enable means ready for input and Disable means not ready for input.
    Please send me sample code.
    Thanks in advance.

    Hi Vipin,
        You have to loop through the table columns to set the properties in the PBO of your screen.
    Here is the sample solution.
    delcare a workarea for the columns in the table control in your top include.
    Table Control .
    CONTROLS: TAB1 TYPE TABLEVIEW USING SCREEN '0100'.
    DATA: WA_COLS LIKE LINE OF TAB1-COLS.
    in your screen
    PROCESS BEFORE OUTPUT.
      MODULE INTIALISE_100.
    *&      Module  0100_INTIALISE  OUTPUT
    MODULE INTIALISE_100 OUTPUT.
        LOOP AT TAB1-COLS INTO WA_COLS.
          WA_COLS-SCREEN-INPUT = 1.
          MODIFY TAB1-COLS FROM WA_COLS TRANSPORTING SCREEN-INPUT.
        ENDLOOP.
    ENDMODULE.                 " 0100_INTIALISE  OUTPUT
    modify the screen-input property as required for the table control columns.
    Please provide points if helpfull.....
    Thanks,
    Karthik
    Message was edited by: Karthik
            Karthikeyan K

  • Validating enabled and disabled menu bar in JInternalFrame

    hi,
    everybody.
    i have created a main window using JInternalFrame and JDesktopPane. The window has a menu bar in which document menu is used for closing the main window, while employee menu is used for adding new frame for the employee. while the login frame is displayed when the application is executed.
    my problem is, i want to validate that before login process, employee menu should be disabled, and after login is performed employee menu is enabled.
    the following is my code.
    please reply me as i am stucked with it.
    waiting for the reply
    thanks in advance.
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    import java.util.*;
    public class InternalFrameDemo extends JFrame implements ActionListener
    JDesktopPane desktop;
    public InternalFrameDemo()
    super("InternalFrameDemo");
    int inset = 50;
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(inset, inset, screenSize.width - inset*2, screenSize.height - inset*2);
    desktop = new JDesktopPane();
    setContentPane(desktop);
    desktop.setBackground(Color.white);
    setJMenuBar(createMenuBar());
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    createLogin();
    public JMenuBar createMenuBar()
    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("Document");
    menu.setMnemonic(KeyEvent.VK_D);
    menuBar.add(menu);
    JMenuItem menuItem = new JMenuItem("Quit");
    menuItem.setMnemonic(KeyEvent.VK_Q);
    menuItem.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_Q, ActionEvent.ALT_MASK));
    menuItem.setActionCommand("quit");
    menuItem.addActionListener(this);
    menu.add(menuItem);
    JMenu employee = new JMenu("Employee");
    employee.setMnemonic(KeyEvent.VK_E);
    employee.setActionCommand("employee");
    menuBar.add(employee);
    JMenuItem additem = new JMenuItem("Add");
    additem.setMnemonic(KeyEvent.VK_A);
    additem.setActionCommand("add");
    additem.addActionListener(this);
    employee.add(additem);
    return menuBar;
    public void actionPerformed(ActionEvent ae)
    String str = ae.getActionCommand();
    if(str.equals("add"))
    System.out.println("Employee Form Invoked");
    createEmployee();
    else if(str.equals("quit"))
    quit();
    public void createEmployee()
    MyEmployeeFrame employeeframe = new MyEmployeeFrame();
    employeeframe.setVisible(true);
    desktop.add(employeeframe);
    try
    employeeframe.setSelected(true);
    catch(Exception e)
    public void createLogin()
    MyLogin loginframe = new MyLogin();
    loginframe.setVisible(true);
    desktop.add(loginframe);
    try
    loginframe.setSelected(true);
    catch(Exception e){}
    public void quit()
    System.exit(0);
    private static void createAndShowGUI()
    JFrame.setDefaultLookAndFeelDecorated(true);
    InternalFrameDemo frame = new InternalFrameDemo();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(800,600);
    frame.setVisible(true);
    public static void main(String a[])
    createAndShowGUI();
    class MyEmployeeFrame extends JInternalFrame implements ActionListener
    JFrame employeeframe;
    JLabel labelfirstname;
    JLabel labellastname;
    JLabel labelage;
    JLabel labeladdress;
    JLabel labelcity;
    JLabel labelstate;
    JTextField textfirstname;
    JTextField textlastname;
    JTextField textage;
    JTextField textaddress;
    JTextField textcity;
    JTextField textstate;
    JButton buttonsave;
    FileOutputStream out;
    PrintStream p;
    String strfirstname,strlastname,strage,straddress,strcity,strstate;
    GridBagLayout gl;
    GridBagConstraints gbc;
    public MyEmployeeFrame()
    super("Employee Details",true,true,true,true);
    setSize(500,400);
    labelfirstname = new JLabel("First Name");
    labellastname = new JLabel("Last Name");
    labelage = new JLabel("Age");
    labeladdress = new JLabel("Address");
    labelcity = new JLabel("City");
    labelstate = new JLabel("State");
    textfirstname = new JTextField(10);
    textlastname = new JTextField(10);
    textage = new JTextField(5);
    textaddress = new JTextField(15);
    textcity = new JTextField(10);
    textstate = new JTextField(10);
    buttonsave = new JButton("Save");
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 3;
    gl.setConstraints(labelfirstname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 3;
    gl.setConstraints(textfirstname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 5;
    gl.setConstraints(labellastname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 5;
    gl.setConstraints(textlastname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 7;
    gl.setConstraints(labelage,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 7;
    gl.setConstraints(textage,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 9;
    gl.setConstraints(labeladdress,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 9;
    gl.setConstraints(textaddress,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 11;
    gl.setConstraints(labelcity,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 11;
    gl.setConstraints(textcity,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 13;
    gl.setConstraints(labelstate,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 13;
    gl.setConstraints(textstate,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 3;
    gbc.gridy = 17;
    gl.setConstraints(buttonsave,gbc);
    Container contentpane = getContentPane();
    contentpane.setLayout(gl);
    contentpane.add(labelfirstname);
    contentpane.add(textfirstname);
    contentpane.add(labellastname);
    contentpane.add(textlastname);
    contentpane.add(labelage);
    contentpane.add(textage);
    contentpane.add(labeladdress);
    contentpane.add(textaddress);
    contentpane.add(labelcity);
    contentpane.add(textcity);
    contentpane.add(labelstate);
    contentpane.add(textstate);
    contentpane.add(buttonsave);
    buttonsave.addActionListener(this);
    public void reset()
    textfirstname.setText("");
    textlastname.setText("");
    textage.setText("");
    textaddress.setText("");
    textcity.setText("");
    textstate.setText("");
    public void actionPerformed(ActionEvent ae)
    String str = ae.getActionCommand();
    System.out.println(str);
    if(str.equalsIgnoreCase("Save"))
    try
    out = new FileOutputStream("myfile.txt",true);
    p = new PrintStream( out );
    strfirstname = textfirstname.getText();
    strlastname = textlastname.getText();
    strage = textage.getText();
    straddress = textaddress.getText();
    strcity = textcity.getText();
    strstate = textstate.getText();
    p.print(strfirstname+"|");
    p.print(strlastname+"|");
    p.print(strage+"|");
    p.print(straddress+"|");
    p.print(strcity+"|");
    p.println(strstate);
    System.out.println("Record Saved");
    reset();
    p.close();
    catch (Exception e)
    System.err.println ("Error writing to file");
    class MyLogin extends JInternalFrame implements ActionListener
    JFrame loginframe;
    JLabel labelname;
    JLabel labelpassword;
    JTextField textname;
    JPasswordField textpassword;
    JButton okbutton;
    String name = "";
    FileOutputStream out;
    PrintStream p;
    Date date;
    GregorianCalendar gcal;
    GridBagLayout gl;
    GridBagConstraints gbc;
    public MyLogin()
    super("Login",true,true,true,true);
    setSize(400,300);
    gl = new GridBagLayout();
    gbc = new GridBagConstraints();
    labelname = new JLabel("User");
    labelpassword = new JLabel("Password");
    textname = new JTextField("",9);
    textpassword = new JPasswordField(5);
    okbutton = new JButton("OK");
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 5;
    gl.setConstraints(labelname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 2;
    gbc.gridy = 5;
    gl.setConstraints(textname,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 10;
    gl.setConstraints(labelpassword,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 2;
    gbc.gridy = 10;
    gl.setConstraints(textpassword,gbc);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridx = 1;
    gbc.gridy = 15;
    gl.setConstraints(okbutton,gbc);
    Container contentpane = getContentPane();
    contentpane.setLayout(gl);
    contentpane.add(labelname);
    contentpane.add(labelpassword);
    contentpane.add(textname);
    contentpane.add(textpassword);
    contentpane.add(okbutton);
    okbutton.addActionListener(this);
    public void reset()
    textname.setText("");
    textpassword.setText("");
    public void run()
    try
    String text = textname.getText();
    String blank="";
    if(text.equals(blank))
    System.out.println("First Enter a UserName");
    else
    if(text != blank)
    date = new Date();
    gcal = new GregorianCalendar();
    gcal.setTime(date);
    out = new FileOutputStream("log.txt",true);
    p = new PrintStream( out );
    name = textname.getText();
    String entry = "UserName:- " + name + " Logged in:- " + gcal.get(Calendar.HOUR) + ":" + gcal.get(Calendar.MINUTE) + " Date:- " + gcal.get(Calendar.DATE) + "/" + gcal.get(Calendar.MONTH) + "/" + gcal.get(Calendar.YEAR);
    p.println(entry);
    System.out.println("Record Saved");
    reset();
    p.close();
    catch (IOException e)
    System.err.println("Error writing to file");
    public void actionPerformed(ActionEvent ae)
    String str = ae.getActionCommand();
    if(str.equals("OK"))
    run();
    loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }

    I realize this post is from a few days ago, but if you're still looking for help:
    This is my first thought on how to do this. Unfortunately, it's a bit messy. JMenuItems can be enabled and disabled but JMenus don't have this option...
    public class InternalFrameDemo extends JFrame implements ActionListener
        JDesktopPane desktop;
        JMenuBar menuBar;
        public InternalFrameDemo()
         setJMenuBar(createMenuBar());
         desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
         createLogin();
        public JMenuBar createMenuBar()
         menuBar = new JMenuBar();
         JMenu menu = new JMenu("Document");
         menu.setMnemonic(KeyEvent.VK_D);
         menuBar.add(menu);
         JMenuItem menuItem = new JMenuItem("Quit");
         menuItem.setMnemonic(KeyEvent.VK_Q);
         menuItem.setAccelerator(KeyStroke.getKeyStroke( KeyEvent.VK_Q, ActionEvent.ALT_MASK));
         menuItem.setActionCommand("quit");
         menuItem.addActionListener(this);
         menu.add(menuItem);
         JMenuItem additem = new JMenuItem("Add");
         additem.setMnemonic(KeyEvent.VK_A);
         additem.setActionCommand("add");
         additem.addActionListener(this);
         employee.add(additem);
         return menuBar;
        public void createLogin()
         MyLogin loginframe = new MyLogin( menuBar );
         loginframe.setVisible(true);
         desktop.add(loginframe);
         try
             loginframe.setSelected(true);
         catch(Exception e)
    class MyLogin extends JInternalFrame implements ActionListener
        JMenuBar menuBar;
        public MyLogin( JMenuBar menuBar1 )
         super("Login",true,true,true,true);
         menuBar = menuBar1;
        public void actionPerformed(ActionEvent ae)
         String str = ae.getActionCommand();
         if(str.equals("OK"))
             run();
             JMenu employee = new JMenu("Employee");
             employee.setMnemonic(KeyEvent.VK_E);
             employee.setActionCommand("employee");
             menuBar.add(employee);
             loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }

  • Abstract class with set and get methods

    hi
    how to write set and get methods(plain methods) in an abstartc class
    ex: setUsername(String)
    String getUsername()
    and one class is extending this abstract class and same methods existing in that sub class also..... how to write......plz provide some ideas
    am new to programming....
    asap
    thnx in advance

    yes... as i told u.... i am new to coding......
    and my problem is ..... i have 2 classes one is abstract class without abstract methods.. and another class is extending abstract class.....
    in abstract class i have 2 methods...one is setusername(string) and getusername() ..... how to write these two methods.... in abstract class i have private variables username...... when user logins ..... i need to catch the user name and i need to validate with my oracle database and i need to identify the role of that user and based on role of that user i need to direct him to appropriate jsp page.......
    for that now i am writing business process classes..... the above mentioned two classes are from business process.....
    could u help me now
    thnx in advance

Maybe you are looking for

  • Apple adressbook failures after update to Lion

    Recently I updated my MacBookPro from SnowLeo 10.6.7 to Lion 10.7.4. by downloading the Lion software from App Store. I followed the instructions and finally it seemed to function properly. In the beginning I had some issues making backups with time

  • How do I transfer my iTunes to a 'new' computer using my iPad?

    It's not really a new computer, but the same one I've had for a while now. I had gotten a virus on my computer and took it to IT. Long story short, they had to wipe my hard drive, because of how deep the virus got in and I'm basically starting over f

  • Cannot manually select Automator workflows in iCal

    I know That the Way, Apple intends that we create an Automator workflow as an iCal alarm is to create a new iCal alarm in Automator, and once you save it it automatically creates a new event in iCal. Unfortunately, that's not the way I want to work-

  • Help!! Slow Broadband Issues

    Hi There, I was hoping that someone may be able to help me with an Issue I am having with the Speed of our ADSL Broadband. Unfortunatley the  BT Call centre have not been much help and after being cut off four times yesterday we are pulling our hair

  • HELP Sequence file translator, how to insert a sub sequence ?

    Hi, I would like to know how insert sub sequence in the sequence pane and how insert steps in this sub sequences with the sequence file translator which use text file (.lvtf). Which vi do i have to modify in the project LabVIEW of Seqfiletranslator ?