Button Focus : Focus « Swing JFC « Java

Button Focus

Button Focus
import java.awt.Container;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JFrame;

public class ButtonFocus {
  public static void main(String args[]) {
    JFrame frame = new JFrame("Action Sample");

    JButton focusButton = new JButton("Focused");
    JButton notFocusButton = new JButton("Not Focused");

    Container contentPane = frame.getContentPane();
    contentPane.setLayout(new FlowLayout());
    frame.setSize(300, 100);


Related examples in the same category

1.Focus Cycle SampleFocus Cycle Sample
2.Focus Traversal ExampleFocus Traversal Example
3.Focus ExampleFocus Example
4.Focus Concepts DemoFocus Concepts Demo
5.Track Focus Demo
6.Focus Traversal DemoFocus Traversal Demo
7.Use this method to determine whether a particular component has the focus
8.Handling Focus Changes
9.Requests focus for a component
10.Requests focus unless the component already has focus