JCheckBox wont receive initial focus in JTable under 1.6

If I have a JCheckBox in a JTable, clicking the checkbox has no effect unless the table already has focus. This is new to 1.6 I believe.
The code example below should illustrate the problem. With focus on the JTextField at the top, try to click a checkbox in the table. It won't take respond. If you click another field in the table first, the checkbox will then begin responding. Two strange things I've noticed with it are.
1) removing the call the table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); makes it work correctly. Of course then it won't give up focus correctly.
2) My example has the JTable within a JInternalFrame. If the table is just in a JFrame, the problem disappears. You can commment/uncomment these two lines to see the difference:
initInteralFrame(panel);
//initNoInteralFrame(panel);
I'm very surprised nobody else has noticed this, but I didn't see any postings or bugs on it. Can anyone see something I am doing wrong or find a workaround?
I submitted this bug a while back which is probably related, but this case with the checkbox is a bit less obscure:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6568959
import java.awt.Dimension;
import javax.swing.BoxLayout;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
public class TableTest2 extends JFrame
     public TableTest2()
          addWindowListener(new java.awt.event.WindowAdapter()
               public void windowClosing(java.awt.event.WindowEvent evt)
                    System.exit(0);
          JPanel panel = new JPanel();
          panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
          String[] columnNames = {"First Name",     "Last Name","Sport","# of Years","Vegetarian"};
          //Object[][] data= new Object[3][5];
          Object[][] data = {
               {"Mary", "Campione","Snowboarding", new Integer(5), new Boolean(false)},
               {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)},
               {"Kathy", "Walrath","Knitting", new Integer(2), new Boolean(false)},
               {"Sharon", "Zakhour","Speed reading", new Integer(20), new Boolean(true)},
               {"Philip", "Milne","Pool", new Integer(10), new Boolean(false)}
          DefaultTableModel myModel = new DefaultTableModel(data, columnNames)
               public Class getColumnClass(int c)
                    return getValueAt(0, c).getClass();
          JTable table = new JTable(myModel);
          table.setSurrendersFocusOnKeystroke(true);
          table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
          JScrollPane jScrollPane = new JScrollPane();
          jScrollPane.setViewportView(table);
          panel.add(new JLabel("Field 1"));
          panel.add(new JTextField(15));
          panel.add(jScrollPane);
          // ************ comment out one or the other of these to see error
          initInteralFrame(panel);
          //initNoInteralFrame(panel);
          Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
          setSize(new Dimension(800, 600));
          setLocation((screenSize.width-800)/2,(screenSize.height-600)/2);
     private void initInteralFrame(JPanel panel)
          JInternalFrame jif = new JInternalFrame();
          JDesktopPane desktop = new JDesktopPane();
          jif.setVisible(true);
          desktop.add(jif);
          setContentPane(desktop);
          jif.add(panel);
          jif.pack();
     private void initNoInteralFrame(JPanel panel)
          getContentPane().add(panel);
      * @param args the command line arguments
     public static void main(String args[])
          new TableTest2().setVisible(true);
}

It appears to me that the first click is "selecting"
the internal frame to make it active and therefore
have focus.Under 1.5, that appears to be the behavior. Under 1.6 the focus starts out in the internal frame on the JTextField above the JTable. You can click into any field in the table from there fine, but you can't transfer focus from the JTextField outside the table to the JCheckbox in the table... no matter how many clicks. The checkbox only works after the table becomes focused by clicking on one of the other fields or tabbing into the table.

