Skip to content

Commit f7e0570

Browse files
committed
bit less use of new Dimension()
1 parent 25e1fc7 commit f7e0570

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

sources/net.sf.j2s.java.core/src/swingjs/JSUtil.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import swingjs.api.js.J2SInterface;
4242
import swingjs.api.js.JQuery;
4343
import swingjs.json.JSON;
44+
import swingjs.plaf.JSComponentUI;
4445
import swingjs.plaf.JSFrameUI;
4546

4647
public class JSUtil implements JSUtilI {
@@ -388,7 +389,7 @@ public static boolean isClassLoaded(String className) {
388389
static String processCSS(String css, String path) {
389390
if (path != null && css.indexOf("images/") >= 0) {
390391
path = path.substring(0, path.lastIndexOf("/") + 1) + "images/";
391-
css = PT.rep(css, "images/", path);
392+
css = css.replaceAll("images/", path);
392393
}
393394
jQuery.$("head").append(jQuery.$("<style type='text/css'>" + css + "</style>"));
394395
return css;
@@ -577,7 +578,7 @@ public static Locale getDefaultLocale(String language) {
577578
String region, country, variant;
578579
if (language == null)
579580
language = J2S.getDefaultLanguage(true);
580-
language = language.replace('-','_');
581+
language = language.replaceAll("-","_");
581582
if (language == null || language.length() == 0 || language.equalsIgnoreCase("en"))
582583
language = "en_US";
583584
int i = language.indexOf('_');
@@ -1060,5 +1061,10 @@ public void showStatus(String msg, boolean doFadeOut) {
10601061
J2S.showStatus(msg, doFadeOut);
10611062
}
10621063

1064+
@Override
1065+
public void setUIEnabled(JComponent jc, boolean enabled) {
1066+
((JSComponentUI) jc.getUI()).setUIDisabled(!enabled);
1067+
}
1068+
10631069
}
10641070

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSButtonUI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,8 +774,8 @@ protected void installDefaults(AbstractButton b) {
774774
//
775775

776776
@Override
777-
protected Dimension getCSSAdjustment(boolean addingCSS) {
778-
return new Dimension((itemNode == null ? 0 : 10), 0);
777+
protected Dimension getCSSAdjustment(boolean addingCSS, boolean mutable) {
778+
return mutable || itemNode != null ? new Dimension((itemNode == null ? 0 : 10), 0) : ZERO_SIZE;
779779
}
780780

781781
@Override

0 commit comments

Comments
 (0)