How to achieve the following style for Datepicker Arrow Button?
I am able to Achieve the following Style For Arrow Button.
Below Css is used for achieving the above style
.date-picker > .arrow-button > .arrow {
-fx-opacity:0;
}
.date-picker > .arrow-button {
-fx-background-image:url("/com/ispiro/ui/assets/img/datepicker.png")
-fx-background-repeat: no-repeat;
-fx-background-position: center center;
-fx-background-color:#1079D8;
}
Related
I have created a Menu on my JavaFX application. Here i want to style the RadioMenuItem component:
How i can:
Modify the Arrow to colorize the Background (Like )
Hide only the Arrow completely
// [...]
You can use CSS styles.
Background color (checked):
.radio-menu-item:checked > .left-container {
-fx-background-color: blue;
}
Arrow color:
.radio-menu-item:checked > .left-container > .radio {
-fx-background-color: blue;
}
Same color hides the arrow.
I want to style JavaFX TabPane dropdown menu. The menu, which appears when there is too much tabs to fit to screen. I have found this substructure in java documentation.
tab-header-area — StackPane
headers-region — StackPane
tab-header-background — StackPane
control-buttons-tab — StackPane
tab-down-button — Pane
arrow — StackPane
tab — Tab
tab-label — Label
tab-close-button — StackPane
tab-content-area — StackPane
But there is nothing about the dropdown menu. So is there any way to style this with css?
Too late to the party, but this might help someone. You can access the tabs menu using this code:
// Access the tabs menu itself
.tab-pane > .tab-header-area > .control-buttons-tab > .container > .tab-down-button .context-menu {
// Do something.
}
// Access menu item
.tab-pane > .tab-header-area > .control-buttons-tab > .container > .tab-down-button .context-menu .radio-menu-item {
// Do something.
}
// Access menu item's text
.tab-pane > .tab-header-area > .control-buttons-tab > .container > .tab-down-button .context-menu .radio-menu-item .label {
// Do something.
}
// Access menu item's check sign
.tab-pane > .tab-header-area > .control-buttons-tab > .container > .tab-down-button .context-menu .radio-menu-item .left-container .radio {
// Do something.
}
You can access the dropmenu with the class .context-menu in the CSS file.
For example you can change the background color of the drop-down menu using this code snippet:
.context-menu {
-fx-background-color: #d0d0d0;
}
http://jsbin.com/olecad/3/edit
I am trying to move a input button by css margin-left:50%
but the button didn't move, the background moved.
Please help to guide me how to move a input button
Remove css from the input and add css for below.
.ui-btn-left, .ui-btn-right, .ui-input-clear, .ui-btn-inline, .ui-grid-a .ui-btn, .ui-grid-b .ui-btn, .ui-grid-c .ui-btn, .ui-grid-d .ui-btn, .ui-grid-e .ui-btn, .ui-grid-solo .ui-btn {
margin-left: 20%;
margin-right: 5px;
}
in jquery.mobile.css line number 2177.
Try this CSS : add text-align:center in button3 css and remove margin-left:50% from input
#buttons_1{
background:red;
}
#buttons_2{
background:green;
}
#buttons_3{
background:blue;
text-align:center;
}
#input{
margin-top:0px;
background:red;
}
I tried to change styles in menu button. I could change menu button style but not its menu item.
No matter what i try menu item inside menu-button remains unchanged.
.menu-button {
-fx-background-color:black;
}
.menu-button .label {
-fx-background-color:black; }
Now how can i change color that is left out??
MenuButton uses Menu internally and has a similar API. In such way that MenuButton contains MenuItems list just like Menu. So I think you need to try to play with .menu, .menu-button and .menu-item CSS selectors in caspian.css. More specifically with .menu-item.
EDIT: It seems you need to change the .context-menu too, because the popped up menu of the menuButton is ContextMenu.
.menu-item .label {
-fx-text-fill: white;
}
.menu-item:focused {
-fx-background-color: darkgray;
}
.menu-item:focused .label {
-fx-text-fill: blue;
}
.context-menu {
-fx-skin: "com.sun.javafx.scene.control.skin.ContextMenuSkin";
-fx-background-color: black;
-fx-background-insets: 0, 1, 2;
-fx-background-radius: 0 6 6 6, 0 5 5 5, 0 4 4 4;
/* -fx-padding: 0.666667em 0.083333em 0.666667em 0.083333em; 8 1 8 1 */
-fx-padding: 0.333333em 0.083333em 0.666667em 0.083333em; /* 4 1 8 1 */
}
This has also been asked here and here, so I decided to write a CSS template for styling menu bars.
Using this CSS template is a very easy way to style a MenuBar, its top-level MenuButton entries, and each MenuButton's MenuItem children, i.e, "the whole menu bar".
The only thing that has to be done is to adjust four variables according to one's needs:
-fx-my-menu-color: The menu bar's default background color (i.e., when item is not hovered / selected)
-fx-my-menu-color-highlighted: An item's background color if it is hovered / selected.
-fx-my-menu-font-color: The menu bar's default font color (i.e., when item is not hovered / selected)
-fx-my-menu-font-color-highlighted: An item's font color if it is hovered / selected.
The complete CSS file is commented to explain each defined rule:
/* VARIABLE DEFINITIONS: Only these 4 variables have to be adjusted, the rest is copy-paste */
* {
-fx-my-menu-color: #263238; /* Change according to your needs */
-fx-my-menu-color-highlighted: #455a64; /* Change according to your needs */
-fx-my-menu-font-color: #FFFFFF; /* Change according to your needs */
-fx-my-menu-font-color-highlighted: #FFFFFF; /* Change according to your needs */
}
/* MENU BAR + Top-level MENU BUTTONS */
/*** The menu bar itself ***/
.menu-bar {
-fx-background-color: -fx-my-menu-color;
}
/*** Top-level menu itself (not selected / hovered) ***/
.menu-bar > .container > .menu-button {
-fx-background-color: -fx-my-menu-color;
}
/*** Top-level menu's label (not selected / hovered) ***/
.menu-bar > .container > .menu-button > .label {
-fx-text-fill: -fx-my-menu-font-color;
}
/*** Top-level menu's label (disabled) ***/
.menu-bar > .container > .menu-button > .label:disabled {
-fx-opacity: 1.0;
}
/*** Top-level menu itself (selected / hovered) ***/
.menu-bar > .container > .menu-button:hover,
.menu-bar > .container > .menu-button:focused,
.menu-bar > .container > .menu-button:showing {
-fx-background-color: -fx-my-menu-color-highlighted;
}
/*** Top-level menu's label (selected / hovered) ***/
.menu-bar > .container > .menu-button:hover > .label,
.menu-bar > .container > .menu-button:focused > .label,
.menu-bar > .container > .menu-button:showing > .label {
-fx-text-fill: -fx-my-menu-font-color-highlighted;
}
/* MENU ITEM (children of a MENU BUTTON) */
/*** The item itself (not hovered / focused) ***/
.menu-item {
-fx-background-color: -fx-my-menu-color;
}
/*** The item's label (not hovered / focused) ***/
.menu-item .label {
-fx-text-fill: -fx-my-menu-font-color;
}
/*** The item's label (disabled) ***/
.menu-item .label:disabled {
-fx-opacity: 1.0;
}
/*** The item itself (hovered / focused) ***/
.menu-item:focused, .menu-item:hovered {
-fx-background-color: -fx-my-menu-color-highlighted;
}
/*** The item's label (hovered / focused) ***/
.menu-item:focused .label, .menu-item:hovered .label {
-fx-text-fill: -fx-my-menu-font-color-highlighted;
}
/* CONTEXT MENU */
/*** The context menu that contains a menu's menu items ***/
.context-menu {
-fx-background-color: -fx-my-menu-color;
}
I'm using this html code for my buttons :
<a id="my-button" class="btn" name="my-button" href="#">
<span>Some text</span>
</a>
My button is actually composed of two images defined in CSS (i'm using sprites CSS):
.btn {
background-image: url(images/btn-left.png);
}
.btn:hover {
background-position:0 -27px;
}
.btn span {
background-image: url(images/btn-right.png);
}
.btn span:hover {
background-position:0 -27px;
}
I can put text of any size in the span. When I'm over the span, the left and the right button are modified, but when i'm just hover the a tag (a few pixels image) there is just the left button is changed, not the right...
How to change the span style when I'm hover the a tag please ?
I'm not sure why you need to have the span? Why not use one sprite image so you only need to load one image and have something like:
<a class="btn" name="my-button" href="#">
Some text
</a>
and use CSS to process the hover state.
.btn {
width: xxx;
height: xxx;
background-image: url(images/btn-left.png);
background-position:top; /* use one long image with both states for active and hover */
display:block;
}
.btn:hover {
background-position:bottom; /* moves the image down on hover to the lower part of the image */
}
I've made a little example, obviously just using color instead of image. Check it out: http://jsfiddle.net/kkj8n/
Just switch background color to image and use background-position to operate the change in position.
write like this:
.btn:hover {
background-position:0 -27px;
}
.btn:hover span{
background-position:0 -27px;
}
OR
If background position is same then write like this:
.btn:hover, .btn:hover span {
background-position:0 -27px;
}