On-Enter action/ event on UI Elements Transparent Container/ Tray

Dear Experts,
Is there any way to implement the On-Enter action/ event on the UI Elements Transparent Container/ Tray?
Thanks.
Tee

Hi Tee,
As such there is no OnEnter event for either tray or transparent container but tray has some other events like onToggle associated with it.
Refer this online help: http://help.sap.com/saphelp_nw70ehp1/helpdata/en/42/b6836382323122e10000000a1553f7/content.htm
I hope it helps.
Regards
Arjun

Similar Messages

  • ********  Need to add any button activated ACTION EVENT***********

    Can anyone help me add any type of ACTION EVENT /ACTION LISTENER TO THIS CODE
    PLEASE REVIEW AND COMPILE IF NECESSARY. Ensure that it compiles without errors. Currently it compiles without errors. It opens up as a GUI window that accepts a password. If anyone could just add a button to it that will do just about anything, time check, date check whatever it would be great!!!!! THIS WAS COMPILED WITH THE JGRASP COMPILER JAVA ACCEPTED
    Thank you all,
    ********************** Bruce's Code*****************************
    import java.awt.*;
    public class TimeEntryForm extends Panel
    private Panel tallPanel = new Panel();
    private Panel tallPanel2= new Panel();
    public TimeEntryForm()
    tallPanel.setLayout(new GridLayout(3, 1));
    tallPanel.add(new Label("Hrs Total"));
    tallPanel.add(new Label("Any"));
    tallPanel.add(new Label("One"));
    tallPanel2.setLayout(new GridLayout(3,1));
    tallPanel2.add(new Label("Personal Leave "));
    tallPanel2.add(new Label("Hrs Total "));
    tallPanel2.add(new Label("Pay Calc "));
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0; c.gridy = 2;
    add(new Label("Social Security # "), c);
    c.gridx = 1; c.gridy = 0;
    add(new Label("TIME ENTRY FORM"), c);
    c.gridx = 1;c.gridy = 1;
    add(new Label("Enter Date Here "), c);
    c.gridx = 3;c.gridy = 2;
    add(new Label("Employee Name "), c);
    c.gridx = 3;c.gridy = 4;
    add(new Label("Sick Time "), c);
    c.gridx = 0; c.gridy = 3;
    add(new Label("IN OUT "), c);
    c.gridx = 0; c.gridy = 4;
    add(new Label("IN OUT "), c);
    c.gridx = 0; c.gridy = 5;
    add(new Label("IN OUT "), c);
    c.gridx = 0; c.gridy = 6;
    add(new Label("IN OUT "), c);
    c.gridx = 0; c.gridy = 7;
    add(new Label("IN OUT "), c);
    c.gridx = 0; c.gridy = 8;
    add(new Label("IN OUT "), c);
    c.gridx = 0; c.gridy = 9;
    add(tallPanel2, c);
    c.gridx = 1;c.gridy = 11; //note, sets y
    add(new Label("Hrs Worked Today "), c);
    c.gridx = 1;c.gridy = 12;
    add(new Label("Pay Earned Today "), c);
    c.gridx = 2;
    add(tallPanel2, c);
    public static void main(String args[])
    Frame f = new Frame("Time Entry Form");
    f.add(new TimeEntryForm());
    f.pack();
    f.setVisible(true);
    }

    Hi java-luv,
    I am not sure if I understand the problem. But I was able to add a JButton to your code (using the JBuilder designer). The button just exists the application. Please check the listing below. Hope this helps.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class TimeEntryForm extends Panel
    private Panel tallPanel = new Panel();
    private Panel tallPanel2 = new Panel();
    private JButton jButton1 = new JButton();
    public TimeEntryForm() {
    tallPanel.setLayout(new GridLayout(3, 1));
    tallPanel.add(new Label("Hrs Total"));
    tallPanel.add(new Label("Any"));
    tallPanel.add(new Label("One"));
    tallPanel2.setLayout(new GridLayout(3, 1));
    tallPanel2.add(new Label("Personal Leave "));
    tallPanel2.add(new Label("Hrs Total "));
    tallPanel2.add(new Label("Pay Calc "));
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 2;
    add(new Label("Social Security # "), c);
    c.gridx = 1;
    c.gridy = 0;
    add(new Label("TIME ENTRY FORM"), c);
    c.gridx = 1;
    c.gridy = 1;
    add(new Label("Enter Date Here "), c);
    c.gridx = 3;
    c.gridy = 2;
    add(new Label("Employee Name "), c);
    c.gridx = 3;
    c.gridy = 4;
    add(new Label("Sick Time "), c);
    c.gridx = 0;
    c.gridy = 3;
    add(new Label("IN OUT "), c);
    c.gridx = 0;
    c.gridy = 4;
    add(new Label("IN OUT "), c);
    c.gridx = 0;
    c.gridy = 5;
    add(new Label("IN OUT "), c);
    c.gridx = 0;
    c.gridy = 6;
    add(new Label("IN OUT "), c);
    c.gridx = 0;
    c.gridy = 7;
    add(new Label("IN OUT "), c);
    c.gridx = 0;
    c.gridy = 8;
    add(new Label("IN OUT "), c);
    c.gridx = 0;
    c.gridy = 9;
    add(tallPanel2, c);
    c.gridx = 1;
    c.gridy = 11; //note, sets y
    add(new Label("Hrs Worked Today "), c);
    c.gridx = 1;
    c.gridy = 12;
    add(new Label("Pay Earned Today "), c);
    c.gridx = 2;
    add(tallPanel2, c);
    jbInit();
    public static void main(String args[]) {
    Frame f = new Frame("Time Entry Form");
    f.add(new TimeEntryForm());
    f.pack();
    f.setVisible(true);
    private void jbInit() {
    jButton1.setText("Exit");
    jButton1.addActionListener(new TimeEntryForm_jButton1_actionAdapter(this));
    this.add(jButton1, null);
    void jButton1_actionPerformed(ActionEvent e) {
    System.exit(0);
    class TimeEntryForm_jButton1_actionAdapter implements java.awt.event.ActionListener {
    TimeEntryForm adaptee;
    TimeEntryForm_jButton1_actionAdapter(TimeEntryForm adaptee) {
    this.adaptee = adaptee;
    public void actionPerformed(ActionEvent e) {
    adaptee.jButton1_actionPerformed(e);

  • How do you do action recording in Photoshop Elements like you can in regular photoshop?

    How do you do action recording in Photoshop Elements like you can in regular photoshop?
    One of my clients is a club promoter and they would like to put their logo on the bottom left of their photos from their events. Usually I can do this by opening the logo (which has like 50% opacity), copying the logo, recording an action set, pasting the logo i copied to memory into the photo, resize the photo and export and close the photo, save the action set and then just batch- automate and choose all currently opened images to run the action on.
    *I mentioned the 50% opacity because I want to put the logo on the photos but not totally hide what's underneath the logo.
    How do I do the same with photoshop elements?
    -Line

    Just another option that may work for you there are a number of relatively cheap and a couple of freeware programs that are listed here, there are many others I am sure.
    http://shareme.com/showall/Batch-Watermark.html
    I have not used any of these so I can not recommend of course but most have trial versions.
    Good Luck,
    Don

  • Action event of combobox

    Hi all..
    I have three combo boxes.
    the second combobox values are loaded when a element from first combobox is chosen.
    the third combobox values are loaded when a element from second combobox is chosen.
    it works fine the first time.
    but when i rechoose an element from the first combobox, the action event for the second combobox is fired without me clicking the second combobox and hence throws an null pointer exception.
    i have the functions written according to the action events.
    should i use any things with respect to the mouse click or something??

    Hi again..
    i used itemListener as u suggested but still face problem..
    the third combo box is not getting loaded.. ie the loadcurrent() is not getting called.
    below is the code..
    public void itemStateChanged(ItemEvent ie)
              Object source=ie.getItemSelectable();
              if(source==tname)
                   System.out.println("combo tname");
                   loadstd();
              else if(source==stdfile)
                   System.out.println("combo stdfile");
                   loadcurrent();
              else if(source==curfile)
                   System.out.println("combo curfile");
         }

  • Mouse Enter/Exit Events

    Hi,
    I've got a question regarding mouse enter/exit events. Specifically, I would like to know why so many mouse enter/exit events are generated. Suppose you stack multiple Panes like this:
    @Override
    public void start(Stage frame) throws Exception {
         Pane root = new Pane();
         frame.setScene(new Scene(root));
         addEnterExitHandlers(root, "root");
         Pane fst = new Pane();
         root.getChildren().add(fst);
         addEnterExitHandlers(fst, "first");
         Pane snd = new Pane();
         fst.getChildren().add(snd);
         addEnterExitHandlers(snd, "second");
         Rectangle rect = new Rectangle(0, 0, 100, 100);
         snd.getChildren().add(rect);
         addEnterExitHandlers(rect, "rect");
         frame.show();
    The addEnterExitHandlers() method simply registers event handlers for MouseEvent.MOUSE_ENTERED_TARGET and MouseEvent.MOUSE_EXITED_TARGET which print the event type's name together with the specified string.
    The resulting output looks like this:
    root MOUSE_ENTERED
    first MOUSE_ENTERED
    root MOUSE_ENTERED_TARGET
    second MOUSE_ENTERED
    first MOUSE_ENTERED_TARGET
    root MOUSE_ENTERED_TARGET
    rect MOUSE_ENTERED
    second MOUSE_ENTERED_TARGET
    first MOUSE_ENTERED_TARGET
    root MOUSE_ENTERED_TARGET
    root MOUSE_EXITED
    first MOUSE_EXITED
    root MOUSE_EXITED_TARGET
    second MOUSE_EXITED
    first MOUSE_EXITED_TARGET
    root MOUSE_EXITED_TARGET
    rect MOUSE_EXITED
    second MOUSE_EXITED_TARGET
    first MOUSE_EXITED_TARGET
    root MOUSE_EXITED_TARGET
    This output is not accurate, because I inserted empty lines to visually group related elements.
    As you can see, a MOUSE_ENTERED event is fired for every node and all parent nodes receive MOUSE_ENTER_TARGET events. I just thought that it would be sufficient to only fire the last group of enter/exit events, respectively, i.e.:
    rect MOUSE_ENTERED
    second MOUSE_ENTERED_TARGET
    first MOUSE_ENTERED_TARGET
    root MOUSE_ENTERED_TARGET
    rect MOUSE_EXITED
    second MOUSE_EXITED_TARGET
    first MOUSE_EXITED_TARGET
    root MOUSE_EXITED_TARGET
    Is there a specific reason for the behavior?
    Best regards,
    Matthias

    Hi Matthias,
    yes, there is a reason for this. In vast majority of use-cases, the entered/exited handlers are added on a node to handle the case when mouse enters/exits the node. The _TARGET variants tell you "this node or some of its children was entered/exited", which is not quite it. So right now, if you want to check that fst was entered, you just do:
    fst.setOnMouseEntered(new EventHandler<MouseEvent>() {
      @Override public void handle(MouseEvent e) {
        // your code
    If we generated only the last group of events as you suggest, you would have to do:
    fst.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, new EventHandler<MouseEvent>() {
      @Override public void handle(MouseEvent e) {
        if (e.getTarget() == fst) {
          // your code
    Even if we added the convenience handlers for the _TARGET variants (setOnMouseEnteredTarget), having to always check the target would be pretty annoying.
    Cheers,
    Pavel

  • How to set fire action event for particular rows in a table

    HI All,
    I have a requirement in which I want to set fire action event for particular rows in a table based on some condition.
    The table has columns like fullname,employee id etc.
    So i want to set fire action event for particulars rows only which will saisfy some condition.

    Atanu,
    Your approach(setting fire action for few rows) seems not possible. Better to go ahead with workaround.
    Do you want this functionality in processRequest(while page loading) or processFromRequest(on some event) method ? Give more explanation regd. your requirement ?
    In either case loop through the rows and when your condition is met write the action to be performed in controller.
    Regards,
    Anand

  • How do I enter an event in Calendar and repeat it every 3rd day

    How do I enter an event in Calendar and repeat it every 3rd day

    Hello PatrickMaryAnn,
    Thanks for the question, and welcome to Apple Support Communities.
    When editing or creating an event, choose Repeat > Custom… - then choose "Daily" and enter Every 3 days.
    Calendar: Update or delete an event
    http://support.apple.com/kb/PH11509
    Thanks,
    Matt M.

  • ICal will not let me enter an event on a certain date.

    Ok, so I'm trying to enter an event on Sunday the 7th of October on my MBP's iCal (5.0.3) and every time I double click on the date in month or week view, it leaps to Saturday the 6th.  I've tried entering the event on my iPad and it shows up on the right date there, but when it goes to the cloud and comes to my MBP the event has leapt over to Saturday the 6th again!!  I have tried refreshing all and then I deleted my p.list and logged out and then in again, but I'm still unable to enter any events for Sunday the 7th on my MBP's iCal. 
    Anybody got any clues? 

    Sometimes iCal doesn't handle properly days when the clock changes; Sunday 7th October is your next change. Try changing your time zone to another with the same offset from UTC - eg Papua. I think it is a fault in the time zone file, rather than in iCal itself.

  • I am synching my ipad and iphone with icloud. Events put in calendar go to the iphone, but if i enter an event on the iphone, it does not go to the ipad. What do i do to get this to work both ways?

    I am synching my ipad and iphone with icloud. Events put in calendar on ipad  go to the iphone calendar,, but if i enter an event on the iphone calendar, it does not go to the ipad. What do i do to get this to work both ways?

    OK Vicky, good clues...
    See if this helps...
    Open Keychain Access in Utilities, use Keychain First Aid under the Keychain Menu item, then either check the Password under that item, change it, or delete it and start over. See if there are duplicates, should be one for Incoming & one for Outgoing.
    Resetting your keychain in Mac OS X...
    If Keychain First Aid finds an issue that it cannot repair, or if you do not know your keychain password, you may need to reset your keychain.
    http://support.apple.com/kb/TS1544

  • How do I enter a event into the calendar

    I just switched from Android to Apple iPhone.  When I try to use the calendar, nothing happens.  The calendar comes up, it shows the correct dates, I can move from list to day to monthly view.  But when I try to enter an event, nothing happens.  I have set up the calendar in the set up screen.  What gives?  Is it defective?

    Entering an event is done by tapping on the "+" on the upper right corner of the screen. If that is not there, it may be because you are using iCloud. That has been an issue at times. Generally toggling iCloud off and on will correct that.

  • MVC �Best Practice� (handling multiple views per action/event)

    Looking for the best approach for handling multiple views for one action/event class? Background: I have a small application using a basic MVC model, one controller servlet, multiple event classes, and multiple JSP views. For performance reasons, the controller Servlet is loaded once, and each event class is an instance within it. Each event has an �eventProcess()� and an �eventForward()� method called by the controller, standard stuff.
    However, because event classes should not use instance variables, how should I communicate which view to forward to should based upon eventProcess() logic (e.g. if error, error.jsp, if success, success.sjp)? Currently, there is only one view mapped per event, and I'm having to put error handling logic in the JSP, which goes against the JSP being for just view only.
    My though was 1) A session object/variable that the eventProcess() sets, and the eventForward() reads, or 2) Have eventProcess() return a mapping key and have the conroller lookup a view page based upon that key, as opposed to 1-1 event/view mapping.
    Would like your thoughts!
    Thanks
    bRi

    Your solution seems ok to me, but maybe the Struts framework from Apache
    that implements MVC for JSP is a better solution for you:
    http://jakarta.apache.org/struts/index.html
    You should take a look at it. It has in addition some useful taglibs that makes life much easier.
    We have successfully used it in a project with about 50 pages.

  • h:CommandLink : Action event not called on the first click

    Hi,
    I am facing a problem here.
    I have a JSF page:
    When I first load the page, I have few text boxes and dropdowns. With out doing anything If I click the <h:commandLink I call an action in my pagecode.
    But the problem is on the very first load of the page, without doing anything if I click on the command link action event in my pagecode is not called, but If I click on the link the second timethe pagecode actionevent is called.
    So I think tried submitting the form in the JSF page onclik of the commandlink it works in my Local IBM RAD. But doesnot work in the WebSphere Portal.
    So can you tell me if I can submit the form atleast once when the page loads for the first time
    This is my command link:
    <tr>
    <td colspan="2" align="center">
    <h:commandLink styleClass="commandLink" id="lnkBtnCreateUser" action="#{pc_Createuser.doLnkBtnCreateUserAction}">
    <hx:graphicImageEx styleClass="graphicImageEx" id="imgBtnCreateUser" value="/theme/images/btnCreateUser.gif" style="border:0;cursor:pointer" onclick="return onFormSubmit();"></hx:graphicImageEx>
    </h:commandLink>
    </td>
    </tr>
    function onFormSubmit(){
    //enabling all the disable components
    So can anybody please help me on this. Why exactly the pageCode action event is not called for the very first click ???

    seems that a prependID="false" attribute in the respective form was causing the trouble. At least it's working now that I've deleted it.
    I introduced it, because last time the component ID's messed up the output of the error/success messages ("j_id:xxx isn't that of a usefull information to the enduser).
    Edited by: stger on Apr 9, 2008 5:41 PM

  • Problem with action events........ :(

    hi all,
    there is a strange problem which me and my colleagues are facing now-a-days......
    For some odd and unknown reason, the links on the page suddenly stops woking... it goes like this....
    we write events (buttons or action links) .... we test them and they are working fine...... than we write some other piece of code and than run the program and links work no more... The program never goes in the action event for the component...... and surprisingly it also dont show an error.... It just keeps on refreshing itself again and again....... (this thing is also verified by using debugger that actions events just stop being called....) it happens for random situations ...... Once i thought that maybe its has to do something with beforeRenderResponse() method... but it happens even in beans without beforeRenderResponse() method.....
    Can anyone tell me whats going on around here???? we are extremely confused here with dead lines approaching fast........
    regards

    I've had this same problem....links were working fine yesterday. I added more functionality which didn't even affect the links, and now they're not working. Unfortunately, I don't have a solution either.
    Has anybody been able to access the logging in the facescontext or application to see what the lifecycle is doing before it stops???

  • Please help me with some action event buttons

    {color:#ff6600}i am trying to figure out how to capture two values from an action event button. i have already tried it 6 times and i cant figure it out.
    Its a simple calculator with numbers 1 and 2 and does a multiplication calculation.
    Can you help me figure it out it will be really helpful.
    {color}
    import javax.swing.*;
    import java.util.*;
    import java.awt.event.*;
    public class Calculator implements ActionListener {
    JFrame frame;
    JPanel contentpane;
    JButton one,two;
    JTextField field;
    JButton mult;
    JButton adds;
    JButton equals;
    JButton go;
    public Calculator() {
    frame = new JFrame ("Calculator" );
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    contentpane = new JPanel();
    contentpane.setBorder(BorderFactory.createEmptyBorder(20,20,40,40));
    one = new JButton( Integer.toString(1));
    one.setActionCommand(Integer.toString(1));
    one.addActionListener(this);
    contentpane.add(one);
    two = new JButton(Integer.toString(2));
    two.setActionCommand(Integer.toString(2));
    two.addActionListener(this);
    contentpane.add(two);
    field = new JTextField(10 );
    contentpane.add(field);
    go = new JButton("calculate");
    go.setActionCommand("go");
    go.addActionListener(this);
    contentpane.add(go);
    mult = new JButton( "*");
    mult.setActionCommand("mult");
    mult.addActionListener(this);
    contentpane.add(mult);
    adds = new JButton( "+");
    adds.setActionCommand("add");
    contentpane.add(adds);
    frame.setContentPane(contentpane);
    frame.pack();
    frame.setVisible(true);
    public void actionPerformed (ActionEvent event ) {
    String eventn = event.getActionCommand();
    String text = field.getText();
    String mult ="*";
    {color:#800080}if (eventn.equals("1")||eventn.equals("2") ){  \\ *{color:#ff6600}i dont know how to store two different value from an action event{color}*
    text+=eventn ;
    int num = Integer.parseInt(text);
    field.setText(text);
    {color}
    {color:#800080}if (eventn.equalsIgnoreCase("mult")){
    field.setText("");
    {color}
    {color:#800080}};
    {color}
    public static void runGui(){
    JFrame.setDefaultLookAndFeelDecorated(true);
    Calculator r = new Calculator();
    public static void main (String[]args){
    javax.swing.SwingUtilities.invokeLater(new Runnable(){
    public void run(){
    runGui();

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ListenerDemo {
        private class DigitListener implements ActionListener {
           private int digit;
           public DigitListener(int digit) {
               this.digit = digit;
           public void actionPerformed(ActionEvent evt) {
                JOptionPane.showMessageDialog(f, "You pressed " + digit);
        private JFrame f = new JFrame();
        private JButton button1 = new JButton("1");
        private JButton button2 = new JButton("2");
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    new ListenerDemo().go();
        void go() {
            button1.addActionListener(new DigitListener(1));
            button2.addActionListener(new DigitListener(2));
            JPanel cp = new JPanel();
            cp.add(button1);
            cp.add(button2);
            f.setContentPane(cp);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
    }

  • How do I retain Jbutton text for action event & set img icon on Jbutton

    I need to retain the text on my button as I use this to identify the action event in actionPerformed method when the button is pressed.
    Hoe do I add an image icon to the Jbutton without effecting this?
    [/b]
    class CalcPanel extends JPanel
        implements ActionListener, CurrencyVals
    //currency panel data members
        JButton[] cb = new JButton[4];
    JPanel cbkeys = new JPanel(new GridLayout(4,1));
    //Toolkit tk = Toolkit.getDefaultToolkit();
        //Image img = tk.getImage("D:/temp/ausflag.jpg");
    public CalcPanel(){
    ImageIcon b = new ImageIcon("D:/temp/ausflag.jpg","AUS");
        cb[AUS]= new JButton(b);  //cb[AUS]= new JButton("AUS");
          cbkeys.add(cb[AUS]);
          cb[AUS].addActionListener(this);
    setLayout(new BorderLayout());
        add(display, BorderLayout.NORTH);
        add(keys, BorderLayout.CENTER);
        add(cbkeys, BorderLayout.EAST);
        add(label, BorderLayout.SOUTH);
        public void actionPerformed(ActionEvent evt){
          Object source = evt.getSource();
          int id;
          if (keyBoard) {
            if (source instanceof JButton) {
              String s = ((JButton)source).getText();
    [/b]Regards
    Synfield

    if(keyBoard) { ??! [/b]... do have cause to feel flattered?
    Copy and paste this and save a small eg;- 25px high x 50px wide Jpeg image in the same file and call it "new.jpg", then study it, this posted program (again?) to see where your code went astray.
    THEN, figure out what you want to do with your code ...keep at it!
    Sue x
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ButtonIcon extends JFrame implements ActionListener {
    String []str ={"abc","def","ghi","jkl","mno","pqr","st","uvw"};
    JButton b[] = new JButton[str.length];
       JButton on = new JButton("ON");
       JButton off = new JButton("OFF");
       JButton picture;
       JPanel panel;
       String str2="";
       Font font = new Font("Comic Sans MS" ,0, 14);
       boolean keyBoard;
       ImageIcon icon = new ImageIcon("new.jpg");
    public ButtonIcon(){
       Container c = getContentPane();
       panel = new JPanel();
       panel.setLayout(new FlowLayout());
       picture = new JButton(icon);
       for (int j=0; j<=str.length-1; j++){
             b[j]= new JButton(str[j]);
             b[j].setFont(font);
             panel.add(b[j]);
             b[j].addActionListener(this);
       on.addActionListener(this);
       off.addActionListener(this);
       panel.add(on);
       panel.add(off);
       panel.add(picture);
       c.add(panel);
       public void paint (Graphics g) {
          super.paint (g);
          Graphics2D G = (Graphics2D) g;
          G.setColor(Color.red);
          G.setFont(font);
          G.drawString(str2, 25, 150);
    public void actionPerformed(ActionEvent evt){
        String command = evt.getActionCommand();
        if (keyBoard) {
           if (evt.getSource() instanceof JButton ) {
               str2 += command;
           if (evt.getActionCommand().equals("OFF")) str2 = "";
        if(command.equals("ON")) keyBoard = true;
        if(command.equals("OFF")) keyBoard = false;
    repaint();
    public static void main (String []args){
       ButtonIcon boo = new ButtonIcon();
       boo.setSize(300,200);
       boo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
       boo.setVisible(true);

Maybe you are looking for