Button.requestFocus(); does not give the focus to a button...

I have a Frame with a message (textPane) and a button, for accept the message. I want the button to be focused when I open the frame, so this will allow the user to just press one key for accepting the message without use the mouse.
How can I acomplish this???!!!
Thanks on advance.

I still cannot give the focus to the button when I open the JDialog.
My code is this:
public class VError extends JDialog
GridBagLayout gridBagLayout1 = new GridBagLayout();
JTextPane jTextPane1 = new JTextPane();
JPanel jPanel1 = new JPanel();
JButton jButton1 = new JButton();
GridBagLayout gridBagLayout2 = new GridBagLayout();
String message;
ResourceBundle mes = ResourceBundle.getBundle("com.saincotrafico.optimus.client.resources.RError",Locale.getDefault());
MutableAttributeSet mas;
public VError(String message)
this.setSize(250,150);
this.setResizable(false);
this.getContentPane().setBackground(UIManager.getColor("Panel.background"));
this.setTitle(mes.getString("title"));
this.message = message;
try
jbInit();
catch(Exception e) {
e.printStackTrace();
private void jbInit() throws Exception
mas=new SimpleAttributeSet();
StyleConstants.setAlignment(mas,StyleConstants.ALIGN_CENTER);
jTextPane1.setParagraphAttributes(mas,true);
jTextPane1.setEditable(false);
jTextPane1.setSelectedTextColor(Color.black);
jTextPane1.setText("\n"+message);
jTextPane1.setBackground(this.getBackground());
jTextPane1.setEditable(false);
this.getContentPane().setLayout(gridBagLayout1);
jButton1.setSelected(true);
jButton1.setText(mes.getString("aceptar"));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
jPanel1.setLayout(gridBagLayout2);
this.getContentPane().add(jTextPane1, new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
this.getContentPane().add(jPanel1, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
,GridBagConstraints.SOUTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 10, 0), 0, 0));
jPanel1.add(jButton1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5, 157, 5, 158), 0, 0));
this.getRootPane().setDefaultButton(jButton1);
jButton1.requestDefaultFocus();
jButton1.requestFocus();
void jButton1_actionPerformed(ActionEvent e)
this.dispose();
}

