According to https://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.rap.doc%2Fguide%2Freference%2Ftheming%2FCCombo.html the CCombo widget from SWT is themable, and the icon can be set.
I have the following CSS:
CCombo{
background-color: rgb(00,255,00);
}
CCombo Text {
background-color: rgb(00,255,00);
}
CCombo Button{
background-color: rgb(00,255,00);
background-image: url(ABSOLUTE PATH TO ICON);
}
CCombo Button-Icon{
background-color: rgb(00,255,00);
background-image: url(ABSOLUTE PATH TO ICON);
}
List[style~='SWT.DROP_DOWN']{
background-color: rgb(00,255,00);
}
And the background color is working fine. However I can't seem to get the icons working. I am using Linux to develop, however the application is deployed to windows7/10 so a solution for this platform would be sufficient for me.
I don't think this is possible.
The down arrow in CCombo is created using the SWT.ARROW | SWT.DOWN style on Button.
This setImage method of Button specifically ignores any setImage call when the style is SWT.ARROW so the CSS styling will not work.
I am looking at the macOS SWT code, there may be differences on other platforms.
Related
I am developing some custom controls for use in an RCP app. One control is a couple of Labels on a Composite. I gave the Composite a CSS Id and tried to apply this style:
#ImageSelectorButton, #ImageSelectorButton > *
{
font-size: 28pt;
color: rgb(51, 204, 153);
background-color: #ffffff;
}
When the app starts, the control is displayed but the background is transparent. I tried using background-color: rgb(255,255,255,255); but the result is the same.
If the style is changed to background-color: #fffffe; the background is (almost) white and opaque.
Is this a bug or working as intended?
I am trying, unsuccessfully, to get a background image to display. The java code is:
absolutePanel = new AbsolutePanel();
absolutePanel.setSize("600px", "600px");
absolutePanel.getElement().setId("cwAbsolutePanel");
absolutePanel.addStyleName("absolutePanel");
final Image img = new Image(Resources.INSTANCE.baseballBall());
absolutePanel.add(img, 10, 10);
CSS:
.absolutePanel {
background-image: url(bbdiamond.png);
background-size: 100% 100%;
background-repeat: no-repeat;
}
The path of the image and CSS file are:
I have tried "url('bbdiamond.png');" and "url(..\bbdiamond.png);" and "url('..\bbdiamond.png');".
I have also tried giving .absolutePanel a height and width of 100% each; background-color: white and opacity: 1.
Your assistance would be greatly appreciated.
Regards,
Glyn
I do not know why, however when I started testing this morning the CSS background was displayed. I have not made any changes to the CSS or the AbsolutePanel. In future if I am having issues with CSS I will reboot first.
Regards,
Glyn
I have a GWT application with some SimplePanel.
How can I make its border dashed?
I tried myPanel.addStyleName(Style.BorderStyle.DOTTED.getCssName());, but it didn't work.
This should work using Element#getStyle() method to update the element's Style object.
SimplePanel myPanel=new SimplePanel();
myPanel.getElement().getStyle().setBorderStyle(BorderStyle.DOTTED);
but I suggest you to keep the styling in the CSS file instead of directly applying it in Java file that is more difficult to manage and change in future mostly in case of themes.
CSS:
.dashedBorder{
border: 1px dotted black;
}
JAVA:
SimplePanel myPanel=new SimplePanel();
myPanel.setStyleName("dashedBorder");
I'm writing a simple JavaFX application, but I can't get some of the CSS styling to work.
The problem is the -fx-background-color property for my TextArea.
This is the relevant CSS:
.text-area {
-fx-font-family: Consolas;
-fx-highlight-fill: #00ff00;
-fx-highlight-text-fill: #000000;
-fx-text-fill: #00ff00;
-fx-background-color: #000000;
}
All the fields perform as expected, except -fx-background-color, which apparently does nothing. I still have the default white background. As you can see in the picture, the TextField below, which has identical CSS, but does apply the background color as expected.
Picture of my problem
Any clues?
You need to set the content:
.text-area .content{
-fx-background-color: black;
}
...
Or see this answer maybe: Transparent background of a textarea in JavaFX 8
I had the same problem: What I did:
Created a .css file called console.css with following content:
.text-area {
-fx-font-family: Consolas;
-fx-font-size: 15;
-fx-text-fill: #ffffff;
-fx-display-caret:true;
}
.text-area .content {
-fx-background-color: #000000;
}
On my scene called:
scene.getStylesheets().add(this.getClass()
.getResource("/stylesheets/console.css").toExternalForm());
Explanation:
The second part just loads the css stuff. (trivial)
The fist part (css): You have to check which property has to be applied on which part of the object. For instance: -fx-font-family is on .text-area but -fx-background-color is on .content. Understanding this concept let you understand all of the css stuff in JavaFx.
JavaFX-CSS-Docu
(recommended).
Good programming :-)
Are you using scene builder?
I tried the same css you use and everything works fine, maybe it's a bug in your version.
I tested it for text-area and text-field.
You should use -fx-control-inner-background for example for a TextArea with id=textAreaField:
#textAreaField {
-fx-control-inner-background: #000000;
-fx-text-fill: #ffffff;}
and you can for more information, see this topic:
Textarea javaFx Color
In JavaFx ,TextArea has two substuctures (Content & scrollPane) ,for each structure has all properties of TextInputControl :
text-area{ }
text-area .content { }
text-area.scroll-pane { }
I have the following code, which displays the images in my table with no border, then an orange border when hovered over:
table.test {
}
.test img {
border: solid 4px transparent;
}
.test img:hover {
border-color: orange;
}
If it try the following, i expect the border to stay orange after click, but it does not
.test img:active {
border-color: orange;
}
The images being used are thumbnail size instead of checkboxes.
Any ideas how I can keep the border orange after click?
Images cannot use active. http://www.whatwg.org/specs/web-apps/current-work/multipage/selectors.html#selector-active.Wrap it within an anchor and prevent default on the anchor click and change the cursor maybe?
check this fiddle might help you using simple jquery let you give your output
$('.test img').on('click', function(){
//use jquery css function
$(this).css({"border-color":"orange"});
// or add class .active with your own style
$(this).addClass('active');
})
make your image as block element and add this jquery click event. solved
You can create a class called orangeborder (or anything, really). Give it the attributes of border-color:orange;.
Then you can use jQuery and use:
$('img').click(function(){
$(this).toggleClass('orangeborder');
});
jsFiddle