I want to set a background image for my // Application route.js
var ApplicationRoute = Ember.Route.extend({
model: function() {
return Ember.RSVP.hash({
showBackground: false
});
},
setupController: function(controller, models) {
controller.setProperties(models);
},
action: {
showBackground: function(){
// This runs fine
this.controllerFor('application').set('showBackground', true);
},
hideBackground: function(){
// This runs fine
this.controllerFor('application').set('showBackground', false);
}
}
});
// Background component.js
var BackgroundImage = Ember.Component.extend({
// This never runs for some reason!?
controlImage: function(){
if( this.get('showBackground') ) {
// Open menu!
console.log('show image');
} else {
// Close menu!
console.log('hide image');
}
}.observes('showBackground')
});
// Login template.hbs
{{background-image showBackground=showBackground}}
which contains many JPannel
and JTextField
(I used JButton
), but the the components won't appear unless the mouse passes by.
I can't make a g.drawImage()
for every component because I have too many of them.
Can anyone please help or point me into the right direction?
答案 0 :(得分:2)
It sounds like either you've overridden import re
m = re.search(".*\) (.*)\[.*\] (.*)","6d) We took no [pains] to hide it .")
if m:
g = m.groups()
print g[0] + g[1]
or failed to call paint
when painting your image.
Make sure that:
super.paintComponent
of your paintComponent
JPanel
before you perform any custom paintingFor example
Also take a look at Painting in AWT and Swing and Performing Custom Painting for more details about painting in Swing