How I set the Focus in object
Hello.
I need set the focus on first object in a JInternalFrame.
The form JInternalFrame contain a JTabbedPanel and this include object jFormatedTextFields.
I need when the init form set the focus over first object in the first tab of JTabbedPanel. How I do?.
Than You
[301 byte] By [
ezikoha] at [2007-10-3 2:52:26]

works OK in this
(tabbed panes seem to be working OK for focus now, don't know what's changed)
import javax.swing.*;
import java.awt.*;
import javax.swing.text.*;
class Testing extends JFrame
{
MaskFormatter mf;
JFormattedTextField ftf;
public Testing()
{
setLocation(300,200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try{mf = new MaskFormatter("###.###.##.##");}
catch(Exception e){e.printStackTrace();}
ftf = new JFormattedTextField(mf);
JTabbedPane tp = new JTabbedPane();
tp.addTab("A",ftf);
JDesktopPane dp = new JDesktopPane();
JInternalFrame if1 = new JInternalFrame( "I-F1", true, true, true, true );
if1.setLocation(50,50);
if1.getContentPane().add(tp);
if1.pack();
if1.setVisible(true);
dp.add(if1);
getContentPane().add(dp);
setSize(400,300);
setVisible(true);
ftf.requestFocusInWindow();
}
public static void main(String[] args){new Testing();}
}