Daniel Marti wrote:1)The images+headlines are place in a panel with a JLabel + a second JPanel with a bufferedImage. I want that panel to "slide" on the x axis from width to 0. I managed to do it by rewriting paintComponent(Graphics g). Is there an easier/less mistake prone way of handling this?
Using a JScrollPane with hidden scroll bars is an option. Wrap the component in a JScrollPane with ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER and ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER. Then use getHorizontalScrollBar().setValue(...) to scroll from code.
2)This application will be running on my laptop, which i only use very sporadically at work to make fast direct queries to the server. The problem is that after some time the laptop goes into screensaver/sleep mode. I do not want to remove the screensaver or sleep mode permanently (i often forget the laptop at work...). Is there a way to block the screensaver/sleep from firing while the application is active?
A hack is to use java.awt.PointerInfo and java.awt.Robot to move the mouse a bit:
Call this using a javax.swing.Timer and your mouse will move one pixel and back regularly. That can be annoying when you're actually using your mouse, so perhaps you can build in a check to only do this if the mouse hasn't moved since the last time.