Adding a actionlistner to the button

Is there a way of adding a actionlistner to the button with out getting a error like this one.
non-static variable this cannot be referenced from a static context
import javax.swing.*;
import javax.swing.UIManager;
import java.awt.*;
import java.awt.event.*;
import com.l2fprod.gui.plaf.skin.*;
import javax.swing.JButton;
public class Simon5 extends JFrame
    private boolean  toggle;
    public static void main(String[] args)
        try
            Skin theSkinToUse = SkinLookAndFeel.loadThemePack("chaNinja-Bluethemepack.zip");
            SkinLookAndFeel.setSkin(theSkinToUse);
            UIManager.setLookAndFeel(new SkinLookAndFeel());
        catch (Exception e){ }
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame fr = new JFrame("Simon3");
        JPanel jb = new JPanel();
        Simon5 sex = new Simon5();
        Component contents = sex.createComponents();
        fr.getContentPane().add(contents, BorderLayout.EAST);
        fr.getContentPane().add (jb, BorderLayout.NORTH);
        fr.addWindowListener(new WindowAdapter()
            public void windowClosing(WindowEvent evt)
                System.exit(0);
        jb.addActionListener(new LookAndFeelL(fr));
        JButton bob = new JButton("Holy Shit!");
        jb.add(bob);
        jb.setBackground(Color.blue);
    fr.setLocationRelativeTo(null);
    fr.setMinimumSize(new Dimension(470, 320));
    fr.setBounds(new Rectangle(160, 125, 470, 320));
    fr.setVisible(true);
    }

Is there a way of adding a actionlistner to the
button with out getting a error like this one.
non-static variable this cannot be referenced from a
static contextIt has nothing to do with ActionListeners. Somewhere you're trying to access an object variable without a reference to any object, from the static context.
You know, being able to search for information is actually a good skill for programmers to have. You might want to acquire it, too.

