Skip to content

Commit a030f59

Browse files
hansonrhansonr
authored andcommitted
AWT TextField margins
1 parent 59c9ccf commit a030f59

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sources/net.sf.j2s.java.core/src/swingjs/a2s/TextField.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.awt.Dimension;
44
import java.awt.FontMetrics;
5+
import java.awt.Insets;
56
import java.awt.event.TextEvent;
67
import java.awt.event.TextListener;
78

@@ -29,6 +30,13 @@ public TextField(String text, int width) {
2930
super(text, width);
3031
}
3132

33+
private static Insets awtInsets = new Insets(5, 2, 5, 2);
34+
// awt.Button has an unadjustable horizontal inset of what appears to be about 6 pixels
35+
@Override
36+
public Insets getMargin() {
37+
return awtInsets;
38+
}
39+
3240
public void addTextListener(final TextListener textListener) {
3341
getDocument().addDocumentListener(new DocumentListener() {
3442

0 commit comments

Comments
 (0)