I know that in order to make a good screensaver, I need to ditch the title bar and the minimizing components thing.
I've tried a few things including JWindow but it's not even showing up.
What class would be good as a sort of window or GUI that wouldn't have a minimize or maximize or title bar to it and yet would still let me add a Mouse Listener to it?
I tried these things below and nothing worked.
JPanel appears to have windows too. If not, how to you get one to show up without a window? And how do you add a Mouse Listener to it?
Most screensavers will exit when you click a mouse or hit a key. (Is there a way you can make it exit if you press a key?
Like if (KEY_PRESSED == true) or something like that)
JFrame is out.
Frame is also probably out.
JSplitPane is out.
JLayeredPane seems too strange.
JApplet also a title bar, and I don't want anything that's internet run at the moment anyway.
JViewPort, whatever that is, isn't working either.
import java.awt.*; import javax.swing.*; import java.util.*; import java.io.*; public class Demo5 extends JWindow { private JButton button, button2; private JPanel p; public Demo5() { setVisible(true); button = new JButton("Button"); button2 = new JButton("Button 2"); p = new JPanel(); p.add(button); p.add(button2); setFocusable(true); add(button); setContentPane(p); } public static void main(String[] args) { Demo5 d5 = new Demo5(); d5.setVisible(true); JLayeredPane jlp = new JLayeredPane(); jlp.setVisible(true); } }