Warning: session_start(): open(/var/lib/php/sessions/sess_g8eljfkmr69v2fg8sq835auiti, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// ToolTip mechanism with custom Swing content.
// Note: Doesn't make a border by itself, just shows the raw component
// returned by makeContent.
sclass CustomToolTip is AutoCloseable {
JComponent target;
JWindow window;
bool debug;
MouseAdapter mouseAdapter;
swappable JComponent makeContent() { null; }
*(IF0 *makeContent) {}
// run in Swing thread
void move {
if (window == null) ret;
if (debug) print("CustomToolTip move");
var mouse = mouseLocationOnScreen();
window.setLocation(mouse.x+10, mouse.y+10);
}
// run in Swing thread
void showOrMove {
if (window != null)
ret with move();
window = new JWindow;
window.pack();
thread "Make tool tip content" {
var content = makeContent();
if (content == null) ret;
swing {
setWindowContents(window, content);
move();
window.pack();
if (isAlwaysOnTop(getWindow(target)))
window.setAlwaysOnTop(true);
showWindow(window);
}
}
}
void hide swing {
disposeWindow(window);
window = null;
}
void installOn(JComponent target) {
this.target = target;
if (target == null) ret;
addMouseAdapter(target, mouseAdapter = new MouseAdapter {
@Override public void mouseEntered aka mouseMoved(MouseEvent e) { showOrMove(); }
@Override public void mouseExited aka mousePressed(MouseEvent e) { hide(); }
});
target.setToolTipText(null);
}
public void close swing {
hide();
removeMouseAdapter(target, mouseAdapter);
target = null;
}
}