PDA

View Full Version : Error with onRender()



jeyhun
15 Dec 2011, 1:15 AM
Hi, i get an error in protected void onRender in Eclipse, can anybody explain what i do wrong?





import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.Popup;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;


public class LinkFeedPopup extends Popup
{
public LinkFeedPopup()
{
setSize(300, 55);
setBorders(true);
setShadow(true);
setAutoHeight(false);

final TextField<String> urlField = new TextField<>();

@Override
protected void onRender(Element parent int index) {
super.onRender(parent, index);
final Text explainationText = new Text("Enter a feed URL");
final Button addButton = new Button("Add");
addButton.addSelectionListener(new SelectionListener<ButtonEvent>() {

@Override
public void componentSelected(ButtonEvent ce) {
addFeed(urlField.getValue());
}


private void addFeed(String url) {
Window.alert("The " + url + " would be sent for the respond on server!");
}
});

final BorderLayout layout = new BorderLayout();
setLayout(layout);

final BorderLayoutData textData = new BorderLayoutData(LayoutRegion.NORTH, 20);
textData.setMargins(new Margins(2));
final BorderLayoutData fieldData = new BorderLayoutData(LayoutRegion.SOUTH);
fieldData.setMargins(new Margins(2));
final BorderLayoutData buttonData = new BorderLayoutData(LayoutRegion.EAST, 50);
buttonData.setMargins(new Margins(2));

add(explainationText, textData);
add(urlField, fieldData);
add(addButton, buttonData);

}

}
}


Eclipse show this one:
30029

sven
15 Dec 2011, 1:27 AM
The errors tells you exactly what is wrong. Add a "}" befor the "@Override" and remove one "}" at the bottom.

jeyhun
15 Dec 2011, 1:51 AM
you right:) stupid mistake. thank u ~o)