Results 1 to 2 of 2

Thread: How to carve a Focus Listener in Java?

  1. #1
    SmithJohnson is offline Senior Member
    Join Date
    Dec 2009
    Posts
    364
    Rep Power
    3

    Default How to carve a Focus Listener in Java?

    I am new in programming word. I am learning JAVA programming language. I want to use Focus Listener in my project. But I don’t have any knowledge of it. So anyone knows how to write a Focus Listener in Java? Also tell me the methods that are used by the focus listener.

  2. #2
    Williamsjones is offline Senior Member
    Join Date
    Dec 2009
    Posts
    352
    Rep Power
    3

    Default

    Focus events are fired when an element loses the keyboard focus. This is true whether the change in focus comes through the mouse, the keyboard, or programmatically. From the user's point of view, the component with the keyboard focus is usually famous — with a dotted or black border.

    Try to understand following code given below which is solve your problem.

    Code:
    Frame frame = new JFrame("Trial");
        JPanel panel = new JPanel(new BorderLayout());
        JButton button = new JButton("Test Page");
        panel.add(button);
        frame.getContentPane().add(panel);  
        frame.pack(); 
        button.requestFocusInWindow(); 
        frame.setVisible(true);

Similar Threads

  1. Validator focus in Adobe CS5
    By HowardAdams in forum General Software Terms
    Replies: 2
    Last Post: 07-15-2010, 02:36 PM
  2. Focus Photoeditor - 6.1.10.1
    By MyersGray in forum Download Tools and Softwares
    Replies: 0
    Last Post: 05-14-2010, 02:36 PM
  3. Focus Photoeditor - 6.1.10
    By CarterWatson in forum Download Tools and Softwares
    Replies: 0
    Last Post: 05-12-2010, 03:18 PM
  4. Document Listener in Java
    By Brian Close in forum Programming
    Replies: 3
    Last Post: 03-17-2010, 11:56 AM
  5. How to write a element Listener in Java?
    By Brownchris in forum Software Jargons
    Replies: 1
    Last Post: 02-13-2010, 01:56 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
SEO by SubmitEdge

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48