Focus of JWindow in Solaris OS urgent!...

In my application the whole Guis lies on an window when this application is opened my JWindow is not getting the Focus in Solaris OS even though i give requestFocus() please help somebody

This is kind of strange, I use this technique myself with J2SDK 1.3.1 and Solaris 8. I exteded the sample code:
The extended source of the WindowListener again.
import javax.swing.*;
import java.awt.event.*;
public class GrabFocusWindowAdapter extends WindowAdapter
private JComponent component;
public GrabFocusWindowAdapter(JComponent component)
this.component = component;
public void windowOpened(WindowEvent event)
setFocus(event);
public void windowIsClosing(WindowEvent event)
setFocus(event);
public void setFocus(WindowEvent event)
if (component != null && component.isEnabled())
component.requestFocus();
The dialog classes source is as follows (when the dialog appears, the "focused" field should have the focus (always)):
import javax.swing.*;
public class DetailsDialog extends JDialog
public DetailsDialog(JFrame parent)
super(parent, "Title");
JTextField focused = new JTextField();
JTextField notFocused = new JTextField();
getContentPane().setLayout(new BorderLayout());
getContentPane().add(focused, BorderLayout.NORTH);
getContentPane().add(notFocused, BorderLayout.SOUTH);
pack();
setResizable(false);
addWindowListener(new GrabFocusWindowAdapter(focused));
}

