Skip to content

Commit 2641edb

Browse files
hansonrhansonr
authored andcommitted
protection of SwingJS-specific field names
1 parent 00796e1 commit 2641edb

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

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

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ public abstract class JComponent extends Container {
204204
*
205205
* SwingJS
206206
*/
207-
private boolean _isAlignmentXSet;
208-
private float _alignmentX;
209-
private boolean _isAlignmentYSet;
210-
private float _alignmentY;
207+
private boolean 秘isAlignmentXSet;
208+
private float 秘alignmentX;
209+
private boolean 秘isAlignmentYSet;
210+
private float 秘alignmentY;
211211

212212
/**
213213
* Backing store for JComponent properties and listeners
@@ -222,9 +222,9 @@ public abstract class JComponent extends Container {
222222
/**
223223
* Whether or not autoscroll has been enabled.
224224
*/
225-
private boolean _autoscrolls;
226-
private Border _border;
227-
private int _flags;
225+
private boolean autoscrolls;
226+
private Border border;
227+
private int flags;
228228

229229
/* Input verifier for this component */
230230
// private InputVerifier inputVerifier = null;
@@ -287,7 +287,7 @@ public abstract class JComponent extends Container {
287287
/**
288288
* <code>JPopupMenu</code> assigned to this component and all of its childrens
289289
*/
290-
private JPopupMenu _popupMenu;
290+
private JPopupMenu 秘popupMenu;
291291

292292
/** Private flags **/
293293
private static final int IS_DOUBLE_BUFFERED = 0;
@@ -498,8 +498,8 @@ public void setComponentPopupMenu(JPopupMenu popup) {
498498
if (popup != null) {
499499
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
500500
}
501-
JPopupMenu oldPopup = this._popupMenu;
502-
this._popupMenu = popup;
501+
JPopupMenu oldPopup = this.秘popupMenu;
502+
this.秘popupMenu = popup;
503503
firePropertyChange("componentPopupMenu", oldPopup, popup);
504504
}
505505

@@ -518,10 +518,10 @@ public void setComponentPopupMenu(JPopupMenu popup) {
518518
public JPopupMenu getComponentPopupMenu() {
519519

520520
if (!getInheritsPopupMenu()) {
521-
return _popupMenu;
521+
return 秘popupMenu;
522522
}
523523

524-
if (_popupMenu == null) {
524+
if (秘popupMenu == null) {
525525
// Search parents for its popup
526526
Container parent = getParent();
527527
while (parent != null) {
@@ -537,7 +537,7 @@ public JPopupMenu getComponentPopupMenu() {
537537
return null;
538538
}
539539

540-
return _popupMenu;
540+
return 秘popupMenu;
541541
}
542542

543543
/**
@@ -1590,9 +1590,9 @@ public boolean contains(int x, int y) {
15901590
* description: The component's border.
15911591
*/
15921592
public void setBorder(Border border) {
1593-
Border oldBorder = this._border;
1593+
Border oldBorder = this.border;
15941594

1595-
this._border = border;
1595+
this.border = border;
15961596
firePropertyChange("border", oldBorder, border);
15971597
if (border != oldBorder) {
15981598
if (border == null
@@ -1613,7 +1613,7 @@ public void setBorder(Border border) {
16131613
* @see #setBorder
16141614
*/
16151615
public Border getBorder() {
1616-
return _border;
1616+
return border;
16171617
}
16181618

16191619
/**
@@ -1625,8 +1625,8 @@ public Border getBorder() {
16251625
*/
16261626
@Override
16271627
public Insets getInsets() {
1628-
if (_border != null) {
1629-
return _border.getBorderInsets(this);
1628+
if (border != null) {
1629+
return border.getBorderInsets(this);
16301630
}
16311631
return super.getInsets();
16321632
}
@@ -1654,17 +1654,17 @@ public Insets getInsets(Insets insets) {
16541654
// because AWT components do not have this method
16551655
in = getInsets();
16561656
} else {
1657-
if (_border == null) {
1657+
if (border == null) {
16581658
// super.getInsets() always returns an Insets object with
16591659
// all of its value zeroed. No need for a new object here.
16601660
insets.left = insets.top = insets.right = insets.bottom = 0;
16611661
} else {
1662-
if (_border instanceof AbstractBorder) {
1663-
in = ((AbstractBorder) _border).getBorderInsets(this, insets);
1662+
if (border instanceof AbstractBorder) {
1663+
in = ((AbstractBorder) border).getBorderInsets(this, insets);
16641664
}
16651665
// Can't reuse border insets because the Border interface
16661666
// can't be enhanced.
1667-
in = _border.getBorderInsets(this);
1667+
in = border.getBorderInsets(this);
16681668
}
16691669
}
16701670
if (in != null) {
@@ -1686,8 +1686,8 @@ public Insets getInsets(Insets insets) {
16861686
*/
16871687
@Override
16881688
public float getAlignmentY() {
1689-
if (_isAlignmentYSet) {
1690-
return _alignmentY;
1689+
if (秘isAlignmentYSet) {
1690+
return 秘alignmentY;
16911691
}
16921692
return super.getAlignmentY();
16931693
}
@@ -1701,9 +1701,9 @@ public float getAlignmentY() {
17011701
* @beaninfo description: The preferred vertical alignment of the component.
17021702
*/
17031703
public void setAlignmentY(float alignmentY) {
1704-
this._alignmentY = alignmentY > 1.0f ? 1.0f : alignmentY < 0.0f ? 0.0f
1704+
this.秘alignmentY = alignmentY > 1.0f ? 1.0f : alignmentY < 0.0f ? 0.0f
17051705
: alignmentY;
1706-
_isAlignmentYSet = true;
1706+
秘isAlignmentYSet = true;
17071707
}
17081708

17091709
/**
@@ -1716,8 +1716,8 @@ public void setAlignmentY(float alignmentY) {
17161716
*/
17171717
@Override
17181718
public float getAlignmentX() {
1719-
if (_isAlignmentXSet) {
1720-
return _alignmentX;
1719+
if (秘isAlignmentXSet) {
1720+
return 秘alignmentX;
17211721
}
17221722
return super.getAlignmentX();
17231723
}
@@ -1731,9 +1731,9 @@ public float getAlignmentX() {
17311731
* @beaninfo description: The preferred horizontal alignment of the component.
17321732
*/
17331733
public void setAlignmentX(float alignmentX) {
1734-
this._alignmentX = alignmentX > 1.0f ? 1.0f : alignmentX < 0.0f ? 0.0f
1734+
this.秘alignmentX = alignmentX > 1.0f ? 1.0f : alignmentX < 0.0f ? 0.0f
17351735
: alignmentX;
1736-
_isAlignmentXSet = true;
1736+
秘isAlignmentXSet = true;
17371737
}
17381738

17391739
/**
@@ -2962,8 +2962,8 @@ public void scrollRectToVisible(Rectangle aRect) {
29622962
*/
29632963
public void setAutoscrolls(boolean autoscrolls) {
29642964
setFlag(AUTOSCROLLS_SET, true);
2965-
if (this._autoscrolls != autoscrolls) {
2966-
this._autoscrolls = autoscrolls;
2965+
if (this.autoscrolls != autoscrolls) {
2966+
this.autoscrolls = autoscrolls;
29672967
if (autoscrolls) {
29682968
enableEvents(AWTEvent.MOUSE_EVENT_MASK);
29692969
enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
@@ -2981,7 +2981,7 @@ public void setAutoscrolls(boolean autoscrolls) {
29812981
* @see #setAutoscrolls
29822982
*/
29832983
public boolean getAutoscrolls() {
2984-
return _autoscrolls;
2984+
return autoscrolls;
29852985
}
29862986

29872987
/**
@@ -2997,7 +2997,7 @@ public boolean getAutoscrolls() {
29972997
*/
29982998
@Override
29992999
protected void processMouseEvent(MouseEvent e) {
3000-
if (_autoscrolls && e.getID() == MouseEvent.MOUSE_RELEASED) {
3000+
if (autoscrolls && e.getID() == MouseEvent.MOUSE_RELEASED) {
30013001
Autoscroller.stop(this);
30023002
}
30033003
super.processMouseEvent(e);
@@ -3013,7 +3013,7 @@ protected void processMouseEvent(MouseEvent e) {
30133013
@Override
30143014
protected void processMouseMotionEvent(MouseEvent e) {
30153015
boolean dispatch = true;
3016-
if (_autoscrolls && e.getID() == MouseEvent.MOUSE_DRAGGED) {
3016+
if (autoscrolls && e.getID() == MouseEvent.MOUSE_DRAGGED) {
30173017
// We don't want to do the drags when the mouse moves if we're
30183018
// autoscrolling. It makes it feel spastic.
30193019
dispatch = !Autoscroller.isRunning(this);
@@ -4168,7 +4168,7 @@ public void removeNotify() {
41684168
RepaintManager.currentManager(this).resetDoubleBuffer();
41694169
setCreatedDoubleBuffer(false);
41704170
}
4171-
if (_autoscrolls) {
4171+
if (autoscrolls) {
41724172
Autoscroller.stop(this);
41734173
}
41744174
}
@@ -4684,15 +4684,15 @@ boolean checkIfChildObscuredBySibling() {
46844684

46854685
private void setFlag(int aFlag, boolean aValue) {
46864686
if (aValue) {
4687-
_flags |= (1 << aFlag);
4687+
flags |= (1 << aFlag);
46884688
} else {
4689-
_flags &= ~(1 << aFlag);
4689+
flags &= ~(1 << aFlag);
46904690
}
46914691
}
46924692

46934693
private boolean getFlag(int aFlag) {
46944694
int mask = (1 << aFlag);
4695-
return ((_flags & mask) == mask);
4695+
return ((flags & mask) == mask);
46964696
}
46974697

46984698
// // These functions must be static so that they can be called from
@@ -4758,11 +4758,11 @@ protected String paramString() {
47584758
.toString() : "");
47594759
String maximumSizeString = (isMaximumSizeSet() ? getMaximumSize()
47604760
.toString() : "");
4761-
String borderString = (_border == null ? "" : (_border == this ? "this"
4762-
: _border.toString()));
4761+
String borderString = (border == null ? "" : (border == this ? "this"
4762+
: border.toString()));
47634763

4764-
return super.paramString() + ",alignmentX=" + _alignmentX + ",alignmentY="
4765-
+ _alignmentY + ",border=" + borderString + ",flags=" + _flags
4764+
return super.paramString() + ",alignmentX=" + 秘alignmentX + ",alignmentY="
4765+
+ 秘alignmentY + ",border=" + borderString + ",flags=" + flags
47664766
+ // should beef this up a bit
47674767
",maximumSize=" + maximumSizeString + ",minimumSize="
47684768
+ minimumSizeString + ",preferredSize=" + preferredSizeString;

0 commit comments

Comments
 (0)