Similar Messages

  • BB Pearl 8130 Wont Receive SMS texts

    So iv had the blackberry for just under a week and already im having problems with it. First of all the browser icon is missing from my menu the only way to get on the internet is to go to switch applications and the browser icon is there. Second issue which im having the biggest problem with is that my phone wont receive any SMS texts all of a sudden. Earlier today it was working fine and now it just stopped. I tried a battery pull tried turning my phone off and back on and still nothing. I only keep receiving constant duplicates of the same last txt I received.
    Any help would be greatly appreciated thanks

    But i found an answer that seems to work!  Thank you, AT&T!
    Re: how to send text message to Cell phone via computer
    You need to know the recipient phone's carrier.
    If you were texting AT&T phones: 10digitphonenumber  at   att.net
    There is more information if you Google "att send text from computer", but this forum won't let me post links... :)

  • Initial focus positioning in a Scene

    I'm working on a live preview of FXML-Files inside the Eclipse IDE but I'm in trouble because whenever I reload the FXML-File for previewing. The focus is shifted from my editor to the initial item in the preview. Is there a way to turn of this initial focus setting?

    The focus traversal stuff is controlled (to some degree) by the following API => http://docs.oracle.com/javafx/2.0/api/javafx/scene/Node.html#focusTraversableProperty
    The doc says "When a Scene is created, the system gives focus to a Node whose focusTraversable variable is true and that is eligible to receive the focus, unless the focus had been set explicitly via a call to requestFocus()."
    So, before you add your nodes to the scene, you could recurse through them, record their focusTraversable property to a temporary list, then place the nodes in the scene, and later set their focusTraversable property back to it's original value if needed - might work ;-)
    JavaFX seems to be lacking a global focus handling model for a Scene - I'll add that as a feature to the the list of Jiras I should file, but never have.

  • I lost my old ipod and got a new one, the new one wont receive my playlists from my library. what am i doing wrong?

    new one wont receive my playlists from my library. what am i doing wrong? It looks like they are synched and i have the latest version of itunes on both but the only way to access my music is through the store

    See:
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive: Apple Support Communities
    If all your synced media like apps and music is in your iTunes library then simply:
    - Backup to iTunes.
    - Restore the iPod from that backup.
    For how to do both see:
    iOS: How to back up

  • Using a JCheckBox in the header of a JTable

    I would like to know if it is possible to put a JCheckBox in the header of a column of a JTable.
    In fact my table has several columns and its first column uses checkboxes to signify the seleced items in the table. I would like to have a checkbox in the header of this column so when it is checked, I select all possible items from the table (not all rows are selectable).
    I have not seen any eample of putting something other than text in table headers. Does anyone know if this is possible and how to do it?

    I haven't tried check boxes but I use my own header renderers for other purposes. They are the same as cell renderers, so this sort of thing should work...
    TableColumn tc = myTable.getColumnModel().getColumn(0);
    tc.setHeaderRenderer(new CheckHeaderRenderer());
    class CheckHeaderRenderer extends JCheckBox implements TableCellRenderer
      public Component getTableCellRendererComponent(JTable table,
                                               Object  value,
                                               boolean isSelected,
                                               boolean hasFocus,
                                               int     row,
                                               int     column)
        // whatever
        return this;

  • HT1476 i-phone3 wont recharge; initially home button wouldn't work. Applied the 'auto-touch button thing' via settings. This worked until I ran out of battery life. Now it won't recharge either via laptop (usually does) or wall switch. Just a blk screen.

    i-phone3 wont recharge; initially home button wouldn't work. Applied the 'auto-touch button thing' via settings. This worked until I ran out of battery life. Now it won’t recharge either via laptop (usually does) or wall switch. Just a blk screen.

    In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
    That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
    Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
    Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
    While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
    Hunt

  • Is there a bug in the JTable under 1.2.2 ?

    Hi I use the VM 1.2.2.
    My JTable is disabled by:
    referencesTable.setEnabled(false);
    But this method has no effect under 1.2.
    If I run the app. under 1.4 the table is disabled.
    How can I disable a JTable under 1.2.
    Thanx
    Stephan

    Thanks M, you're right, I do have 13.0.1, it's just for some reason ive noticed some strange behavior in photoshop, can't figure out why. I still can't get my panels to collapse when double clicking the bar and the curves adjustment layer doesn't allow me to place a point using the eyedropper tool when clicking on the image, this has just recently started after reinstalling photoshop on my imac using the creative cloud application manager

  • Help in Changing Initial Focus in Jpanel?

    HI
    I have extended JPanel to create a class which has many components like JButtons etc. This class is reusable and has to be used at many places.
    When I include this class in a JFrame, the focus is always with the first component of my class. But I want the initial Focus to be with another component.
    I can do this by calling some method from outside my class but I do not want the user to bother with this extra function calling. Is there any way to change initial focus from within my class? I have already tried grabFocus() and requestFocus() but these methods have no effect before frame packing. Can anybody suggest some workaround?
    Regards
    Abhinit Kumar

    You have to do it after the frame is visible. Assuming you class is not a singleton, make the call to requestFocus the last thing in the contructor.

  • Setting initial focus amidst multiple templates, task flows, and fragments.

    Hi Guys,
    Using JDev 11.1.1.4.
    I've got page fragments for which I'd like to set the initial focus. The issue is that oftentimes these .jsff pages are nested within page templates, train templates, dynamic regions, etc. As far as I know, the initial focus for a component is set on the document. The trick is finding out what all the prefixes are before the .jsff component.
    pt1:dynamicRegion:3:pt1:t1:0:it1Is there any easy way to figure out all the prefixes before this :it1, which can oftentimes be dramatically different?
    Would the easiest way be to set the initial focus to say "defaultFocus" and then have every .jsff have a component id called "defaultFocus"? Feels like cheating, but any other way I can think of seems way too complicated.
    Thanks,
    Will

    The method we use is mainly programmed by: Marianne Horsch.
    So again, 1 page:
    <af:document ...  initialFocusId="#{backingBeanScope.bolsysPageBean.initialFocus}">
    <af:form .... defaultCommand="#{backingBeanScope.bolsysPageBean.defaultCommand}">Within the body of this page a dynamic region is defined, this is all that is ever refreshed.
    Bean, not all logging etc removed:
      private static final String DEFAULT_COMMAND_ATTRIBUTE = "defaultCommand";
      private static final String INITIAL_FOCUS_ATTRIBUTE = "initialFocus";
      private String defaultCommand;
      private String initialFocus;
      public BolsysPageBean() {
        super();
        initPage();
      public final void initPage() {
        List<UIComponent> childrenList = getPageChildrenList();
        if (!childrenList.isEmpty()) {
          UIComponent defaultCommandComponent =
            UIComponentUtils.findComponentWithAttribute(childrenList, DEFAULT_COMMAND_ATTRIBUTE);
          if (defaultCommandComponent != null) {
            defaultCommand = defaultCommandComponent.getClientId(FacesContext.getCurrentInstance());
          UIComponent initialFocusComponent =
            UIComponentUtils.findComponentWithAttribute(childrenList, INITIAL_FOCUS_ATTRIBUTE);
          if (initialFocusComponent != null) {
            initialFocus = initialFocusComponent.getClientId(FacesContext.getCurrentInstance());
      private List<UIComponent> getPageChildrenList() {
        UIViewRoot root = FacesContext.getCurrentInstance().getViewRoot();
        if (FacesContext.getCurrentInstance() != null && FacesContext.getCurrentInstance().getViewRoot() != null) {
          return UIComponentUtils.getAllChildComponents(root);
        return Collections.<UIComponent>emptyList();
      public String getDefaultCommand() {
        return defaultCommand;
      public String getInitialFocus() {
        return initialFocus;
      }Util code:
      public static List<UIComponent> getAllChildComponents(UIComponent root) {
        List<UIComponent> list = new ArrayList<UIComponent>();
        if (root.getFacetCount() > 0) {
          Map<String, UIComponent> facetMap = root.getFacets();
          for (Map.Entry<String, UIComponent> entry : facetMap.entrySet()) {
            UIComponent facetComponent = entry.getValue();
            list.add(facetComponent);
            if (facetComponent.getChildCount() > 0 || facetComponent.getFacetCount() > 0) {
              list.addAll(getAllChildComponents(facetComponent));
        list.addAll(getOwnChildren(root));
        return list;
      private static List<UIComponent> getOwnChildren(UIComponent root) {
        List<UIComponent> list = new ArrayList<UIComponent>();
        if (root.getChildCount() > 0) {
          for (UIComponent child : root.getChildren()) {
            list.add(child);
            if (child.getChildCount() > 0 || child.getFacetCount() > 0) {
              list.addAll(getAllChildComponents(child));
        return list;
      }  The dynamic region is based on a backing bean as well.
    As I said before, when you want it right use beans (:
    -Anton

  • I forgot my answers of security questions when i select (send a mail to reset my security questions) the mail wont received to my mail box?

    i forgot my answers of security questions when i select (send a mail to reset my security questions) the mail wont received to my mail box?

    Read this about how to change the security questions: http://support.apple.com/kb/HT5312
    If you can't use these procedures because you don't have a rescue email address you will have to contact Apple. See http://support.apple.com/kb/HT5699

  • Change the initial focus to "message" in JOptionPane.showOptionDialog?

    JPanel panel = new JPanel (false);
    JTextArea txtArea = new JTextArea (msg, 2, 60);
    JScrollPane sPane = new JScrollPane (txtArea);
    panel.add (sPane);
    int button = JOptionPane.showOptionDialog (frame, panel, titleStr, optionType, JOptionPane.PLAIN_MESSAGE, null, null, null);
    Is there a way to make txtArea to have the initial focus?
    Thanks,
    Ben

    Hi,
    Check out this post:
    Hide the 'no data found' message
    I hope that helps.
    -Marc

  • Wont receive MMS messages..

    My curve 9300 wont receive picture messages, I have a unlimited texting plan, and I can send mms, but can't receive, I also have a social networking plan, do I need something else?

    Have you tried updating your phone´s firmware? Maybe that´ll solve your problem...
    You can update your phone using the NSU:
    Nokia Software Updater
    All you need for this is a internet connection and a data cable for your phone!
    Give it a go and let us know how it went. 
    By clicking the "Kudos!" or the "Solution?" button on the right you can say "Thank You" and you´ll show the author and others that the post is useful.
    The day we stop improving is the day we stop being good.

  • Initial Focus

    I have six text boxes in a panel. How do I make the initial focus to be in the first enabled text box. And how do I make the focus to traverse in a serial order..like how it used to work with setNextFocusableComponent() in jdk1.3.
    Please help.

    Here you are (It's Christmas time ;-) )
    The following programme demonstrates a simple way of controlling the focus
    sequence when navigating with the TAB and shift-TAB keys through the components
    of a panel.
    Here we have only four textfields (tf1-tf4) in one column and two buttons (b1,
    b2) in a second column. When running the programme, the focus sequence is: tf1,
    b1, tf2, tf3, b2, tf4.
    But this is not really what we would like. We'd rather prefer to first fill the
    textfields and then choose between two different actions. So remove the comment
    slashes in
    //    panel.setFocusCycleRoot(true);
    //    panel.setFocusTraversalPolicy(new MyFocusTraversalPolicy());
    Recompile and run, and see that the sequence is now: tf1, tf2, tf3, tf4, b1, b2
    as desired.
    What has happened?
    With "panel.setFocusCycleRoot(true);" we declared our panel as the FocusCycleRoot
    which is an obligatory step. The actual FocusTraversalPolicy is defined in our
    own class MyFocusTraversalPolicy. What happens there? Not very much. The
    important thing is that it extends ContainerOrderFocusTraversalPolicy; read well
    the word "ContainerOrder..." that means the order is taken from our panel IN THE
    SEQUENCE WE ADDED OUR COMPONENTS THERE. Make a brief test in changing the order
    in the panel: Cut the line
        panel.add(tf4);
    and paste it after
        panel.add(b2);
    Compile and run. Yes, our sequence has changed to: tf1, tf2, tf3, b1, b2, tf4.
    Remains to explain the effect of the method "protected boolean accept(Component
    aComp)" in class MyFocusTraversalPolicy. Well, without the accept-method the
    focus would move in our example also to the JLabels and the JPanel itself. So the
    method makes sure that the focus rests only on components which can accept input
    or fire an action.
    import java.awt.*;
    import javax.swing.*;
    public class FocusSeqDemo
      public static void main(String args[])
      { new FocusSeqDemo();
      public FocusSeqDemo()
      { JFrame frame = new JFrame();
        frame.setSize (210,220);
        frame.setTitle ("FocusSeqDemo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container cp = frame.getContentPane();     
        JPanel panel = new JPanel();
        panel.setLayout(null);
    //    panel.setFocusCycleRoot(true);
    //    panel.setFocusTraversalPolicy(new MyFocusTraversalPolicy());
        JLabel l1= new JLabel("A:");
        JLabel l2= new JLabel("B:");
        JTextField tf1= new JTextField();
        JTextField tf2= new JTextField();
        JTextField tf3= new JTextField();
        JTextField tf4= new JTextField();
        JButton b1 = new JButton("action 1");
        JButton b2 = new JButton("action 2");
        Insets insets= new Insets(0,0,0,0);
        b1.setMargin(insets);
        b2.setMargin(insets);
        l1.setBounds(10,40,20,21);
        l2.setBounds(10,100,20,21);
        tf1.setBounds(30,40,50,21);
        tf2.setBounds(30,70,50,21);
        tf3.setBounds(30,100,50,21);
        tf4.setBounds(30,130,50,21);
        b1.setBounds(110,60,60,30);
        b2.setBounds(110,100,60,30);
        panel.add(l1);
        panel.add(l2);
        panel.add(tf1);
        panel.add(tf2);
        panel.add(tf3);
        panel.add(tf4);
        panel.add(b1);
        panel.add(b2);
        cp.add(panel, BorderLayout.CENTER);
        frame.setVisible(true);
        panel.getComponent(2).requestFocusInWindow(); // component 0 and 1 are the
    //                                             labels.
      class MyFocusTraversalPolicy extends ContainerOrderFocusTraversalPolicy
      { protected boolean accept(Component aComp)
        { if (aComp instanceof JTextField || aComp instanceof JButton)
                                  return super.accept(aComp);
          return false; // JLabel and JPanel.
    }

  • Please can someone help me? Have iphone 4 and just returned home from abroad where the phone worked fine. Now it wont receive wifi. It picks up signal and shows on phone but cant connect to internet. Computers and ipod all working ok

    Hi, please can someone help me?
    Have just returned home from abroad where my iphone 4 worked perfectly.
    Now at home it wont receive wifi. It picks up the signal which shows in phones display but cant connect to the internet. Computers and ipod all working fine so I assume it must be a problem with the phone.
    Have checked that wifi is turned on and tried resetting phone to no avail

    Hello melissa82686,
    From your description, it sounds like you may have been using the SMS feature of Continuity in iOS 8. If this is the case and it has somehow become misconfigured after a recent change, you may find the information and steps outlined in the following articles helpful:
    SMS
    With Continuity, all the SMS and MMS text messages you send and receive on your iPhone also appear on your Mac, iPad, and iPod touch. Even if the person you’re communicating with doesn’t have an iPhone. And regardless of what phone they have, you can reply from whichever device is closest to you, including your iPad or Mac. You can also initiate a  conversation by clicking a phone number in Safari, Contacts, or Calendar.
    To use Continuity for SMS and MMS with your iPhone and your Mac, iPad or iPod touch
    Your iPhone, iPad, and iPod touch need to use iOS 8.1, and your Mac needs to use OS X Yosemite.
    Sign in to iMessage on your iPhone, your other iOS devices, and your Mac using the same Apple ID.
    On your iPhone:
    Go to Settings > Messages > Send & Receive > You Can Be Reached By, and add a check to both your phone number and email address.
    Go to Messages > Text Message Forwarding, and enable the device(s) you would like to forward messages to.
    Your Mac, iPad, or iPod touch will display a code. Enter this code on your iPhone to verify the SMS feature.
    Connect your iPhone, iPad, iPod touch, and Mac using Continuity - Apple Support
    Get help using Continuity with iOS 8 and OS X Yosemite - Apple Support
    Sincerely,
    - Brenden

  • My iphone 4 wont receive and make call i already  did reset networ setting but still wont work..help me pls..

    anyone can help me about my prblem on my iphone 4,.my phone wont receive  and make calls..i already did the reset network setting,and off the 3G ..but still wont work..help pls..thks

    try easy first.  if pre paid make sure you have not ran out of date,might need top up.  if on contract check with your provider to see if they have stopped your account, if all fails ring apple

Maybe you are looking for

  • Parsing XML files from application server

    I need to read  an XML file from the application server. This can be done using OPEN DATASET in BINARY MODE and reading into internal table of type binary data. But inorder to parse the document using the iXML library, i need to pass the filesize of

  • Connecting Airport Express to Airport Extreme Base Station

    Hi Folks. I am at my wit's end. I have an Airport Extreme Base Station (main hub) purchased in 2003. Just bought a new Airport Express and it just won't connect to the AEBS. I think I've tried everything. From automatic WDS set up (described here htt

  • For Each loop that iterates in reverse order

    Can I use the For Each loop to iterate in reverse order?

  • Trying to listen to an email attachment in WAV format.

    My home phone messages are forwarded to my .Mac email account, but show up as an attachment in WAV format. When I click on the attachment to play the recorded phone message I get an alert saying "This movie could not be played". I need to be able to

  • No Port listed (URGENT)

    I am doing a program that read from serial port and send the data to the client by using UDP. I am using this program to test the port in my PC: import javax.comm.*; import java.util.*; public class PortLister { public static void main(String[] args)