Simple Stack Problem

Hi All,
I'm trying to create a graphical calculator and want to input the equation as a string into a stack. I think the code does this, but when I try to pop it I get an error. Here's the code:
public void calculate(String n, int parethCount, String temp)
          int nLength = n.length();
          stack = new Stack();
          display.setText("Working");
          while (nLength > 0)
               stack.push(n.substring(nLength, nLength-1));
               nLength--;
          display.setText(stack.pop());
    }I'm just trying to pop the last item inserted into the stack and display it in the calc display. Here's the error I get.
C:\Java\4-14-03>javac calculator1.java
calculator1.java:212: setText(java.lang.String) in javax.swing.text.JTextCompone
nt cannot be applied to (java.lang.Object)
display.setText(stack.pop());
^
1 error
Don't know why. Any thoughts.
Thanks,
bob2829

try this: stack.pop().toString()

Similar Messages

  • Real simple xslt problem/question

    Hi, i have a real simple xslt problem but i just cant figure out how to do it by looking at various examples on the net. i have a xml document and in it are some elements with a "result" tag name. i want to use xslt to reproduce exactly the same xml document except with an attribute called "id" added to those elements with a "result" tag name. i'm sure that theres a simple solution to it but i just cant figure it out. any helps greatly appreciated, thanks

    Start with the XSLT identity transform (I don't have it handy and it's fairly long, but you should be able to google it up). Add this:<xsl:template match="result">
      <result id="">
        <xsl:apply-templates>
      </result>
    </xsl:template>

  • JDeveloper IDE simple setting problem

    Hi,
    Recently we switched to JDeveloper from Visual Cafe .I have a simple setting problem.How can I set the options so that IDE gives, the core java classes and packages,and our application classes and packeges, prompts in imports as well as in code.Where to set the options.
    eg: when I write
    import java. it should prompt all the pakages.
    Thanks in advance.
    -Gopal
    null

    I am not sure I understand what you are requesting, but ...
    You can configure JDeveloper projects to include various libraries by default.
    This is done by selecting menu Tools | Default Project Properties.../ Libraries tab.
    You should define a library for your classes.
    You can import any of the packages / classes from all the libraries which your project includes.
    It would be incorrect for a tool to automatically add a bunch of import lines at the top of every file because each file should import what it needs and just as importantly, not import what it does not need depending on the component type (e.g. a servlet should not include javax.swing.* ).
    An easy way to import elements into JDeveloper is to type in something like:
    import java.
    // and then type in Ctrl Space
    and this launches the package browser, you can select packages or classes to import.
    You can also do this at the variable declaratiton point such as typing in:
    foo() {
    Frame x
    // Press Control Alt Space
    and this will correctly change the type (Frame) to the type you select in the package browser and add the import statement.
    -John
    null

  • Simple OOP Problem. Help!

    This is just a simple OOP problem that i cant decide on a best
    implementation for.
    im passing an object to an instance of, 'TabbedFrame', which is just
    a frame with a Tabbed Pane in it that is holding custom panels.
    however, these custom panels need access to the object being
    passed to 'TabbedFrame' and to some methods in it.
    i cant make them static however so how do i gain access to them?
    is my only option to pass the 'TabbedFrame' to each panel?
    like - jtabbedpane.add( "Panel 1", new mypanel1(this));
    here is code:
    new TabbedFrame( DataObject );
    public class TabbedFrame{
    public TabbedFrame(DataObject do){
    this.do = do;
    jtabbedpane.add( "Panel 1", new mypanel1() );
    DataObject do;
    public class mypanel1{
    public mypanel1(){
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    }i would just pass the DataObject to evey panel (there are 12) but
    i also need to be able to call methods in the 'TabbedFrame'.
    Any help would be appreciated!

    Modify mypanel1's constructor:
    public class mypanel1{
    TabbedFrame tf;
    public mypanel1(TabbedFrame tf){
    this.tf = tf;
    // need access to DataObject of the 'TabbedFrame' object that instantiated
    // this 'mypanel1' and to some of its methods
    DataObject theDo = tf.getDataObject();
    tf.someMethod(); // Call method on the TabbedFrame
    }In TabbedFrame:
    public TabbedFrame(DataObject do){
    this.do = do;
    // Modify call to constructor to pass "this" TabbedFrame.
    jtabbedpane.add( "Panel 1", new mypanel1(this) );
    }

  • Appearance panel stack problem

    this is probably common sense, but for the life of me i cant figure it out.
    I have a simple text. In the appearance panel, the "eyes" are greyed out and i cant add effects, nor can i change the stack order.
    However i create a simple rectangle and i am able to do it.
    what is the problem here?

    If you plan on applying the same attributes to your entire selection of text, I recommend  selecting your charachters with the type tool and setting your fill & strokes to none.
    Then as per Wade  change to a selection tool and begin applying your strokes and fills
    At type level you can move fill to the top, add multiple strokes which now go outwards, etc. The type level overides the character, but I still like to clean character level out to none to keep my files clean and not have problems with removing unused colors and such.

  • Simple button problem

    I am having a real problem creating a simple button - I have
    created a Flash file using Action script 2, and when I create a
    simple button - text with a rectangle as a background, (see
    http://www.elkhavenestate.com),
    and the over state is behaving in a bizarre fashion. This is my
    first time using CS3, so is there a new control that I'm
    missing?

    I take it that it's the Home button. It appears to have a
    selectable text field or something in it, which is causing the
    problem. Either change that to a static text field or set its
    selectable property to false. The other two buttons appear to be
    fine, so maybe you can just duplicate one of them and turn it into
    the Home button.
    If I picked the wrong button, let me know.

  • Image size and stacking problem with FF12 even in safe mode. Images are 5x the right size and overlayed on top of other pictures or text. how to fix?

    OK this problems limited to Facebook only. When logged in FF12 the entire page is scrambled. The pictures are stacked over each other and are 5 to 6 times the size their supposed to be. I have tried everything I could think of to fix this it even runs like this when in safe mode. I have uninstalled all plugins and all extensions I have uninstalled and even tried back dating FF. it's still so massively out of proportion that you can't do anything. .even when zoomed out 3x it's so large the pictures are larger than my screen. They are still overlapped so bad you can't do a thing with it. Even worse I uninstalled and installed pale moon and the effects migrated to that browser as well. Only browser I found unaffected by this is IE. Lord knows I don't wanna ever have to go that rout so I'm asking for help. I have a whole list of parsing errors and decoration drops, to many to post. any help would be much appreciated until it's fixed I'm stuck with IE. Chrome wont work with the software I run only IE or FF will.

    -> press '''CTRL''' + '''0''' (zero) to '''Reset''' Zoom
    * For details, see this article -> [[How do I use Zoom?]]
    Check and tell if its working.

  • Load files into Stack Problems

    So what happen was this. I make GIFs as a hobby. But what happen was that 3 days ago, I opened my Photoshop CS5.1 Extended version 12.1 (x64) and did the usual thing.
    I went to Scripts and to Load Files into Stacks. I loaded my files and pressed OK. So here's the funny part, usually, the pictures will load by itself and eveyrthing will be in order. But what happen was that the layers load to around 6 to 7 layers and everything just disappear. Literally disappear. Like I didn't even load anything. No canvas, no images, nothing. I thought it was a bug or something so I reinstalled my CS5 but the problem remains.
    So I try with my CS6 Extended version 13.0 x64. (That I barely use because I'm still more comfortable with CS5.) And the same thing happens.
    I decided to Google it and nothing comes up. I do not know whether is it my laptop or something went wrong somewhere. This has never happen before for the amount of time I have CS5.
    I even change my scratch disc space. Last time it was on (C) with around 20GB space and nothing happens. So I changed it to my D drive and it has atleast 150GB space. I even tried closing every applications I have to test whether is it something related to my ram. But nothing happens. The problem remains.
    So I require some help because I asked around and it appears that none of my friends knows whats wrong.
    Here's my system information:
    Window 7 Ultimate Service Pack 1
    Intel (R) Pentium (R) CPU B970 @ 2.30GHZ
    6.00 GB Ram
    Running on 64-bit OS
    Graphics:
    Intel(R) HD Graphics Family

    When you start having problems with Photoshop.  Most of the time its because of something external to Photoshop or your user id Photoshop preferences.   Reinstalling Photoshop seldom fixes these problem. For User preferences survive across the reinstall. Third party plug-in may as well. Since you have the problem with both CS5 and CS6 it may have to do with the files your loading into the stack. For that something both version are trying to process.  CS5 and CS6 haves separate Preferences and third party add on must be installed into each though they may share plug-in if you use Photoshop Preferences to and a additional plug-in path and you use the same path for CS5 and CS6.

  • Logo/picture to menubar? simple css problem?

    Hi, I'm having a problem getting a logo to appear correctly in a horizontal menu bar. It appears to be fine in IE 8, Safari 5, Chrome, and Firefox. However in IE 7 and lower it does not seem to display correctly. The only conditional notes I have for IE 7 and lower deals with the slideshow on the page which shouldn't be affecting the menubar as it is in a different div.
    Here is the url: www.elementcentral.com
    Any advice? I could really use some help- I've tried quite a few things but to no avail...
    Thanks for any help you can offer and I'm more than happy to clarify or anything else!
    Sincerely,
    Matt

    Anyone? I'm thinking its just something simple but I can't figure it out for the life of me heh.

  • Java Stack Problem

    Dear Gurus,
    Right Now I have Installed in my server sapfs Abap stack+Java stack.Abap stack is working fine,Java stack also config toll is working fine.Iam new to Java Stack,I have open explorer and given this path http://hostname:5<instanc no of java>00/irj/portal but page cannot displayed.Please give sugestion any problem with Java stack or else any parameter I have to set.
    Best Regards,
    kk

    Hello krishna murthy,
    I would suggest you use jcmon to test whether java stack is really running, because network or browser could prevent java page being properly displayed. Usage:
    logon as <sid>adm
    jcmon pf=<you instance profile>
    then "20", you will see whether java dispatcher, server, sdm running. If running, it should like:
    |Idx|Name               |PID     |State                |Error|Restart|
    |---|-------------------|--------|---------------------|-----|-------|
    |  0|dispatcher         |   25298|Running              |    0|yes    |
    |  1|server0            |   25299|Running              |    0|yes    |
    |  2|SDM                |   20917|Running              |    0|yes    |
    good luck.
    Rongfeng

  • Catalyst (3750 24 10/100/1000T) and (3750 12 SFP) Stacking Problems

    Dear all
    I'm having a very strange situation here (at least for me)
    we have 4 core switches
    2 x   WS-C3750G-24T-S Catalyst 3750 24 10/100/1000T + IPB Image
    and
    2 x   WS-C3750G-12S-S Catalyst 3750 12 SFP + IPB Image
    Stack configuration is done this way
    when the switches are powered on, the first two SFP core switches are seen as a single stack with the stack master LED turned green on the first switch
    the other two (24 10/100/1000T) switches have the RPS LEDs always green, mode cannot be changed, and cannot be accessed by Console connection
    but when the (24 10/100/1000T) are powered off, the first (SFP) switch in the stack reports that " Switch 3 and 4 has been removed from Stack "
    which means they are stacked but there's something wrong, because
    only the SFP ports are shown in the " Show interfaces status " , the ethernet ports of the bottom switches are not present !!!
    can you please tell me what's the poblem ?

    Dear Daniel
    Sorry for my delayed response but i was actually quite busy
    but the problem was actually in another sense
    the default profile for the Catalyst 3750 SFP is the Aggregate SDM Template
    while the 3750 10/100/1000 ethernet Switch Default SDM profile was Desktop profile
    so i had an SDM mismatch
    DATACENTER#sh switch detail
    Switch/Stack Mac Address : 081f.f3cf.1c80
                                               H/W   Current
    Switch#  Role   Mac Address     Priority Version  State
    *1       Master 081f.f3cf.1c80     1      0       Ready              
    2       Member 081f.f3cf.5900     1      0       Ready              
    3       Member aca0.16ac.0180     1      2       SDM Mismatch       
    4       Member aca0.16a3.bc80     1      2       SDM Mismatch 
             Stack Port Status             Neighbors    
    Switch#  Port 1     Port 2           Port 1   Port 2
      1        Ok         Ok                2        4
      2        Ok         Ok                3        1
      3        Ok         Ok                4        2
      4        Ok         Ok                1        3 
    all i did was changing the default profile of the SFP switches into the Desktop Profile and problem was solved
    switch 1 provision ws-c3750g-12s
    switch 2 provision ws-c3750g-12s
    switch 3 provision ws-c3750g-24t
    switch 4 provision ws-c3750g-24t
    system mtu routing 1500
    ip subnet-zero
    no file verify auto
    spanning-tree mode pvst
    spanning-tree extend system-id
    vlan internal allocation policy ascending
    interface GigabitEthernet1/0/1
    interface GigabitEthernet1/0/2
    interface GigabitEthernet1/0/3
    interface GigabitEthernet1/0/4
    interface GigabitEthernet1/0/5
    interface GigabitEthernet1/0/6
    interface GigabitEthernet1/0/7
    interface GigabitEthernet1/0/8
    interface GigabitEthernet1/0/9
    interface GigabitEthernet1/0/10
    interface GigabitEthernet1/0/11
    interface GigabitEthernet1/0/12
    interface GigabitEthernet2/0/1
    interface GigabitEthernet2/0/2
    interface GigabitEthernet2/0/3
    switchport trunk encapsulation dot1q
    switchport mode trunk
    interface GigabitEthernet2/0/4
    interface GigabitEthernet2/0/5
    interface GigabitEthernet2/0/6
    interface GigabitEthernet2/0/7
    interface GigabitEthernet2/0/8
    interface GigabitEthernet2/0/9
    interface GigabitEthernet2/0/10
    interface GigabitEthernet2/0/11
    interface GigabitEthernet2/0/12
    interface GigabitEthernet3/0/1
    interface GigabitEthernet3/0/2
    interface GigabitEthernet3/0/3
    interface GigabitEthernet3/0/4
    interface GigabitEthernet3/0/5
    interface GigabitEthernet3/0/6
    interface GigabitEthernet3/0/7
    interface GigabitEthernet3/0/8
    interface GigabitEthernet3/0/9
    interface GigabitEthernet3/0/10
    interface GigabitEthernet3/0/11
    interface GigabitEthernet3/0/12
    interface GigabitEthernet3/0/13
    interface GigabitEthernet3/0/14
    interface GigabitEthernet3/0/15
    interface GigabitEthernet3/0/16
    interface GigabitEthernet3/0/17
    interface GigabitEthernet3/0/18
    interface GigabitEthernet3/0/19
    interface GigabitEthernet3/0/20
    interface GigabitEthernet3/0/21
    interface GigabitEthernet3/0/22
    interface GigabitEthernet3/0/23
    interface GigabitEthernet3/0/24
    interface GigabitEthernet4/0/1
    interface GigabitEthernet4/0/2
    interface GigabitEthernet4/0/3
    interface GigabitEthernet4/0/4
    interface GigabitEthernet4/0/5
    interface GigabitEthernet4/0/6
    interface GigabitEthernet4/0/7
    interface GigabitEthernet4/0/8
    interface GigabitEthernet4/0/9
    interface GigabitEthernet4/0/10
    interface GigabitEthernet4/0/11
    interface GigabitEthernet4/0/12
    interface GigabitEthernet4/0/13
    interface GigabitEthernet4/0/14
    interface GigabitEthernet4/0/15
    interface GigabitEthernet4/0/16
    interface GigabitEthernet4/0/17
    interface GigabitEthernet4/0/18
    interface GigabitEthernet4/0/19
    interface GigabitEthernet4/0/20
    interface GigabitEthernet4/0/21
    interface GigabitEthernet4/0/22
    interface GigabitEthernet4/0/23
    interface GigabitEthernet4/0/24
    that's it !
    : D
    cheers

  • Stacking Problem in pam.conf on Solaris 10 ?

    Hi all,
    I have pam.conf with enteries for
    # Default definition for Password management
    # Used when service name is not explicitly mentioned for password management
    *other password required pam_dhkeys.so.1*
    *other password requisite pam_authtok_get.so.1*
    *other password requisite pam_authtok_check.so.1*
    *other password required pam_authtok_store.so.1*
    As per my understanding the
    (I) SPI pam_authtok_get.so.1 is used to get the user credentials from password DB.
    (II) SPI pam_authtok_check.so.1* is used to check if the new password supplied is satisfying the password policy on the OS ( by reading values from /etc/default/passwd )
    (III) SPI pam_authtok_store.so.1* is used to store the newly entered password to password db.
    Please correct me if I am wrong anywhere.
    Now I have a requirement thar an application has to be wriiten which will just check that the entered password satisfies the password policies of the OS or not, but it should not update the password DB(should not store the password)
    I make the following enteries in my pam.conf
    osPasswdCheck password required pam_dhkeys.so.1
    osPasswdCheck password requisite pam_authtok_get.so.1
    osPasswdCheck password requisite pam_authtok_check.so.1
    I removed the entry for pam_authtok_store.so.1 as I dont want to store the but when I run my application it always give error 20 authentication manipulation error.
    please refer (/usr/include/security/pam_appl.h)
    I have done all the formalities w.r.t writing a PAM Conversation funtion and the application is returning success when I add the pam_authtok_store.so.1 into the SPI
    Please anyone can help me out.Is there is anyother way with which I can use my application just to check password (w.r.t. OS policy) .
    I will be really thankful if anybody can provide me with working PAM Modules stack for achieving it.
    Thanks in advcance.
    Regards,
    Rahul.
    but I dont want to store it.

    Why not just keep the "pam_authtok_store.so.1" line in your pam.conf file and set it to a level of "requisite" or lower? I haven't tried it myself yet, but I've found that in the past when editing this file, completely removing a line rather than giving the PAM stack what it would expect to see with that line being there in some way can also cause problems.

  • 1.2 RAW + JPEG Stacking problem

    I have posted this elsewhere, but nobody seems to understand my problem, I hope I can describe it correctly here...
    Lightroom 1.2 is stacking photos automatically where the filename is the same, although the extensions are different:
    All my photos are stored in folders by Date (i.e. I have a folder named "2007 10 04", which has 93 photos taken on that date). I have 2 files that have similar names (from different cameras). One file is of a duck and is named "IMG001.CR2", and the other file is of a cat named "IMG001.JPG". Lightroom has seen these files as the same photo and displays the duck photo, but hides the cat photo. The thumbnail only shows the duck photo, and has the header "CR2+JPG" to show me there are 2 photos. I want to separate these photos from each other, but cannot see how!
    I hope this makes sense.

    I don't think you CAN view them seperately later if they are 'joined'.
    Way I heard it described was that it shows CR2+JPG as a 'convenience' so you know its there and Lightroom didn't just totally ignore it. (And apparently it would use it as a sidecar for display until LR created its own previews.)
    Initially in 1.0 LR wouldn't let you import the jpegs at ALL unless they were in a different folder from the RAW images. This was because it was apparently thought that no "real" workflow by a "real" photographer would involve anyone wanting to look at the jpegs if the RAW existed, and being "smarter" than the user it wouldn't bring them in at all if they were side by side. Wasn't until they got flamed for this and some battles behind the scenes that they begrudgingly allow us to now do this.
    What I'll probably do is evntually start stacking my jpegs with my RAW images... I wish there was an option to AUTOSTACK RAW to jpeg on import.

  • Simple DLL problem

    I'm dabbling with DLL writing and can't figure out how to pass a string to a
    DLL. As far as I can see, it should be simple.
    My DLL function, in the DLL "test.dll", is simply
    TEST_API int test(LPCTSTR WinName)
    return 0;
    Instead of LPCTSTR I've also tried the more conventional "char *WinName",
    and a few others. All give the same error; "The exception Priviledged
    Instruction occurred in the application at location (blah)." The error
    message doesn't seem too specific; exactly the same thing happens if I
    deliberately copy some text to an uninitialised pointer.
    I'm calling the function using a "Call Library Node", passing a
    pre-generated string in the form of a C string pointer. The calling
    convention is set to "winapi" but doesn't seem too relevant.
    If I remove the string argument and change the function definition to take
    (void) then it works, in that I can put integers in the return code and pass
    them back to Labview, so it's the passing of the string that's the problem.
    However, if I have more code in there and I use the Visual C++ debugger, the
    error message is only generated on hitting the "return" line, and I can see
    the string that has been passed in when I look at "WinName" in the debugger.
    Can anyone shed some light on this?
    Craig Graham
    Physicist/Labview Programmer
    Lancaster University, UK

    Craig;
    I am going to throw some random thoughts that may help you in your situation:
    - I avoid to use VC's wizard. It gives (and gave me) a lot of headaches. All it does it to add a lot of garbage to your project that nobody understand.
    - If your source file is a .cpp, wrap your function prototypes inside the extern "C" declaration.
    - Always initialize every variable in LabVIEW side. For example, for your function you should wire an empty string in the input side of the "Call Library Node" for the "WinName" variable.
    - I claim ignorance in this one, but seems to simplify my projects. Exclude rarely-used Windows header files by adding the following statement before your headers "include":
    #define VC_EXTRALEAN
    I hope this can be of help. If I co
    me up with some more suggestion, I'll let you know.
    Best regards;
    Enrique
    www.vartortech.com

  • Another simple classpath problem question

    Hi All
    Yes I know, there are a lots of questions about this matter, but I couldn't found a solution to my problem.
    I have a simple program:
    public class prueba {
            public static void main(String[] args) {
                    System.out.println("Ahi va...");
    }placed in /tmp/javier/prueba.java
    After compiled, I've tried to run it from / and then problems started:
    cd /
    java /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    I said, ok...it could be a classpath problem...then:
    java -cp /tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba
    Damn, another try...
    java -cp .:/tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Jesus Christ....may be the last slash....
    java -cp .:/tmp/javier /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Oh...no.... may be classpath to java classes..
    java -cp .:/usr/java/j2sdk1.4.2_01/lib/jre/:/tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Well, I don't know why this error happens....
    Please, could somebody help me !!!
    Thanks in advance...
    <jl>

    It's not too early to start following the Sun coding
    conventions for Java:
    http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.
    tmlHi
    thanks for your reply.
    Yes, I agree. I use conventions with my programs. But my real problem was with a real application and then I did quickly this simple code to help others to understand the problem and give a fast reply...
    Let me know if that works. (It was fine on my
    machine.) - MODYes it works fine, thanks.... and Damn...Murphys law again, the only option I didn't tried is the solution to my problem... :)
    Thanks again...

Maybe you are looking for

  • Which business object to be used BUS2015 or BUS2009

    Hi Workflow gurus, I have an issue in sending external mail when Purchase requisition is saved. Issue: When purchase requisition is saved, I need to send an external mail to MS outlook of the approver. Here the issue is whether I should use the busin

  • Problem with Webdings Font in Keynote

    When I select Webding font, this is what I get: ABCDEFGH I have opened the font book and the font appears correctly in there.  I just can't get it to show up in my presentation.  I'm using version 6.2.2 and everything was working fine until I got a p

  • Can you block a number from ringing, however still get voice mail.  Is that possible???

    There are some folks that call so much and it seems at just the wrong time.  I'd like to able to block them so my phone doesn't ring and yet, still get the voice mails that I can check at a later date when it's convenient.   Is there a way to do that

  • Metro Ethernet Design question

    Hello, I was wondering how service providers guarantee their security protection in the Metro Ethernet model, especially when Internet is one of the applications used over the Metro network. For example: The customer edge switch (3550) is connected d

  • Logic Express 7.2 can't find contiguous sync to sync video properly

    I'm trying to Sync video in Logic Express, I remember in Logic Pro that there was a contiguous Sync section that you could uncheck on the movie and then the movie would play fine, but now I keep on seeing the movie continually hunting for the correct