java


“Custom” element and directory isses with CSS


How do I select a custom style for, lets say text, if the directory is in another folder? From what I understand, all I would have to do is do whatINeedToEdit.getStyle().add("my_customText"); but since the CSS file is in another folder, I have no idea how to fix this.
enter image description here
package gameName;
import gameName.Cards.OladamCard;
import javafx.application.*;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class NodeTester extends Application
{
public static void main( String[]args)
{
launch(args);
}
#Override
public void start(Stage window) throws Exception
{
OladamCard oladam = new OladamCard();
window.setTitle("Tester");
TextGenerator text = new TextGenerator(oladam.getName());
text.setSize(45);
text.embolden();
//text.dropShadowFromID(oladam.getTextFontID());
StackPane pane1 = new StackPane();
text.getText().getStyleClass().add("my_customText");
text.getText().setStyle("/res/CSS/Test.css/my_customText");
pane1.getChildren().add(text.getText());
Scene scene1 = new Scene(pane1,1000,1000);
scene1.getStylesheets().add("/res/CSS/Test.css");
window.setScene(scene1);
window.show();
}
}
CSS:
.root{
-fx-background-color:#BDBDBD;
}
.my_customText
{
text-shadow: -1px 0 #ffff00, 0 1px #ffff00, 1px 0 #ffff00, 0 -1px #ffff00;
}
EDIT: I'm trying to get an outline for the the text, but CSS is a real strugle for me :P
In this tester I'm just trying to get the text that the generator (it just makes drop shadows, inner shadows, blur effects, ect (And hopefully strokes ;P)) makes to actually interact with the CSS.
The stylesheet will be added to the scene and the rules defined in it will be applied to all the nodes in the scene. To get the rules defined for style class my_customText to be applied to the text node, you need to give the text node that style class. To do that, replace the line
text.getText().setStyle("/res/CSS/Test.css/my_customText");
with
text.getText().getStyleClass().add("my_customText");
Note that the rule you have defined will not work, as text-shadow is not a valid JavaFX CSS style property. The properties defined for each node type are listed in the JavaFX CSS documentation.

Related Links

Memory leak in native java aplication
Java - Regex error when using “\\” as a delimeter [duplicate]
Java parallelStream() with custom pool with caller work stealing?
Configuring Camel With Spring No Xml
RecyclerView ItemAnimator animation not fired when calling notifyItemInserted() in onActivityResult
Java color interpolation between 3 stops
Make Spring Security recheck Authorities/Roles for each request
Exception in thread “main” java.lang.IndexOutOfBoundsException: Index: 5, Size: 0
variable n is already defined in java [closed]
Extract public.key
Compare two resultsets and separate the matched and mismatched records in java
Using Nutch how to crawl the dynamic content of web page that are uisng ajax?
Looping to create a custom String
Not enough space for ad banner
Adding mongod “where” Clause in java
Java String comparison ALWAYS returns false

Categories

HOME
testng
hook
blogger
pypi
debugging
path-finding
include
grep
rsyslog
leon
infragistics
installshield
fingerprint
windows-10-universal
tomcat6
fancybox-3
spring-kafka
timeout
percona
dynamics-crm-online
quartz-scheduler
iolanguage
django-admin
aurigma
database-replication
lucene.net
google-pagespeed
visual-composer
nodatime
predix
amazonsellercentral
zapier
accessor
devops
captiveportal
dxf
java-7
xpages-ssjs
user-interaction
windows-error-reporting
facebook-apps
jaxb2
quote
ioio
webtest
force-layout
qwerty
neuroscience
hilbert-curve
leading-zero
graphenedb
dism
gzipstream
nand2tetris
angular-resource
dotcover
togetherjs
idisposable
boost-preprocessor
akka-cluster
visual-c++-2008
ableton-live
elements
url-masking
mikroc
mathematica-frontend
plottable.js
clang-static-analyzer
connect-by
lttng
suffix-tree
rhino-servicebus
independentsoft
xpath-1.0
vhd
xna-4.0
wso2cloud
map-projections
vstest.console.exe
remobjects
dia
markers
document-classification
typeof
contenttype
xceed-datagrid
undefined-reference
dealloc
srs
html5-notifications
pyhdf
jsctypes
dataservice
cos
eclipse-memory-analyzer
html4
clipper
coredump
floating
radcombobox
visitor-statistic
coda-slider
private-members
msdev
.net-1.0
ntvdm.exe

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App