Fwd: Re: java.lang.NullPointerException at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1129)

2013-07-23 Thread Pavel Safrata

Forwarding to the list..
Pavel

 Original Message 
Subject: 	Re: java.lang.NullPointerException at 
com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1129)

Date:   Tue, 23 Jul 2013 15:48:20 +0300
From:   Peter Penzov peter.pen...@gmail.com
To: Pavel Safrata pavel.safr...@oracle.com



With the help of Pavel Safrata I found the problem. I have this css file 
which sets the style and the images of the toggle buttons:


#pill-left {
-fx-padding: 5;
-fx-border-image-source: url(/com/dx57dc/images/left-btn.png);
-fx-border-image-slice: 4 4 4 4 fill;
-fx-border-image-width: 4 4 4 4;
-fx-border-image-insets: 0;
-fx-border-image-repeat: stretch;
-fx-background-color: null !important;
}
#pill-left:selected { -fx-border-image-source: 
url(/com/dx57dc/images/left-btn-selected.png); }

#pill-left .label {
-fx-text-fill: #d3d3d3;
-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 
0 , -1 );

}

#pill-left:selected .label {
/* -fx-text-fill: black; */
-fx-text-fill: white;
-fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
}
#pill-center {
-fx-padding: 5;
-fx-border-image-source: url(/com/dx57dc/images/center-btn.png);
-fx-border-image-slice: 4 4 4 4 fill;
-fx-border-image-width: 4 4 4 4;
-fx-border-image-insets: 0;
-fx-border-image-repeat: stretch;
-fx-background-color: null !important;
}
#pill-center:selected { -fx-border-image-source: 
url(/com/dx57dc/images/center-btn-selected.png); }

#pill-center .label {
-fx-text-fill: #d3d3d3;
-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 
0 , -1 );

}
#pill-center:selected .label {
-fx-text-fill: black;
-fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
}
#pill-right {
-fx-padding: 5;
-fx-border-image-source: url(/com/dx57dc/images/right-btn.png);
-fx-border-image-slice: 4 4 4 4 fill;
-fx-border-image-width: 4 4 4 4;
-fx-border-image-insets: 0;
-fx-border-image-repeat: stretch;
-fx-background-color: null !important;
}
#pill-right:selected { -fx-border-image-source: 
url(/com/dx57dc/images/right-btn-selected.png); }

#pill-right .label {
-fx-text-fill: #d3d3d3;
-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 
0 , -1 );

}
#pill-right:selected .label {
-fx-text-fill: black;
-fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
}

The images are placed at the Java package: com.dx57dc.images
What is the proper way to load images from css in Java 8?


On Tue, Jul 23, 2013 at 1:51 PM, Pavel Safrata pavel.safr...@oracle.com 
mailto:pavel.safr...@oracle.com wrote:


   Hi Peter,
   it's enough to report on one place, let's discuss the issue in the
   bug. I'll put there a comment soon.
   Pavel


   On 23.7.2013 12:37, Peter Penzov wrote:

   Hi,
   I'm working on JavaFX example which uses Toggle button:

   private void initMainStage(final Stage mainStage)
 {
 // Set Main Window Label

 // Set Icon of the main stage
 Image img = new
   
Image(getClass().getResource(/com/dx57dc/images/internet-icon.png).toExternalForm());

 mainStage.getIcons().add(img);

 // Main Stage
 root = new BorderPane();
 final VBox vbox = new VBox();
 // Set Style
 String pillButtonCss =
   
DX57DC.class.getResource(/com/dx57dc/css/PillButton.css).toExternalForm();


 // Create 3 toggle buttons and a toogle group for them
 ToggleButton tb1 = new ToggleButton(Infrastructure);
 tb1.setId(pill-left);
 ToggleButton tb2 = new ToggleButton(Agents);
 tb2.setId(pill-center);
 ToggleButton tb3 = new ToggleButton(Live Performance);
 tb3.setId(pill-right);

 final ToggleGroup group = new ToggleGroup();
 tb1.setToggleGroup(group);
 tb2.setToggleGroup(group);
 tb3.setToggleGroup(group);
 // Select the first button by default
 group.selectToggle(tb1);

 // Some test data
 final Rectangle rect2 = new Rectangle(300, 300);
 rect2.setFill(Color.SILVER);
 final Rectangle rect3 = new Rectangle(300, 300);
 rect3.setFill(Color.DODGERBLUE);

 tb1.setUserData(root);
 tb2.setUserData(rect2);
 tb3.setUserData(rect3);
 final HBox hBox = new HBox();

 // Listener which changes toggle buttons content
 group.selectedToggleProperty().addListener(new
   ChangeListenerToggle()
 {
 @Override
 public void changed(ObservableValue? extends
   Toggle ov,
   Toggle

Re: java.lang.NullPointerException at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:1129)

2013-07-23 Thread Richard Bair
David Grieve is your best resource, but he's on vacation.

On Jul 23, 2013, at 9:00 AM, Peter Penzov peter.pen...@gmail.com wrote:

 Well, the only solution that I can think of is to place the images and the
 css file into one folder.
 
 
 On Tue, Jul 23, 2013 at 3:51 PM, Pavel Safrata 
 pavel.safr...@oracle.comwrote:
 
 Forwarding to the list..
 Pavel
 
 
  Original Message 
 Subject:Re: java.lang.NullPointerException at
 com.sun.javafx.sg.prism.**NGRegion.renderContent(**NGRegion.java:1129)
 Date:   Tue, 23 Jul 2013 15:48:20 +0300
 From:   Peter Penzov peter.pen...@gmail.com
 To: Pavel Safrata pavel.safr...@oracle.com
 
 
 
 With the help of Pavel Safrata I found the problem. I have this css file
 which sets the style and the images of the toggle buttons:
 
 #pill-left {
-fx-padding: 5;
-fx-border-image-source: url(/com/dx57dc/images/left-**btn.png);
-fx-border-image-slice: 4 4 4 4 fill;
-fx-border-image-width: 4 4 4 4;
-fx-border-image-insets: 0;
-fx-border-image-repeat: stretch;
-fx-background-color: null !important;
 }
 #pill-left:selected { -fx-border-image-source:
 url(/com/dx57dc/images/left-**btn-selected.png); }
 #pill-left .label {
-fx-text-fill: #d3d3d3;
-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 0 ,
 -1 );
 }
 
 #pill-left:selected .label {