Similar Messages

  • Adding our logo as the button??

    Here is what I want to do. I have set up the main menu file in photoshop. I already added the text for my sections(play, extras, chapters) What I want to do is bring in our logo to DVDSP, which I already did, and use that as the actual function for the play, extras, and chapters. For example, when I want to play, I want the logo under play, then when I press over, I want the logo to go to the next button and so on...
    Can somebody help me figure out how to make my logo the button function?
    Thanks

    I think I may not be quite following 100% (and if you can post what you are describing if the items below do not help, I can take a look)
    Anyway, take a look here, a way to make highlights over video (uses Motion to make the video and exports an image as an overlay from Motion, but concept works with Photoshop also for the overlay and in the other links.)
    http://dvdstepbystep.com/motion.php
    You can place the logo in the video and then make an overlay to highlight the logo, or you can just make the overlay of the logo and map it out.

  • Adding an image to the Static Button Widget

    Hi all
    I managed to convince my client to let me do my own navigation instead of using the by default navigation bar and its limitations. I finally will be able to do branching and customised feedback on several slides! Great. BUT. There is a but. I need to make the new buttons look like the current ones: Pause/Play, previous, next, TOC and Exit.
    I was happy to discover that I could use a static button widget on my master to deal with my previous and next buttons for all my standard slides. But when I try to add an image of my button the way I want it to look, it looks like that:
    If I resize the button the picture remains at the same size:
    I don't get the Image feature here at all and I wonder if it's possible to customise the button with our own pictures...
    Any success anybody?

    Alright thanks for your suggestions. Yes I am publishing to a slightly different location and I pasted the picture at the root of the published folder. The pic is found but it appears tiny:
    It should replace the button by default but it is added to the button actually, by its side.
    Cheers
    Helene

  • I'm having trouble with the new reminder app for iOS 6 on my iPhone 4s.  The button for adding a reminder has disappeared. Is this a bug or am I missing something?

    The button for adding a reminder seems to have disappeared.  Is this a bug or am I missing something?

    It should be on the top of any list you create.  It is the Plus Sign in the upper right hand corner of the "Paper".

  • I am new at Captivate 8 and I have created a learning project using an existing power point presentation.  I have added a button that will allow my students to view a video on the subject.  When I run the project in Preview the button works but when I pub

    I am new at Captivate 8 and I have created a learning project using an existing power point presentation.  I have added a button that will allow my students to view a video on the subject.  When I run the project in Preview the button works but when I publish it, it stops working.

    I added an Interactions button and in the Actions on Success I open an URL or file. I have placed the video on our web server.   In the URL I point to our web server "http://www.wmabhs.org/Media/Add Client 3rd Party Coverage.mp4".  If I run this from any browser it works.  So what do you think I have done wrong?

  • My iPhone got wet.. The phone is working except the home button but Siri is working.. I had also added the assistant touch but in that also the button did not work.. So what should I do???

    My iPhone got wet.. The phone is working except the home button but Siri is working.. I had also added the assistant touch but in that also the button did not work.. So what should I do???

    The phone is damaged. Take it in to an Apple Store or authorized service provider. More than likely you will have to pay for an out of warranty replacement.

  • Latest update of Firefox is REALLLLLY slow. Is it just all the extra functionality that has been added or is there a button I need to press to make it the same speed as it use to be. Can I downgrade to last version?

    Latest update of Firefox is REALLY slow. Is it just all the extra functionality that has been added or is there a button I need to press to make it the same speed as it use to be? I'll have to start usin safari again as this isn't funny anymore
    Can i retro grade back to the last version?

    uninstalled firefox ....deleted all files still remaining under mozilla firefox directory in program files ... to avoid having to reprogram all my settings, reisntall all addons as well .. I did not remove anything from mozilla firefox that is stored in either appdata or under the windows users directory (if any)
    ... the as suggested reinstalled the latest version of the firefox browser using the link you provided in the email ..; tested and several issues still remain present and unresolved ....
    so please this is urgent or I will have to jump browsers and start using chrome .. because we work 14 hours a day 6 (sometimes 7) days a week, to get ready for the launch of our newest venture and we cannot lose that much days on browser related issues ... so please instead of putting me through week long step process .. of do this .. do that .. can you please actually look into the issue from your end .. I use firefox for so many, many years thta I deserve this kind of support .. thnx Robert

  • When I try to setup my iCloud, after adding my AppleID & password, the next screen is the EULA (with an Agree and a Disagree button) - I press Agree - Nothing happens.  It appears to freeze.

    When I try to setup my iCloud, after adding my AppleID & password, the next screen is the EULA (with an Agree and a Disagree button) - I press Agree - Nothing happens.  It appears to freeze.  This phone was previously owned and the last owner's apple id is what defaults...  I do not know the last owner's password. - I just want to get rid of that person's iCloud in order to create my own with my own account.

    With iOS 7 you will not be able to delete the iCloud account without providing the password for the iCloud ID.  If it is the previous owner's account, you will need to have them remove it from their ID as mentioned in this article: http://support.apple.com/kb/TS4515.

  • Adding a url to flash buttons in Dreamweaver

    I have a web site built and I have recently added Flash buttons and I need to add my web pages to the buttons. How would I go about doing this?

    Let's say you create a button symbol.  Since it is a button, it is already a self animating object that will react to mouse interactions, but only visually at this stage.  The first thing you need to do to make it useful code-wise is to assign it a unique instance name.  So you drag a copy of it out to the stage from the library, and while it's still selected, you enter that unique instance name for it in the Properties panel... let's say you name it "btn1"
    In AS3, to make a button work with code, you need to add an event listener and event handler function for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:
    btn1.addEventListener(MouseEvent.CLICK, btn1Click);
    The name of the unique function for processing the clicking of that button is specified at the end of the event listener assignment, so now you just have to write that function out:
    function btn1Click(evt:MouseEvent):void {
       var url:String = "http://www.awebsite.com/awebpage.html";
       var req:URLRequest = new URLRequest(url);
       navigateToURL(req);

  • How to add a new button in IC tool bar and handle the event for the button?

    Hi,
        I am working on CRM 2007 Interaction center. To add a new button to IC toolbar, customizing is available to define a new button and then assign in to the profile.
    In SPRO->CRM->IC webclient->Customer Specifc System Modifications->Define Toolbar Buttons, I defined one new button with ID ZSTART.
    Now in SPRO->CRM->IC webclient->Basic Functions->Communication Channels->Define Toolbar Profiles , I selected Default profileid and in Generic Layout Buttons Tab, I added the new button ZSTART in Position 3.
         So after completing the customizing when the user logs in using role IC_AGENT,  the button (with ID:ZSTART) gets displayed in the IC toolbar too.
          Now on click of this button, I need to create an object.
    To do so, I have to catch the event which is raised by this new button.
           Please let me how to implement the event handler for this new button. What will be the event name for this button click event and how I can subscribe for it ?
         Please let me know if anyone of you have already worked on similar requirements.
    Regards,
    Manas.
    Edited by: manas sahoo on Jul 22, 2008 7:49 PM

    Hello Manas,
    There are a couple of threads in the community that might help you out (if you haven't already found them):
    Re: IC Web Client Toolbar
    /message/3621917#3621917 [original link is broken]
    Regards,
    Renee Wilhelm
    Edited by: Renee Wilhelm on Nov 6, 2008 7:46 PM

  • Ideas for Adding a "One Click" Print Button to VA01 Overview Screen

    I am not an ABAP developer and am doing some preliminary functional investigation to determine the best way to add a simple "one-click" button that allows a Sales Order Confirmation output to be sent to the printer.
    Can someone that really knows, tell me whether or not a custom menu item can be added to VA01 and VA02?
    I have seen lots of threads telling folks how to find user exits and menu exits for a program so I don't need that advice.  Rather, looking for someone who has already investigated this for VA01 and VA02 and knows the answer.
    Problem Statement:
    Our users would like a "quick print" button on the VA01/VA02 application toolbar that immediately spools the Order Confirmation output to the printer. Our users want to print the output on demand, i.e., they do not want the output to automatically be printed when the order is created because a printout is not always needed. We already have condition records created with Dispatch Time set to 3 - Send with application own transaction. However, it takes 7 or more clicks to print the output on demand by navigating the menu (Extras > Output > Edit...Further Data...etc.) and changing the Dispatch Time to 4 - Send immediately when saving. This is a big ergonomic issue and a time killer.
    Although the number of clicks to print are less when printing the output from the VA02 initial screen (via menu Sales document > Issue Output To), this is not acceptable when creating new orders. Really need an on-demand, "one click" quick print button on the VA01 screen. As an aside, we have a totally custom transaction for preparing sales order data (shopping cart-like way of finding materials and entering required data) that then calls VA01 and fills in all of the information. When saving in VA01, the user is returned to our Z-transaction so asking the user to subsequently run VA02 to print is not practical.
    Current Output Determination:
    We have custom output type ZBS0 (copy of BS0). Condition records for print medium are set to Dispatch Time = 3.
    Ideal Solution:
    Add a Print Icon to the application toolbar as described above.  From the button, write custom code that calls RSNAST00 (or is there a better way?) to send the output to the printer.
    Any feedback on how others have solved this problem would be greatly appreciated.
    Rob

    Still looking for input from anyone that has had experience trying to add a menu item or toolbar button to VA01.  In our case, for sending output.
    Madhu,
    Please again read my Problem Statement in my original posting for the business requirement.  We are using ECC 6.0.  Yes, I know that transaction VA02 has Sales Document > "Issue Output To" that allows you to print.  However, we want to be able to print from the VA01 Overview screen after all of the sales order information has been entered.  We would like to be able to click a print button which would save the new sales order and immediately issue the output.  Again, we do not want the output to automatically print for every new sales order - we want to be able to print only when needed.  The conditions that a sales person would use to decide to print a copy are too numerous or varied so they cannot be automated in a condition record.  Of course we do use condition records for creating the output but we do not send immediately on save.
    When creating a sales order, the sales person does not want to do the extra clicks and key strokes to then navigate or open a new VA02 session to print from the VA02 initial screen.  And as described in my original posting, it is a lot of clicks navigate the VA01 Extras > Output menu to change the output to print on save.
    If you observe the "day in the life" of a sales person and see all of the key strokes and clicking required to create an ECC 6.0 sales order, you understand why the extra 7 to 11 clicks to just print an output is very annoying.  We have created a totally custom Z-transaction that allows our sales folks to capture everything need for a new sales order all on one screen with no tab views.  We then launch VA01 to fill in all of the data entered in our custom transaction.  This all works very well and is a huge time saver for our sales staff.  Now we are looking to save a few more clicks by simplifying the printing.

  • [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

    When selecting a menu item I used to click the left mouse button and hold it down, move the pointer to the desired menu item and release the mouse button. Everything works fine in the mine menu, but there's a problem when adding new adjustment layer from the layer panel: when I release the button nothing happens, I have to press the button again. In previous PS version it worked fine. How can I fix this?

    I don't think that is user fixable, meaning you'll have to wait till adobe fixes it with an update.
    Photoshop cc 2014
    windows does not work
    mac does work
    Did you already post over here:
    [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

  • Updated to Firefox 5, and now my Yahoo Toolbar won't show any of the buttons.

    I delayed updating to Firefox, because V3 worked so well and V4 sucked. But as a security concern, I finally made the upgrade and discovered my Yahoo Toolbar isn't working properly.
    The Toolbar is there, but the buttons I've all added are gone. I can't make changes in preferences, the toolbar is enabled... I just have no buttons.
    I've upgraded to the most recent Toolbar, which was supposed to work with Firefox 5... but it doesn't.
    Help!

    My FF6.0 was fine till it updated (automatically) and then no toolbar buttons.

  • After adding list view into the web part page, the items and list control ribbon is not activated.

    I created new webpart page and added one list view web part into the page.
    However I can see the ITEMS and LIST tabs on ribbon area, but all the buttons are deactivated.
    Do I have to activate any feature for this or any settings are needed for the webpart?
    I already have full permission for this site.
    For your easy understand I added the screenshot.

    Thanks for you advice.
    However I am currently using the context menu and edit link in the view.
    My Client keep complaining about the ribbon is not activated even thought it works fine in the SharePoint 2010.

  • Changing the button fill color in Captivate 7?

    I am pretty sure that when I used Captivate 6 and I created a button, there was an option in the Properties pane to allow me to change the fill color of the button. I am using Captivate 7 now, and I no longer see this option. Under the "General" tab, it allows me to change the button type, caption, make it transparent, or allows me to see button widgets. Did they remove the ability to simply change the fill color of a button?

    I'm wondering if this is something that was maybe added in a service release. Either that or you may need to reset your preferences.
    Mine has a section titled Fill & Stroke as shown below.
    Cheers... Rick

Maybe you are looking for

  • Running Pandora in background

    Is it possible and/or how can Pandora run in the background behind other apps? Thanks!

  • SMTP routing all messages to Postmaster to Root and then null...

    Anyone got any idea what might be causing this...? Have a very simple OS X Server.  Until upgrading to Server 3 / 10.9 it all worked fine.  Then, after upgrade, I stopped getting mail on the Postmaster account. Digging into SMTP log shows that server

  • Similar method like XtAppAddInput(..)

    I have used XtAppAddInput()method which is under X11 utility library in unix. Can you suggest any utility in java which allows similar funtionality? For more details about X window methods, pliz go thru Unix man page.

  • Cannot access Hotmail

    I have just bought a new Apple Macbook. I am unable to access hotmail - Safari gives message re. unable to access server. I have cleared cache and reset Safari. No joy. I have gone to Preferences and enabled "cookies". Please can anybody help. I am a

  • TB stops responding. It takes forever to work. How can i fix this?

    Thunderbird takes a long time to load. When I open it and try to read an email, it states "not responding". this happens each time i try to read an email in my inbox. It is a Gmail account. Can I uninstall and reinstall without losing anything?