How can I use setLocation() from javax.swing.JFrame on a customized JButton? I have tried to use setLayout(null); but then the button disappears!
1
Expert's answer
2013-03-05T09:20:03-0500
1.Set both prefered size and size for JFrame 2. Set both prefered size to JPanel and jbutton you add 3. frame.setLayout(null) 4. panel.setLayout(null) panel.add(myButton) frame.add(panel)
frame.setLayout(null); panel.setLayout(null);
>I have tried to use setLayout(null); but then the button disappears! This stuff happens when some element has no size set. If the element has no size, no location or even no text SWING can easily decide to not draw it at all for better optimization, seriously, no one needs sizeless empty button
Comments
Leave a comment