Radiobuttons and the focus event

This is in AS2.
Is there a 'onFocus' event for individual radio buttons,  or is it limited to the radiobutton group ?
If there is a focus event for the buttons,  how to I set it up ?  I've set up an event listener with an 'onFocus' event,  'gotFocus' event,  'focus' event and nothing is triggered.....
Regards,
Rich

If you look thru the help documents, all of the events associated with the radio button class are listed.  There is a focusIn event that the radio button inherits from the UIComponent class.  Here is an example for using it...
var listenerObject:Object = new Object();
listenerObject.focusIn = function(eventObj:Object) {
    trace("radiobutton1 just got focus");
radiobutton1.addEventListener("focusIn", listenerObject);

Similar Messages

  • Trying to create a new movie.  It tells me to name my movie, and the only event choice is the last movie I made.  I don't want it there.  I'm lost and I'm just starting.  Not sure I like the new version.  Any help out there?

    I'm trying to create a new movie.  It tells me to name my movie, and the only event choice in the drop down menu is the last movie I made. IMovie Library is greyed out. I'm lost and I'm just starting.  Not sure I like the new version.  Any help out there?

    peggy818 wrote:
    … I'm lost and I'm just starting.  Not sure I like the new version.  …
    have a read in the Manual:
    http://help.apple.com/imovie/mac/10.0/?lang=en#mov755717b21

  • Repository service and the PRE_DELETE Event

    Hello,
    I have implemented a repository service which is reacting on the PRE_DELETE event. I want to develop a recycle bin functionality.
    The problem is that the resource is already deleted when I get the PRE_DELETE event and I can't move or copy the resource any more.
    Is there a possibility to access the resource? Or another event?
    Thanks
    David

    Hi Rui,
    I was thinking about the solution with the new delete command but my problem is to secure  that I have changed the delete command in all necessary layout sets ( Search Result, Favorits, all navigation iViews and so on). And also to secure that I don't have to change system iViews or system layout sets. Tips to secure the changes are really appreciated.
    Has some one experiences with the PRE_DELETE or the DELETE Event?
    Thanks
    David

  • How do I get videos and pictures taken in the same event to show in a slideshow in the order they were taken?

    How do I get videos and pictures taken in Photos and the same Event to show in the order they were taken? Pictures and videos are seperated with videos at the end of both Photos and the Event.

    You're welcome.
    What's likely happened is that when you transferred the video to the new machine they lost their dates.
    Photos use the Exif metadata to record the date and time of the shot. This is quite different from the date and time of the file, which can change as the file is copied from place to place. Video doesn't have Exif, and so iPhoto uses the file date, and that's changed.
    Simply, there's no absoultely reliable way to date video.
    Try assign dates with the Batch Change command under the Photos menu.

  • Unable to use the focus feature on a field

    hi,
    I have the need to manipulate the focus event of a field. This is my pdf body structure :
    form1 ----> form
    |_ a ----> page
    |_b ----> textfield
    |_c ----> textfield
    The idea is to test if the user pressed the key "ESC", "TAB" or "ENTER" when exiting from field "b". If so, and after testing the content of the field, i wanted to set the focus on that same field "b" to let the user proceed with the correction.
    I tried with the "xfa.event.commitKey" to see if the "ESC", "TAB" or "ENTER" keys where pressed while exiting the field. I then redirected the focus to different fields named "ESC", "TAB" and "ENTER" just to be sure that i was getting the correct keys.
    This feature works if i set the focus in a different field than the one i'm exiting.
    Then, i tried a different approach. On the exit event of the field, i placed the following code :
    app.setTimeOut("this.getField('form1[0].a[0].b[0]').setFocus()", 1000);
    This would do the same as the setFocus after a while.
    For what i could see, catching the events with the "xfa.event.commitKey" for the "ESC", "TAB" or "ENTER" key works alright. The problem is to set the focus to the current field ( the one where the exit event is being analyzed ). However, if i change the destination field to any other field on the form, all the scripts work.
    Following the structure that i have on top, it the exit event is being analyzed on field "b" and the "setFocus" or the "app.setTimeOut" scripts indicate field "b" as destination, it doesn't work.
    If i change the destination field to be "c", all the scripts work as expected. It seems like there is a problem with setting the focus on the field that i'm exiting from.
    Any ideas on this ???
    Thanks.

    Does anyone have a solution to this problem?
    I'm urgently trying to find a workaround, but nothing seems to work.
    The focus on the current field works in acrobat reader versions above 8.0, but in 8.0 it just doesn''t work...
    To reiterate:
    On the exit event of a textbox I need to display a validation message if a certain condition is met. I then need to refocus on the same textbox after the "ok" button is clicked in the validation warning.
    My setFocus code is correct, but it just doesn't work in 8.0.
    Thoughts?

  • JDialog and request focus

    Hi
    I am designing an application that brings up a JDialog box. When a button is pressed on this JDialog box this triggers an action event and some code is executed.
    When this button is pressed I dispose the dialog box and I want the focus to change to one of my components, I have been doing this with the requestFocus command. For some reason this focused event is not picked up by the focus handler. This only happens in this one place, if I move the requestFocus code to anywhere else in the program the focus event works fine. Does anyone have any ideas why.
    Thanks

    Without seeing any code, I would guess that disposing of a dialog causes focus changes to be requested internally. So if you put your focus change request after you dispose the dialog, that might help.

  • Focus events being received out of order

    I have a complicated applet where each component is registered with multiple focus listeners. I have several pairs of JTextFields and JButtons - textfield A, button A, textfield B, button B etc. Clicking on a JButton normally causes a JTable to be popped and focus transferred to it. Clicking on the table header or selecting a table row causes the table popup to close and the focus transferred to the textfield associated with the button.
    I'm running into a strange case where the focus is initially on textfield A. Clicking on button B causes a temporary loss of focus on textfield A. The trace shows that the focus owner is null and the permanent focus owner is textfield A. The table still gets launched. Selecting a table row causes it to close but no component has focus any more. Focus owner continues to be null, and permanent owner continues to be textfield A.
    After working on other windows in the meantime, and returning to this window I find that the focus in now back to textfield B, as it should. However, the trace shows that B has received permanent focus events. This is followed by receiving permanent focusLost events on A and then permanent focusGained events on A. At the point all in said and done, the focus appears on B.
    Does someone know why the focusGained event on B appears before focus events on A? Another strange thing in the trace was that some focus gain/loss method invocations were interrupted, another focus method invoked and the previous method resumed. I could possibly take care of this by using synchronized on all focus gain/loss methods. Also, some methods show only part of execution and not even resumed. This is still a mystery to me. I'll appreciate if someone can shed light on this.

    One of the things you'll notice is that when a text field loses focus to a right-click JPopupMenu, it is never just one foucs lost/gained pair, but rather they trade focus back and fourth a few times. This is the same when the popup closes, the focus trades back and fourth a few times.
    You are describing a similar situation between a button and a text field.
    There never was any guarantee the gained/lost events happen in any order. Also, if there is a chain of focus events, the information in the intermediate events may not be useful.
    If you really do need to understand the focus changes at an actionable level, you might want to consider writing a focus helper class that can be used to answer semantic questions about focus changes, such as, did this component lose focus because of a button click? Or was it a Popup? Or was it a Tab-keystroke?
    The focus helper can store 'hidden' information in any JComponent using JComponent.setClientProperty(Object key, Object value)...
    So instead of creating a focus listener like:
    myComponent.addFocusListener(new FocusAdapter() {
      public void focusGained(FocusEvent e) {
        // do stuff here
    });You can do it like this:
    myComponent.addFocusListener(FocusHelper.createTextFieldToButtonListener());and in that method it creates the listener like this (you might need to pass some parameters):
    public static FocusListener createTextFieldToButtonListener() {
    FocusAdapter adapter = new FocusAdapter() {
      public void focusGained(FocusEvent e) {
        recordEvent(e);
        // do stuff here
    return adapter;
    }The helper method "recordEvent" tags those components with additional information about permenant and temporary focus ownership. Also it clears hidden information that is no longer useful.
    Then later on you can give the focus helper a FocusEvent, and ask it, is this text field gaining focus because of a Tab-In, or is it because of a popup menu has closed?
    The helper constructs answers based on the hidden properties it finds in the e.getOppositeComponent() and e.getSource(). It put those properties there, so it knows what they mean, and it uses them to distinguish between useless information in the focus event chain, and the important things you want to know.

  • Focus Event

    I have a problem like this:
    I have a form with 2 text fields: Text1, Text2. If focusing on Text1 and pass focus-event to Text2, a Message_Box will show to confirm: "Do you want to change focusing from Text1 to Text2 (Y/N)?". If you choose Yes then focus on Text2, otherwise keep focusing on Text1.
    I have tried with following codes but it shows Message_Box 2 times when choosing No.
    Please help me to solve this issue.
    Thanks alot.
    import com.fss.swing.*;
    import javax.swing.JFrame;
    import javax.swing.JTextField;
    import java.awt.BorderLayout;
    import java.awt.Rectangle;
    import javax.swing.*;
    import javax.swing.JButton;
    import java.awt.event.FocusAdapter;
    import java.awt.event.FocusEvent;
    import java.awt.Dimension;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2003</p>
    * <p>Company: FSS-FPT</p>
    * @author not attributable
    * @version 1.0
    public class test extends JFrame
         public test()
              try
                   jbInit();
              catch(Exception ex)
                   ex.printStackTrace();
         private void jbInit() throws Exception
              jTextField1.setText("jTextField1");
              jTextField1.setBounds(new Rectangle(21,65,226,19));
              this.getContentPane().setLayout(null);
              this.getContentPane().add(jTextField1,null);
              jButton1.setBounds(new Rectangle(132,128,73,23));
              jButton1.setText("jButton1");
              this.getContentPane().add(jTextField2);
              this.getContentPane().add(jButton1);
              jTextField2.setText("jTextField2");
              jTextField2.setBounds(new Rectangle(267,66,64,19));
              jTextField1.addFocusListener(new FocusAdapter() {
                   public void focusLost(FocusEvent e){
                        if(e.isTemporary())
                             return;
                        int i = MessageBox.showConfirmDialog(test.this,"Do you want to change focusing from Text1 to Text2 (Y/N)?","Confirm");
                        if(i == MessageBox.YES_OPTION)
                             jTextField2.requestFocus();
    else
    jTextField1.requestFocus();
         JTextField jTextField1 = new JTextField();
         JTextField jTextField2 = new JTextField();
         JButton jButton1 = new JButton();
         public static void main(String args[]) {
              test t = new test();
              t.setTitle("Test");
              t.setSize(new Dimension(400,300));
              t.setVisible(true);
    Edited by: googlecomvn on Jul 4, 2008 3:23 AM

    The way I've seen to cancel focus events is using a VetoableChangeListener:
    [http://java.sun.com/j2se/1.5.0/docs/api/java/awt/doc-files/FocusSpec.html#FocusAndVetoableChangeListener]
    import java.awt.KeyboardFocusManager;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyVetoException;
    import java.beans.VetoableChangeListener;
    import javax.swing.BoxLayout;
    import javax.swing.JFrame;
    import javax.swing.JTextField;
    public class FocusTest extends JFrame {
       public FocusTest() {
          final JTextField field1 = new JTextField("type \"text\"");
          final JTextField field2 = new JTextField("then click on me!");
          setLayout( new BoxLayout( this.getContentPane(), BoxLayout.Y_AXIS ) );
          add(field1);
          add(field2);
          pack();
          KeyboardFocusManager.getCurrentKeyboardFocusManager().addVetoableChangeListener(
             new VetoableChangeListener() {
                public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
                   if ( evt.getOldValue() == field1 ) {
                      if ( !"text".equals(field1.getText()) ) { //simple validation
                         throw new PropertyVetoException("Invalid value for field1", evt);
       public static void main(String[] args) {
          new FocusTest().setVisible(true);
    }You'd definitely get in trouble with using a JOptionPane in the change listener, though (as it would throw more focus events, requiring more JOptionPanes, etc).
    Edited by: endasil on 4-Jul-2008 8:50 AM

  • [CS4/CS5] ScriptUI focus event (Win/Mac)

    Hi friends,
    I'm looking after a way to control the focus of EditText widgets within a Dialog but I'm totally confused by the event loop logics —especially in Mac OS.
    The basic task I need to achieve is to attach a validation mechanism to an EditText. When the user has entered a wrong field and the change event occurs, I want to display an alert box, then re-activate the field. The problem is that both the change event and the alert box interfer with focus attribution. I think that user or system focus/blur events are stacked so that any command that attempts to focus back to the original widget cannot work while the stack is not empty.
    Here is a simple test to illustrate my problem. The script is supposed to display an alert when the user change a field, then it tries to focus back to the corresponding field through myWidget.active = true. This does not work.
    var     u,
         w = new Window('dialog',u,u,{xname:'Window'}),
         e1 = w.add('edittext', u, "",{xname:'EditText (1)'}),
         e2 = w.add('edittext', u, "",{xname:'EditText (2)'}),
         eInfo = w.add('edittext', [0,0,300,400], "",{xname: 'EditText (Info)', multiline:true}),
         b = w.add('button',u,'Clear', {xname:'Button'});
    e1.characters = e2.characters = 20;
    var anyEvent = function(ev)
         var tg = ev.target;
         eInfo.text += (tg.properties.xname + ' -> ' +
              ev.type.toUpperCase() +
              (tg.active ? '  (active)':'  (non active)') +
              '\n');
    var changeEvent = function(ev)
         eInfo.text += ('\n--- BEFORE Breaking Alert\n');
         alert("Breaking alert");
         // Trying to FOCUS back on ev.target
         eInfo.text += ('\n--- BEFORE Active=true\n');
         ev.target.active = true;
         eInfo.text += ('--- AFTER Active=true\n');
    // Event 'inspector'
    w.addEventListener('change', anyEvent);
    w.addEventListener('focus', anyEvent);
    w.addEventListener('blur', anyEvent);
    // Events
    w.addEventListener('change', changeEvent);
    b.onClick = function(){eInfo.text = '';};
    w.show();
    I tried various strategies to address this problem by using event timestamps and/or dispatching custom new UIEvent('focus'...), but nothing works conveniently.
    In addition I got odd behaviours in Mac OS. The below screenshot shows a piece of a ScriptUI dialog —using a custom framework, so don't be surprised by the skin! What is weird is that in a particular state *two* EditText controls have the focus ring at the same time:
    I didn't know such a thing could happen. I probably did not understand anything about the 'focus' paradigm.
    Any help from an expert would be greatly appreciated. Thanks a lot!
    @+
    Marc

    Harbs. wrote:
    It does seem to change the focus, but you are still left with a cursor sometimes (which does not work).
    The one that has the focus rect allows input and .active = true seems to work fine. (Mac 10.6 CS5)
    Harbs
    Well, this is not so clear to me. My beta-tester —also Mac CS5— reports unpredictable behaviors. It also depends on how the user change the focus: using the TAB key and clicking into another field are not equivalent. (It seems that the change-focus-by-click event is more complicated to counteract...)
    But generally, on Mac platforms, we cannot be sure that setting myEditText.active = true gives the focus back to myEditText when other user events are running. The problem is that the active property is not always 'reliable'. We found that (under unstable circumstances) e1.active might returns true while e2 actually owns the focus ring! Somehow, Mac systems can dissociate the 'active' control and the focus... I don't know.
    My assumption is that the focus has a high level priority in the Mac event loop and that it closely mirrors the user interaction, while the active property is an abstract thing featured by the ScriptUI layer. The purpose of ScriptUI is to wrap OS events and widgets in a single scripting interface for both Mac and Win, but ScriptUI is nothing but a bridge. I suppose that "myWidget is active" and "myWidget has the focus" means exactly the same thing in Windows, so ScriptUI can easily target the focus through the active property in Win environment. But Mac OS doesn't work the same way.
    Interestingly when we set an EditText as borderless in Windows, we entirely remove the default widget appearence. On the contrary, a borderless EditText in Mac still reserve an additional region for the focus and there is no way to hide the focus ring when the control receives the inputs.
    In addition, I posted above a screenshot where two EditText instances have the focus ring at the same time. I'm not a Mac user but I was told that this is not a normal situation. Then playing with the active property in ScriptUI can really disrupt the focus behavior on Mac platforms...
    My first idea was to study more closely event triggering and to use a timestamp-based routine to keep the control of the focus. So I sent the following script to my beta-tester:
    var     u,
         w = new Window('dialog',u,u,{xname:'Window'}),
         e1 = w.add('edittext', u, "aaa",{xname:'(1)'}),
         e2 = w.add('edittext', u, "",{xname:'(2)'}),
         eInfo = w.add('edittext', [0,0,300,400], "",{xname: '(Info)', multiline:true}),
         cForce = w.add('checkbox', u, "Force default value on error"),
         b = w.add('button',u,'Clear', {xname:'(Button)', name:'ok'});
    e1.characters = e2.characters = 20;
    var fgTarget = null,
         fgTimeStamp = +new Date,
         fgAlerting = null,
         fgNonValid;
    var blurEventHandler = function(ev)
         if( fgAlerting ) return;
         var d = +new Date - fgTimeStamp;
         if( 100 < d )
              eInfo.text = '';
              fgTarget = ev.target;
              fgTimeStamp = +new Date;
              fgAlerting = null;
              fgNonValid = isNaN(fgTarget.text);
         d += ' ms';
         eInfo.text += (ev.target.properties.xname + ' is losing the focus  ' + d + '\n');
         fgTarget.active = true;
         if( fgNonValid )
              eInfo.text += ('  Re-activate ' + fgTarget.properties.xname +
                   ' from '+ ev.target.properties.xname + '\n' +
                   '  w.active=' + w.active + '\n' +
                   '  e1.active=' + e1.active + '\n' +
                   '  e2.active=' + e2.active + '\n') ;
              if( null===fgAlerting )
                   fgAlerting = true;
                   eInfo.text += '--- ALERT ---\n';
                   alert("Please enter a numeric value or let the field empty.");
                   fgAlerting = false;
                   if( cForce.value ) fgTarget.text = '50';
                   fgTimeStamp = +new Date;
    e1.addEventListener('blur',blurEventHandler);
    e2.addEventListener('blur',blurEventHandler);
    var anyEventHandler = function(ev)
         eInfo.text += (ev.target.properties.xname + ' -> ' + ev.type + '\n');
    e1.addEventListener('mousedown',anyEventHandler);
    e1.addEventListener('mouseup',anyEventHandler);
    e1.addEventListener('keydown',anyEventHandler);
    e1.addEventListener('keyup',anyEventHandler);
    e2.addEventListener('mousedown',anyEventHandler);
    e2.addEventListener('mouseup',anyEventHandler);
    e2.addEventListener('keydown',anyEventHandler);
    e2.addEventListener('keyup',anyEventHandler);
    b.onClick = function(){eInfo.text='';}
    e1.active = true;
    w.show();
    This script gives unstable results. ScriptUI does not always report every event that actually occurs.
    But as a general rule, what the user has done supersedes what the script can do.
    Any help from ScriptUI / Mac gurus would be highly welcome.
    @+
    Marc

  • An unnatural focus event is killing MOUSE_RELEASE on XP

    I only have this error being reported from people with XP PRO.
    So I overrode the dispatchEvent method so that I could monitor every event
    that was occuring because for some reason when a window lost focus then
    gained focus java acted like the mouse was still held down. These are the
    results I found:
    So this is in reference to a TEXT_AREA. A person clicks on the desktop so the text_area has lost focus and then they click back on the text_area. Below are the events that are fired when the user clicks back on the text_area and it regains focus..
    WIN98 WORKING:
    WINDOW_ACTIVATED,opposite=null,oldState=0,newState=0
    WINDOW_GAINED_FOCUS,opposite=null,oldState=0,newState=0
    FOCUS_GAINED,permanent,opposite=null
    MOUSE_PRESSED,(11,8),button=1,modifiers=Button1,extModifiers=Button1,clickCo
    unt=1
    MOUSE_RELEASED,(11,8),button=1,modifiers=Button1,clickCount=1
    MOUSE_CLICKED,(11,8),button=1,modifiers=Button1,clickCount=1
    Focus gained and 3 proper mouse events are fired
    NOW
    WINXP PRO:
    FOCUS_GAINED,permanent
    MOUSE_PRESSED,(353,221),mods=16,clickCount=1
    FOCUS_LOST,permanent
    FOCUS_GAINED,permanent
    MOUSE_CLICKED,(353,221),mods=16,clickCount=1
    INVOCATION_DEFAULT,runnable=sun.awt.GlobalCursorManager$1@3e0e27,notifier=nu
    ll,catchExceptions=false
    MOUSE_MOVED,(353,220),mods=0,clickCount=0
    MOUSE_MOVED,(352,218),mods=0,clickCount=0
    Focus is gained, mouse is pressed, then focus is lost?????? then immediately
    gained???? and then mouse is clicked. The mouse released never gets fired
    thus when I move the mouse around the text field it just highlights things
    as if I'm holding down the mouse button. Somewhere in that odd gain and then focus the event is getting lost.
    ideas?? or workarounds??

    Hmmm that could be it. I've had a couple people report the problem though and they were all on XP PRO, maybe the drivers in XP are acting funny. Thanks for the idea, hopefully that's the problem.
    I did find out a little more out about the focus events.
    I have a class called AsmEditWindow that extends Frame.
    In this frame I have two different TextAreas, each of these textAreas have there own separate focus listeners that I've set up using inner classes. So like:
    msgarea.addFocusListener(new MsgAreaFocusListener());
    textarea.addFocusListener(new TextAreaFocusListener());
    Now on the functioning windows 98 system I Get:
    java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=null] on text0
    java.awt.SequencedEvent[] on text0
    java.awt.event.MouseEvent[MOUSE_PRESSED,(11,8),button=1,modifiers=Button1,extModifiers=Button1,clickCount=1] on text0
    java.awt.SentEvent[] on sun.awt.windows.WToolkit@11946c2
    java.awt.SentEvent[] on sun.awt.windows.WToolkit@11946c2
    java.awt.event.MouseEvent[MOUSE_RELEASED,(11,8),button=1,modifiers=Button1,clickCount=1] on text0
    The first focus event is on text0 then the mouse listeners proceed without a problem.
    On the non-functioning windows XP system I get:
    java.awt.event.FocusEvent[FOCUS_GAINED,permanent] on frame1
    java.awt.event.MouseEvent[MOUSE_PRESSED,(353,221),mods=16,clickCount=1] on text0
    java.awt.event.FocusEvent[FOCUS_LOST,permanent] on frame1
    java.awt.event.FocusEvent[FOCUS_GAINED,permanent] on text0
    So frame1 gains, then mouse is pressed, then frame 1 loses and text0 gains focus and the mouse_release event never gets thrown.
    Is there something more that I should be posting to give insight? The code section to setup the Frame is about 95 lines so I was thinking that was too long to put in the post. If this assumption is incorrect tell me what part of the code would be useful, and I'll post it.
    Thanks

  • How do I turn on the GUI controls for the Focus Blur Effect in Final Cut Pro X

    I can't find the setting that enables the GUI control overlay to manipulate the parameters of the Focus blur effect in Final Cut Pro X. When I have the clip and the focus effect selected I only get a center element overlay. At one point I had controls for all the other elements of this effect.
    anyone know a shortcut or how I can toggle these controls back on?

    I don't see any other screen controls either.
    Maybe there was a change sometime, or maybe you were using a different effect?

  • Setting and getting focus on controls

    hi experts
    how can i set focus on a control (e.g. like on a button)
    Ashish

    hi bill
    i tried using the focus listener but some problems are there.
    plz take a look at following applet code. that messageboxes
    in both the focus events keep on flashing . what must be the
    problem.plz let me know.
    Sorry for the identation of code, the code is idented properly
    in my file but in this box it appears like this only.
    Ashish
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    /*<applet code="w_passwd" width = 300 height = 300>
    </applet>*/
    public class w_passwd extends Applet implements ActionListener,FocusListener {
    Label st_2;
    Label st_1;
    TextField sle_2;
    TextField sle_1;
    Button cb_2;
    Button cb_1;
    JPanel button_panel;
    JPanel cbox_panel;
    JPanel label_panel;
    JPanel sle_panel;
    public void init(){
    label_panel=new JPanel();
    label_panel.setLayout(new BoxLayout(label_panel, BoxLayout.Y_AXIS));
    sle_panel=new JPanel();
    sle_panel.setLayout(new BoxLayout(sle_panel, BoxLayout.Y_AXIS));
    button_panel = new JPanel();
    button_panel.setLayout(new BoxLayout(button_panel, BoxLayout.Y_AXIS));
    cb_1 = new Button( "Ok");
    add(cb_1);
    cb_1.addActionListener(this);
    button_panel.add(cb_1);
    cb_2 = new Button( "Cancel");
    add(cb_2);
    cb_2.addActionListener(this);
    button_panel.add(cb_2);
    sle_1 = new TextField(20);
    add(sle_1);
    sle_panel.add(sle_1);
    sle_2 = new TextField(20);
    sle_2.setEchoChar('*');
    add(sle_2);
    sle_panel.add(sle_2);
    st_1 = new Label( "Name");
    add(st_1);
    label_panel.add(st_1);
    st_2 = new Label( "Password");
    add(st_2);
    label_panel.add(st_2);
    cb_2.addFocusListener(this);
    add(label_panel);
    add(button_panel);
    add(sle_panel);
    public void actionPerformed(ActionEvent ae){
    String action = ae.getActionCommand();
    if (action.equals( "Cancel"))
    if (action.equals( "Ok"))
    JOptionPane.showMessageDialog(null,"hello there");
    public void focusGained(FocusEvent fe)
         if (cb_2.hasFocus())
         JOptionPane.showMessageDialog(null,"got focus");     
    public void focusLost(FocusEvent fe)
         Object source = fe.getSource();
         if (source instanceof Button)
              JOptionPane.showMessageDialog(null,"lost focus");

  • Question re installing Leopard/Time Machine and my lost Events

    I posted a question about my lost Events the other day. I've tried to rebuild my library using Library Manager but so far I still have one event with over 5,000 photos and the few events I've created or re-created since that mysteriously happened.
    I really really don't want to go through and organize these over again.
    Wondering if I would be able to use Time Machine to go back and restore my events if I were to install Leopard now.

    No that wouldn't work. Time machine will not know about anything from before it is installed.
    Regards
    TD

  • Where is the focus??

    I have several applets on a page.
    Under 1.4.0 I could see where the focus was & control it.
    I am now using 1.4.1 and the focus is nowhere to be seen - I have put focus listeners in all of the components & the focus is gone from all of these by the time the applets finish loading.
    I know there are a lot of posts about focus & 1.4.1, but none of them have helped.
    I also know that there are changes with focus management in 1.4.1, but why would this mean that nothing has focus? Surely something must have the focus?
    Thanks for any help.

    Thanks for your input, however Java definitely lets you apply focus to yor applet.
    I finally solved this, by finding out exactly where the focus was ending up - and it was ending up in one of the components in the main applet. This component is not even visible, and it's certainly not editable (it was the parent of the applet), so why the focus was going there, I don't know. So much for 1.4.1 fixing all the focus issues, though I must say the new API calls came in use in figuring this out.
    Here is some duke $$ because you made an effort.

  • The JPanel no longer gets a focus event after upgrading java version

    I have started looking at an application, which I haven't developed myself. It is a Swing application which runs as a standalone application. It is currently running on JRE 1.4.1, but for many reasons we would like to upgrade (to 1.5.0).
    During one of the actions that the users make is that he goes through a number of screens filling in details and then goes to the next screen. This has been done through having a JTabbedPane with six tabs. Each tab is a JPanel with various content.
    At each page the user presses a button, which (among other things) sets the selected Index of the JTabbedPane to the next tab. The JPanel that is attached to the tab has a FocusListener, which does various load actions when the JPanel receives focus.
    Now to the problem: In version 1.4.1 (up to and including version 1.4.1_07) these actions actually triggered the FocusListener event and ran the focusGained method as intended. Starting from 1.4.2 (and any 1.5 version I have tested) this event does not occur any longer (no code change, simply changing the JRE). My conclusion is that either the JPanel no longer gets focus or the event simply does not get triggered even though it should. What I can't figure out is why, what really happens and finally even more important, how do I solve this.
    Any help is appreciated. The code is quite extensive so it does not quite fit in here, but I will provide snippets as requested.

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5089436
    "Evaluation" section will give you more info.
    basically, you have to set a requestFocusInWindow(), but it needs to be
    wrapped in a SwingUtilities.invokeLater(..), or, if that fails to work, inside a
    timer, setRepeats(false), about 150ms.
    From memory, it is only the timer that will work with the JTabbedPane, but
    with newer versions, the SwingUtilities.invokelater() might now work

Maybe you are looking for

  • How can I move my old messages from my PC to my new Macbook (not the profile, just the messages)?

    I have used Thunderbird for years as I am a business owner who needs to keep a copy of old emails. I have just changed from a PC to a Macbook pro, and want to move all my old archived messages from the past 2 or 3 years to my Mac, including non-archi

  • I just moved to iCloud and now my old emails are gone. How do I get them back?

    I just moved to iCloud and now all my old e-mails (not from a me account) are gone. How can I get my e-mail back? Please Help!!

  • Outlet adapter not working

    I was recently given an old Ipod mini which had been formated for a Mac. I have a pc, so I reformatted the ipod. It told me to plug it in before it could finish, which I have seen in other posts that there is no way around. So I went out and bought A

  • PNP LDB Authorization skipping

    Hi Experts, We have a custom report reading data from  Infotype 0000,0001,0002 and 9001.This is working fine. There are many SAP users who will use the report. Users AAXX have 9001 authorization and user BBXX does not have 9001 authorization. Problem

  • Illustrator CS Question -- don't laugh!

    Hi Everyone! Yea, I know I'm behind the times on my home iMac*. Someday, I will upgrade. Meanwhile I have a pressing dilemma! My question: Every now and then, I hit a button that I shouldn't have... and apparently, I've done it again. Now when I draw