setSize « Button « Java Swing Q&A





1. JButton and setSize()    coderanch.com

2. JButton & setSize    coderanch.com

Why doesn't setSize() do anything? I have a button but it takes up the size of the whole frame and I have tried using setSize() to make it smaller but it does absolutley nothing. I've read elsewhere that instead of setSize() you should use setPreferredSize or setMinimumSize() but they take (int dimension) as a parameterr and I have no idea what ...

3. Why can't JButton resize use setSize but have to use setPreferredSize    forums.oracle.com

Dear all, i have one question here. Why is it that i have to use setPreferredSize() instead of setSize() to resize a JButton? As from the API, setSize() is inherited from java.awt.Component and setPreferredSize() inherited from javax.swing..JComponent and I should be able to use any of the 2 methods. Am i correct to say that? Please help to solve my doubt. ...