show when the iconified frame is mousedin or when the iconified frame is selected?
I have a InternalFrameListener on all the frames .
I tried the InternalFrameListener and the propertyChangeListener
public static class InternalFrameListener extends InternalFrameAdapter implements Serializable {
public void internalFrameIconified(InternalFrameEvent e) {
displayMessage("Internal frame iconified", e);
final String text=e.getInternalFrame().getTitle();
e.getInternalFrame().setToolTipText(text);
final JInternalFrame source=e.getInternalFrame();
e.getInternalFrame().addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(MouseEvent e) {
//super.mouseEntered(e);
source.setToolTipText(text);
}
});
}
}
}
private static class InternalFrameClicked {
private static JPopupMenu popupMenu;
private InternalFrameClicked(MouseEvent e, String toolTipText) {
// code is not working
if (e.getButton() != MouseEvent.BUTTON1 && e.getClickCount() == 1) { // if is right-click
System.out.println(C + M + AND + " var : if (e.getButton() != MouseEvent.BUTTON1 && e.getClickCount() == 1) { : \n");
// create popup with Close menuitem
popupMenu = new JPopupMenu();
popupMenu.add(toolTipText);
// display popup near location of mouse click
popupMenu.show(e.getComponent(), e.getX(), e.getY() - 10);
}
}
}
if (propertyName.equals(JInternalFrame.IS_ICON_PROPERTY)) {
final JInternalFrame source = (JInternalFrame) propertyChangeEvent.getSource();
final String s = source.getTitle();
System.out.println(C + M + AND + s + ": final String s = source.getTitle();: \n");
source.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
//super.mouseEntered(e);
source.setToolTipText(s);
}
});
}

New Topic/Question
Reply




MultiQuote







|