Similar Messages

  • Problem with Mnemonic Alt F4 with JWindow in solaris OS urgent!......

    hi all
    I have a problem with JWindow i created a menu where in i have all menuitems as i needed with a close MenuItem with Mnemonic ALT F4 i could not able to close the JWindow in solaris as iam not able to catch th e ALT F4 event please help guys and gals.

    HI JRG
    look my code once when i run this code iam not able to catch ALT F4 press as when iam printing the key pressed iam not able to catch ALT F4 any suggestions please
    import javax.swing.*;
    import java.awt.event.*;
    public class MyWindow extends JWindow implements KeyListener, WindowListener
    public MyWindow(){
    super();
    addKeyListener( this);// for closing
    addWindowListener( this);// for focus
    show();
    // implement the window listener
    public void windowClosing( WindowEvent e ) {
    //System.exit(0);
    public void windowClosed( WindowEvent e ) {}
    public void windowActivated( WindowEvent e ) {}
    public void windowDeactivated( WindowEvent e ) {}
    public void windowDeiconified( WindowEvent e ) {}
    public void windowIconified( WindowEvent e ) {}
    public void windowOpened( WindowEvent e ){
    requestFocus();
    // implement the key listener
    public void keyReleased( KeyEvent e){}
    public void keyTyped( KeyEvent e){}
    public void keyPressed( KeyEvent e){
    if( (e.getKeyCode() == KeyEvent.VK_F4) && (e.getModifiers() == InputEvent.ALT_MASK)){
    e.consume();
    dispose();
    System.exit( 0);
    public static void main(String s[])
    MyWindow mywin=new MyWindow();
    mywin.setSize(400,400);

  • Can I catch ALRM signal on solaris ?Urgent......

    Hi !
    Is it possible to catch the ALRM signal on Solaris ?? I heard that trying to catch a signal that will be handled by the JVM will throw an IllegalArgumentException. This is what happening when I try to catch the ALRM signal. I'm getting "java.lang.IllegalArgumentException : UnknownSignal : ALRM". But, in the same application, I'm able to catch INT and TERM signals.Can anyone tell me how to trap the ALRM signal on Solaris ???
    Thanks in advance .
    Ramesh Thota

    No ! I did not use any native code. I've used the classes sun.misc.Signal and sun.misc.SignalHandler for this. Here is my code :
    import sun.misc.Signal;
    import sun.misc.SignalHandler;
    public class test implements Runnable
    public static boolean signalFlag = false;
    public static Object valueLock = new Object();
    public static void main(String args[])
    test t = new test();
    Thread thread = new Thread(t);
    thread.start();
    String SIG_TERM = "TERM";
    String SIG_INT = "INT";
    String SIG_ALRM = "ALRM";
    SignalHandler sigHdl = new SignalHandler ()
         public void handle( Signal aSignal )
         synchronized(valueLock)
              signalFlag = true;
              System.out.println( "Caught " + aSignal.toString()+ " signal.");
              System.out.println(signalFlag);
              valueLock.notify();
         } // End of Sync Block
    } // End of method handle
    }; //end of class
    // Installing signal handlers
    Signal.handle( new Signal( SIG_INT ), sigHdl );
    Signal.handle( new Signal( SIG_TERM ), sigHdl );
    Signal.handle( new Signal( SIG_ALRM ), sigHdl );
    } // End of Main
    public void run()
    try{
         synchronized(valueLock)
         while(signalFlag != true)
         valueLock.wait();
    } // end of try
    catch(InterruptedException iox)
         System.out.println("Interrupted");
    } // End of Run
    }// End of Class

  • OCI lib to link to at Solaris[REAL URGENT]

    Hi!
    I am doing my first OCI application, at the first call to OCIInitialize linker cant to resolve the symbol. Please tell me which lib to link to on Oracle9i. I am not using the make file provieded by the demo & also not able to figure out the libs from those makefiles.
    Thanks for your time,
    Usman.

    i like this, too:
    find $ORACLE_HOME/lib -type f -name "*.so*" -exec nm --print-file-name 2>/dev/null {} \; | grep "T OCIInitialize"                                                                                                                                                                                                                                                                               

  • I need your help to resolve my problem - SunSparc V890, Solaris 10

    Hi all!
    I made myself one big problem!
    When I create one file named as dbora which is to be used to startup/shutdown automatically Oracle Database in Solaris 10, but I changed the owner of /etc from root to oracle users
    #chown -R oracle:dba /etcAnd so that, I did not connect to the OS by remote session, telnet, ssh or ftp. Searched in Google, I found one action which was described like
    Step 1: Boot in OS by CDRom in single mode users
    ok>boot cdrom -sStep 2: Find the disk which contains the root
    #formatStep 3: Mount this disk with making one temporary directory
    #mkdir a
    #mount /dev/******* /aStep 4: Re-change the owner of /etc
    #chown -R root /a/etcStep 5: Unmount the disk
    #unmoun /aStep 6: Reboot
    #rebootPlease help me! This is the urgent problem because of my production database still at there
    Thank you very much!

    There is an exact same problem opened in another forum:
    [http://www.unix.com/sun-solaris/69644-urgent-help.html|http://www.unix.com/sun-solaris/69644-urgent-help.html]
    There are solutions posted on this thread, and by looking at the OP' name from that forum, this is you, isn't it?
    Did the solutions posted there not work for you?
    By following the solution there, you'll be able to boot up and connect to the server. However, there are files/directories owned by root with different group. After doing so, you might want to compare with another system and apply right group ownership to files/directories under /etc.

  • JTextArea in JWindow

    Basic problem is typing text in a JTextArea once added to JWindow, sounds simple?
    Once the textarea is added there's no caret displayed in the area, and does not accept focus.
    JWindow window = new .....
    JPanel panel = new ......
    panel.add(new JTextArea());
    window.add(panel);
    Is there a bug etc, or do other containers such as JFrame provide additional functionality to support textareas?

    See this thread:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=410638

  • Step by Step RAC 11GR2 with Grid Infrastructure on Solaris installation

    Y'ello All,
    Please I need documentation for RAC 11GR2 with Grid Infrastructure on Solaris installation urgently.
    Thany you very much for your support
    BR,

    What type of shared storage will you be using?
    Properly configure DNS
    Properly configure /etc/hosts files
    Properly configure SCAN
    Properly configure SHARED storage (Preferably ASM - "raw" devices) - make sure you partition the disk devices to "skip" the first 1MB of the device)
    BEFORE installation, confirm grid-owner and oracle-rdbms-owner can read AND write to these shared devices from ALL nodes. Permissions must be set to <grid-owner:<grid+oracle shared group> (grid:oinstall where oracle is also in the oinstall group)
    Properly configure ssh password-less connections for both GRID-owner AND oracle-rdbms-owner.
    IP addresses required
    3 SCAN addresses that point to myhost-scan.mydomain.tld in a round-robin fashion
    PER NODE:
    1 public IP address
    1 virtual IP address
    1 interconnect IP address should be iin /etc/hosts ONLY - Non-routable and not reachable via the public interface. DO NOT use CROSSOVER cable.
    Interconnect should be on a DEDICATED INTERCONNECT switch.
    As for the SHARED storage, the LUNS/Devices can be "carved" out on your SAN by your SAN admin. MAKE SURE that ALL devices in a given diskgroup are EQUAL size. (ie - DATA000=250GB/each, DATA001 500GB/each etc)
    The installation guide gives a lot of directions on PRE-REQUISITES. Follow them. And remember, since you are new to this, you may install this several times before you get it the way you need it to be. Even installing MANY RAC clusters on multiple platforms, I still install it 2-3 times. Generally because the SA has forgotten some pre-req step.

  • Post-upgrade tasks for OWB 10g Release 2

    Hi,
    we're planning to upgrade from OWB 10.1.0.2 to 10.2.x.
    Now, I'm trying to get a clear view on what will be the "post-upgrade" tasks, in terms of manual adaptations, corrections, etc. to get everything back up and running after the upgrade ...
    E.g. : by means of test al already exported a dimension, and imported it in the 10.2 repository ... Turned out that in the pre-10.2 version, there were no validation problems, but as from 10.2 (although the upgrade and import were successful), I got 19 warnings and 2 errors ... because each level needs to have a business or surrogate key ...
    It' s things like that I'm especially interested in, in order to determine the workload after the upgrade ...
    So, feel free to share your experiences ; I'm looking forward to read them!
    Thanks!
    Grtz.

    Here are some from my list. I stopped maintaining it a while ago, we have lots more where this came from. Some of it also apply to older versions of OWB.
    Key lookup     You are to choose input and output attributes BEFORE being able to choose loookup table, all in a time consuming wizard
    Expressions     Copy and paste into expression editor, validation fails for expressions using lowercase (such as "upper" or "substr")
    Renaming attributes     Not possible anymore, you need to open details
    Adding a table component     You must browse in a tree structure (time consuming), not search functionality anymore
    Import     Import converting from 9.2 hangs after 15% in about 10% of all imports
    Import     Some mappings are not possible to import, a total rewrite is necessary
    Deployment     You can only deploy about 5-10 times before you need to restart OWB
    Memory leak     If something goes wrong in OWB, memory is never cleared - JAWAW.exe needs to be removed manually from memory
    Import     Importing mappings one by one (as this is sometimes needed due to OWB), the last directory used is OF COURSE not default when importing the next time
    OWB GUI / mapping editor     When working with components in the mapping editor, an object hidden behind the object you are actually working with is selected prior to the object in visual focus to the user
    BUG!     Urgent: CASE - wrong generated Code
    ANSI JOINS     Remove ANSI-SQL from mapping configuration, otherwise (+) outer joins will not work
    Transformations     Not possible to enter a transformation such as "sysdate", you must find it in a huge tree structure list (no search available)

  • SAP with Macros

    Hi Experts,
    I am working on Single click entry tool, my requirement is
    1. I want to know how many sessioned i have opened in SAP through Macros in a popup.
    2. suppouse i am getting 2 sessions in popup and i am selecting any one then automatically macro will focus in selected one in SAP.
    urgent.....

    Back again to tell you this is a common task and has been solved like a zillion times, check for example these links:
    http://www.sapdev.co.uk/file/file_upexcel.htm
    http://www.sap-img.com/abap/upload-direct-excel.htm
    And I would put some money on the fact there is some demo report on this topic in your ERP (but I am sorry, I don´t know any useful rpogram name, maybe you can try to seacrh a little using wildcards... XLS maybe?).
    Regards Otto

  • How to set the move functionality.

    I want to set the move functionality for a Jwindow in solaris. If i click on the ALT F7 then the default move works, I want to set that default fuctionality to my menuitem is it possible.

    Do you have any solution regarding this move please tell
    K_ramanadham. But how to know your id kalpana there is nothing in your profile. If possible please send it to binduA @yahoo.com

  • Post Upgrade Tasks

    Hello,
    Recently we upgraded our E-Recruiting 3.0 SP12 system to SP15 (13,14,15).  Does anyone know of where I could obtain notes on post upgrade tasks?  i.e. things to check, activate, etc.
    Thanks!
    Ryan

    Here are some from my list. I stopped maintaining it a while ago, we have lots more where this came from. Some of it also apply to older versions of OWB.
    Key lookup     You are to choose input and output attributes BEFORE being able to choose loookup table, all in a time consuming wizard
    Expressions     Copy and paste into expression editor, validation fails for expressions using lowercase (such as "upper" or "substr")
    Renaming attributes     Not possible anymore, you need to open details
    Adding a table component     You must browse in a tree structure (time consuming), not search functionality anymore
    Import     Import converting from 9.2 hangs after 15% in about 10% of all imports
    Import     Some mappings are not possible to import, a total rewrite is necessary
    Deployment     You can only deploy about 5-10 times before you need to restart OWB
    Memory leak     If something goes wrong in OWB, memory is never cleared - JAWAW.exe needs to be removed manually from memory
    Import     Importing mappings one by one (as this is sometimes needed due to OWB), the last directory used is OF COURSE not default when importing the next time
    OWB GUI / mapping editor     When working with components in the mapping editor, an object hidden behind the object you are actually working with is selected prior to the object in visual focus to the user
    BUG!     Urgent: CASE - wrong generated Code
    ANSI JOINS     Remove ANSI-SQL from mapping configuration, otherwise (+) outer joins will not work
    Transformations     Not possible to enter a transformation such as "sysdate", you must find it in a huge tree structure list (no search available)

  • How to set ALT keys functionality?

    I want to set the ALT key fuctionality externally is it possiable, that is in solaris.

    hi thank for your response but my problem is how to fire the Fuctionality extenally. I explain my problem
    I want to set the move funtionality for a JWindow in solaris but i won't set the transprent window. In solaris Whenever you click on ALT F7 then the default move fires, i want to set it in my menuitem.

  • Urgent JWindow closing!!!!!!

    Hi ALL
    My problem is iam not able to close my JWindow by pressing ALT F4 in Solaris OS any suggestions please forward waiting for reply.....

    Hi kalpana,
    some code:
    public class MyWindow extends JWindow implements KeyListener, WindowListener
    public MyWindow(){
    super();
    ... // set width, height and whatever
    addKeyListener( this);// for closing
    addWindowListener( this);// for focus
    show();
    // implement the window listener
    public void windowClosing( WindowEvent e ) {
    //System.exit(0);
    public void windowClosed( WindowEvent e ) {}
    public void windowActivated( WindowEvent e ) {}
    public void windowDeactivated( WindowEvent e ) {}
    public void windowDeiconified( WindowEvent e ) {}
    public void windowIconified( WindowEvent e ) {}
    public void windowOpened( WindowEvent e ){
    requestFocus();
    // implement the key listener
    public void keyReleased( KeyEvent e){}
    public void keyTyped( KeyEvent e){}
    public void keyPressed( KeyEvent e){
    if( (e.getKeyCode() == KeyEvent.VK_ESCAPE) && (e.getModifiers() == InputEvent.ALT_MASK)){
    e.consume();
    dispose();
    System.exit( 0);
    I haven't tested this code, but it's copied out of an application that works.
    Hope this helps.
    Oliver

  • Focus Problem on Solaris with jdk 1.3.1

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

    Hi all,
    We are having a focus problem on Solaris. The same code works fine on Windows without any problem.
    I am sending the test code and run steps below which you can compile and repeat the problem.
    NOTE: When we put a comment on the line "f1.requestFocus();" in TestFocus.java it works OK.
    Run Steps :
    1. Run TestFocus.class
    2. A JFrame appears with 2 text field and a button
    3. Try to write something on the text fields. It works OK.
    4. Click the button to open a new JFrame
    5. A new JFrame opens with a single text field and a button.
    6. Click the button to close the second frame
    7. You are now on the main JFrame
    8. Try to write something on the text fields. It works OK.
    9. Repeat the steps 4-7
    10. Try to write something on the text fields. You are able to focus and write on the first field. BUT you cannot select or write the second Field!
    JAVA SOURCE FILES :
    PenHesapListener.java :
    public interface PenHesapListener extends java.util.EventListener {
    void tamam_actionPerformed(java.util.EventObject newEvent);
    void iptal_actionPerformed(java.util.EventObject newEvent);
    ------PenHesapLisEventMulticaster.java----------------------------------
    public class PenHesapLisEventMulticaster extends java.awt.AWTEventMulticaster implements PenHesapListener {
    * Constructor to support multicast events.
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected PenHesapLisEventMulticaster(java.util.EventListener a, java.util.EventListener b) {
         super(a, b);
    * Add new listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param a muhasebe.HesappenListener
    * @param b muhasebe.HesappenListener
    public static PenHesapListener add(PenHesapListener a, PenHesapListener b) {
         return (PenHesapListener)addInternal(a, b);
    * Add new listener to support multicast events.
    * @return java.util.EventListener
    * @param a java.util.EventListener
    * @param b java.util.EventListener
    protected static java.util.EventListener addInternal(java.util.EventListener a, java.util.EventListener b) {
         if (a == null) return b;
         if (b == null) return a;
         return new PenHesapLisEventMulticaster(a, b);
    * @return java.util.EventListener
    * @param oldl muhasebe.HesappenListener
    protected java.util.EventListener remove(PenHesapListener oldl) {
         if (oldl == a) return b;
         if (oldl == b) return a;
         java.util.EventListener a2 = removeInternal(a, oldl);
         java.util.EventListener b2 = removeInternal(b, oldl);
         if (a2 == a && b2 == b)
              return this;
         return addInternal(a2, b2);
    * Remove listener to support multicast events.
    * @return muhasebe.HesappenListener
    * @param l muhasebe.HesappenListener
    * @param oldl muhasebe.HesappenListener
    public static PenHesapListener remove(PenHesapListener l, PenHesapListener oldl) {
         if (l == oldl || l == null)
              return null;
         if(l instanceof PenHesapLisEventMulticaster)
              return (PenHesapListener)((PenHesapLisEventMulticaster) l).remove(oldl);
         return l;
    public void tamam_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).tamam_actionPerformed(newEvent);
         ((PenHesapListener)b).tamam_actionPerformed(newEvent);
    public void iptal_actionPerformed(java.util.EventObject newEvent) {
         ((PenHesapListener)a).iptal_actionPerformed(newEvent);
         ((PenHesapListener)b).iptal_actionPerformed(newEvent);
    ---------TestFocus2.java-----------------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    public class TestFocus2 extends JFrame implements ActionListener
         protected transient PenHesapListener PenhListener = null ;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus2()
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   fireTamam_actionPerformed(e);
         public void addPenHesapListener(PenHesapListener newListener)
              PenhListener = PenHesapLisEventMulticaster.add(PenhListener, newListener);
              return;
         protected void fireTamam_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.tamam_actionPerformed(newEvent);
              this.setVisible(false);
         protected void fireiptal_actionPerformed(java.util.EventObject newEvent) {
              PenhListener.iptal_actionPerformed(newEvent);
         public static void main(String x[])
              TestFocus2 gen01 = new TestFocus2();
    --------TestFocus.java-----------------------------------
    import javax.swing.*;
    import javax.swing.JOptionPane;
    import java.awt.event.WindowAdapter;
    import java.awt.event.KeyListener;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.StringTokenizer;
    import java.text.SimpleDateFormat;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.Color;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import java.awt.Container;
    public class TestFocus extends JFrame implements ActionListener
         PenKreKart aPenKreKart = null ;      
         Container ctn = null;
         JTextField f10 = null;
         JButton b10= null ;
         JTextField f1 = new JTextField() ;
         JTextField f2 = new JTextField() ;
         JButton b1 = new JButton() ;
         JFrame f20 = null;
         public TestFocus()
              //aPenKreKart = new PenKreKart(true);
              //aPenKreKart.aTemelPencere.setVisible(false);
              getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
              getContentPane().add(f1);
              getContentPane().add(f2);
              getContentPane().add(b1);
              pack();
              setVisible(true);
              b1.addActionListener(this);
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == b1)
                   pencere_islemi();
         // pencere koyma k?sm? .. begin                               
         public void pencere_islemi() {     
              ctn = this;
              ctn.setEnabled(false);
              TestFocus2 fpen = new TestFocus2();
              //aPenKreKart.aTemelPencere.setVisible(true); //buras?          
              //aPenKreKart.aTemelPencere.addPenHesapListener(new PenHesapListener() {
              fpen.addPenHesapListener(new PenHesapListener() {
                        // metod      tamam_actionPerformed begin...          
                        public void tamam_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             // Problem is when we comment the below line it works .....
                             f1.requestFocus();
                             System.out.println("tamam");
                        // metod      tamam_actionPerformed end...          
                        // metod      iptal_actionPerformed begin...          
                        public void iptal_actionPerformed(java.util.EventObject newEvent) {
                             ctn.setEnabled(true);
                             ctn.requestFocus();
                             System.out.println("iptal");
                        // metod      iptal_actionPerformed begin...          
         // pencere koyma k?sm? .. end                               
         public static void main(String x[])
              TestFocus gen01 = new TestFocus();

  • How to gain focus to a JTextField in a Jwindow

    Hi Friends
    I am trying to create a Login screen which covers the entire desktop using a Jwindow.
    I have one JTextfield and JPassword field in the Jwindow but i am not able to gain focus to those text fields and not able to type anything in those fields...
    I am using java 1.4.2
    This is my program...
    public class Login implements ActionListener
            JWindow fs;
            JTextField tx1;
            JPasswordField tx2;
             public Login ()
                 fs= new JWindow(new JFrame());
                 tx1= new JTextField(12);
                 tx2= new JPasswordField(12);
                 JButton jb = new JButton();
                 fs.getContentPane().setLayout(new FlowLayout());
                 fs.getContentPane().add(tx1);
                 fs.getContentPane().add(tx2);
                 fs.getContentPane().add(jb);
                 fs.setSize(300,300);
                 fs.setVisible(true);
                 fs.show();
                 fs.toFront();
    public void actionPerformed (ActionEvent e)
         System.out.println("User id "+tx1.getText()+" and Password is : "+tx2.getText()):
    public static void main(String[] args)
        new Login();
         Can some one help me in solving this issue with JWINDOW... Plz dont suggest JFrame , since i am not willing to use that header....
    Thanks in advance
    Ur Friend.

    Swing releated questions should be posted in the Swing forum.
    Check out this posting, found in the Swing forum:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=675445
    Plz dont suggest JFrame , since i am not willing to use that header....
    JFrame.setDefaultLookAndFeelDecorated(false);

Maybe you are looking for