/[classpath]/classpath/javax/swing/plaf/basic/BasicTableUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicTableUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by rabbit78, Fri Jun 3 09:31:32 2005 UTC revision 1.7 by abalkiss, Thu Jun 30 20:35:00 2005 UTC
# Line 104  public class BasicTableUI Line 104  public class BasicTableUI
104    {    {
105      Point begin, curr;      Point begin, curr;
106    
107      private void updateSelection()      private void updateSelection(boolean controlPressed)
108      {      {
109        if (table.getRowSelectionAllowed())        if (table.getRowSelectionAllowed())
110          {          {
# Line 112  public class BasicTableUI Line 112  public class BasicTableUI
112            int hi_row  = table.rowAtPoint(curr);            int hi_row  = table.rowAtPoint(curr);
113            ListSelectionModel rowModel = table.getSelectionModel();            ListSelectionModel rowModel = table.getSelectionModel();
114            if (lo_row != -1 && hi_row != -1)            if (lo_row != -1 && hi_row != -1)
115              rowModel.setSelectionInterval(lo_row, hi_row);              {
116                  if (controlPressed && rowModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION)
117                    rowModel.addSelectionInterval(lo_row, hi_row);
118                  else
119                    rowModel.setSelectionInterval(lo_row, hi_row);
120                }
121          }          }
122    
123        if (table.getColumnSelectionAllowed())        if (table.getColumnSelectionAllowed())
# Line 121  public class BasicTableUI Line 126  public class BasicTableUI
126            int hi_col = table.columnAtPoint(curr);            int hi_col = table.columnAtPoint(curr);
127            ListSelectionModel colModel = table.getColumnModel().getSelectionModel();            ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
128            if (lo_col != -1 && hi_col != -1)            if (lo_col != -1 && hi_col != -1)
129              colModel.setSelectionInterval(lo_col, hi_col);              {
130                  if (controlPressed && colModel.getSelectionMode() != ListSelectionModel.SINGLE_SELECTION)
131                    colModel.addSelectionInterval(lo_col, hi_col);
132                  else
133                    colModel.setSelectionInterval(lo_col, hi_col);
134                }
135          }          }
136      }      }
137    
# Line 131  public class BasicTableUI Line 141  public class BasicTableUI
141      public void mouseDragged(MouseEvent e)      public void mouseDragged(MouseEvent e)
142      {      {
143        curr = new Point(e.getX(), e.getY());        curr = new Point(e.getX(), e.getY());
144        updateSelection();              updateSelection(e.isControlDown());      
145      }      }
146      public void mouseEntered(MouseEvent e)      public void mouseEntered(MouseEvent e)
147      {      {
# Line 146  public class BasicTableUI Line 156  public class BasicTableUI
156      {      {
157        begin = new Point(e.getX(), e.getY());        begin = new Point(e.getX(), e.getY());
158        curr = new Point(e.getX(), e.getY());        curr = new Point(e.getX(), e.getY());
159        updateSelection();        updateSelection(e.isControlDown());
160          
161      }      }
162      public void mouseReleased(MouseEvent e)      public void mouseReleased(MouseEvent e)
163      {      {
# Line 205  public class BasicTableUI Line 216  public class BasicTableUI
216      table.addFocusListener(focusListener);        table.addFocusListener(focusListener);  
217      table.addKeyListener(keyListener);      table.addKeyListener(keyListener);
218      table.addMouseListener(mouseInputListener);          table.addMouseListener(mouseInputListener);    
219        table.addMouseMotionListener(mouseInputListener);
220    }    }
221    
222    protected void uninstallDefaults()    protected void uninstallDefaults()
# Line 236  public class BasicTableUI Line 248  public class BasicTableUI
248      table.removeFocusListener(focusListener);        table.removeFocusListener(focusListener);  
249      table.removeKeyListener(keyListener);      table.removeKeyListener(keyListener);
250      table.removeMouseListener(mouseInputListener);          table.removeMouseListener(mouseInputListener);    
251        table.removeMouseMotionListener(mouseInputListener);
252    }    }
253    
254    public void installUI(JComponent comp)    public void installUI(JComponent comp)

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26