GWT:设置按钮/设计按钮大小的最佳方法?
Google Web Toolkit 是个好东西。我只是在设计上遇到了一些问题。让我们从按钮开始:每个浏览器都会向我显示不同的按钮外观。
这里火狐: http://img832.imageshack.us/img832/3259/22957182.jpg< /a> 这里是 Internet Explorer:http://img62.imageshack.us/img62/9310/32392601。 jpg
代码始终相同:
Button btnTest = new Button("Test");
layoutPanel.add(btnTest);
layoutPanel.setWidgetLeftWidth(btnTest, 58.0, Unit.PX, 87.0, Unit.PX);
layoutPanel.setWidgetTopHeight(btnTest, 238.0, Unit.PX, 25.0, Unit.PX);
我可以使用 btnTest.setSize... extra 但它不会改变问题。我不明白。我需要一个按钮(以及其他所有内容)在 IE 上看起来正常的网站。
这就是为什么我问:在 gwt 中设计按钮有不同的方法吗?因为使用普通的 gwt 按钮是有问题的(参见图片)。 “熟练”的人在使用 gwt 时使用了哪些技巧?
我的意思是 gwt = java 到 javascript ,这些按钮(以及其他所有按钮)是 javascriptbuttons 还是?我对javascript一无所知,但是有一种方法可以使按钮在IE上看起来像在firefox上一样,或者?
谢谢你!
Google Web Toolkit is a nice thing. I just have some problems with the designing. Lets start with the buttons: every browsers shows me a different look of a button.
Here Firefox: http://img832.imageshack.us/img832/3259/22957182.jpg
Here the Internet Explorer: http://img62.imageshack.us/img62/9310/32392601.jpg
The Code is always the same:
Button btnTest = new Button("Test");
layoutPanel.add(btnTest);
layoutPanel.setWidgetLeftWidth(btnTest, 58.0, Unit.PX, 87.0, Unit.PX);
layoutPanel.setWidgetTopHeight(btnTest, 238.0, Unit.PX, 25.0, Unit.PX);
I can use btnTest.setSize... extra but it wont change the problem. I dont understand that. I need a website where the buttons (and everything else) looks normal on the IE.
Thats why i ask: are there different ways to design a button in gwt? Because to use a normal gwt button is buggy (see the pictures). What kind of tricks are the "skilled" people using with gwt?
i mean gwt = java to javascript , these buttons (an everything else) are javascriptbuttons or? i have no idea about javascript, but there is a way to make buttons which looks on IE the same like on firefox or?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Button 类使用浏览器的本机按钮实现。为了对按钮的外观进行更细粒度的控制,请使用您想要的确切面扩展 CustomButton。
http:// /google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/CustomButton.html
我不知道具体的教程,但我的代码看起来有些东西像这样:
public class WVButton extends CustomButton {
那么 CSS 文件有
.WV-Button{}
.WV-Button-up-hovering{}
.WV-Button-up-disabled{}
等等。
每个都定义了该面孔的background-image:url("")。
The Button class uses the browser's native button implementation. For more fine grained control over the appearance of buttons extend CustomButton with the exact faces you want.
http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/CustomButton.html
I'm not aware of a specific tutorial but my code looks something like this:
public class WVButton extends CustomButton {
Then the CSS file has
.WV-Button{}
.WV-Button-up-hovering{}
.WV-Button-up-disabled{}
and so on.
Each of which defines background-image:url("") of that face.