Nimbus: background color of editable JComboBox - jcombobox

There are several related questions, but none of them has an answer that works for Nimbus and an editable JComboBox.
So, is there really no solution to set the backgound color of an editable JComboBox in Nimbus?
The below does NOT work:
((JTextComponent)jComboBox1.getEditor().getEditorComponent()).setOpaque(true);
((JTextComponent)jComboBox1.getEditor().getEditorComponent()).setBackground(Color.blue);
E.g. Change background color editable JComboBox illustrates the problem, but the provided solution only works for the Metal LaF.

Related

Devexpress BatchEdit cell style - Simulate input

I'm using DevExpress and I have an ASPxGridView that can be modified by BatchEdit.
This grid only have some cells that can be edited, and even on the same column some cells can be modified and others not (it depends on some conditions and I control that by JS with OnBatchStartEdit)
I want that the user could see quickly which cells are ready for edit and which ones not. I thought about simulating an style like if it were an input with CSS with outline and outline-offset, but outline-offset does not work on IE and without it, it is really ugly.
Another option I thought was with a border + radius, but with radius the background color of the cells outside the radius stays in white, and I don't want that because all the row must have the same color.
Do you have any solution to the issues of the options above or a new way to do what I want?

Changing the Shadow Color of a Disabled QComboBox also changes the color of Active Text

I'm currently trying to change the style of of disabled QComboBox, including the shadow drawn behind the text. Annoyingly enough, it seems the text shadow cannot be styled in the style sheet, which would be my preferred solution, but that's not the issue at hand.
I've have managed to change the shadow color in my code using setColor( QPalette::Disabled, QPalette::Light, QColor( #, #, # ) on the QComboBox's palette. While this "works". I come into the issue that the text color for the active state (but not the list view) also takes on that color, completely overriding changes made by the style sheet. I was under the impression that style sheet was meant to trump the palette.
Ideally, the fix for this would be a 100% style sheet solution, but google searches for me have had no positive results as far as setting the shadow color in the style sheet. I did find something about an etch-disable-text property, but that seems to only be psuedo science.
Calling setColor( QPalette::Active, QPalette::ButtonText, QColor( #, #, # ) ) on my palette before assigning it to by QComboBox resolves the issue, but I'm still looking for a style sheet solution.

Highlighting text in JavaFx Label

I am trying to set the text background of the JavaFx label text as green using the following CSS
label.setStyle("-fx-background-color:rgba(85, 255, 68,0.7););
And the unhighlight using the following
label.setStyle("-fx-background-color:rgba(0,0,255,0);");
However these does not work most of the times when it has to be done back to back.
Is there any way to set the style without using CSS i.e. using JavaFx API itself. I found label.textFill(Paint p) for text color but nothing for background colour i.e. the color of the label itself.
Is there any way to set the style without using CSS i.e. using JavaFx API itself.
For some styles (such as the text fill) yes. For background colors, background images, borders, etc API methods will not be available until JavaFX 8 is released (see Public API for Region backgrounds and borders in the JavaFX issue tracker for more information - anybody can sign up for access).
these does not work most of the times when it has to be done back to back.
If you just highlight a label and then unhighlight it again without using something like a PauseTransition to give the user some time to see the highlighted label, then, from the user's perspective nothing is going to happen as all the user will see is an unhighlighted label.
Not sure of your use case, but if you only want to highlight part of the text in a label or let the user highlight the text with a mouse, then you can use a TextField with editable set to false.
Possible Workaround
If the Java 8 preview does not work for you and you are experiencing errors due do bugs in the JavaFX CSS processing, then try placing a Pane then a label inside a StackPane. Set the background color of the Pane to label.setStyle("-fx-background-color:rgba(85, 255, 68,0.7);); Bind the Pane's preferred width and height to the Label's width and height and toggle setVisible on the Pane as appropriate.
Finally I found the workarround. I had to give a PauseTransition to give the system some time between unhighlight and highlight. CSS showed effect only after the pausetransaction if the labels were already highlighted. I think it may be a bug. I will file a jira. The duration of paustransition may be as low as 1 milisecond so that there is not lag from the user's point of view.

Flex DropDownList Normal state border color

So I'm trying to change to appearance of a spark DropDownList when it's in the normal state. I thought I color used the borderColor property but that seems to only change the color of the border when the list is open. Any ideas? Thanks In advance.
You're right about borderColor in case of using standard spark.skins.spark.DropDownListSkin. But you can create your custom implementation of spark.skins.spark.DropDownListButtonSkin which displays button part of DropDownList and then create your own DropDownListSkin which will use your button with desired border. All the skins can be exact copies of original skins with minimum required customization.

Flex LinkBar: how to set a selected button's background color?

I was able to set the text color of a selected LinkBar button by "disabledColor" style of LinkBar. Accordingly, I expect to set the background color of the selected button by "backgroundDisabledColor" style, however, it didn't work; and except "backgroundDisabledColor", I didn't see any other style that could possibly achieve this. Please help. Thanks.
The problem is probably that you're setting the style on the LinkBar itself - try setting the LinkBar's linkButtonStyleName style to a different style selector that contains all of the styles you need for your button. You should be able to set the fillColors style of the buttons themselves there - this will change the default look of the button.
If you need to adjust the "selected" color or if you need something more advanced than just skinning the button background you'll need to write a custom skin class. This isn't too difficult - the Button class has a whole set of "Selected" styles - selectedDownSkin, selectedUpSkin, selectedDisabledSkin, etc. IMO the best practice is to set your button skin to a custom skin class that sets the different individual styles based on state.
David Flately illustrates this method here. Check out his source - that should get you what you need. A good book on this topic that has this sort of thing along with lots of other examples is Juan Sanchez and Andy McIntosh's Creating Visual Experiences with Flex 3.0. I can't post a link to it because my reputation isn't high enough here yet, but you can find it on amazon or barnes and noble or any other online bookstore.
FYI - answer here....
http://dezeloper.wordpress.com/2010/02/24/flex-css-linkbar-togglebuttonbar-selected-text-color/
Haha, was looking for same thing, you can see on the source code of LinkBar:
// Hilite the new selection.
child = Button(getChildAt(selectedIndex));
child.enabled = false;
Which is clever!!! Rather than set selected to true, they disable the selected button ... why not ;-( Took me half an hour to understand the Flex team logical ...
eBuildy, Flex Specialists

Resources