Skip to content

Commit c8e6a51

Browse files
hansonrhansonr
authored andcommitted
JTable performance upgrade
1 parent 4deaf61 commit c8e6a51

File tree

19 files changed

+407
-311
lines changed

19 files changed

+407
-311
lines changed
-18.6 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190703091927
1+
20190706052225
-18.6 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20190703091927
1+
20190706052225
-18.6 KB
Binary file not shown.

sources/net.sf.j2s.java.core/src/java/awt/Component.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5419,7 +5419,7 @@ protected void processFocusEvent(FocusEvent e) {
54195419
*/
54205420
protected void processKeyEvent(KeyEvent e) {
54215421
KeyListener listener = keyListener;
5422-
if (listener != null && (((JSComponent)this).秘isAWT()|| 秘isFocusableSet)) {
5422+
if (listener != null && (((JSComponent)this).秘isAWT()|| 秘isFocusableSet || keyListener != null)) {
54235423
int id = e.getID();
54245424
switch (id) {
54255425
case KeyEvent.KEY_TYPED:

sources/net.sf.j2s.java.core/src/javax/swing/CellRendererPane.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
/**
3939
* This class is inserted in between cell renderers and the components that
40-
* use them. It just exists to thwart the 秘repaint() and invalidate() methods
40+
* use them. It just exists to thwart the repaint() and invalidate() methods
4141
* which would otherwise propagate up the tree when the renderer was configured.
4242
* It's used by the implementations of JTable, JTree, and JList. For example,
4343
* here's how CellRendererPane is used in the code the paints each row

sources/net.sf.j2s.java.core/src/javax/swing/DefaultCellEditor.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,19 @@
2828

2929
package javax.swing;
3030

31-
import java.util.EventObject;
32-
3331
import java.awt.Component;
3432
import java.awt.event.ActionEvent;
3533
import java.awt.event.ActionListener;
3634
import java.awt.event.ItemEvent;
3735
import java.awt.event.ItemListener;
3836
import java.awt.event.MouseEvent;
37+
import java.util.EventObject;
38+
3939
import javax.swing.table.TableCellEditor;
4040
import javax.swing.table.TableCellRenderer;
4141
import javax.swing.tree.TreeCellEditor;
4242

4343
import swingjs.plaf.CellHolder;
44-
import swingjs.plaf.JSComponentUI;
4544

4645
/**
4746
* The default editor for table and tree cells.
@@ -381,7 +380,7 @@ public boolean startCellEditing(EventObject anEvent) {
381380
* @return true
382381
*/
383382
public boolean stopCellEditing() {
384-
System.out.println("DefaultCellEditor stop");
383+
//System.out.println("DefaultCellEditor stop");
385384
fireEditingStopped();
386385
return true;
387386
}
@@ -390,7 +389,7 @@ public boolean stopCellEditing() {
390389
* Cancels editing. This method calls <code>fireEditingCanceled</code>.
391390
*/
392391
public void cancelCellEditing() {
393-
System.out.println("DefaultCellEditor cancel");
392+
//System.out.println("DefaultCellEditor cancel");
394393
fireEditingCanceled();
395394
}
396395

@@ -402,7 +401,7 @@ public void cancelCellEditing() {
402401
*/
403402
@Override
404403
public void actionPerformed(ActionEvent e) {
405-
System.out.println("DefaultCellEditor action Performed");
404+
//System.out.println("DefaultCellEditor action Performed");
406405
DefaultCellEditor.this.stopCellEditing();
407406
}
408407

sources/net.sf.j2s.java.core/src/javax/swing/JComponent.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,9 @@ protected void paintChildren(Graphics g) {
687687
if (jc != null && jc.isVisible()) {
688688
jc.getBounds(tmpRect);
689689
boolean isContentPane = jc.getRootPane().getContentPane() == jc;
690-
Rectangle vr = (jc instanceof JTable ? jc.getVisibleRect() : tmpRect);
690+
Rectangle vr = (
691+
//jc instanceof JTable ? jc.getVisibleRect() :
692+
tmpRect);
691693
JSGraphics2D jsg = (JSGraphics2D) (Object) g.create(tmpRect.x,
692694
(isContentPane ? 0 : tmpRect.y), vr.width, vr.height);
693695
jsg.setColor(jc.getForeground());

sources/net.sf.j2s.java.core/src/javax/swing/JTable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
243243
ListSelectionListener, CellEditorListener, /* Accessible, */ RowSorterListener {
244244

245245

246-
private final static Rectangle r = new Rectangle();
246+
//private final static Rectangle r = new Rectangle();
247247
//
248248
// Static Constants
249249
//
@@ -5797,7 +5797,7 @@ public TableCellEditor getCellEditor() {
57975797
* @beaninfo bound: true description: The table's active cell editor.
57985798
*/
57995799
public void setCellEditor(TableCellEditor anEditor) {
5800-
System.out.println("JTable setting Cell Editor " + anEditor);
5800+
//System.out.println("JTable setting Cell Editor " + anEditor);
58015801
TableCellEditor oldEditor = cellEditor;
58025802
cellEditor = anEditor;
58035803
boolean a = _addingEditor;

0 commit comments

Comments
 (0)