Next component to get focus?

Hey Guys,
If i had a panel with buttons and other components and if the focus is on one of the buttons, is it possible to have java return what the next component to get the focus is? I know there's a getNextFocusableComponent, but i'd rather use something that is deprecated so any suggestion is welcomed.
Here's my code, I basically want the focus to go to button3 when it gets to the last cell in the table. I want the java to figure out the next component because I would rather not hard-code anything into this. Thanks guys!
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class TestGui {
public static void main(String[] args) {
TestGuiFrame frame = new TestGuiFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
class TestGuiFrame extends JFrame {
public TestGuiFrame() {
setTitle("Pete's Test GUI");
setSize(200, 200);
Container contentPane = getContentPane();
JPanel panel = new JPanel();
JButton button1 = new JButton("button1");
JButton button2 = new JButton("button2");
JButton button3 = new JButton("button3");
JButton button4 = new JButton("button4");
JTable table1 = new JTable(2, 3);
panel.add(button1);
panel.add(button2);
panel.add(table1);
panel.add(button3);
panel.add(button4);
contentPane.add(panel);
InputMap im = table1.getInputMap(JTable.
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
KeyStroke tab = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0);
final Action oldTabAction = table1.getActionMap().get(im.get(tab));
Action tabAction = new AbstractAction() {
public void actionPerformed(ActionEvent e) {
oldTabAction.actionPerformed(e);
JTable table = (JTable) e.getSource();
int rowCount = table.getRowCount();
int columnCount = table.getColumnCount();
int row = table.getSelectedRow();
int column = table.getSelectedColumn();
if (row == (rowCount-1) && column == (columnCount-1)) {
//set focus to next component <---- HELP NEEDED HERE =)
table1.getActionMap().put(im.get(tab),tabAction);
}

I haven't tried it but you should be able to do something like:
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager()
FocusTraversalPolicy policy = manager.getDefaultFocusTraversalPolicy()
Component c = policy.getComponentAfter(....);Otherwise, maybe the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html]How to Use the Focus Subsystem will help.

Similar Messages

  • Customize "Tab" key for JTextArea to focus next component.

    Hi,
    I am trying to change the "TAB" key behaviour for JTextArea, by using CustomAction configured via InputMap() and ActionMap(). When the user presses the Tab key, the focus should go the next component instead of tabbing in the same JTextArea component. Here is the code for the CustomAction().
        public static class CustomTabAction extends AbstractAction {
            private JComponent comp;
            public CustomTabAction (JComponent comp) {
                this.comp = comp;
                this.comp.getInputMap().put(KeyStroke.getKeyStroke("TAB"), "TABPressed");
                this.comp.getActionMap().put("TABPressed", this);
            public void actionPerformed(ActionEvent evt) {
                Object source = evt.getSource();
                if (source instanceof Component) {
                    FocusManager.getCurrentKeyboardFocusManager().
                            focusNextComponent((Component) source);
        }This works for most of the cases in my applicaiton. The problem is that it doesn't work with JTable which has a custom cell editor (JTextArea). In JTextArea field of JTable, if the Tab is pressed, nothing happens and the cursor remains in the custom JTextArea exactly at the same place, without even tabbing spaces. Here is the CustomCellEditor code.
        public class DescColCellEditor extends AbstractCellEditor implements TableCellEditor {
    //prepare the component.
            JComponent comp = new JTextArea();
            public Component getTableCellEditorComponent(JTable table, Object value,
                    boolean isSelected, int rowIndex, int vColIndex) {
                // Configure Tab key to focus to next component
                CustomActions.setCustomAction("CustomTabAction", comp);
                // Configure the component with the specified value
                ((JTextArea)comp).setText((String)value);
                // Return the configured component
                return comp;
            // This method is called when editing is completed.
            // It must return the new value to be stored in the cell.
            public Object getCellEditorValue() {
                return ((JTextArea)comp).getText();
        }regards,
    nirvan

    >
    textArea.getInputMap().remove(....);but that won't work because the binding is actually defined in the parent InputMap. So I think you need to use code like:
    textArea.getInputMap().getParent().remove(...);But I'm not sure about this as I've never tried it.I tried removing the VK_TAB key from both the input map and parent input map as shown below. But I still have to press "TAB" twice in order to get out of the JTextArea column in JTable.
                comp.getInputMap().getParent().remove(
                            KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0));
                comp.getInputMap().remove(
                            KeyStroke.getKeyStroke(KeyEvent.VK_TAB,0));after coding this, I am using the setFocusTraversalKeys for adding only "TAB" key as ForwardTraversalKey as given below.
            Set newForwardKeys = new HashSet();
            newForwardKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0));
            comp.setFocusTraversalKeys(
                        KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,newForwardKeys);
            Set newBackwardKeys = new HashSet();
            newBackwardKeys.add(KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_DOWN_MASK));
            comp.setFocusTraversalKeys(
                        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,newBackwardKeys);The only problem that remains now is that I have to press the "TAB" twice in order to get out of the JTextArea column
    regards,
    nirvan.

  • Using TAB to focus next component in a JTextArea

    hello everybody,
    I would like to use the TAB-key in a JTextArea to focus the next component in my frame.
    I tried to use an KeyListener which calls an instance of javax.swing.FocusManager with the method
    focusNextComponent(Component c).
    My problem is, that - allthough I call consume() for the KeyEvent - the TAB is displayed im my JTextArea........
    how can I solve this, that the TAB is NOT visible?
    (plaese excuse my bad english )
    Thanks Chris

    The way to do it is use setNextFocusableComponent(Component c)
    so as you create each component, you can set the order that the tab key will give focus.
    eg
    JButton b1 = new JButton();
    JButton b2 = new JButton();
    b1.setNextFocusableComponent(b2);
    etc...
    The tab won't be displayed in the JTextArea then,.
    James

  • Get focused component

    Hi
    Is there a method to get the component that has focus?
    Besides using a for loop with method hasfocu()
    Thanks

    Assuming you want to find what component has focus within a specified frame:JFrame myFrame = xxx;
    Component focusComp = SwingUtilities.findFocusOwner( myFrame );

  • Disabled button getting focus

    My problem is that a disabled button are getting focus, which is bad when the application are operated without a mouse.
    I made this litlte demo to illustrate the problem.
    Try pressing button no.1. This will disable button no.1 and button no.2,
    but why are button no.2 getting focus afterwards?
    * NewJFrame.java
    * Created on 29. september 2005, 16:55
    import javax.swing.*;
    * @author  Peter
    public class NewJFrame extends javax.swing.JFrame {
        /** Creates new form NewJFrame */
        public NewJFrame() {
            initComponents();
            printButtonStatus();
        private void printButtonStatus () {
            printFocus (jButton1);
            printFocus (jButton2);
            printFocus (jButton3);
            printFocus (jButton4);
         * Just debug inf.
        private void printFocus (JButton button) {
            System.out.println ("Button=<" + button.getText () + ">, Enabled=<" + button.isEnabled() + ">, Focus=<" + button.isFocusable() + ">");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            jPanel1 = new javax.swing.JPanel();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jButton3 = new javax.swing.JButton();
            jPanel2 = new javax.swing.JPanel();
            jButton4 = new javax.swing.JButton();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            jPanel1.add(jButton1);
            jButton2.setText("jButton2");
            jPanel1.add(jButton2);
            jButton3.setText("jButton3");
            jPanel1.add(jButton3);
            getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
            jButton4.setText("jButton1");
            jPanel2.add(jButton4);
            getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:       
            jButton1.setEnabled(false);
            jButton2.setEnabled(false);
            jButton3.setEnabled(false);
            printButtonStatus();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NewJFrame().setVisible(true);
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton3;
        private javax.swing.JButton jButton4;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        // End of variables declaration
    }

    Very courius.
    I have made a little change in your code.
    1) scenario
    Simply changing .setEnabled(false) invokation, the class works fine.
    so
    jButton2.setEnabled(false);
    jButton3.setEnabled(false);
    jButton1.setEnabled(false);
    2) scenario
    the class works fine also using your .setEnabled(false) order invokations and putting after those:
    FocusManager.getCurrentManager().focusNextComponent();
    I do not know exactly why, I suppose that is there something not properly
    syncronized in events dispaching.
    In my opinion:
    a) setEnabled(false) at last calls for setEnabled(false) of JComponent
    that fires a propertyChange event
    so:
    scenario 1)
    buttons 2 and 3 are disabled before of button1 that has the focus in
    that moment (given by a the mouse click on itself)
    When botton1.setEnabled(false) is performed buttons 2 and 3 are
    just disabled, so focus is got by button4 (that is enabled)
    scenario 2)
    button1 that has the focus (given it by the mouse click) becames
    disabled before that button2 becames disabled too.
    So, probably, when the event of PropertyChanged is fired and processed, button2.setEnabled(false) invokation has not been
    just performed and swings looks for it as a focusable component
    So, using FocusManager.getCurrentManager().focusNextComponent(),
    we force the transer focus on next focusable component.
    This is only a my suppose, looking what happens.
    Regards.
    import javax.swing.*;
    * @author Peter
    public class NewJFrame extends javax.swing.JFrame {
    /** Creates new form NewJFrame */
    public NewJFrame() {
    initComponents();
    private void printButtonStatus () {
    printFocus (jButton1);
    printFocus (jButton2);
    printFocus (jButton3);
    printFocus (jButton4);
    System.out.println("--------------------------------");
    * Just debug inf.
    private void printFocus (JButton button) {
    System.out.println ("Button=<" + button.getText () + ">, Enabled=<" + button.isEnabled() + ">, Focus=<" + button.hasFocus() + ">, Focusable=<" + button.isFocusable() + ">");
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    private void initComponents() {
    jPanel1 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    jButton4 = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jButton1.setText("jButton1");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    jPanel1.add(jButton1);
    jButton2.setText("jButton2");
    jPanel1.add(jButton2);
    jButton3.setText("jButton3");
    jPanel1.add(jButton3);
    getContentPane().add(jPanel1, java.awt.BorderLayout.NORTH);
    jButton4.setText("jButton1");
    jPanel2.add(jButton4);
    getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);
    pack();
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    // I have simply change the order
    jButton2.setEnabled(false);
    jButton3.setEnabled(false);
    jButton1.setEnabled(false);
    // with this sentence the class work with original .setEnabled order
    //FocusManager.getCurrentManager().focusNextComponent();
    SwingUtilities.invokeLater(new Runnable()
    public void run()
    printButtonStatus();
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new NewJFrame().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration
    }

  • How to prevent Cell from getting focus when I click on a cell in JTable

    Hi,
    I have a new problem which I did not have when using jdk1.3. I have a non editable JTable. Now whenever I select a row the row gets highlighted - which is ok but at the same time the cell on which I click ( to select the row ) also gets focus.
    Previously I used to extend JTable and override the isManagingFocus method to return false. But now it doesnt seem to work
    What should
    Thanks
    --J                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Well, I'm still using JDK1.3 and I don't get the behaviour you describe.
    When isManagingFocus is true then using the tab key will cause focus to move from cell to cell within the JTable and focus will never leave the JTable.
    When isManagingFocus is false then using the tab key will cause focus to move the the JTable to the next component on the JFrame.
    In both cases once focus is on the JTable an individual cell is always highlighted to indicate it has focus.
    The question is if your program only cares which row has been selected, why do you care if an individual cells appears to have focus?

  • Problem in getting focus on JEditorPane

    Hi,
    Inside JFrame I have a JPanel. JPanel contains 2 JButtons, 1 JTextField and 1 JEditorPane.
    On pressing TAB key, focus goes over the 2 JButtons and 1 JTextField but it does not go over to the JEditorPane. Can somebody help me ?
    TIA
    Ajit

    hi,
    Thanks for replying. Now the editorpane is getting the focus. But once it gets the focus, on next TAB key-press instead of moving the focus to the next component ( one of buttons or texfield) it stays in the editorpane itself and creates tab space there. I want the focus to move over all the components inside JPanel using TAB key.
    Ajit

  • Custom TextInput itemEditor not getting focus.

    I have an AdvancedDataGrid that has a custom itemEditor on an amounts field. If I do an inline textInput itemEditor everything works fine, but if I separate out the textInput itemEditor into it's own component then when I click on the amounts column it doesn't seem to get focus. What happens is I click once and it appears like the text box has appeared, but there is not cursor, so I can't start typing my amount. I need to click a second time in the cell for the cursor to appear.
    Here are my datagrid columns:
    <datagrids:columns>
            <mx:AdvancedDataGridColumn dataField="Customer" headerText="Cust" editable="false"/>
            <mx:AdvancedDataGridColumn dataField="Balance" headerText="Bal" editable="false"/>
            <mx:AdvancedDataGridColumn dataField="paymentAmountString" headerText="Amount"
                               editable="true" textAlign="right"
                               editorDataField="amountText" itemEditor="com.ihcfs.flex.renderers.AdvancedAmountTextInputRenderer">
            </mx:AdvancedDataGridColumn>
        </datagrids:columns>
    Here is my custom renderer/editor, I've tried both a spark TextInput and an mx:TextInput. They both have the same behavior.
    <?xml version="1.0" encoding="utf-8"?>
    <s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                      xmlns:s="library://ns.adobe.com/flex/spark"
                                      xmlns:mx="library://ns.adobe.com/flex/mx"
                                      focusEnabled="true">
        <fx:Script>
            <![CDATA[
                public var amountText:String;
            ]]>
        </fx:Script>
        <s:TextInput id="amountTextInput"
                     width="100%" height="100%"
                     textAlign="right"
                     change="amountText = amountTextInput.text;"
                     focusEnabled="true"
                     editable="true"
                     restrict="[0-9][.]"/>
    </s:MXAdvancedDataGridItemRenderer>
    If I do an inline item editor it works just fine, it's when I move it out to a reusable component that this behavior happens.
    Inline:
    <datagrids:columns>
            <mx:DataGridColumn dataField="customer" headerText="Cust"
                               editable="false" textAlign="center"/>
            <mx:DataGridColumn dataField="balance" headerText="Bal"
                               editable="false" textAlign="center"/>
            <mx:DataGridColumn dataField="paymentAmountString" headerText="Amount"
                               editable="true" editorDataField="text" textAlign="right">
                <mx:itemEditor>
                    <fx:Component>
                        <mx:TextInput width="100%" height="100%" textAlign="right"
                                      focusOut="textinput1_focusOutHandler(event)"
                                      focusIn="textinput1_focusInHandler(event)">
                            <fx:Script>
                                <![CDATA[
                                    import mx.controls.Alert;
                                    import mx.controls.Text;
                                    import mx.events.FlexEvent;
                                    import mx.formatters.CurrencyFormatter;
                                    [Bindable]
                                    private var originalAmount:Number;
                                    private var amountFormatter:CurrencyFormatter = new CurrencyFormatter();
                                    protected function textinput1_focusOutHandler(event:FocusEvent):void
                                        var e:TextEvent = new TextEvent("amountEntered", true);
                                        var textField:TextField = event.target as TextField;
                                        var newAmount:Number = 0;
                                        if(!isNaN(parseFloat(textField.text))){
                                            newAmount = parseFloat(textField.text);
                                        e.text = new String((newAmount - originalAmount) + "");
                                        dispatchEvent(e);
                                    protected function textinput1_focusInHandler(event:FocusEvent):void
                                        var textfield:TextField = event.target as TextField;
                                        if(!isNaN(parseFloat(textfield.text))){
                                            originalAmount = parseFloat(textfield.text);
                                        } else {
                                            originalAmount = 0;
                                ]]>
                            </fx:Script>
                        </mx:TextInput>
                    </fx:Component>
                </mx:itemEditor>
            </mx:DataGridColumn>
        </datagrids:columns>
    Thanks for the help!

    I attempted to do as you said using the following code:
    override public function setFocus():void{
         stage.focus = amountTextInput;
         amountTextInput.setFocus();
    I also tried adding an event handler to my renderer to capture the focus in event and try the same thing:
    <s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                      xmlns:s="library://ns.adobe.com/flex/spark"
                                      xmlns:mx="library://ns.adobe.com/flex/mx"
                                      focusEnabled="true"
                                      focusIn="mxadvanceddatagriditemrenderer1_focusInHandler(event)">
    protected function mxadvanceddatagriditemrenderer1_focusInHandler(event:FocusEvent):void
         amountTextInput.setFocus();
    Neither of these solutions work. I could just go back to using the inline code, but I'd prefer to not copy and paste that code into several different grids.
    Thanks again for the help.

  • Disabled Button Gets Focus in 1.4 and not in 1.3

    Hi
    I am in the process of migrating from version 1.3 to 1.4.2
    I have a screen on which I I have a button which is disabled when teh screen initializes. There are other items to which I can navigate through TAB.
    If i keep pressing Tab so that the focus comes to the disabled object, then it just stays there...nothing happens in version 1.4 although version 1.3 works for a similar scene and teh control goes to teh next component on the screen
    I have tried setting the focus by checking the status of teh button and have set it to the same value as being enabled or disabled.
    Any help please!
    Thanks
    priya

    hi
    I have tried this...but this doesnot seem to help...
    i have also set
    setRequestFocusEnabled(false)
    to disable mosue and keyboard events..but thsi doensot seem to help either...
    thanks
    priya

  • Two clicks for getting focus in h:inputtext ?

    Hello.
    I have a JSF page whose three first components are *<h:inputText ...*
    When I press Tab for get focus on the next inputText, the cursor pass to the next field and disappear. I need click mouse on the field for getting focus again. Why?
    Thank you.

    Then I don't know. It's certainly a matter of the webbrowser/client environment. All I can suggest is to test in different browsers/environments and to doublecheck all the generated HTML/JS output.

  • Can't get focused a JTextField within a JTable cell

    I have a table and I placed a cell editor with a JText field on it for all cell editing,
    I want to do things when the focus is lost or gained and my app works fine when a cell is double clicked or f2 is pressed, but when a cell is selected (without double clicking) and just begin typing it produces no focus gained event.
    I tried by calling grabFocus method of that jTextField within the overriden prepareEditor method of the JTable but it doesn't get focus (doesn't even gains and loses it :s )
    Does anyone have an idea of how to force this component to grab focus?
    Thanks

    Hai,
    dont add the FocusListener to the EditorComponent.
    Try to use the JTable Functions - like this:
    import javax.swing.event.ChangeEvent;
    import javax.swing.table.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.EventObject;
    import javax.swing.*;
    public class Test extends JFrame
         JTable table;
         JTextArea text;
         JScrollPane scroll;
         JTextField cellTextField;
         Test()
              DefaultTableModel model = new DefaultTableModel();
              cellTextField = new JTextField();
              text = new JTextArea();
              text.setEditable(false);
              scroll = new JScrollPane();
              scroll.setViewportView(text);
              table = new JTable(model){
                   @Override
                   public Component prepareEditor(TableCellEditor editor, int row, int column) {
                        text.append("Better use this to Start Edit!\n");
                        return super.prepareEditor(editor, row, column);
                   @Override
                   public void editingStopped(ChangeEvent e) {
                        text.append("Better use this to Stop Edit!\n");
                        super.editingStopped(e);
              model.addColumn("Column 1");
              model.addColumn("Column 2");          
              model.addRow(new String [] {"Cell 1", "Cell 2"});
              table.setCellSelectionEnabled( true );
              table.getColumnModel().getColumn(0).setCellEditor( new DefaultCellEditor(cellTextField));
              table.getColumnModel().getColumn(1).setCellEditor( new DefaultCellEditor(cellTextField));
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(table, BorderLayout.NORTH);
              getContentPane().add(scroll, BorderLayout.CENTER);
              setSize(300, 300);
              setVisible(true);
              setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
         public static void main(String[] args)
              new Test();
    }

  • Disabled Object Gets Focus

    Hi
    I am in the process of migrating from version 1.3 to 1.4.2
    I have a screen on which I I have a button which is disabled when teh screen initializes. There are other items to which I can navigate through TAB.
    If i keep pressing Tab so that the focus comes to the disabled object, then it just stays there...nothing happens in version 1.4 although version 1.3 works for a similar scene and teh control goes to teh next component on the screen
    I have tried setting the focus by checking the status of teh button and have set it to the same value as being enabled or disabled.
    Any help please!
    Thanks
    priya

    If i keep pressing Tab so that the focus comes to the disabled object, then it just stays thereNever seen this behaviour.
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • How to make a JScrollPane not getting Focus?

    How to make a JScrollPane not getting Focus?
    When i tab out from a textfield inside a scroll pane focus is going to ScrollPane .And if i press tab once more then only focus is going to other textField which is outside the scrollpane.
    For me when i press tab from a text field inside a scrollPane ,i should go to textfield out side the scroll pane.
    satish

    Hi,
    I've the same problem, that I have to double click on tab
    to step from a textfield with a scrollpane to the next textfield in my panel.
    I tried to implement a FocusListener on my JScrollPane, but without success.
    Can you tell me in detail how to implement this listener ?
    Kind regards
    Andy Kanzlers

  • Help need on ALV Get focus & set Hot Key

    Hi Expert,
    In my project, I am working extensively in WDP ALV component. My have some tropical requirement in this project.
    1.     Get the reference of the particular box of a ALV table. There is some set-focus functionality, but there is nothing called get focus. Do any one have any ides, how can I get the reference of the particular selected box ( cell ) from a ALV table.
    2.     Is it possible to set Hot key in the WDP component? For a example, if I click that hot key, it will trigger some action.
    It will be an great help, if any one can provide any idea on this.
    Thanks in advance,
    Regards,
    Satrajit.

    Hi Satrajit,
    For hot keys..
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/b951297a6d2d65e10000000a42189c/content.htm
    You want to do on perticular cell.. this helps.
    http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/45/12093591152464e10000000a1553f7/content.htm
    http://wiki.sdn.sap.com/wiki/display/WDABAP/HowtotriggertheeventON_CELL_ACTIONin+ALV
    OR based on attribute you can do any actions..
    for example :..
    DATA lt_table_settings  TYPE REF TO if_salv_wd_table_settings.
      DATA lt_column_settings TYPE REF TO if_salv_wd_column_settings.
      DATA lt_columns         TYPE salv_wd_t_column_ref.
      DATA ls_columns         TYPE salv_wd_s_column_ref.
      DATA lv_column          TYPE REF TO cl_salv_wd_column.
      lt_columns = lt_column_settings->get_columns( ).
    *** To change and set Column Header Text ***
      LOOP AT lt_columns INTO ls_columns.
        lv_column = ls_columns-r_column.
        CASE ls_columns-id.
          WHEN 'DEALER '. // your attribute name
        // your action...
    ENDCASE.
    ENDLOOP.
    Cheers,
    Kris.

  • Swing JTextFeild is not getting focus -  Using jdk-7u17-windows-i586

    Hi All
    Recently I upgraded my Application with Java 1.7 (using jdk-7u17-windows-i586) from java 1.6. Swing component JTextfeilds used to get focus when using java1.6. But after up-gradation to Java 1.7 in few scenarios JTextFeild is not getting focus and I am unable to do any thing with keyboard. Again I have to click on some button with Mouse and need to keep focus using mouse in the textfeild.
    OS : Windows
    Used Java Version : jdk-7u17-windows-i586
    Issue : JTextFeild is not getting focus

    993277 wrote:
    Hi All
    Recently I upgraded my Application with Java 1.7 (using jdk-7u17-windows-i586) from java 1.6. Swing component JTextfeilds used to get focus when using java1.6. But after up-gradation to Java 1.7 in few scenarios JTextFeild is not getting focus and I am unable to do any thing with keyboard. Again I have to click on some button with Mouse and need to keep focus using mouse in the textfeild.
    OS : Windows
    Used Java Version : jdk-7u17-windows-i586
    Issue : JTextFeild is not getting focusThat's an incomplete bug report, not a question. This is a forum, not a bug tracking system. Try bugs.sun.com. And you may want to include a small sample program in the bug report that demonstrates the problem.

Maybe you are looking for

  • What is USB 2.0 output voltage on 17 in Macbook Pro?

    Need to know the exact output voltage of the MBpro 17" USB port- as i am hooking up very delicate electronic periphrial --cant find it on line anywhere.. does anyone know? [email protected] thank you g

  • Weblogic Classpath setting error not able to pick the properties file

    Hi All, We are using a third party jar and create a java Web service on the top of that jar. This jar file need two configuration file .properties and .xml when we deploy war for the application into weblogic server it will give file not found error.

  • Where are the downloaded files? Project is not showing up in the programs area of Windows 8.1

    I downloaded the Project files.  Now it doesn't show up in the programs area.  What happened to it?  The files did download completely - it took a while!  Assistance is greatly appreciated! 

  • Leading & Non-leading leadger

    Hi friends, I want to know that for one single client, where, there are several different co codes are configured  n all co codes ve the requirement of different ledger as main ledger, whether  its posible or not possible to create more than one lead

  • Recipient Can't Open Word Dox

    All My iMac and its Mail send MS Word documents good as gold most of the time, but sometimes the recipient can't open it. It seems to be one of the Mac's little ways. Normally, the recipients could if they took the option of Opening Using: Word, but