Search code examples
cssgwtgwt2gxt

How to put the Icons In the Center of the button in GXT


Hi i am working on GXT

i have a button with an Icon.

I want to put the Icon in center.

Currently it looks like this.

enter image description here

the icon of the button is in left (because of IconAlign.LEFT).

I want it in center. But there is nothing like IconAlign.CENTER

If any one has an idea what to add in code.Please share

code

button.setIconAlign(IconAlign.LEFT);
button.setIcon(Resources.INSTANCE.modify());
button.setStyleName("project-Button");

CSS

.project-Button {
    color: Black;
    border: thin outset #FF6600;
    font-family: Courier New, Century Gothic, Times New Roman, Verdana, Arial;
    vertical-align: middle;
    text-align: center;
    background-color: White;
    cursor: pointer;
}

thank you in advance


updated

public interface Resources extends ClientBundle {

    public Resources INSTANCE = GWT.create(Resources.class);

     @Source("Images/modify.png")
     ImageResource modify();
}

Solution

  • used this. and itis working fine.

    vertical-align: middle;
    text-align: center;
    background-position:30% 70%;