Combobox selection highlight in LWUIT - combobox

I have a combobox in LWUIT and when I use my arrows up and down I can't see which item is selected so How can I change the background color of combobox item selected in LWUIT

Use the ComboBoxUIID ComboBoxFocus Selected style.

Finally I found the answer, I have used Cell Renderer to be able to change the Style of ComboBox Item and also I have used Look and Feel to be able to change the arrow Icon and replace it with my Icon
genderCB.setListCellRenderer(my defined cell renderer);
Blockquote
LookAndFeel lf = UIManager.getInstance().getLookAndFeel();
try {
((DefaultLookAndFeel) lf).setComboBoxImage(Image.createImage(image));
} catch (Exception ex) {
ex.printStackTrace();
}

Related

How to remove these blue bars/borders in checkbox in Kendo

I am creating a treeview using
kendo.data.HierarchicalDataSource
I want to remove these highlighted border. It is there only when using treeview.
Thanks.
Try overwriting the following style using !important. I overwritten it with red color, you can change it to any color of your choice.
.k-state-selected,
.k-state-selected:link,
.k-state-selected:visited,
.k-tool.k-state-selected
{
color : #ffff;
background-color:#ff0000!important;
}
Sample dojo

Setting the RadioButton "Selected" style in Codename One

I believe the RadioButton "selected" style is not getting set properly.
I am trying to style the radio button using the standard UIID RadioButton in the theme.
I updated the unselected font style to black.
I updated the selected and pressed font style to teal.
It looks like the pressed style works but the selected style does not work. Such that when the radio button is pressed, the font switches to teal but after it gets selected, the font reverts back to black.
Here is the code I used for testing.
Form hi = new Form("Hi World");
hi.addComponent(new RadioButton("Button 1"));
hi.addComponent(new RadioButton("Button 2"));
hi.addComponent(new RadioButton("Button 3"));
hi.show();
First it seems you didn't add the radio buttons to a ButtonGroup which means the radio button won't be selected properly.
Notice the selected style applies to focus of the component and will only appear on touch. It isn't related to the selected state in the radio button which means checked (sorry about that confusing terminology).
I'm guessing you are trying to customize the check symbol which you can customize via theme constants.

Hiding element while preserving its space in page layout

I'm making a list of containers programmatically. These containers have a table layout with two cells. In first cell I'm showing a checkbox and in second cell is a multibutton:
In some rows I would like disable user to click on a checkbox. I've tried using .setHidden(true), setVisible(true), etc.. on a checkbox but in that case checkbox is not visible(which is also acceptable) but in that case it is not preserving it's space and data in rows are not vertically aligned(as you see in the image). Does anyone know how to achieve this??? Graying and disabling the checkbox would be great, but not showing it and preserving it's space would be acceptable.
Here's the code:
Container list = findContainerOrders(f);
list.setScrollableY(true);
LinkedHashMap htJSONObject;
//al is a ArrayList
for(int i=0; i < al.size(); i++){
htJSONObject = (LinkedHashMap)al.get(i);
Container cr = new Container();
TableLayout gr = new TableLayout(1, 2);
gr.setGrowHorizontally(true);
cr.setLayout(gr);
final MultiButton b = new MultiButton();
b.setName((String)htJSONObject.get("text1"));
b.setTextLine1((String)htJSONObject.get("text2"));
b.setTextLine2((String)htJSONObject.get("text3"));
b.setTextLine3((String)htJSONObject.get("text4"));
b.setUIIDLine1("MultiLine1");
b.setUIIDLine2("MultiLine2");
b.setUIIDLine3("MultiLine1Right");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
//some action here
}
});
CheckBox cb = new CheckBox();
cb.setName((String)htJSONObject.get("text1"));
String sSomeCondition = (String)htJSONObject.get("Condition");
//If this condition equals "NO" than I want to disable the checkbox
if (sSomeCondition.equals("NO")) {
// I've tried this but it doesn't work good
//cb.setHidden(true);
//cb.setHidden(true, true);
//cb.setVisible(true);
//cb.setEnabled(false);
//TODO - disable checkbox code....???
}
else {
cr.addComponent(cb);
}
cr.addComponent(b);
list.addComponent(cr);
}
When I use "setEnabled(false)" like Chen said in his answer, the checkbox is disabled but it's apperence is the same. I have a disabled style for my checkbox in my theme and I was able to change checkbox background but I want to change the color of the checkbox rectangle.
I tried to do that by adding constant "checkBoxUncheckDisImage" in a theme "Constants" tab and adding another image which would replace checkbox rectangle image but it didn't work.
How do I change the default checkbox image for a disabled checkbox?
setEnabled(false) should do the trick, make sure you have a disabled style for the CheckBox in your theme

JavaFX combobox, getting white background after listview

I m getting a white background in my ComboBox in javaFx
Screenshot of combobox I m getting
I simply used this
ComboBox mode = new ComboBox();
mode.getItems().addAll("Cash", "Cheque", "Account Transfer");
Please tell me how to resolve this..
As you can read here, when the combo is shown a PopupControl that extends `PopupWindow' is shown. It has its own scene and styling.
My guess is you have some styling applied to the CSS rule .root.popup, something like this:
.root.popup {
-fx-background-color: white;
}
Try to remove that sytling or change it to:
.root.popup {
-fx-background-color: transparent;
}
and check if the problem is solved.

Add image to Checkbox in winforms

I have a Image path(some thing like this "http://ABC/XYZ/PQR.gif").And I want to assign this image to checkbox in winforms using C#.winfroms checkbox does not have SRC,How can I assign this image to checkbox.?
The Background of a check box can be filled with a provided image.
See
CheckBox Overview
CheckBox Members
Control.BackgroundImage Property
Try this
Set the BackGroundImage Property.
Change the BackGroundImageLayout
Property to stretch.
Change the Font Color if required

Resources