Multiple GUI's in One Program

Hi, I am building some Java GUI's and I have a query/problem. I have set the windowClosing(WindowEvent e) method to hide frames (when the x button is clicked) rather than close them ...
public void windowClosing(WindowEvent e)
{ setVisible(false); }
I then have a statement in my main class to say that if all windows have been hidden(thought to be closed),then when the last one is closed, exit the program.
So for example with 2 frames, i have a statement
if(observable.setVisible(false) && obs1.setVisible(false))
{ System.exit(0); }
where observeable and obs1 are the frames. for this I get an error "'void' type not allowed here if(observable.setVisible(true) != true"
So my question is, should I be doing this a different way or what am I doing wrong.
The Reason that I am trying to do it this is that I am using Inheritance for some of the Frames so I guess that they are not all independant of one another, therefore if I close one of them, they all close and the program exits.
Any help gratefully appreciated.

As the previous post says, you shuld replace setVisible with isVisible in your code: if(observable.setVisible(false) && obs1.setVisible(false))
setVisible is a method that returns "void" or said in other way, does not have return.
That's why you get the error "'void' type not allowed here", because the method setVisible constitutes an expression of tipe "void", and this is not allowed in an 'if' statement, only boolean expressions.

Similar Messages

  • Multiple event structures in one program

    I know it's not good practice to have one event structure inside another event structure (I don't know exactly why). But if another event structure is in the subvi, is it safe? Please comment.

    guangdew1 wrote:
    I know it's not good practice to have one event structure inside another event structure (I don't know exactly why).
    This is because of dataflow and the way event structures work. If you have an event structure inside an event structure, both event structures will accumulate events whenever one occurs, but it is unlikely that they can be handled in the order they occur or at all. By default, event structure are set to lock the front panel until the event completes, meaning that if an inner event gets triggered first, the code will lock up, because it will no longer be possible to trigger one of the outer events. If the outer event occurs first, it cannot complete, because it requires a later firing of one of the inner events before it is ready to handle the next event that occurs in the UI. Even if it marginally works if the panels don't get locked, you are requiring the user to trigger events in a certain order. How is he supposed to know what's allowed or not?
    If this is not exactly clear to you, you need to start with a few tutorial and learn about dataflow, Then start using a single event structure and see how things work by programming scenarios and see what happens.
    guangdew1 wrote:
    But if another event structure is in the subvi, is it safe? Please comment.
    Event structures are only useful inside interactive subVIs that show their front panel. even then I strongly advise against calling anything interactive, or anything that takes excessively long, inside a main event structure. You end up with code that can become unpredictable, can deadlock, is hard to debug and flies in the face of all good programming guidelines.
    Obviously, you have some specific application in mind where you think something like that is useful, I can guarantee you that there is a much better solution is you think about this a bit longer. If you need help, please describe exactly what the program should do and how it should react to user interactions at the various stages.
    A program should always be approached from the code and UI needs. Don't start with a harebrained code construct (events inside events) and then look for a use. It does not exist! 
    Event structure only belong in toplevel loops. They should never be hidden insde squences or case structures (or other event structures as already mentioned above). If you have multiple toplevel loops that run in parallel, it is safe to place up to one event structure inside each. Each event structure can have an unlimited number of event cases. This should be sufficient to handle any programming need you might have.
    LabVIEW Champion . Do more with less code and in less time .

  • How to use multiple visa read in one program

    hi
    i am working at Hameg HM8143 power supply i want to measure voltage and current simultaneiously and use the measured values for further calculations. for this i used two visa read blocks.
    >>>>>>the measured values are shown in the same visa read string however i want it to be shown sepetately,
    >>>>>>One of the VISA read block gives error. so i want to know how to use VISA read to get current and voltage simultaneously in seperate strings
    >>>>>>than how to convert strings to numbers  for using them for my calcultions.
    i am attaching screen shot as well
    Attachments:
    screenshot.JPG ‏164 KB

    you can not use a single serial to send 2 commands simultaniously?
    There is a single serial line so one command has to be before another.  This doesnt mena that you can not read from 2 seperate threads but will have to ensure that there is a locking mechanism to make sure that your queries are atomic.  In labview encapsulating all communications can be done with an action engine which will allow for concurrent execution with automatic blocking of your resource (serial device).
    Paul Falkenstein
    Coleman Technologies Inc.
    CLA, CPI, AIA-Vision
    Labview 4.0- 2013, RT, Vision, FPGA

  • Is it possible to have Multiple Spool requests in one batch job overview?

    Hi,
    While running one of my z program in back ground, there are two spools generated (one by write statement and one by OPEN_FORM statement and both the spools are available in SP01 Transaction), but when i see the job overview in transaction SM37, I only see one spool request (that of the last spool request). Can any body in the group please tell me is it possible to see multiple spool requests in the job overview of one Abap program and if yes, how?
    Thank you.
    Abinash

    Hi Jayanthi,
    Thank you for the link. But probably that discussion was also an unsolved one.
    Anyway, does any one in the group think that display of multiple spools per one step job is dependent on client / SAP Server setting? Because as evident from the chain of mails in the link provided by Jayanthi, some people say that they see multiple spool requests for one program in batch mode job overview (SM37)? If yes, can some body tell me the required configuration?

  • About opening multiple files at once (in one program instance)

    While developing an Image Viewer application i realized i had to give it some functionality for when a user selects multiple images in a directory and presses enter to open them with my app.
    Everything is going well except for one tiny detail:
    The Windows OS believes i am trying to open several instances of my Image Viewer, it even alerts me that "Choosing to 'Open' 26 items at once may take a long time and cause your computer to respond slowly."
    It then hangs for a few seconds before opening my app. And i am talking about only 26 items. If i were to open more, the time it hangs is proportional and for that time the cpu usage is as its maximum (in this case a quad core).
    So, do you know about a solution to this? Or at least a workaround?
    Ideally, Windows would end up knowing i'm trying to open several files in only one program instance.
    ps: i already tried deactivating the code that loads the Images, even with the InvokeEvent Listener doing nothing, Windows takes a lot of time trying to open 26 program instances.

    it should work the way she's doing it, unless something is broken in CC
    try these other two options
    1. select all files and press "Enter", they should all open
    2. select all files and press the button "Open" in explorer Toolbar

  • Multiple users logged into one server, each users printer has a different name, application needs ONE name to print to.

    Multiple users logged into one server, each users printer has a different name, application needs ONE name to print to. 
    I'm NOT in any way a Terminal Services expert and I need help trying to get an application program working in a multi-user environment.
    The issue is that the printer changes for every user that is logged in. The application needs to print NOT to the default printer, but to a "special" printer which is selected in the application... let's call it a label printer to simplify the explanation.
    You have your default regular printer, easy for the application to find that one, and then you have a special printer that labels get printed onto. The application needs to know what printer is the label printer. So we allow the user to select that in the
    application and the selection is stored in a config file in 
    C:\ProgramData\mfgr\prog\setting files
    I don't have access to the application so I can't change how this works.  
    In the "regular" world, selecting the label printer driver to use should be per machine, NOT per user. When a new user logs into a machine, the physical printer doesn't go "poof" and a new printer suddenly appear. Same printer for all
    users.
    Yet in terminal services, the physical machine is "merged" with the virtual machine on the server. And there can be many users logged in at the same time. So each users real machine (and real printer) is injected into the "fake" terminal
    services machine. The name of the printers is made unique for each user. So the printers DO go "poof" and change names depending on the user logged into terminal services.
    So user "A" logs in and sets up the application to print to "LabelPrinterForUserA" (or whatever the name of the printer happens to be), that setting is stored in the ProgramData subfolder, and all is well. Later, user "B" logs
    in, and when they print, the application tries to print to "LabelPrinterForUserA" which doesn't exist for user B or is only accessible by user A. If user B re-configures, that breaks it for user A. 
    SOLUTION 1: The way that /should/ work (in my mind) is that you define one "generic" printer in Terminal Services... call it "Virtual Label printer" and when the user wants to print to it, the print job gets re-directed back to whatever
    physical printer is actually connected to their local workstation. There is a map of virtual printer to actual printer depending on the current user. The application is told once to print to "Virtual Label Printer" for all users.
    SOLUTION 2: Or... there should be some way to make the ProgramData sub folders separate per user. E.g. when user "A" tries to access:
    C:\ProgramData\mfgr\prog\setting files
    they actually get 
    C:\UserData\UserA\AppData\mfgr\prog\setting files
    and user "B" gets
    C:\UserData\UserB\AppData\mfgr\prog\setting files
    So the question I have is: Does either of those solutions exist hidden somewhere in the setup of terminal server? Or is there another way around this issue that I don't know?

    I don't really have a "for sure" answer to this, but because people here can't seem to deal with a question that hasn't been answered I'll provide the best answer I did receive from ServerFault.com user Nathan:
    I can feel your pain with using old software on terminal servers ...the solution I've come up with definitely won't scale as it requires some manual configuration, but I've gotten this method to work with our label printers (which require to be
    printed to an LPT port...yep, that old).
    Share your USB-connected printers to the network on each machine. Then, have the user log in on aunique session for each of them
    (a TS account cannot be shared among computers for this to work) and install a network printer pointing to the USB one they shared. Try to use a DNS name to account for possible DHCP movements.
    After, it should work. Each user can do this since display names can be identical as long as the ports are different (which they are).
    This was clarified by the following series of comments:
    I think you are on to something here, and I originally advised the admin to do this. The problem he ran into is that it setup the printer names in the TS as "printer on usersworkstation"
    and he could not rename it except to change the "printer" to whatever. E.g. the "on userworkstation" remained. I believe there is another way of installing the printer which avoids this, but I can't find it. Ages ago, one used to do NET
    USE LPT2 \\computer\printer password /USER:domain\user /PERSISTENT:YES and then tell the driver to print to LPT2 –  James
    Newton Mar
    17 at 16:21   
    @JamesNewton That's actually the exact method we used. The way around the "network printer" part is to install it as local printer and map it to a TCP/IP port that way. –  Nathan
    C Mar
    17 at 16:28
    You mean in the case where the printers are TCP/IP connected and not local USB / LPT to the users workstation? That makes sense. Wonder if this will work for USB connected printers... –  James
    NewtonMar
    17 at 16:35   
    @JamesNewton You'd share the local printer on the client's PC then on the server connect via TCP/IP to it. You'd need static addresses or use DNS names if DHCP, though. –  Nathan
    C Mar
    17 at 16:51
    Ah. Yes. I see. Looks like the LPT thing should work even with a USB connected printer:superuser.com/questions/182655/… –  James
    Newton Mar
    17 at 17:09   

  • One program for pc and mac with different imports

    I am trying to port my Java program from the PC to the MAC. I would like to have one program that works on both, the PC and the MAC. So I am using the
    if (System.getProperty("mrj.version") == null) //PC
    else //MAC
    condition to see if I am on the PC or MAC for making sure that the About menu is at the Help menu on top of the application window (PC) or at the Program menu on top of the screen (MAC) and the Control key (PC) or Command key (MAC) is used.
    However, the Mac also uses additional imports, such as
    import com.apple.laf.*;
    import com.apple.mrj.*;
    import com.apple.eawt.*;
    I cannot make an if statement before the imports. How can I make sure that the imports are only used on the MAC?
    Thanks for your time!

    >
    ..my program has a GUI...>Cool. OK - if you have not tried applications launched by JWS (Java Web Start) it is usually handy to get a feel for how they work for the end user. The biggest difference is between sandboxed applications, and ones that request extended permissions in the form of either j2ee-application-client-permissions or all-permissions. The first removes the warning banner from the bottom of windows, and adds a few other allowable actions, while the latter is, as it implies - all permissions.
    Examples of all-permissions/sandboxed can be seen in this [demo of the JNLP fileservice|http://pscode.org/jws/api.html#fs].
    >
    .. It is a computer graphics program, and it has a Tools palette where you can specify what and how you want to draw or select or move, and it has a Measurements palette, where you can use numbers for your drawing.>Does it offer to export the resulting graphics (e.g. save them to disk)? Does the program load graphic objects from disk? The reason I pointed to a demo of the differences between sand boxed and trusted apps., is because if the app. wants to 'access the local disks' it will either need to request all-permissions or as demonstrated in the example, use the [JNLP API|http://java.sun.com/javase/6/docs/jre/api/javaws/jnlp/index.html] (a group of classes only available to apps. launched by webstart) to do common things like access disks or printer, or take control of downloads...
    If you click the [Launch File Service (sandboxed) demo|http://pscode.org/jws/filetest-sandbox.jnlp] link, you can see what the experience would be like for the end user if the app. were converted to use the JNLP API for file I/O and was delivered entirely sandboxed.
    Of course, if your app. could work entirely sand boxed, like an applet - no code signing or extra permissions would be necessary, but that is uncommon for a desktop application.
    >
    So could you please give me some explanation or reference how to do launching it using webstart, and putting the mac specific resources into a resource section flagged for the Mac? >Launching an app. via webstart is not entirely 'simple', especially if you are new to it. OTOH it is well worth the effort - for the sake of the end user.
    The very basics of webstart is that you create a JNLP file to launch the app., I guess it is similar to the Mac .plist (or whatever they are) that you are discussing in another thread. Java JNLP files are a form of XML. Here is an example of what one might look like for an app. that provides different resources to different OS.
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0"
          codebase="http://ananya.com/lib"
          href="ananyacurves.jnlp">
      <information>
        <title>Ananya Curves</title>
        <vendor>Ananya Systems</vendor>
        <description>Ananya Curves - Computer Graphics</description>
        <offline-allowed/>
        <shortcut online="false">
          <desktop/>
          <menu submenu="AnanyaSystems"/>
        </shortcut>
      </information>
      <security>
           <all-permissions />
      </security>
        <resources>
          <j2se version="1.6+" />
          <jar href="AnanyaCurves.jar" main='true' />
        </resources>
        <!-- This is it! Supply the mac specific classes ONLY to Macintosh OS. -->
        <resources os='Mac'>
          <jar href="mac-specific.jar" />
        </resources>
      <application-desc />
    </jnlp>
    >
    ..Well, I am a complete beginner at this.>It can be a steep learning curve to first use JWS successfully, but it is well worth it.
    There is a good [overview of webstart|http://java.sun.com/developer/technicalArticles/Programming/jnlp/], but I also find it handy to keep the documentation on the [JNLP file syntax|http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html] nearby.
    Unfortunately many IDEs (and people) are not that competent at writing JNLP files, so I provide a JNLP XSD and [YAX-V|http://pscode.org/xml/xmltools.html#yaxv] to validate them.

  • How to delete multiple mail ids in one customer using LSMW ?

    Suppose in one customer having multiple mail ids. I wants to delete those multiple mail ids from one customer how I can do this using LSMW.
    Experts please help me out this problem.

    Dear Venu,
    LSMW or BDC will only add / append data.
    Write a program:
    list of Address number of the customer from KNA1.
    delete all entries from ADR6 for those customer numbers.
    Regards,
    Mani

  • Exporting to multiple PDF's from one report

    I have a requirement to create multiple PDF's from one report.
    My thought is that I can I can create a foreach loop that cycles through one of my groups.  I would then like to have each file have the name of that group. 
    If anyone could help me on how to code this in C# that would be great.  I need to know where I should be putting this code (program.cs or crystalreport.cs) and how I run it.  I am assuming I don't need the viewer for this function, since this is all on my end and no users need to have access to it. 
    My other requirement is to have each of these reports be put into their own folders at C:\.  Thanks for the help in advance!

    OK. Yup, you should be able to do this. When I was reading the initial post it looked like you might have ben wanting to export only a certain section of a report (which is a no go).
    Anyhow, first thing you want to do is apply Service pack 3:
    https://smpdl.sap-ag.de/~sapidp/012002523100007123572010E/cr2008_sp3.exe
    Next, you want to look at a few sample apps and go over some docs. What you want to achieve can be done by using parameters or selection formulas.
    A good coding resources is the [Crystal Reports for Visual Studio 2005 Walkthroughs|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2081b4d9-6864-2b10-f49d-918baefc7a23]. Don't worry about the title, it will apply to CR 2008 also.
    Next, sample apps can be downloaded from here:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
    [CR 2008 developer library|http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_dg_12_en.chm]
    [API reference|http://help.sap.com/businessobject/product_guides/boexir31/en/crsdk_net_apiRef_12_en.chm]
    Not sure if you are thinking of this being a web app, but here are some resources for that:
    [Interactivity and Reports in Web Applications|http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/208edbbf-671e-2b10-d7b5-9b57a832e427&overridelayout=true]
    Before starting your project, you should have a look at [this|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40bccdfd-88a6-2b10-1da1-c47a54b625a7] to make sure you are using the right SDK for your purposes.
    Finally, the following are links to 3rd party resources and I'm adding htese just as an FYI:
    http://www.emoreau.com/Entries/Articles/2006/09/Feeding-Crystal-Reports-from-your-application.aspx
    http://msdn.microsoft.com/en-us/magazine/cc301570.aspx
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • How to store multiple values associated to one key

    hello all
    In my program I need to store "multiple values associated to one key".
    for example : key would be ="T"
                             Values are    = 2,4,5,1,2Plz tell me which data structure I can use for this purpose.
    I have tried Hashtable for it, unfortunately it does not support duplicate keys in one Hashtable.
    Thanx.
    Rakesh

    The easiest thing to do, is store another data structure as your value for a
    particular key. So "T" being your your key, you would associate the value
    to be an int[] (if you know the number of sub values) or create a new Vector
    for each key, then you don't have to worry about the number of values at
    compile time. All the while still using the Hashtable for constant time
    look up. So like this:
    public void storeMultValues(int[] arr)
      Vector v = new Vector();
      v.add(new Integer(1));
      v.add(new Integer(2));
      v.add(new Integer(3));
      this.hashtable.put("T", v);
    }See if you can work with that.
    -Cludge

  • Adding A Pushbutton To GUI Status of Standard Program

    Hi,
    I need to add a pushbutton to the GUI status of one of the SAP standard programs, the system being <b>ECC 6.0</b>. One method which I tried was by copying the standard program as a Z program and then modifying the GUI status per my requirement. Although this works, one drawback in doing it this way was with the introduction of the new Enhancement Framework in ECC 6.0, the defined enhancements from the standard program were not copied to the Z program.
    I am looking for suggestions on how to add a pushbutton in the GUI status of the standard program using the enhancement concept. Please let me know the implications if any, while carrying out this change.
    Regards,
    Ravi Krishna

    GOTO Se41 Transaction ..
    one example :
    Standard Program : SAPLSLVC_FULLSCREEN
    Status : STANDARD_FULLSCREEN
    use ur program first and status and now click on copy status ...
    copy from standard to custom..

  • Multiple tc types on one scxi 1102

    Does anybody know if you can use two different thermocouple types on one SCXI-1102 module? 
    I need to measure both Type K and Type T thermocouples.  I am using a SCXI 1303 connector block and plan to use the internal CJC.
    Thanks in advance
    doloop

    Hello doloop,
    You can indeed configure a task to have to two different types of
    thermocouples, and acquire from multiple thermocouple types in one
    DAQmx Task.  For each channel, the NI-DAQmx driver will apply
    different conversion coefficients to convert voltage measurements from
    different thermocouple types into temperature measurements.  You
    can configure this easily in Measurement & Automation Explorer
    (MAX), by creating a DAQmx Task of the thermocouple type, and adding
    multiple physical channels from the SCXI 1102 module to the channel
    list.  For each channel in the scan list, under the settings tab,
    you will have the option to select what type of thermocouple to
    associate with each channel, along with CJC settings.  You can
    also do this programmatically in LabVIEW using the DAQmx Create Channel
    VI.  I've attached a shot of a block diagram that shows how to
    program this.
    I hope this helps!
    Travis G.
    Applications Engineering
    Message Edited by Travis G. on 04-18-2006 05:09 PM
    Attachments:
    MultipleThermocoupleTask.Jpg ‏68 KB

  • How to create one program from few programs

    Hi.
    I have for example 5 programs and I would like to create one program in which i could switch between this 5 programs. One of these should be running all the time and the others should start when i will switch to them. I need solution or something like that.
    Thanks.

    You can do a search on "dynamically called" sub vi's.
    See the tiny example below of how to call it.  You can actually call multiple VI's and they will run in parallel, although you have to be careful when doing this.
    You would have to wire False to  "Wait till done"
    You can stop/close the VI using property node.  If you wired False to "Auto Dispose Ref", then make sure you do close ALL references before exiting your program.
    Message Edited by Ray.R on 04-27-2010 08:19 AM
    Attachments:
    callByReference.png ‏16 KB

  • Caling WD Application from one program

    Hi Experts,
    How i can call the WD Application from one program without creating  the TCODE for the WD application.
    Thanks
    Mahesh

    > I want to call the WD Application from a report without tcode.. Is it possible?
    Hi Create a Push button In your report., On Click of button
    call function call_browser
    and pass your WDA url to this FM.,
    else If you want to display in SAP GUI it self., use cl_gui_html_viewer  class and disaply that url...
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • Multiple Checkbox Values Into One Field

    Hopefully someone can help me with this issue I'm having.
    I'm trying to save the values of multiple selected checkboxes into one field separated by commas through ADDT's Insert Transaction code. I can do this easily with DW's standard insert record wizard by using the PHP implode() function but I haven't been able to figure it out with ADDT's code.
    <form>
    <input type="checkbox" value="1" name="program[]" /> Program One
    <input type="checkbox" value="2" name="program[]" /> Program Two
    <input type="checkbox" value="3" name="program[]" /> Program Three
    <input type="checkbox" value="4" name="program[]" /> Program Four
    </form>
    THIS IS ADDT'S CODING
    $ins_quoteManager->addColumn("programs", "STRING_TYPE",  "POST", "programs");
    THIS WORKS VIA DREAMWEAVER'S INSERT RECORD WIZARD
    Original: GetSQLValueString($_POST['programs'], "text"),
    Modified: GetSQLValueString(implode(',',$_POST['programs']), "text"),
    Anyone know how to modify the ADDT code with the implode function to get this to work?

    Have you tried ADDT´s "comma-separated checkboxes" form control, which will also store the values into a field of your choice (and of course retrieve them from there on update record - pages) ? The only possible drawback might be, that the checkboxes can´t be defined statically, means that the array of value/label - pairs will be retrieved from another table by establishing an additional recordset.
    Cheers,
    Günter

Maybe you are looking for