Similar Messages

  • I download iOS 7 one song does not delete. I will swipe but it does not give the option to delete

    I downloaded iOS 7 and one song  does not give the option to delete

    Same problem.  Certain songs simply cannot be deleted.   I'd love someone to acknowledge it's a bug.

  • I have an iphone 5 and he thinks that the speakers and headphones it does not give the maximum volume!

    I have an iphone 5 and he thinks that the speakers and headphones it does not give the maximum volume!

    why does he think that?

  • My iphone's screen goes black and it behaves like that it is switched off.No switches work and the power button also does not respond.The ringtone do not also respond.The only way to switch on the phone is to press  home button and  power button together.

    My iphone's screen goes black and it behaves like that it is switched off.No switches work and the power button also does not respond.The ringtone do not also respond.The only way to switch on the phone is to press  home button and  power button together.

    Pressing the Home button and the sleep/wake or on/off button together until you see the Apple logo and then release is called a reset.
    If no change after a reset, the next step is restoring your iPhone.

  • Right click with mouse in Word 2013 does not give the list with translate and synonyms etc

    since i upgraded to windows 8.1 right click on words in word 2013 does not open the regular list where you can tap on synonyms and translate. 
    it does work if i touch the screen.
    i moved to mouse mode but it does not help 
    can anyone help...
    i am starting to hate windows 8.1 and word 2013 because of this feature not working

    Hi
    I have tested in my computer and it worked well.
    Normally when we type a wrong spelling, right clicking the word does not give a list with translate and synonyms.
    Check to make sure your spelling is right.
    if the issue persists, Start Word in safe mode to check the issue:Hold "Ctrl" key and click into the program.
    It is also recommended that you do a repair for your Office suites in
    Control panel>Program and features>Office>Change>Repair
    Thanks
    Tylor Wang
    TechNet Community Support

  • Qosmio x770/00x - button 1 does not work pressing 6 and other button

    This is going to sound so weird, but bear with me...
    I just got a Qosmio x770/00x a couple of weeks ago, mostly for gaming purposes.
    I play in left-handed configuration, using the Num pad as directional keys, with some of the other non-directional numbers mapped to things like 'jump' and 'melee', etc.
    I have the '1/End' key mapped usually to the 'Crouch' motion in games, and noticed that if I press the '6/Right' key, in combination with any other number key, the '1/End' key won't register!
    This means if I'm moving Forwards in a game, and Strafe to the right, I can't simultaneously crouch.
    I've done a bit of playing around, and it seems that this bug isn't limited to my unit, or to any particular program. If you try a similar thing in any other program (eg Notepad), and hold the '6' key down along with any other number key, the '1' key won't register.
    However it seems that it *has* to be the '6' key in the combination (eg. if you press '4' and '7' together, and then press '1', the '1' will still register.
    Have also tried this on the store demo model at the local computer place, and it seems that it's a problem with this particular model.
    The store computer runs Windows 7 Home Premium.
    I'm running Win7 Pro. BIOS and Windows are fully updated.
    Have also tried it on my older P-series Satellite, and that doesn't have the same problem.
    Any ideas?

    Hi
    >I've done a bit of playing around, and it seems that this bug isn't limited to my unit, or to any particular program. If you try a similar thing in any other program (eg Notepad), and hold the '6' key down along with any other number key, the '1' key won't register.
    >However it seems that it has to be the '6' key in the combination (eg. if you press '4' and '7' together, and then press '1', the '1' will still register.
    Ive got 2 notebooks from two different manufactures and the button 1 does not register if 6 + other button is pressed.
    Dont think its a really a keyboard bug because this happen with my two notebooks which are not really similar to each other

  • I have iMovie 11 version 9.0.04. When I try to burn a movie on a dvd  the button ''share ''does not open the idvd window. I do not find idvd in  my computer

    I want to burn on a dvd some  videos I have on Quick time player version 10.1 and on  imovie version 9.0.04. On the tutorial it said ,with  imovie, to select a video, clic the button share, the idvd button, and the idvd will open automatically, but idvd does not open. My computer said that I have a 6.0.4 idvd version but I do not find it in my applications list. I tried to download the next versions but is said that it is not possible. How can I burn my videos on dvd-r?

    I want to burn on a dvd some  videos I have on Quick time player version 10.1 and on  imovie version 9.0.04. On the tutorial it said ,with  imovie, to select a video, clic the button share, the idvd button, and the idvd will open automatically, but idvd does not open. My computer said that I have a 6.0.4 idvd version but I do not find it in my applications list. I tried to download the next versions but is said that it is not possible. How can I burn my videos on dvd-r?

  • Compressor does not start the job after submit button clicked.

    Hello All,
    FCP 6.0/ Compressor 3.0.5
    I am trying to export a section of a FCP timeline sequence (set with in and out) thorugh Compressor, into a couple of video formats (DVD and a custom H.264). After I set the destination and make surte that the source file is in place, I press "Submit" button and again "submit" from pop-up window and nothing happens. No usual window with the job processing appears, like it ussually does. I restarted programs and computer and no change. Compressor quitted unexpectedly few times within the same process of initiating export from FCP. I tried test export from a different FCP project and the compressing does not start either after pressing "submit".
    I did not have this problem before. I would greatly appreiciate any suggestions.
    Best to all,
    Izabela

    Dear ToddNashville,
    Thank you so much! This was it! It was processing but did not see the process as the "ghost" icons of the new exporte files in destinations would not appear immiediately as I thought they usually do. Once they are completed or 1/2 way through they appear.
    I did not try the batchlist before. It is so clear as far as whats running and how much time left! I hope all will process fine.
    Thank you!

  • Hi, I have a 7th Gen Ipod Nano and I am unable to delete songs. When synced on the PC I can select tracks but right clicking on them does not give the ability to delete. I have downloaded the latest 1.0.3 software but it did not help.

    Hi,  I have a 7th gen ipod nano and am having a problem with deleting songs. I can select the track in my ipod's library but right clicking does not bring up the option to delet. I have downloaded the latest update for the ipod but this has not solved the issue. Can anyone suggest a remedy? thanks

    Hello Lor100,
    In order to delete or add individual songs from and to your iPod, you'll need to enable 'manual mode' on the device. This will allow you to add and remove exactly the content you desire.
    Managing content manually on iPhone, iPad, and iPod
    http://support.apple.com/kb/HT1535
    Cheers,
    Allen

  • Wiki Placeholder does not give the option to create

    When trying to create a link on my Enterprise Wiki page I created a placeholder, the issue is that I am not able to select the placeholder and get the prompt to create. I've researched and still can't come up with a logical explanation. I am able to create
    the link "the long way" it is just more favorable to use the placeholder. (I'm using IE 10)

    I need to understand this question. When you say you created a placeholder on your wiki page what do mean? Did you mean using "[[" ?
    Based on my understanding of your question I would try to answer and you can correct me by providing more information.
    On your Enterprise Wiki Page if you want to create a link to a page all you do is
    1) start with [[ bracket. This will open a dropdown and will let you pick the existing page or list items.
    2) In case the page does not exist then you simply go ahead and complete the bracket with your text. 
    e.g. [[MYNEWPAGE]]
    3) When you save the page you will see a link on your MYNEWPAGE text and it will have ..... under the text.
    4) You simply click the link and it will let you create a page by providing the title.
    Amit

  • V_V2 Rescheduling does not give the split schedule lines

    Dear All
    When I create a Sales order, if the partial qty is available, system confirms partial immediately and balance after lead time.
    However when I run rescheduling run from V_V2 , it changes all the qty to end lead time confirmation.
    I do not have any other sales order in Pipe line.
    Why the Rescheduling does not confirm on split basis.
    Looking for exprts opinion.
    Regards,
    Neeraj

    Hello,
    I have two ideas related to your question:
    -1-Try to use the transaction V_V1, it the same function of the V_V2, but you can select the sales order instead the material.
    -2-Check in your sales order if you have the flag "no re-scheduling" it's a flag on the schedule line( item, tab schedule line), if you have selected the flag, the v_v2 doesn't works for the schedule line.
    If I think anything i'll send you a message,
    Best regards

  • LR does not take the focus

    LR doesn't take the focus when a pre-launch windows opens first--i.e. the 'backup catalog window' or the 'choose catalog' window.
    This is frustrating because LR sits in front of all other windows and therefore looks to have the focus, but to get the actual focus on LR I have to cycle to the LR window (alt+tab) or click on LR in the task bar.
    OS=Vista
    Taskbar set to autohide.

    There are still broken links with backslashes in that frame (right-click context menu: This Frame > Reload Frame).<br />
    Only the first two have a forward slash.<br />
    I have a bookmarklet to fix such links (86 originally, still 84 links left) and that makes the images show.
    It is amazing that the pages with the backslashes also were uploaded (you may want to remove those!):
    *http://www.autogamma.com/FastSP/pompe%5CPL103.html
    *http://www.autogamma.com/FastSP/pompe/PL103.html

  • TS1389 itunes store does not give the option to authorise my computer

    i do not the option in my account to authorise my computer.
    where is the authorise button??

    See this Discussion...
    https://discussions.apple.com/thread/4631735?tstart=0
    See Here for full details...
    About authorization and deauthorization

  • [Solved] Rankmirrors command does not give the fastest mirrors.

    Hello Dear Arch users,
    This is not ,actually, a real issue but a simple question.
    When I uncomment all mirrors in mirror.pacnew and rank them like with
    "rankmirrors -n 12 /etc/pacman.d/mirrorlist.pacnew > /etc/pacman.d/mirrorlist"
    ,and try to do a "pacman -Syy", some mirrors failed to connect or time out, so I comment
    them in mirror.pacnew and redo the process.
    Would there be a way of having only the faster mirrors that don't time out or failed to connect?
    If the answer is "no", I think I can begin coding a script that does exactly like rankmirrors but that has not bad" mirrors.
    Thank you for your time and support.
    Last edited by venam (2012-07-10 06:24:00)

    Hello ngoonee,
    I think the problem can comes from my DNS or from my connection.
    In my country the internet is really slow so maybe it is the problem.
    Thank you for your answer.

  • Spotlight does not give the option to show file names only

    I have noticed that Spotlight doesn't have the button to allow for showing only the file name that contain the search word. I use this function a lot and not having it makes my searches much more tedious. Anyone know if there is some hidden way now in Lion to do this?
    Sima

    Well, after digging for a while in help, I found it. You have to click "show all" after beginning the search, then click on the + sign to add criteria, then choose criteria from the pop-up menu labeled "Kind". I had to go further and click on "other" to find "filename", then it worked. It seems like a lot more work than it was before. I would think that putting a few buttons with some of the most common uses at the top of the window would be more convenient, or at least, providing an option to put those buttons there.
    Sima

Maybe you are looking for

  • Getting a New MBP and Want to Understand CDs/DVDs

    Hello- this might be the wrong area bt I am sure I will hear if it is. If it is, I apologize in advance. I have never understood all the various kinds of CDs/DVds. One very specific question I have is trying to purchase the correct CD/DVD for making

  • GR/IR Clearing GL Account

    How to clear GR/IR CLEARING GL account in FI if all MIGO done and PO closed for the financial year 2009-10 How to clear GR/IR CLEARING (Without PO) GL Account in FI for yea end closing activity How to clear SR/IR CLEARING (Without PO) GL Account in F

  • Only seeing 2 GB memory (Windows XP Pro SP2, 32 bit)

    I have 4 GB installed on my Mac Pro (early 2008). It's running Windows XP Pro SP2, 32 bit). The System Information says I only have 1.99 GB of RAM. I understand that 32-bit Windows can only see up to 3 GB of RAM. But I'm only seeing 2 GB. (For exampl

  • Mandatory update not working on Mountain Lion...

    Is anyone else having problems installing the Folio Builder Panel update on Mountain Lion? I tried downloading the update from two different browsers and I'm getting the following error message every time: Any suggestions?

  • Tables in html

    I have the following code and cannot get the words under the picture as close as I want. Can anyone give me a tip on how to get the words closer to the picture. They are currently under the picture with too much space and I want the words almost touc