Skip to content

Commit 7e4fe83

Browse files
author
soheil_h_y
committed
1 parent 3732f61 commit 7e4fe83

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Button.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,24 @@ void createHandle() {
12631263
btnHandle.className = "button-push";
12641264
}
12651265
}
1266+
btnHandle.onmouseover = new RunnableCompatibility() {
1267+
public void run() {
1268+
String cssName = " button-hover";
1269+
int idx = btnHandle.className.indexOf(cssName);
1270+
if(idx == -1){
1271+
btnHandle.className = btnHandle.className + cssName;
1272+
}
1273+
}
1274+
};
1275+
btnHandle.onmouseout = new RunnableCompatibility() {
1276+
public void run() {
1277+
String cssName = " button-hover";
1278+
int idx = btnHandle.className.indexOf(cssName);
1279+
if(idx != -1){
1280+
btnHandle.className = btnHandle.className.substring(0, idx) + btnHandle.className.substring(cssName.length() + idx);
1281+
}
1282+
}
1283+
};
12661284
//bindHandle();
12671285
hookSelection();
12681286
}

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/Combo.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1182,11 +1182,15 @@ public void remove (int index) {
11821182
Option[] oldOptions = selectInput.options;
11831183
if (0 > index && index > oldOptions.length - 1)
11841184
error (SWT.ERROR_INVALID_RANGE);
1185+
if(selectInput.selectedIndex == index){
1186+
noSelection =true;
1187+
}
11851188
Option[] newOptions = new Option[oldOptions.length - 1];
11861189
System.arraycopy(oldOptions,0, newOptions, 0, index);
11871190
System.arraycopy(oldOptions, index + 1, newOptions, index, oldOptions.length - index - 1);
11881191
selectInput.options = newOptions;
11891192
itemCount--;
1193+
11901194
}
11911195

11921196
/**
@@ -1242,6 +1246,9 @@ public void remove (int start, int end) {
12421246
Option[] oldOptions = selectInput.options;
12431247
if ((0 > start && start > oldOptions.length - 1) || (0 > end && end > oldOptions.length - 1))
12441248
error (SWT.ERROR_INVALID_RANGE);
1249+
if(start <= selectInput.selectedIndex && selectInput.selectedIndex <= end){
1250+
noSelection = true;
1251+
}
12451252
Option[] newOptions = new Option[oldOptions.length - (end - start + 1)];
12461253
System.arraycopy(oldOptions,0, newOptions, 0, start);
12471254
System.arraycopy(oldOptions, end + 1, newOptions, start, oldOptions.length - end - 1);
@@ -1270,6 +1277,9 @@ public void remove (String string) {
12701277
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
12711278
int index = indexOf (string, 0);
12721279
if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT);
1280+
if(selectInput.selectedIndex == index){
1281+
noSelection = true;
1282+
}
12731283
remove (index);
12741284
}
12751285

@@ -1289,6 +1299,7 @@ public void removeAll () {
12891299
* @j2sNative
12901300
* this.selectInput.options.length = 0;
12911301
*/{}
1302+
noSelection = true;
12921303
itemCount = 0;
12931304
textInput.value = "";
12941305
sendEvent (SWT.Modify);
@@ -1483,9 +1494,10 @@ public void select (int index) {
14831494
}
14841495
*/
14851496
if(index >= 0 && index < itemCount){
1497+
noSelection = false;
14861498
selectInput.selectedIndex = index;
1499+
setText(getItem(index));
14871500
}
1488-
setText(getItem(index));
14891501
}
14901502
/*
14911503
void setBackgroundPixel (int pixel) {

0 commit comments

Comments
 (0)