JavaFX ComboBox style when focused and item selected - javafx-8

I have been trying to unstyle a combobox. Basically, I want it fully transparent with only text and arrow showing.
I have managed this by doing:
.agent-status-combo .arrow-button, .agent-status-combo .arrow-button:hover {
-fx-background-color: transparent, transparent, transparent, transparent;
}
.agent-status-combo, .agent-status-combo:hover, agent-status-combo:focused, .agent-status-combo:showing, .agent-status-combo:selected, .agent-status-combo:filled {
-fx-font: 14px "Roboto";
-fx-background-color: transparent, transparent, transparent, transparent;
}
.agent-status-combo:hover > .arrow-button {
-fx-background-color: transparent, transparent, transparent, transparent;
}
.agent-status-combo .arrow {
-fx-background-color: #FFFFFF;
}
.agent-status-combo .cell, .agent-status-combo .cell:selected, .agent-status-combo .cell:focused, .agent-status-combo .cell:selected:filled, .agent-status-combo .cell:filled:selected, .agent-status-combo .cell:focused:selected {
-fx-background-color: transparent, transparent, transparent, transparent;
-fx-text-fill: white;
}
.agent-status-combo .list-cell:selected, .agent-status-combo .list-cell:focused, .agent-status-combo .list-cell:selected:filled, .agent-status-combo .list-cell:filled:selected, .agent-status-combo .list-cell:focused:selected {
-fx-background-color: transparent, transparent, transparent, transparent;
}
As you can see from the overkill of selectors, I have an issue.
I can't get all this lovely rules to work for when the Combo is focused... It just reverts to default style.
Has anyone come across this?

You can use jfoenix.jar for this purpose.
Simply install it in scene builder and your project also.
Then you can use its components like combo box and all.
After taking combo box to make it transparent you can use following sample code:
.jfx-combo-box{
-jfx-focus-color: transparent;
-jfx-unfocus-color: transparent;
}
.jfx-combo-box:focused{
-fx-background-color: red;
}
.jfx-combo-box:selected{
-fx-background-color: red;
}

Making it not focus traversable solved the problem. True it prevents to use tab to navigate through the UI, but it is not a concern.

Related

How to set opacity to a background image in Ionic v6

I have an Ion Content, I need to put a background image there with 50% Opacity.
My welcome component html
<ion-content>
<ion-grid>
<ion-row>
...
My welcome component scss
ion-content
{
--background: url(splash1.png) no-repeat center center / cover;
--background-opacity: 0.5;
}
The Background Image is shown, but there is no opacity. How I can fix it? I user Ionic v6 with Angular
use css shadow part background:
ion-content
{
--background: url(splash1.png) no-repeat center center / cover;
}
ion-content::part(background)
{
opacity: 0.5;
}

Ionic 6 modal with transparent background?

I want my modal to have a content (image), and a transparent background, but I can't achieve the transparent background, I will appreciate if you can help me.
Thank you very much!
Ionic CLI: 6.19.0
Ionic Framework: #ionic/angular 6.0.4
global.scss
.modal-answer .modal-wrapper {
--background: transparent !important;
margin: 0 auto;
height: 40%;
top: 30%;
width: 70%;
display: block;
}
game.ts
const modal = await this.modalController.create({
component: ModalAnswerPage,
cssClass: 'modal-answer',
componentProps: {
answe: this.ok_bad_time,
back_g: this.color_backg_modal_ answer'
}
});
return await modal.present().then(_ => {
});
modal-answer.page.scss
ion-content{
--background: transparent;
}
Remove your ion-content from you modal html. It inherit the background color from the component where you open the modal.
in you global.css :
ion-modal {
--background: transparent !important;
}
If this approach doesn't work, then instead you can add opacity to Modal parent element. For example :-
Modal component code :-
<div padding class="mainContent">
<div no-margin margin-top class="feedbackCard">
</div>
</div>
Here mainContent is complete page (transparent bg) and feedbackCard is the subpart (having white bg) and below is the CSS for above component
.mainContent {
flex: 1;
background-color: rgba(0, 0, 0, 0.3) !important;
justify-content: center;
align-content: center;
align-items: center;
display: flex;
}
.feedbackCard {
width: 100%;
border-radius: 4px;
background-color: white;
}
And you can open Modal using below code.
const modal = await this.modalCtrl.create({FeedbackComponent, 'backTransparent', {}});
modal.present();
global.scss
.backTransparent {
--background: transparent !important;
}

How to set width in popup.css of Safari Extension in macOS?

The same width setting worked in iOS. However, in macOS, the width setting is ignore.
:root {
color-scheme: light dark;
}
body {
width: 400px;
padding: 10px;
font-family: system-ui;
text-align: center;
}
#media (prefers-color-scheme: dark) {
/* Dark Mode styles go here. */
}
I want the whole sentence showed in one line. Any idea?

ionic svg-icons - change background color

I use svg-icons in an app and the question is if it is necessary to put icons in different colors there or if I can set a color by code. Here is my approach:
app.scss:
ion-icon {
&[class*="custom-"] {
mask-size: contain;
mask-position: 50% 50%;
mask-repeat: no-repeat;
background: currentColor;
width: 1em;
height: 1em;
}
&[class*="custom-mobile"] {
background: url(../assets/mobile.svg);
}
}
view:
<ion-item>
<ion-icon name="custom-mobile"></ion-icon>
</ion-item>
I change the color of background in the class-part but no effect on view.

celltable - howto use an image as celltable background (or row background)

I need to use an image as table background (as entire row background will works).
I tried this:
.cellTableOddRow {
background-image: url(image.jpg);
background-repeat: repeat-y;
width: 300px;
}
but it puts the image in each cell.
Is this possible?
Thx a lot!
It was really simple:
The image should be in 'cellTableWidget'
.cellTableWidget {
background-image: url(../img/bgtablas.jpg);
background-repeat: repeat-y;
width: 300px;
}
and the row must to 'delete' its style:
.cellTableOddRow {
background: none;
background-image: none;
}