Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8098013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:56:36+00:00 2026-06-05T21:56:36+00:00

I want to create a onscreen keyboard such that when a text field gets

  • 0

I want to create a onscreen keyboard such that when a text field gets focused the keyboard appears on the screen and when the focus is lost or if one clicks outside the screen the keyboard should disappear.

This is not the problem, the problem is that i’m not sure what I should use to create such a keyboard. I cannot use a jFrame because if I click outside the keyboard window then the keyboard goes to the background and is not closed. I also can’t use jDialog because it do not allow us to click outside the window.

I also would like to be able to show a textbox with what is entered by the keyboard in real-time(as i click the keys on the onscreen keyboard it should appear in the textbox). I am doing this program in netbeans so if you could keep that in mind, it would be helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:56:38+00:00Added an answer on June 5, 2026 at 9:56 pm

    I am not sure I understand the requirement here, but see if this example gives you some ideas.

    The basic thrust of it is to ensure there is ‘white space’ (OK RED/ORANGE in this example, but let’s not quibble over shades of gray) around the components that can become focusable. Add a mouse listener to it, and on event, request the focus (or in your case, hide the keyboard).

    import java.awt.*;
    import java.awt.event.*;
    
    import javax.swing.*;
    
    public class ComponentFocus {
    
        ComponentFocus() {
            final JPanel gui = new JPanel(new GridLayout(0,1,15,15));
            gui.setFocusable(true);
            gui.addMouseListener(new MouseAdapter(){
                @Override 
                public void mouseClicked(MouseEvent me) {
                    System.out.println(me);
                    gui.requestFocus(true);
                }
            });
            gui.setBackground(Color.RED);
            gui.addFocusListener(new FocusAdapter(){
                @Override
                public void focusGained(FocusEvent fe) {
                    gui.setBackground(Color.ORANGE);
                }
    
                @Override
                public void focusLost(FocusEvent fe) {
                    gui.setBackground(Color.RED);
                }
            });
    
            JButton button1 = new JButton("button1");
            gui.add(button1);
            JButton button2 = new JButton("button2");
            gui.add(button2);
    
            JOptionPane.showMessageDialog(null, gui);
        }
    
        public static void main(String[] args) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    new ComponentFocus();
                }
            });
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an on-screen display, i.e. text or simple graphics that appear
I've got an online typing program and I want to create an on-screen keyboard
For a project I'm working on I want to create an on-screen keyboard. So
I want to create a virtual numpad, similar to the on-screen keyboard. How do
I want to create a UIButton that moves random on screen after pressed it.
I want to create a function which plot on screen a set of figures
I want create wordpress website into which I want create user management... That means
i want create a custom json data from the mssql 2008 results so that
I want to create a text display area (either UILabel or UITextView) in my
I want to draw many polygons to the screen but i'm quickly noticing that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.