我编写了以下代码来处理事件,以便最小化或最大化Jinternalframe。
jif.addComponentListener(new ComponentListener() {
public void componentResized(ComponentEvent e) {
Boolean isMax = ((JInternalFrame)e.getComponent()).isMaximum();
if(isMax == false)
{
// TODO Auto-generated method stub
}
else if(isMax == true )
{
// TODO Auto-generated method stub
}
}
public void componentMoved(ComponentEvent e) {
// TODO Auto-generated method stub
}
public void componentShown(ComponentEvent e) {
// TODO Auto-generated method stub
}
public void componentHidden(ComponentEvent e) {
// TODO Auto-generated method stub
}
}
);
问题是当帧加载时会触发isMax部分。我希望只有在Jinternalframe完全加载后才会发生此事件。此外,我注意到当我最小化容器小程序时会触发此事件。
有没有解决方法呢?
答案 0 :(得分:2)
您可以使用$('.page-calendar .bodyClass tr:nth-child(1) > td.weekTitles').each(function() {
count = count + 1;
//console.log(count);
//console.log(this);
$(this).clone().prependTo( $(this).closest('table').find('tr:nth-child(2) td:nth-child(' + count + ')') );
// below variable is how I am identifying new element
var newElem = $('.page-calendar .bodyClass tr:nth-child(2) td.eventText:nth-child(' + count + ') td.weekTitles')[0];
//console.log(newElem);
$(newElem).css('background','red');
// this is where it breaks below, no replace of TD with DIV
$(newElem).each(function (){
$(this).replaceWith( $(this).html()
.replace(/<td/gi, '<div')
.replace(/<\/td>/gi, '</div>')
);
});
});
和PropertyChangeListener
:
InternalFrameListener