Focus se puede aplicar a todos los componentes que pueden recibir entradas
Para manejarlo, la clase debe tener implementada la interfaz FocusListener

import java.awt.event.*;
import java.util.Vector;
import javax.swing.*;
import java.awt.*;

public class FocusEjemplo extends JPanel implements FocusListener {
final static String newline = “\n”;
JTextArea ja;

public FocusEjemplo() {
super(new GridBagLayout());
GridBagLayout gb = (GridBagLayout)getLayout();
GridBagConstraints c = new GridBagConstraints();

c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 1.0;
JTextField txtf = new JTextField(“textfield”);
txtf.setMargin(new Insets(0,2,0,2));
txtf.addFocusListener(this);
gb.setConstraints(txtf, c);
add(txtf);

c.weightx = 0.1;
c.fill = GridBagConstraints.NONE;
JLabel lbl = new JLabel(“Label”);
lbl.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
lbl.addFocusListener(this);
gb.setConstraints(lbl, c);
add(lbl);

String combo = “ComboBox Item #”;
final int numItems = 15;
Vector vector = new Vector(numItems);
for (int i = 0; i < numItems; i++) {
vector.addElement(combo + i);
}
JComboBox comboBox = new JComboBox(vector);
comboBox.addFocusListener(this);
gb.setConstraints(comboBox, c);
add(comboBox);

c.gridwidth = GridBagConstraints.REMAINDER;
JButton button = new JButton(“Botón”);
button.addFocusListener(this);
gb.setConstraints(button, c);
add(button);

c.weightx = 0.0;
c.weighty = 0.1;
c.fill = GridBagConstraints.BOTH;
String listPrefix = “List Item #”;
Vector vectorLista = new Vector(numItems);
for (int i = 0; i < numItems; i++) {
vectorLista.addElement(listPrefix + i);
}
JList list = new JList(vectorLista);
list.setSelectedIndex(1);
list.addFocusListener(this);
JScrollPane listScrollPane = new JScrollPane(list);

listScrollPane.getVerticalScrollBar().setFocusable(false);
listScrollPane.getHorizontalScrollBar().setFocusable(false);
gb.setConstraints(listScrollPane, c);
add(listScrollPane);

c.weighty = 1.0;
c.gridheight = GridBagConstraints.REMAINDER;
ja = new JTextArea();
ja.setEditable(false);
ja.setRequestFocusEnabled(false);
ja.addFocusListener(this);
JScrollPane spane = new JScrollPane(ja);

spane.getHorizontalScrollBar().setFocusable(false);
spane.getVerticalScrollBar().setFocusable(false);
gb.setConstraints(spane, c);
add(spane);

setPreferredSize(new Dimension(450, 450));
setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
}

public void focusGained(FocusEvent e) {
displayMessage(“Focus gained”, e);
}

public void focusLost(FocusEvent e) {
displayMessage(“Focus lost”, e);
}

void displayMessage(String prefix, FocusEvent e) {
ja.append(prefix
+ (e.isTemporary() ? ” (temporary):” : “:”)
+ e.getComponent().getClass().getName()
+ “; Opposite component: ”
+ (e.getOppositeComponent() != null ?
e.getOppositeComponent().getClass().getName() : “null”)
+ newline);
ja.setCaretPosition(ja.getDocument().getLength());
}

private static void createAndShowGUI() {

JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame(“FocusEjemplo”);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JComponent newContentPane = new FocusEjemplo();
newContentPane.setOpaque(true);
frame.setContentPane(newContentPane);
frame.pack();
frame.setVisible(true);
}

public static void main(String[] args) {

javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}