Buttons in panel gives error

i created a class that has many buttons and each button calls something on a Canvas.
but i keep getting errors.
THE ERROR ARE
C:\WINDOWS\Desktop\WINDOWS\pickdraw\ShapeButtons.java:36: local variable drawArea is accessed from within inner class; needs to be declared final
drawArea.setShape(1);
^
1 error
THE CODE IS
import java.awt.*;
import java.awt.event.*;
import java.lang.*;
import java.lang.String.*;
import java.awt.Graphics.*;
public class ShapeButtons extends Panel implements ItemListener
Checkbox fill = new Checkbox("Filled");
Choice sel;
PickCanvas drawArea;
Button rect, oval, poly, del, clear;
public ShapeButtons(PickCanvas drawArea)
this.drawArea= drawArea;
sel = new Choice();
add(sel);
sel.add("selected");
sel.add("deselected");
rect = new Button( "Rect" );
ActionListener lis1 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setShape(1);
rect.addActionListener( lis1 );
oval = new Button( "Oval" );
ActionListener lis2 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setShape(2);
oval.addActionListener( lis2 );
poly = new Button( "Poly" );
ActionListener lis3 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.setShape(3);
poly.addActionListener( lis3 );
del = new Button( "Delete" );
ActionListener lis4 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.delete();
del.addActionListener( lis4 );
clear = new Button( "Clear" );
ActionListener lis5 = new ActionListener()
public void actionPerformed( ActionEvent e )
drawArea.clearCanvas();
clear.addActionListener( lis5 );
add(rect);
add(oval);
add(poly);
add(del);
add(clear);
add(fill);
fill.addItemListener(this);
getSel().addItemListener(this);
getSel().select("deselected");
public Choice getSel()
          return sel;
public void setSelected(String s)
     getSel().select(s);
public void itemStateChanged(ItemEvent e)
if(e.getItemSelectable() == fill)
drawArea.setFill(fill.getState());
if(getSel().getSelectedItem().equalsIgnoreCase("selected"))
               drawArea.setSelect(1);
     else if(getSel().getSelectedItem().equalsIgnoreCase ("deselected"))
               drawArea.setSelect(2);
IN THE PICKCANVAS I DO HAVE A METHOD WHICH IS:
public void setShape(int action)
this.action = action;
AND I DECLARED ACTION IN THIS CANVAS AS int action;
SO I DON'T KNOW WHAT'S WRONG. HELP.     