/* -fx-text-fill: black; */
-fx-text-fill: white;
-fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
 }
 #pill-center {
-fx-padding: 5;
-fx-border-image-source: url(/com/dx57dc/images/**center-btn.png);
-fx-border-image-slice: 4 4 4 4 fill;
-fx-border-image-width: 4 4 4 4;
-fx-border-image-insets: 0;
-fx-border-image-repeat: stretch;
-fx-background-color: null !important;
 }
 #pill-center:selected { -fx-border-image-source: url(/com/dx57dc/images/*
 *center-btn-selected.png); }
 #pill-center .label {
-fx-text-fill: #d3d3d3;
-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 0 ,
 -1 );
 }
 #pill-center:selected .label {
-fx-text-fill: black;
-fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
 }
 #pill-right {
-fx-padding: 5;
-fx-border-image-source: url(/com/dx57dc/images/right-**btn.png);
-fx-border-image-slice: 4 4 4 4 fill;
-fx-border-image-width: 4 4 4 4;
-fx-border-image-insets: 0;
-fx-border-image-repeat: stretch;
-fx-background-color: null !important;
 }
 #pill-right:selected { -fx-border-image-source:
 url(/com/dx57dc/images/right-**btn-selected.png); }
 #pill-right .label {
-fx-text-fill: #d3d3d3;
-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.75) , 0, 0.0 , 0 ,
 -1 );
 }
 #pill-right:selected .label {
-fx-text-fill: black;
-fx-effect: dropshadow( one-pass-box , white , 0, 0.0 , 0 , 1 );
 }
 
 The images are placed at the Java package: com.dx57dc.images
 What is the proper way to load images from css in Java 8?
 
 
 On Tue, Jul 23, 2013 at 1:51 PM, Pavel Safrata 
 pavel.safr...@oracle.commailto:
 pavel.safrata@oracle.**com pavel.safr...@oracle.com wrote:
 
   Hi Peter,
   it's enough to report on one place, let's discuss the issue in the
   bug. I'll put there a comment soon.
   Pavel
 
 
   On 23.7.2013 12:37, Peter Penzov wrote:
 
   Hi,
   I'm working on JavaFX example which uses Toggle button:
 
   private void initMainStage(final Stage mainStage)
 {
 // Set Main Window Label
 
 // Set Icon of the main stage
 Image img = new
   Image(getClass().getResource(**/com/dx57dc/images/internet-**
 icon.png).toExternalForm());
 
 mainStage.getIcons().add(img);
 
 // Main Stage
 root = new BorderPane();
 final VBox vbox = new VBox();
 // Set Style
 String pillButtonCss =
   DX57DC.class.getResource(/**com/dx57dc/css/PillButton.css**
 ).toExternalForm();
 
 
 // Create 3 toggle buttons and a toogle group for them
 ToggleButton tb1 = new ToggleButton(Infrastructure)**;
 tb1.setId(pill-left);
 ToggleButton tb2 = new ToggleButton(Agents);
 tb2.setId(pill-center);
 ToggleButton tb3 = new ToggleButton(Live Performance);
 tb3.setId(pill-right);
 
 final ToggleGroup group = new ToggleGroup();
 tb1.setToggleGroup(group);
 tb2.setToggleGroup(group);
 tb3.setToggleGroup(group);
 // Select the first button by default
 group.selectToggle(tb1);
 
 // Some test data
 final Rectangle rect2 = new Rectangle(300, 300);
 rect2.setFill(Color.SILVER);
 final Rectangle rect3 = new Rectangle(300, 300);
 rect3.setFill(Color.**DODGERBLUE);
 
 tb1.setUserData(root);