Using menu breaking my code. Help?

I don't think this is a bug; I think I'm just missing something. Following is an abbreviated plug-n-play code snippet to reproduce the problem.
The problem is that I can make a JProgressBar work in a JFrame nicely if I do it on it's own, but if I try to execute it as a result of a menu-item click, it only displays the JFrame; the JProgressBar never shows up. Replace the progress bar with a button, label, whatever.
I'm thinking it has something to do with the menu needing to be dismissed or something, but I may be totally off base. Can't find any appropriate documentation. Just finished scanning through 810 bug reports. Need help. What am I missing?
Using j2sdk_1.4_03
Signed,
Feelin' dumb.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame implements ActionListener
Test() {
super("Test");
JMenuBar jmb;
JMenu jm;
JMenuItem jmi;
setSize(300, 200);
jmb = new JMenuBar();
jm = new JMenu("File");
jmi = new JMenuItem("go");
jmi.setActionCommand("go");
jmi.addActionListener(this);
jm.add(jmi);
jmb.add(jm);
setJMenuBar(jmb);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0); }
setVisible(true);
public void actionPerformed(ActionEvent e) {
progressManager pm = new progressManager(0,10000000);
long loop = 0;
while(loop < 10000000) {
pm.setValue(loop++);
pm.close();
public static void main(String args[]) {
System.out.println("Starting");
// This is to show it works without menus... takes a couple
// seconds on my 1.6GHz PC, make the loop smaller if you don't
// want to wait so long.
progressManager pm = new progressManager(0,10000000);
long loop = 0;
while(loop < 10000000) {
pm.setValue(loop++);
pm.close();
Test t = new Test();
class progressManager {
JFrame jf;
JProgressBar jpb;
long min, max;
progressManager(long min, long max) {
this.min = min; this.max = max;
jf = new JFrame("Progress");
jpb = new JProgressBar(0, 100);
Container c = jf.getContentPane();
c.add(jpb);
jf.setBounds(100, 100, 200, 100);
jf.setVisible(true);
public void setValue(long value) {
jpb.setValue((int)(value * 100 / max));
public void close() {
jf.dispose();

Sorry to make this page so long. Here is the code properly formatted and updated as you suggest. The problem still exists, but should be more readable. Thank you very my for the help so far.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame
  Test()
    super("Test");
    JMenuBar jmb;
    JMenu jm;
    JMenuItem jmi;
    setSize(300, 200);
    jmb = new JMenuBar();
    jm = new JMenu("File");
    jmi = new JMenuItem("go");
     //jmi.setActionCommand( "go" );
     jmi.addActionListener( new ActionListener() {
          public void actionPerformed( ActionEvent e ) {
               progressManager pm = new progressManager(0,10000000);
               long loop = 0;
               while(loop < 10000000) {
                    pm.setValue(loop++);
               pm.close();
    jm.add(jmi);
    jmb.add(jm);
    setJMenuBar(jmb);
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e)
        dispose();
        System.exit(0);
    setVisible(true);
  public static void main(String args[])
    System.out.println("Starting");
    // This is to show it works without menus...
    progressManager pm = new progressManager(0,10000000);
    long loop = 0;
    while(loop < 10000000)
      pm.setValue(loop++);
    pm.close();
    Test t = new Test();
class progressManager
  JFrame jf;
  JProgressBar jpb;
  long min, max;
  progressManager(long min, long max)
    this.min = min; this.max = max;
    jf = new JFrame("Progress");
    jpb = new JProgressBar(0, 100);
    Container c = jf.getContentPane();
    c.add(jpb);
    jf.setBounds(100, 100, 200, 100);
    jf.setVisible(true);
  public void setValue(long value)
    jpb.setValue((int)(value * 100 / max));
  public void close()
    jf.dispose();
}

Similar Messages

  • I have photoshop elements 11 installed on my desktop pc, I want to install it on my laptop as well, I read that it can be installed on two systems, but I get a message taht the redemption code has been used by another ID, please help

    I have photoshop elements 11 installed on my desktop pc, I want to install it on my laptop as well, I read that it can be installed on two systems, but I get a message taht the redemption code has been used by another ID, please help

    A redemption code can only be redeemed once.  It is used to acquire a serial number. The serial number is what you need to activate the installed software.  If you did not keep the serial number when you first installed, you might still be able to find it in your Adobe account online if you registered the software.

  • SQ01 help for listing not used problem codegroup and code in notifications

    Hi ,
    I am making a query through SQ01 to find out how many damage codes created for a particular notification type are not being used .
    In infoset I used QMEL which lists problem code group and problem code  and as a bonus we also get codegroup text . When I test this query , I get damage code group and code used in all the notifications . I want solution for the following
    1)How to list only distinct damage codegroup and damage code (Not per notification wise)
    2)Which second table I have to use to get problem code short text
    3)Which table I have to add in infoset and how join has to be created so that I get list of  Damage codegroups and codes not used in notification .
    NPB

    Hi Pete ,
    1)How to list only distinct damage codegroup and damage code (Not per notification wise)
            I have output like
                      problem code group     Problem code grp text        Problem code    Problem code text
                      MRTR                           Transformer  problems        1                        I need table here
                      MRTR                            Transformer Problem           1
                      MRTR                            Transformer problem         2
    I need distinct output like
      problem code group     Problem code grp text        Problem code    Problem code text
                      MRTR                           Transformer  problems        1                        I need table here
                      MRTR                            Transformer problem         2
    2)Which second table I have to use to get problem code short text
                    I need  problem code table
    3)Which  problem code group and code not used
                Suppose for notification type X I have configured damage catalog Q  and Q has MRTR , MRAM , MRGT as code groups and each of them have their own codes (say 1 to 5)...If notifications are created only for MRTR and code 1 , 5
    I need not used output like
    MRTR 2
    MRTR 3
    MRTR 4
    MRAM *
    MRCT *
    How can I achieve this using  sq01,02 etc
    NPB
    Edited by: Narasimha Bhat on Feb 1, 2011 4:54 PM

  • How to know where the user exits or enhancement used in standard sap code?

    Hi
    I m pretty new to abap.
    How can I know where the user exits or enhancement used in standard sap code?
    As i have to add some functionality to the standard sap code. I m looking to search the enhancement or user exits used in this standard code wher i can add my functionality.
    thanks in advance.
    Moderator message : Search for available information, thread locked.
    Edited by: Vinod Kumar on Oct 19, 2011 2:38 PM

    Hi Henry,
    I don't think this is the easiest way to look at the code around a particular field on the screen. Debugging standard programs also can be very tedious, if not impossbile. So, instead of this question, I would like to find out exactly what you want to do if you know the code.
    If you are in a transaction and you want to know where the code of a particular field is, the fastest way to get to it is by pressing the F1 key on the field and then press the Technical info button on the help screen. In here you will typically see the same kind of information but it is very specific to the field you selected.
    PROGRAM(SCREEN) tells you which program is manipulating the main screen, in which your field is embedded. Remember your field may be included in a sub-screen and that subscreen may be the one included in the main screen.
    PROGRAM(SUB SCREEN) tells you which program is directly responsible for the field on the subscreen it is included in. This is where you should find the code most appropriate for the field, but not necessarily.
    PROGRAM(GUI) controls how your push buttons and the menu options in the screen behave and controlled.
    Srinivas

  • See my error : (REP-1272: Column ‘CF_1’ may not be used as break Column.)

    Hi master
    Sir I have master detail report and I use one formula column and one place holder column in my report in master section
    I use this code
    function CF_1Formula return Date is
    begin
    if :chqdate is not null then
         :cp_1 :=:chqdate;
    else
         :cp_1 :=:sdate;
         end if;
    end;
    Sir when I run my report then system give me this error
    REP-1272: Column ‘CF_1’ may not be used as break Column.
    Please give me idea how I get report
    Thank
    aamir

    Hello,
    Break Order cannot be used for some Column Type :
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwcontxt/props/pi_col_break_order.htm
    (CLOB is not explicitly specified, but the restriction for LONG and LONG RAW exists for CLOB too)
    Regards

  • Hi, why do we use the break and continue structure?

    Hi, I was wondering why do we use the break and continue structure in some program such as:
    for ( int i = 1; i <= 10; i++ ) {
    if ( i == 5 )
    break;
    So, now why do we use those codes, instead of achiving the same results by not using the if structure.
    I am new in java so I can be totaly wrong that is why my question come to you guys.
    I will appriciate if you let me understand more.

    I may not completely understand your question, but - imagine the following scenario:
    // Looking for some value in a long, unsorted list
    Object target = null;
    int index = -1;
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        if (curObject.equals(source)) {
            target = source;
            index = i;
    if (target != null){
        System.out.println("Found it at " + index);
    }You will always run through the entire long list, even if the thing you are looking for is the first thing in the list. By inserting a break statement as:
    // Looking for some value in a long, unsorted list
    Object target = null;
    int index = -1;
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        if (curObject.equals(source)) {
            target = source;
            index = i;
            break;
    if (target != null){
        System.out.println("Found it at " + index);
    }You can skip whatever's left in the list.
    As for continue, yes, I suppose you could use a big if, but that can get burdensome - you end up with code like:
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        // you want to do the rest only if some condition holds
        if (someCondition) {
            // do some stuff -
            // And you end up with lots of code
            // all in this if statement thing
            // which is ok, I suppose
            // but harder to read, in my opinion, than the
            // alternative
    }instead of
    for (int i = 0; i < list.size(); i++) {
        Object curObject = list.get(i);
        // you want to do the rest only if some condition holds
        if (!someCondition) {
            continue;
        // do some stuff -
        // And you end up with lots of code
        // all outside of any if statement thing
        // which is easier to read, in my opinion, than the
        // alternative
    }Hope that helped
    Lee

  • Horizontal Spry Menu Breaks in IE6

    I have created an horizontal spry menu using the spry widget
    in DreamWeaver CS3. I would like the width of each menu item to
    adjust to the text (width: auto;) and that works fine in current
    browsers (FireFox, IE7, Opera, Netscape) but in IE6 the menu items
    are displayed vertically instead of horizontally. As soon as I give
    them a width, it displays appropriately in IE6, but that changes
    the look. You can see the page in question at
    http://www.inachordwebdesign.com/ccc/test.html
    Is there any way to work around this problem with the older
    IE versions?
    Any help would be greatly appreciated! Please let me know if
    I need to upload any code. This is one of my first posts, so I'm
    not sure what all I need to post.
    Thanks!

    I have updated the Spry Assets as suggested, but still have
    the same results. Removing the float:left for the menu bar doesn't
    help with the item alignment in IE6 and actually introduces a
    problem in the current version of Firefox, so that isn't the
    problem either.
    Any other thoughts? The only thing that seems to force the
    menu bar to display horizontally in IE is to have fixed widths for
    the list items in the unordered list (ul.MenuBarHorizontal li). As
    soon as I change that from a defined width to auto, or remove the
    width designation altogether, it falls back to a vertical
    arrangement in IE6, though it works in all the more recent browsers
    just fine. We'd rally prefer to let the list items size
    automatically, but if there is no way around it, I'll have to try
    to replicate that effect by assigning a different width to each
    item. That will add a lot of extra code, unfortunately.
    Thanks.

  • Search java code help

    I am writing a small Java program and need help using a simple search code. Here is the code
    public int indexOf(EltType e) {
            int i=0;
            for (i = currsize; i < currsize; i++){
                things[i] = e;
                e.equals(get(i));
            return -1;
        }Basically I want to search the array for e, and return its position, or -1 if e is not found. I know I have to use .equals(i) to compare e and get(i) but unsure where it goes.
    Here is the method that calls it:
    public void searchtester() {
            MyList<String> searchlist = new MyList<String>();
            searchlist.add("tangerine");
            searchlist.add("apple");
            searchlist.add("mango");
            searchlist.add("lime");
            searchlist.add("carrot");
            for (int i = 0; i<searchlist.size(); i++)
            System.out.println("searching for \"" + searchlist.get(i) + "\", result="
                + words.indexOf(searchlist.get(i)));
        }Please let me know what I am doing wrong.

    middle wrote:
    sorry kevinaworkman, not trying to ignore any advice, just very new to java so trying to figure this out. It's okay, I just know from experience that breaking it up into smaller pieces will save you a ton of headaches.
    Ok so I would imagine that loop:
    for (i = currsize; i < currsize; i++)would run onceTake a look at the tutorial on [the for statement|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/for.html] . If i starts out equal to currsize, and is only ever incremented, when will it be less than currsize? But even assuming that the loop runs once, what good would that be? Wouldn't you want the loop to run as many times as there are elements in your array?
    things[i] = e;I'll give you a hint: if this line were executed, it would set the element at position i in the array equal to e. You want to check for equality, not set the whole array equal to e, right? Do you mean == in an if statement?
    e.equals(get(i));Again, if this line was executed, it would check for equality between e and whatever get(i) returns. But then what are you doing with that boolean?
    I want to see if i is equal to e then the result I want is the position of e and if i does not equal e then I want it to result in a -1, the issue is that it is giving me "-1" for all the results when I know that the first 3 items are in the list.You might want to step through your program with a debugger to see what's happening line by line. Or better yet, step through it with a piece of paper and a pencil. Go through the program as if you were the computer, following your program (and not the logic in your head you think the program does) exactly.
    Some other things you might want to consider: the [if statement|http://java.sun.com/docs/books/tutorial/java/nutsandbolts/if.html] , arrays , and the above mentioned for loop tutorials.

  • Where do I find examples of how to use formula functions? Online help only provides syntax

    Hello,
    I would like to run a formula ( for my custom field in Project 2013)  that allows me to see the Finish Time e.g. 17:15 for a task.  I am trawling through the online help to determine which one is best but I would like to read some examples
    of how a function can be used. I hoped Help may do this but no.
    Hope you can point me into the right direction.  Thanks in advance.
    Alan

    Alan,
    Yeah I agree, the on-line help is lacking in information on how to actually USE a function. However, there are some places that may help. Here are a couple, I'm sure there are many others.
    https://support.office.com/en-nz/article/Project-functions-for-custom-fields-7e525143-380f-4083-8d5a-3ecc6ba44f22
    https://msdn.microsoft.com/en-us/library/office/ee767700(v=office.14).aspx
    Since many of the custom field formulas are also used in VBA, I've found the object library reference for VBA to be very helpful in understanding and setting up custom field formulas. To get the the object library, go to Developer/Code group/Visual Basic.
    Once the Visual Basic Editor window opens, hit View/Object Browser. Hit the Help menu and select the Help for Visual Basic. Type in the function of interest.
    However, you say you want a custom formula to see the finish time for a task. You don't need any customization to see that. Simply go to File/Options/General tab and select a date format that includes the time.
    Hope this helps.
    John

  • How many times can you install Lightroom 5? My problem is that I have saved my programs on C. To I have more space, I want to save my programs now on E. Can I now uninstall Lightroom and reinstall from C to E? Can I use the same license code as the first

    Please help!!
    How many times can you install Lightroom 5? My problem is that I have saved my programs on C. To I have more space, I want to save my programs now on E. Can I now uninstall Lightroom and reinstall from C to E? Can I use the same license code as the first installation?

    Thank you for your answers, it helps me a lot.
    But sorry for my ignorance. I understand how you mean it, but I don't know how to do it. I'm scared to lose the settings/edits of the images.

  • What happen if i use controll break statement in between select & endselect

    Hi all,
    what happen if i use controll break statement in between select & endselect ?
    Thanks in Advance
    KR

    Hi for reference u can go through this code example
    data:
      fs_tab like sflight.
      data:
       t_tab like standard table of fs_tab.
       select * from sflight into table t_tab.
       loop at t_tab into fs_tab.
         write: / fs_tab-carrid.
       endloop.
       refresh t_tab.
       clear fs_tab.
       select * from sflight into fs_tab.
         at new fs_tab-carrid.
           append fs_tab to t_tab.
         endat.
       endselect.

  • Smartforms, how to use control break events

    Please help with this requirement.
    Purchase Docu No.111
    Pur Item No       Mat no       Quantity 
    1                        2356      2000
    2                     1256      2000
    3                     8556      2000
    Purchase Docu No.112
    Pur Item No    Mat no    Quantity 
    1                      9656      2000
    2                      7356      2000
    3                      1356      2000
    Purchase Docu No.113
    Pur Item No    Mat no    Quantity 
    1                      5356      2000
    2                      8356      2000
    This i have to design for the smartform.
    1 header data then its item data.
    like is Script i can call the WIndow elements using control break events in the driver prog but how to get this kind of output in Smartforms.???????
    Thanks

    I dont want trigger new page.
    In the same page i want like this
    I have purchase docu data in only 1 internal table.
    So, for every new VBELN, under this i want its corresponding item details.
    I have created the command node for the main window with 2 rows, in the 1st row i am giving VBELN and in the 2nd row i am giving in item details like item no, matnr etc etc and in the condition its askng Field name and Comparison Value.
    How shold i give condition.??????
    Thanks
    Edited by: Jalaaluddin Syed on May 1, 2008 5:03 PM

  • Getting 'File not found' error while using server object model code

    Hi,
    I am using server object model code to pull list data in a console application. My machine has standalone installation of SP 2010. I am getting error 'File Not Found', however the same operation is working fine with client object model code.
    Code I am using:
    string strURL=http://servername/sites/sitename;
    SPSite siteObj=new SPSite (strURL); //getting error here.
    I have already checked the below,
    1. Framework being used is 3.5.
    2. I have proper access to site.
    3. Running visual studio as admin.
    Any help is much appreciated.
    thanks
    Tarique
    thanks and regards Tarique Aslam

    Hello Tarique ,
    Couple of pints need to check:
    1. User running the console application needs to have at least read permission to the SharePoint databases
    2. Set application by changing the "Platform target:" option on the "Build" to "Any CPU"
    Also refer this similar thread:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/2a419663-c6bc-4f6f-841b-75aeb9dd053d/spsite-file-not-found
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • HP Enterprise - Use Cloud-based HP Online Help to Troubleshoot Printing

    HP LaserJet Enterprise printers and HP Officejet Enterprise printers have cloud-based Online Help available to troubleshoot printing issues. HP Online Help users can scan a QR code on the printer display using a mobile phone or tablet, or click an error-specific link in the Event Log of the Embedded Web Server, to automatically retrieve the most relevant and up-to-date information or video to help resolve the issue at the control panel.
    Use Cloud-based HP Online Help to Troubleshoot Printing c04672002
    Setup and Configure Cloud-based HP Online Help  c04671899
    https://www.youtube.com/watch?v=IZyuyDz0Nz0
     

    Hi @Sunshyn2005
    I timed-out waiting for advice, and contacted HP Support, who helped me get the printer back on the air.  While we didn't manage to root-cause it, in the course of trying various things, the tech disabled Norton 360's firewall, which then allowed connecting to the printer, and restoring print service, which remains up after re-enabling the firewall. 
    The timing of the disconnection doesn't neatly corellate with any Windows updates.  My own theory is that it was caused by a 360 update, but am unable to find a smoking gun, since 360 doesn't provide update history.  The exact root-cause remains a mystery, but at least provides another thing for folks to try should they find themselves in similar straits.
    I really appreciated your hint that a Windows update might be the root cause, and your pointing out how to review the history and back-out updates: this morning, I found that Windows had installed a batch of updates overnight, and found that no browsers worked.  Using your advice, I rolled back the update, restoring browsing.
    Thanks,
    -rjs

  • Is third-party SO/PO  process possible using only one company code?

    Hi friend,
    1) my client wants to implement third-party PO process but also wants a way of keeping track of inventory during this process. I know that inventory should be tracked on the vendor side and not on our client side since we're doing third-party PO.
    However my client wants to track inventory (in an inventory g/l account like 120100) so that when my client post a Goods Receipt, the inventory account
    gets Debited and when client post  the outgoing invoice to customer, the inventory account gets Credited. In this way, my client can track
    if the customer have received the ordered item or not.
    The problem is that third-party PO posts to consumption account but DOES NOT post to inventory account. Is there any way of
    setting this up so that in addition to posting to comsumption account every time a Goods Receipt occurs?
    2) i tried to create "Individual Purchase Order" (customer order from client -> client order from
    vendor -> vendor ships item to client -> client then ships item to customer) so that posting will hit inventory account.
    However, i find that taking this approach involves setting up a Plant for vendor (A), a Plant for our Client (B), and a Plant for Customer (C).
    Because when i do a Goods Receipt, the stock has move from Plant A to Plant B. Then when i do a Goods Issue to the customer, it asks for the receiving plant. I assume this means that the stock moves from Plant B to Plant C.  
    Also, from the reading i did on the forum, i get the impression that i need to create more than one Company Code if i were to do
    third-party PO.  Do the Vendors have to be created in a different company code then the Customer? Or does it mean that Just the
    plant (like Plant A) needs to be created in a different Company Code then Plant B and Plant C?
    3) can i do third-party PO using only ONE company code?
    Can anyone provide some clarification on this issue? I've read tons of posting but none really helped clear  this issue up.
    Thanks so much.

    Dear Kishore,
    Individual PO processing is not third party process at all. In third party process the vendor delivers the goods dirctly to the customer - please check what SAP help says.
    http://help.sap.com/saphelp_46c/helpdata/en/dd/5601d4545a11d1a7020000e829fd11/content.htm
    Dear Queyen,
    One important point of third party process is that there's no need to keep stock of materials - that is in harmony with reality. Why does your customer want to keep stock from the goods if they doesn't receive at all? Is it coreect? It doesn't correspond to the fact.
    You can do statistical (ghost) GR against the third-party PO and you can see the goods movement in MB51 - I think this should be enough.
    http://help.sap.com/saphelp_46c/helpdata/en/dd/560287545a11d1a7020000e829fd11/frameset.htm
    BR
    Csaba

Maybe you are looking for

  • Manual clearing of open item

    Hi, Does anybody knows how housebank value of invoice document be captured on payment document during manual outgoing payment (F-58/F-53)? Any information would be greatly appreciated. Thanks,

  • Monitor the step in the job

    Dear all, I want know the function that can monitor the step in a job. I have a program that generates a job within steps. I want to abort the job if a step is cancelled. Can you share the ideas with me? Thank you!

  • Reports-FICO(urgent)

    Dear all, Can anyone tell where the following reports comes in easy access? 1. MIS(Daily reports) 2. Excise returns 3. VAT returns 4. TDS certificates 5. Balance sheet 6. P&L 7. Cash flow 8. Fund Flow Will assign good points. thanks in advance, A.Ana

  • Risk Descriptions in Japanese

    Hi Gurus: I uploaded my ruleset into GRC AC RAR 5.3, generated the rule job and followed the config guide. When I search for the functions and risks they appear in english. When I perform a risk analysis via the informer tab, the risk violations appe

  • Delete old podcasts?

    *** please someone tell me how to delete old podcasts in the new iTunes bollocks there is no ability to highlight and delete! How can this be?