This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Modern JavaScript for the Impatient and have Cay Horstmann on-line!
See this thread for details.
Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

how to get focus on a swing button

 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

when i run my program in internet explorer,the focus in every button is working like this.i have to click a button with mouse for the first time and then if we press the tab key ,the next buttons are getting the focus.after reaching the last button the focus goes to the browser and it is not coming to the first button again.what i need is i want to get the focus by default in the first button without clicking the mouse and after reaching the last button the focus have to come into the first button automatically.my code is below.please help me.

code:
public class AstMonitor extends JApplet implements ActionListener,Runnable {

Thread astThread;
JButton callback = new JButton("0 Callback");
JButton noanswer = new JButton("2 NoAnswer");

JButton voicemail = new JButton("3 AnsMach ");
public void init() {
resize(150,475);
GridLayout gl;
getContentPane().setLayout(new GridLayout(3,10));


callback.setActionCommand("callback");
callback.addActionListener(this);
this.getContentPane().add(callback);
callback.setMnemonic('c');
callback.setBackground(Color.pink);
noanswer.setActionCommand("noanswer");
noanswer.addActionListener(this);
this.getContentPane().add(noanswer);
noanswer.setMnemonic('w');
noanswer.setBackground(Color.pink);
voicemail.setActionCommand("voicemail");
voicemail.addActionListener(this);
this.getContentPane().add(voicemail);
voicemail.setMnemonic('a');
voicemail.setBackground(Color.pink);
astThread = new Thread(this);
astThread.start();
}

please anyone help me.
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic