GWT - fancy Google-style buttons? - java

I'm curious, is there a way to style buttons in my GWT application to make them look the same way they do in GMail?
Are these "buttons" at all? What's the easiest way to get the same?

They're just divs with fancy styles! Check them out with Firebug!

The current version are divs styles with CSS3 properties like gradient and border-radius. Prior to this version GMail had a button also created by divs but not using CSS3 styles. The button was much more complex (several nested divs). That latter button is available for GWT in the library cobogw:
See demo and cobogw on google code.

There is a new Theme called clean. Check it out:

Related

How to change JavaFX slider thumb color without CSS

I'm using ScalaFX, which is currently proving itself to be thoroughly useless and bugging out anytime I try to use css. Is there any way to change the fill color of a Slider without using css, or at least without separate css files?
I've managed to change the track color with slider.setStyle("-fx-control-inner-background: #f08080;"), but can't get the thumb working.
You could use the -fx-base property, which sets the component colors palette according to the value you specify.
Example:
slider.setStyle("-fx-base: #f08080;");
Result:
However why don't you consider using a CSS file? It simplifies everything and allows you to make a lot more customizations. Take a look at the Slider JavaFX CSS reference, I think you will find what you're looking for.

Adding a java.awt.frame to a vaadin layout

I'm working on a vaadin page, but one of the elements I want to put in my VerticalLayout is a java.awt.Frame. Is there a way to do this in vaadin?
As said in the comments, you can't use Swing/AWT stuff in Vaadin since it will be converted to Javascript and DOM to be used in a browser.
If you get a hold on the JS file TeeChart uses you can basically implement a custom client-side widget that will use it.
Take the basic demo here what you have to take care of is that there is a <canvas> tag to render the content in and that the draw() is called at a phase when Vaadin is done creating the surrounding DOM structure.
Please have a look at this tutorial to get an idea on how to wrap a JavaScript library to a Vaadin component.

Bullets not showing in JTextPane

I am developing an editor in Java in which I want to include bullets of different types. I am using HtmlEditorKit. I wanted to add a style sheet but it is not working, I wanted to know if following Pseudo element is supported in Java, if it is supported can you please guide me where I am going wrong?
styleSheet.addRule("ul{list-style-type:none;margin:0px 20px;}");
styleSheet.addRule("li:before{content: \"&#10020\";}");
The Java HTML rendering engine only supports a (very) limited amount of CSS.

Struts2 s:checkbox label not showing up

In the most bizarre of circumstances, the label for my checkbox do not show up in my Struts2 JSP. I have a series of checkboxes, all following the same format, but none of the labels appear. Here is a sample declaration:
<s:checkbox name="chronCheck1" label="New Sales"/>
This is among the most basic of tasks, but something is obviously missing. I am running Struts2 version 2.2.1 via Weblogic 10. Not really sure what else is necessary to help troubleshoot.
You are probably using simple theme in your JSP. With simple theme you must create labels for inputs by yourself.
About simple theme from documentation:
For example, the textfield tag renders the HTML tag without a label, validation, error reporting, or any other formatting or functionality.
See http://struts.apache.org/2.x/docs/themes-and-templates.html.
It is not very clear from the official documentation for the s:checkbox, but in my experiment, if you don't specify the theme, the default theme does not support label. When I change the theme to either xhtml or css_xhtml it successfully showed the label. However these themes also add additional markup and css classes, so you probably need extra css styling and specifying labelposition (top, left, right or bottom) to achieve your desired look and feel. Another option is to create your own theme and apply it. Please refer to this documentation:
https://struts.apache.org/docs/struts-2-themes.html

View GWT HTML source?

Is there a way to VIEW the HTML source code that GWT produces? Currently I just give my flex table the DIV id and that DIV is all HTML I can see in ViewSource.
Is there a way to structure my table in HTML (say using div's and lists) and than create a something like FlexTable around that?
To answer the original question, you can view the HTML GWT has rendered via 'Inspect Element' in Firefox, with Firebug is installed. Alternatively the Web Inspector in Safari/Chrome will do the trick, as will the Developer tools in both IE8 and Opera.
Well well it seems the answer is in the documentation.
In particular Organizing Projects outlines how we can bind different widgets to different id's on the page.
So I can effectively do something like:
# html
<div id="id_table"></div>
<div id="id_next_button"></div>
# java
t = new FlexTable()
RootPanel.get("id_table").add(t);
nextbtn = new Button("next");
RootPanel.get("id_next_button").add(nextbtn);
Wohoo!
Regarding the second part of your quetion. It is possible to create a HTML component in GWT. The recomended way to do this is extending ComplexPanel and create the elements using Document.get().createXXXElement(). But it is a little laborius.
Check out this dicussion and I am sure there are other articles about this around the internet. You can also study the code of other components the extend ComplexPanel.

Categories