drawArea is defined as a member variable of ShapeButtons, so normally it should be usable from an anonymous inner class as you are trying to use it. However, you have named a parameter of the constructor with the same name as the member variable. This means that when you use that variable name, you are referring to the local variable. If local variables are not final, then they cannot be used in inner classes defined within that function. You have three options:
1) Rename the constructor parameter so that drawArea always refers to the member variable.
2) Declare the constructor parameter final with the final keyword.
3) Refer to the drawArea inside the inner classes using the 'qualified this' variable.
The third option is the one I would use, the first being my second choice and the second option the last.
Inside the inner class, 'this' refers to the instance of the inner class. You can refer to the instance of the outter class associated with that instance by prepending the name of the enlosing class with a '.' to the 'this' keyword. For example:
public ShapeButtons(PickCanvas drawArea) {
    this.drawArea= drawArea;
    rect = new Button( "Rect" );
    ActionListener lis1 = new ActionListener() {
        public void actionPerformed( ActionEvent e ) {
            //ShapeButtons.this refers to instance of enclosing class
            ShapeButtons.this.drawArea.setShape(1);
}I was being nice and I answered your question, but next USE CODE TAGS!!!
E. West

Similar Messages

  • Next Button in Report gives error

    We called Report as Application Component
    in the content area. When click the NEXT
    Button to see the next page, It gives the
    Error Like:
    Name "Report_Name" is longer than 30 chars.
    But we have given the Report Name less than
    30 chars.
    Is it bug or anyother way to proceed.
    Thanks,

    Hi,
    With the reports it is not possible. If you want to achieve something like this you should make of dynamic pages to develop the output and the buttons.
    Thanks,
    Sharmila

  • Delete document button in ribbon gives javascript error: g is not a function

    Hello,
    We have a default SharePoint 2010 installation. So an out of the box site template, out of the box document libraries/lists etc, out of the box theme (default one) etc.
    When we check the checkbox next to a document in the shared documents library, the tab in the ribbon automatically switches to the document tab. In this tab there is a button "delete document". When I click that I get a confirmation request, I click OK,
    and then I get a little yellow box in the upper right corner that tells me SharePoint is deleting the document, and then nothing happens.
    The document stays where it is, no refresh of the page as SharePoint should do...
    I have a javascript error, and in FireFox it tells me "g is not a function" on line 2 of the file inplview.js?rev=AohvE9XEf%2FI78tuaw1TGAA
    Line 2 contains like 100 javascript functions on the same line, so it's impossible to find out which function or command throws the error.
    This is not a file created by me, so I guess it comes with SharePoint and that I should not touch it.
    So what do I do now?
    I have another server that we use for SharePoint testing, and there the button works as it should, so it's not SharePoint either...
    Problem is that we use this server to give basic SharePoint trainings to our employees, so it's not a very good start when we have to say the delete button is broken but will work in the actual production environment...

    Hi Stefan,
    In our case the problem was caused because initially we had set the authentication to basic authentication, and then changed the setting to claims based authentication. Somehow this causes SharePoint to give errors.
    I don't know if the same error occurs when you choose claims based authentication from the beginning (so without changing it after creating the web application).
    In our case we had the same behavior, in the ribbon the button didn't work, but in the context menu it did work.
    I don't have any other info, as I said in my previous post, I couldn't find any info on this issue on the net. We figured this one out ourselves. I don't know how to keep the claims based authentication, for us it was just a test to try out that type of
    authentication. Since we were running into problems and we didn't really need it we reverted it back to basic authentication.

  • Just one needed particular GoDaddy web hosting account button link gives error in FF but ok in Pale Moon and IE

    Greetings:
    I've searched but am unable to find a clue. Using Win 7 Home Premium (updates current) on HP DV3T-2000 64-bit.
    Recently (possibly after upgrading to FF 14), on godaddy.com on my web hosting product page, clicking the 'Launch' button throws a godaddy error pg. All other launch buttons operate normally, as do 'all' the buttons (including the tricky one) in Pale Moon and IE.
    I have several times cleared the cache and deleted all g-d cookies through options - show cookies; then closed the browser and restarted the machine. I then disabled all add-ons, tried the above again, no difference so have reactivated the plugins (which were and are current as to updates).
    Here is the text from the godaddy error pg:
    "Error
    There was an error in the application. We apologize for the inconvenience. This error has been logged and reported.
    Click here to go back to your account list."
    The word above [Click] 'here' usually does not work either. Below is the url from the address bar: (When going to the url on a clean new tab, the error page pulls up without the 'Click here to go back to your acct list' ):
    https://hostingmanager.secureserver.net/error.aspx?aspxerrorpath=/AccountPanel2.aspx
    (However, people without a g-d acct will not be able to navigate to the web hosting product page.)
    Thank you very much for your help.
    PS:
    This list of Installed Plugins was auto-filled into the text box below the question text box. I do have more plug-ins than this in use which I can supply if needed. Thank you again!
    * Shockwave Flash 11.4 r402
    * Adobe PDF Plug-In For Firefox and Netscape "9.5.2"
    * Google Update
    * Shockwave Flash 11.3 r300
    * The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    * NPRuntime Script Plug-in Library for Java(TM) Deploy
    * Next Generation Java Plug-in 10.5.1 for Mozilla browsers
    * GEPlugin
    * 5.1.10411.0
    * NDS Player Plugin
    * npPCShow Plugin
    * Windows Activation Technologies Plugin for Mozilla
    * Logitech Device Detection
    * E-centives Coupon Activator
    * Coupons, Inc. Coupon Printer Plugin
    * Coupons, Inc. Coupon Printer DLL
    * Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
    * np-mswmp

    Hi hedera, when you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    (You also can clear Firefox's cache completely using:
    orange Firefox button ''or'' Tools menu > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now")
    (2) Remove the site's cookies (save any pending work first) using either of these. While viewing a page on the site:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    If you can't access the relevant domain without it closing, you can edit the domain at the top of the dialog in order to call up a list of its cookies.
    Then try reloading the page. Does that help?

  • AP Invoice Approval- Approve button gives error

    Hi all,
        I work on oracle applications 11.5.10 and we have modified the AP Invoice approval workflow APINV to send mail notifications to approver.
        The mail is sent to a approver mail address in Microsoft outlook web app as intended. But when the approver clicks on APPROVE or REJECT button, we get an error as below.
         I could see all the listener agents are up and running. Could anyone please shed some light on this issue.
    Error:
    Your request couldn't be completed.
    This may have occurred for security reasons or because your session timed out.
    Thanks,
    VickySure

    hi,
    please open a service request with oracle support to analyze the problem.
    in portal 10.1.4 we offer an easy way of doing this with our new CMEF (content management event framework). you can easily check for pending items and send out an email.
    find more information here:
    http://download-uk.oracle.com/docs/cd/B14099_15/portal.1014/b14135/pdg_cm_cmef.htm
    regards,
    christian

  • Report server gives error

    i have installed oracle 9i AS (EE)on NT,
    Now i want to display reports in pdf/HTML on web broswer. For that i am trying to run report tester page given through broswer it is showing one page having Button(run report), when i click on that, it gives error unable to connected to database, and request rejected by report server. WHY ???
    i want to display reports through JSP How it can be done? Does anybody knows it?
    Naresh
    null

    Please check at http://<server>/dev60html/runrep.htm for follwings :
    01. your test.rdf must be in report60 folder
    02. your db must contain scott user
    03. connect string must be tested and give the same inplace of test
    04. your webhost may contain a dot, please check this should be the same as yours
    hope this will help
    bye !

  • Playing mp4 audio gives error message "Video can't be played because the file is corrupt"

    Playing a particular mp4 audio file directly from a website link gives error message "Video can't be played because the file is corrupt". However other mp4 audio files from this same website do work correctly. What can I do to get all the the mp4 audio files to play directly from the same website? I must have the correct plugins, etc. since the other files play. This file is not playing from YouTube, is it on the website.
    Thank you for your help.

    What is the link to the site and file in question?
    MP4 files should be handled by Firefox itself, not a plug-in.
    # Click the ≡ Menu Button and choose Add-ons.
    # Click Plugins.
    # Set every plug-in to "Never Activate".
    # Try loading the file again. Is there any difference?
    You have two versions of Flash Player installed. Perform a clean installation of Flash Player as follows.
    # From the following page, save the uninstaller somewhere handy, like the desktop.
    #* [http://helpx.adobe.com/flash-player/kb/uninstall-flash-player-windows.html#main_Download_the_Adobe_Flash_Player_uninstaller Uninstall Flash Player for Windows | Adobe Support]
    # From the following page, save the installer for other browsers. If you also use Flash Player in Internet Explorer, also save the ActiveX version.
    #* [http://helpx.adobe.com/flash-player/kb/installation-problems-flash-player-windows.html#main-pars_text_4 Direct downloads of Flash Player for Windows | Adobe Support]
    # Exit all applications.
    # Run the uninstaller.
    # In Windows Explorer, try to open the following folders. If they still exist, delete them manually.
    #* <pre>C:\Windows\system32\Macromed\Flash\</pre>
    #* <pre>C:\Windows\SysWOW64\Macromed\Flash\</pre>
    #* <pre>%AppData%\Adobe\Flash Player\</pre>
    #* <pre>%AppData%\Macromedia\Flash Player\</pre>
    # Restart your computer.
    # Run the installer for other browsers.
    # Run the ActiveX installer if you downloaded it.

  • Lightroom trial doesn't show complete menu selections or import button.  Also get error message on launch:  An error occurred when attempting to change modules.  I am unable to find/see the following file to try renaming the SLCache and SLStore files:  Sy

    Lightroom trial doesn't show complete menu selections or import button.  Also get error message on launch:  An error occurred when attempting to change modules.  I am unable to find/see the following file to try renaming the SLCache and SLStore files:  System Library/Application Support/Adobe.  Any ideas?  I only have 16 days left on the trial and have been unable to get it to work on my Macbook Pro.  This is all I am seeing after Lightroom opens.  Thanks!

    Thanks to both of you for attempting to help.  I finally figured out what was wrong . . . it was a Permissions problem.  Very frustrating, but after scouring the troubleshooting tips I finally found the one that solved my problem.  I had to add a User and give it Read/Write privileges to Lightroom.  The file I had to add the User to was Hidden on my Mac, so that added an even bigger challenge to the mystery.  Only a few days left on my trial version!  I hope I have time to try it out!

  • ITunes gives error code -54 when sync with my iphone 5

    iTunes gives error code (-54) when i try to sync with my iphone5

    I am having the same issue. Since updating to iTunes 11 my iPhone 5 will no longer wirelessly sync. I am operating the latest version of Mountain Lion on a two month old Macbook Pro. When I plug in the USB I go through the steps of making sure the box is clicked to Wireslly sync, but after a few minutes of un-plugging the cord my phone dissapears from my devices. It tries to locate it, but cannot.
    Furthermore, when I launched iTunes 11 for the first time my phone was synced, but since I accidenttly hit the eject button in the top right, this button has yet to come back. Even when the iPhone is linked via USB. Am I Crazy, stupid, or is this a bug?
    BTW, how did MrTrav15 have this problem on 10/17 a month-and-a-half before the launching of iTunes 11?

  • Ldap function gives errors in apex 4.1.1

    Hi all,
    I have a custom function for ldap authentication.
    create or replace
    FUNCTION bgt_ldap_authenticatie_func (
          p_username IN VARCHAR2
        , p_password IN VARCHAR2
    RETURN BOOLEAN
    AS
        l_ldap_host     VARCHAR2(100) := 'domain';
        l_ldap_port     VARCHAR2(4)   := '389';
        l_session       DBMS_LDAP.SESSION;
        l_retval        PLS_INTEGER;
        l_login_result  BOOLEAN := true;
        l_error VARCHAR2(4000);
    BEGIN
        IF p_password IS NULL THEN
            l_login_result := FALSE;
        ELSE
            -- I. LDAP-Login
            BEGIN
                -- LDAP Exceptions
                DBMS_LDAP.USE_EXCEPTION := TRUE;
                -- LDAP-Handle initialiseren ...
                l_session := DBMS_LDAP.INIT(
                      hostname  => l_ldap_host
                    , portnum   => l_ldap_port
                l_retval := DBMS_LDAP.SIMPLE_BIND_S(
                      ld        => l_session
                    , dn        => 'domain\' || LOWER(p_username)
                    , passwd    => p_password
                -- Afmelden van LDAP Server.
                l_retval := DBMS_LDAP.UNBIND_S(ld => l_session);
                -- Registratie was succesvol.
                l_login_result := TRUE;
            EXCEPTION WHEN OTHERS THEN
                l_login_result := FALSE;
            END;
        END IF;
        RETURN l_login_result;
    END;This is working fine on Apex 3.2 and Oracle 10g.
    I now have a development environment with apex 4.1.1 and Oracle 11g.
    I have run above function, with success (no compilation errors).
    I then go to authentication schemes to create my ldap authentication:
    host: domain
    port: 389
    Distinguished Name (DN) String: ou=domain,ou=New Security Groups,ou=Applications,cn=Budgeting_Dev
    Use Exact Distinguished Name (DN): Yes     
    LDAP Username Edit Function: return bgt_ldap_authenticatie_func;      
    When I click on the create button, I get
    1 error has occurred
        ORA-06550: line 5, column 8: PLS-00382: expression is of wrong type ORA-06550: line 5, column 1: PL/SQL: Statement ignoredWhy is it that I'm getting an error when trying to create the authentication when the function has been successfully compiled?
    Thanks,
    Diana

    Hi Diana,
    in addition to Christian comment, the "LDAP Username Edit Function" attribute expects a function which returns VARCHAR2 and not BOOLEAN as your function returns. It should also not be used to actually perform a LDAP lookup, instead it returns the LDAP Username you want to give APEX to perform the LDAP lookup.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • "Create Object " statement gives error: statement is not accessible

    Hi All
    U must b doing good.
    I am new in ABAP Objects.
    I have writeen a simple Class definition n Implimentasion code.
    but whenever i write statement "Create object", it gives error.
    'm working on SAP Dev 4.7.
    the code was like this:-
    class counter definition.
      public section.
        METHODS: set IMPORTING VALUE(set_value) TYPE i,
                 increment,
                 get EXPORTING VALUE(get_value) TYPE i.
       private section.
       DATA count TYPE i.
    ENDCLASS.
    CLASS counter IMPLEMENTATION.
      METHOD set.
        count = set_value.
      ENDMETHOD.
      METHOD increment.
        count = count + 1.
      ENDMETHOD.
      METHOD get.
        get_value = count.
      ENDMETHOD.
    ENDCLASS.
    DATA: cnt_1 TYPE REF TO counter.
    DATA number TYPE I VALUE 5.
    CREATE OBJECT cnt_1 .
    CALL METHOD cnt_1->set
      EXPORTING set_value = number.
    DO 3 TIMES.
       CALL METHOD cnt_1->increment.
    ENDDO.
    CALL METHOD cnt_1->get
      IMPORTING get_value = number.
    write: number.
    its giving error like:-"Statement is not accessible."
    plz tell me the way to resolve this error.
    thanx n regards
    Prashant tiwari

    hi prashant....
      this is the link to post your therads for abap objects:
      [ABAP Objects;.
      if you want to reward, on the left of every reply ther would be some radio buttons like answere, helpful answer,... so on. click the radio button which suits you. answered closes the thread and other points are displayed there itself.
    ---regards,
       alex b justin

  • Downloading mountain Lion OS X v10.8 and it gives "error occured"

    I am Downloading mountain Lion OS X v10.8 and it gives "error occured", and now i can't see any download/Resume button in the "Purchase section" in App Store. what should i do now ??

    Restart your Mac and try again.
    Keep in mind, v10.8 Mountain Lion is a 4.35GB (approxmiately) file size and requires a high speed broadband internet connection.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • IPad 1 gives error message -54 when sync music  it won't sync songs

    It gives error -54 when sync music

    Try a system reset.  It's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until the screen blacks out or you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.

  • Copying a function group gives error

    Dear All,
    I am copying a function a group JV05. I have copied evrything i.e all the includes, TOP etc. But when i activate the group it gives me error. What could be the problem? I have tried to activate the includes & TOP individually. Still it gives error for some variables. Please help me out.
    Thanks in advance!
    Regards,
    Prasad

    hi ,
    **Go to se80..**
    **1. Select function group**
    **2. Enter JV05 as name  "-----> click on spectacles button.**
    **3. Right click on JV05**
    **4. Select copy  "--------> give a Zfunction group name**
    **5. "Copy all the function modules in this function group with zfunctionmodules.**
    **6. Save & Activate.**
    Regards,

  • While uploading material give error

    hi friends !!!!!
    while uploading material give error
    item categary is not assign to g/l a/c and chart of a/c
    thanks in advance

    Dear hanumant
    Go to OMS2, select the material type and double click on "Quantity/Value Update" button on your left screen.
    Here for the combination of valuation area and material type, choose the two boxes "Qty.updating" and "Value updating".
    Thanks
    G. Lakshmipathi

Maybe you are looking for

  • Novo Cálculo de IPI na MP 540

    Amigos, Não sei dúvidas de localização BR são colocadas aqui mas vamos lá: O governo acaba de editar a Medida Provisória 540 que vai alterar a forma de tributação do cigarro. Como sabemos, a função que calcula impostos na TAXBRJ não nos permite inser

  • Create a session programatically (ie, outside of APEX).

    Following on from this thread (Using APEX Collections outside of APEX? we have a requirement to be able to create a user session programatically in sqlplus etc, so that we can utilize the APEX collections framework in our existing developments. The i

  • Z60M Touchpad Right/Left Click Not Working

    I'm baffled.  I can move the pointer all day long with the touchpad, but I cannot select anything by tapping nor with the left and right buttons.  According the BIOS, everything with the ultranav seems normal and active.  I cracked open the palmrest

  • GX660R - 5870M Not being detected on anything other than drivers on MSI CD

    Hello, I installed everything, but the graphics drivers (Catalysts from the ATI website), will not detect the 5870M graphics card. If I use the ones on the MSI disc as provided, this works fine however. Can someone pelase help? I have tried numerous

  • JDBC best practice

    Hi, I am creating a simple desktop application for my own purposes. There will be only one user (me) and I need to use database. Let's say I have various events (button clicks etc) that triggers some actions on my database (update/select/delete). Sho