Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs

      Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      Loss of Focus in Jtable present in Jsplitpane.:
      Whenever a table present in a splitpane and focus is present is any editable cell
      and Whenever the divider of the splitpane is moved the caret/cursor present in table becomes invisible. However If we press any keys with the keyboard the charactors are echoed in the cell But the cursor is not visible.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Enter some data in table and move the divider of the splitpane

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The cursor should be visible even after resizing the divider of the splitpane.
      ACTUAL -
      Loss of Focus & the caret becomes invisible

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Color;
      import java.awt.Dimension;
      import java.beans.PropertyChangeEvent;
      import java.beans.PropertyChangeListener;

      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JScrollPane;
      import javax.swing.JSplitPane;
      import javax.swing.JTable;
      import javax.swing.JTextArea;
      import javax.swing.UIManager;
      import javax.swing.table.AbstractTableModel;

      //SplitPaneDemo itself is not a visible component.
      public class SplitPaneDemo extends JPanel {

      private JSplitPane splitPane;

      public SplitPaneDemo() {

      JTable table1 = new JTable(new MyTableModel());

      //Create the scroll pane and add the table to it.
      JScrollPane scrollPane1 = new JScrollPane(table1);

      JTable table2 = new JTable(new MyTableModel());
      JScrollPane scrollPane2 = new JScrollPane(table2);

      JTextArea textArea = new JTextArea();
      JScrollPane scrollPane3 = new JScrollPane(textArea);


      //Create a split pane with the two scroll panes in it.
      splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPane3,
      scrollPane2);
      splitPane.setOneTouchExpandable(true);
      splitPane.setDividerLocation(350);
      splitPane.addPropertyChangeListener(new PropertyChangeListener(){

      public void propertyChange(PropertyChangeEvent evt) {
      if(evt.getPropertyName().equals(JSplitPane.DIVIDER_LOCATION_PROPERTY)){
      getSplitPane().getRightComponent().hasFocus();
      }
      }

      });

      //Provide a preferred size for the split pane.
      splitPane.setPreferredSize(new Dimension(700, 150));
      }

      class MyTableModel extends AbstractTableModel {
      private String[] columnNames = { "Column 1", "Column 2", "Column 3",
      "Column 4", "Column 5" };

      private Object[][] data = { { "", "", "", "", "" },
      { "", "", "", "", "" }, { "", "", "", "", "" },
      { "", "", "", "", "" }, { "", "", "", "", "" } };

      public int getColumnCount() {
      return columnNames.length;
      }

      public int getRowCount() {
      return data.length;
      }

      public String getColumnName(int col) {
      return columnNames[col];
      }

      public Object getValueAt(int row, int col) {
      return data[row][col];
      }

      public Class getColumnClass(int c) {
      return getValueAt(0, c).getClass();
      }

      public boolean isCellEditable(int row, int col) {
      return true;
      }
      }

      public JSplitPane getSplitPane() {
      return splitPane;
      }

      /**
      * Create the GUI and show it. For thread safety,
      * this method should be invoked from the
      * event-dispatching thread.
      */
      private static void createAndShowGUI() {

      //Create and set up the window.
      try {
      UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      } catch (Exception e) {
      e.printStackTrace();
      }
      JFrame frame = new JFrame("SplitPaneDemo");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      SplitPaneDemo splitPaneDemo = new SplitPaneDemo();

      frame.getContentPane().add(splitPaneDemo.getSplitPane());
      frame.setLocation(200, 300);
      //Display the window.
      frame.pack();
      frame.setVisible(true);
      }

      public static void main(String[] args) {
      //Schedule a job for the event-dispatching thread:
      //creating and showing this application's GUI.
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
      public void run() {
      createAndShowGUI();
      }
      });
      }

      }

      ---------- END SOURCE ----------

        Attachments

          Activity

            People

            • Assignee:
              peterz Peter Zhelezniakov
              Reporter:
              igor Igor Nekrestyanov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: