How to make keyboard modal?

I have a bunch of text edit fields. When the user clicks on one of them the keyboard comes up. But they can touch on another field before they click the DONE button on the keyboard, then they might be editing two fields. I am currently closing off the edit when another one opens up but is there a simpler way, to make the keyboard entry modal so that no other touches can happen until then?

Yes, absolutely. There is no limitation as to how many components a JDialog can contain.
http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JDialog.html
In the JDialog's constructor you can pass :
- the parent JFrame or JDialog,
- whether the current JDialog is modal
- its title.
Then you add components the same than for a JFrame : setContentPane(a Container) or getContentPane().add(...).

Similar Messages

  • How to make another modal popup window in a modal popup window?

    how to make another modal popup window in a modal popup window?
    two modal windows must be made by inheritance of JDialog.

    the jdialog has constructors where you can set another jdialog as owner. (the same as frame)
    Visit our german java forum at http://www.java-forum.org/de
    An english version will be released soon at http://www.java-forum.org/en

  • How to make a modal frame?

    Hello!
    My problem is quite simple, but I don't know how to make some MODAL frames (JFrame I mean). In my application, the user can open a same frame even if this frame is already opened and that's not really good.
    So, I want the user to close the frame before opening another one.
    Can anyone explain me how to do that?

    Generally your actionListener will be an internal class of your main frame class. Usually an anonymous internal class. That means it can act on variables in the frame (which is the sensible place to keep the flags).
    Something like:
    class Class1 extends JDesktop {
    boolean itsOpen = false;
    openAction.setActionListener(new ActionListener(){
      public void actionPerformed(ActionEvent e) {
        if(!itsOpen) {
           itsOpen = true;
           openAction.setEnabled(false);
           MyInternalFrame newFrame = new MyInternalFrame(Class1.this, ....);
           add(newFrame);
       });You do need some way for the internal frame to act on the variables in the main frame. There are various ways of achieving this.
    If we're dealing with a genuine InternalFrame there's a special InternalFrameListener (?) which allows your main frame to listen for the window closing. You can use this instead of hacking the dispose method.
    If you're main frame is a JDeskTop then you can use getDesktop() in your internal frame to access it, then cast the result to the real class of your desktop.
    Our you can simply add a pointer to your class1 to the contructor of your internal frame class.
    You could even get clever and create your own listener system.

  • Very URGENT -- How to make keyboard print

    This is very urgent. How to make the keyboard print?

    Here is the code. It is supposed to make the keyboard type something.
    This is URGENT.
    public class KeyBoarder
         private int keyPressed;
         public KeyBoarder()
              System.out.println("Welcome to keyboard");
         private void print()
              System.out.println("Keyboarder has printed");
         public static void main(String args[])
              KeyBoarder board = new KeyBoarder();
              board.print();

  • T430 - How to make keyboard backlight permanent?

    Hello,
    Is it possible to make keyboard backlight permament?
    It would be nice if it worked all of the time. I had such option in my Dell Vostro and i really miss this feature.
    Solved!
    Go to Solution.

    jazzfog wrote:
    Is it possible to make keyboard backlight permament?
    There's no setting or tool to do it.
    It would be nice if it worked all of the time. I had such option in my Dell Vostro and i really miss this feature.
    People have asked about this on other threads but so far no one has found a way to programmatically control the backlighting. I agree that it would be a useful feature.
    Cheers... Dorian Hausman
    X1C2, TPT2, T430s, SL500, X61s, T60p, A21p, 770, 760ED... 5160, 5150... S360/30

  • How to make a modal JWindow

    I want to make my JWindow modal. Any idea????
    Thanks very much..

    Hi,
    I know thats possible through JNI by making calling to the native operating system. I dont know how to do that. If you could give any idea, or sample code, that would be great. Thanks very much....

  • How to make awt modal dialog to NOT appear on top of existing windows

    Hi,
    I am working on a program that displays awt modal dialog box when it needs some action from the user. My problem is that the modal dialog box cann't be top window as there is one VC++ window that needs to be always top window. Another requirement I must satisfay is that there should not be any flickling. I've tried with setAlowaysOnTop(false), dialog.toBack(), transferFocus(), etc but with no avail. Any help will be greatly appreciated. Thank you in advance.

    Note: This thread was originally posted in the Swing forum, but moved to this forum for closer topic alignment.

  • How to make keyboard do accent marks???

    Ok. So I just got the Mavericks update. And now when I hold down a letter (in order to add an accent mark to it), it won't work anymore. Does anyone know how to fix this!?!? Because Apple sure doesn't. Please help

    I have not moved to Mavericks, all my accents work as before using the option key, so if it has changed, try posting this in the Mavericks or I guess it is this one
    http://www.apple.com/osx/whats-new/
    All the things I have done in the past, previous to Mavericks have worked as normal with the option key and a mod key.
    Like I mentioned before I do not as of yet have Mavericks. so I can not advise you in any certainty.
    If none of the "normal" option keys work for you, you may want to contact Apple and let them know????
    http://www.apple.com/feedback
    Or call Apple support 800-692-7753

  • Does anybody know how to make a modal JFrame?

    Thanks

    Hi, Thanks, but I don't want to use Dialogs since I ned to change the appearance of the "Message title" - color background and the close button. That is why I want to use a JFrame.

  • How to make a keyboard navigating multiple choice list in Flash and control it through actionscript?

    i am making an rpg style game in actionscript 3.0 and i want to make a multiple choice list. I know how to make the list with buttons and how to control it. My question is, how do you make a list that can be navigated using the keyborad arrows? What i am after is being able to hit up, and down to highlight the buttons and enter to chose the button.

    You'll need to make the buttons as movieclips so that you can control which display state they are in (highlighted versus not).
    Then you need to set up a listener for the keyboard keys so that you can have the selected button change and the execute if the Enter is pressed.  Here is a basic setup for a keyboard listener that shows how to detect the three keys you mentioned...
    stage.addEventListener(KeyboardEvent.KEY_DOWN,keyIsDown);
    function keyIsDown(e:KeyboardEvent):void  {
             if (e.keyCode == Keyboard.DOWN) {
                     trace("DOWN");
             } else if (e.keyCode == Keyboard.UP) {
                     trace("UP");
             } else if (e.keyCode == Keyboard.ENTER) {
                     trace("ENTER");

  • How to make an internal frame a modal frame?

    aoa Friends i am trying to make a application using jframe with jdesktoppane and jinternal frame.is there any body who can guide me through that :
    how to make a jinternal frame a modal frame so that if a new jinternalform is opened than the previous one could not be accessed and if new one is closed then we can use that form.

    http://developer.java.sun.com/developer/JDCTechTips/2001/tt1220.html
    This is the example I used approach 2 to simulate a model frame.
    rykk

  • How to make view automatically scroll when keyboard show up

    Hi all
    I'm like a totally noob for objective-c coding, let alone the iPhone programing. :P
    Anyway, I somehow manage to create a simple application that receive input via UITextField, do some simple math, then display the result in other UITextFields (which can act as a input vice versa).
    Problem is, when I use the UITextField at the buttom of the screen as an input, the keyboard will block that text field out of my view, so I could not see what I'm typing at all.
    That's the question. How to make my view scrollable, and make it simply scroll itself out of the way when the keyboard is shown? I already inherit my view from UIScrollView, but don't know what to do next. Can you guys help enlighten me, please?
    Thanx

    Of course, if you're dealing with textFields, you should change a few things try something like that in your .m file :
    - (void)textFieldDidBeginEditing:(UITextField *)theTextField
    if ([theTextField isEqual:yourTextField])
    // Restore the position of the main view if it was animated to make room for the keyboard.
    if (self.view.frame.origin.y >= 0)
    [self setViewMovedUp:YES];
    // Animate the entire view up or down, to prevent the keyboard from covering the author field.
    - (void)setViewMovedUp:(BOOL)movedUp
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    // Make changes to the view's frame inside the animation block. They will be animated instead
    // of taking place immediately.
    CGRect rect = self.view.frame;
    if (movedUp)
    // If moving up, not only decrease the origin but increase the height so the view
    // covers the entire screen behind the keyboard.
    rect.origin.y -= kOFFSETFORKEYBOARD;
    rect.size.height += kOFFSETFORKEYBOARD;
    else
    // If moving down, not only increase the origin but decrease the height.
    rect.origin.y += kOFFSETFORKEYBOARD;
    rect.size.height -= kOFFSETFORKEYBOARD;
    self.view.frame = rect;
    [UIView commitAnimations];
    - (void)keyboardWillShow:(NSNotification *)notif
    // The keyboard will be shown. If the user is editing the author, adjust the display so that the
    // author field will not be covered by the keyboard.
    if ([yourTextField isFirstResponder] && self.view.frame.origin.y >= 0)
    [self setViewMovedUp:YES];
    else if (![yourTextField isFirstResponder] && self.view.frame.origin.y < 0)
    [self setViewMovedUp:NO];
    #pragma mark - UIViewController delegate methods
    - (void)viewWillAppear:(BOOL)animated
    // watch the keyboard so we can adjust the user interface if necessary.
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)
    name:UIKeyboardWillShowNotification object:self.view.window];
    - (void)viewWillDisappear:(BOOL)animated
    [self setEditing:NO animated:YES];
    // unregister for keyboard notifications while not visible.
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil];
    be sure to invoke the method when you dismiss the keyboard, so that the view "falls back" to its normal state:
    if (self.view.frame.origin.y < 0)
    [self setViewMovedUp:NO];
    Of course, declare the method
    (void)setViewMovedUp:(BOOL)movedUp;
    in the .h file
    and the #define you will use in you .m file :
    // the amount of vertical shift upwards keep the text field in view as the keyboard appears
    #define kOFFSETFORKEYBOARD 50.0
    // the duration of the animation for the view shift
    #define kVerticalOffsetAnimationDuration 0.30
    good luck !

  • I am in my e-mail and a keyboard came up but only the left hand-side of the keyboard and I can't get rid of it, any idea how to make it go away?

    I am in my e-mail and a keyboard came up but only the left hand-side of the keyboard and I can't get rid of it, any idea how to make it go away?

    Have you turned the phone off? If so, and it hasn't fixed the issue, try a reset:
    Press and hold the Sleep/On/Off button and the Home button at the same time for approximately 10-15 seconds. Ignore the slide to turn off indicator, and wait for the Apple logo to reappear. Release buttons. No content will he changed with this process.
    Stedman

  • How to make editing cell to show up caret and taking keyboard event

    Hello everyone:
    I have the following problem with table editing.
    1. using mouse clicking, the editing cell will have cursor and taking keyboard event.(no problem with it)
    2. just type in data, it will show up in the selected cell, but the editing cell do not have cursor visible and also do not fire the keyboard event.
    I have problem with this one. So how to make editing cell to have caret visible and taking keyboard event.
    Thank you very much!
    --tony                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi,
    you should subclass JTable and overwrite two methods.
    1. protected boolean processKeyBinding(javax.swing.KeyStroke ks,
    java.awt.event.KeyEvent e,
    int condition,
    boolean pressed)
    to store the current keyboard event,
    2.public boolean editCellAt(int row,int column,java.util.EventObject e)
    to fix the problem with isCellEditable and curret position and direct the event into proper place.

  • How to make iBook keyboard repair?

    I got an iBook that is missing two of the three tab release keys. I got replacements keys and they came with these very tiny springs. I decided I don't know how to make this repair - how to replace the keys. This is not covered at iFixit.com. Any help out there?

    usually the best way for me to replace a key is you pull the white suspension off the key and clip it to the board where it's suppose to be first.
    next, look at the bottom of the key. there are four connection points. 2 are clip type, the other 2 are like a slider joint. put the slider joint together first by taking the key & hooking it to the suspension - only one way, any other way & the key would be upside down.
    you pay have to hold up the suspension with something like a small tool or toothpick.
    pull the tool out while holding onto the key. take the key, lay it flat & push down. hold down & move it around a bit until the other side clips in.

Maybe you are looking for

  • Command $TAB : message Transaction $TAB does not exist Message no. S#343

    when i use the command $TAB to refresh the buffers the system gives me the message " Transaction $TAB does not exist Message no. S#343 " In some systems it works as intended. How can i correct that position.

  • I want  to design a News like the *LInklist* by XML Form Builder

    Hello:    Everyone!    Now I have another problem about XML Form Builder    I want  to design a News like the LInklist by XML Form Builder    I want the result,For Example SAP News        1news1        2news2        3news3 who can give me some advise

  • What's happaned with Web intelligence report Server

    Hello Im making a document about the BOE XI 3.1 server and when i saw the services in cmc web app i dont the services: Web intelligence report Server Web intelligence Job Server Dont this services exist anymore? Thanks Vegas

  • Airport Extreme doesn't connect to my WLAN when powered later than my TC

    I'm using a German Telekom ADSL modem connected to the newest Time Capsule as a base station for my WLAN. Everything works fine and I'm able to connect several iMacs and MacBook Pros as well as two Epson MFPs. In the evening I disconnect Power from t

  • Tabs won't close.

    For the past few days I have been unable to close tabs. Clicking the "X" in the right corner of the tab does nothing. I can open new tabs though. It's really annoying. And yes I've restarted it and all that crap.