Re: JButton is incomplete



felix <ckpradip@xxxxxxxxx> wrote in news:2ab5cebf-5e80-476c-80f5-
4e74b9a54764@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

<snip>
I have placed a button in a gridBagLayout(1, 3).
No. You placed a button into something (perhaps a JPanel?) with a
FlowLayout.
The something was placed into a JPanel with a GridLayout (not
gridBagLayout, not even GridBagLayout).
Presumably, this JPanel was placed into something else unknown with an
unknown LayoutManager.

Words can be misleading. Code can be misleading, but usually less so. A
good example of why an SSCCE is important.

When I reduce the
size of the screen, the button is split. I do not want it to happen
this way.

I have placed the code snippet below

/* Code starts here */
JPanel p = new JPanel();
p.setLayout(new GridLayout(1,3));
The JPanel has a GridLayout

p.add(new JLabel(""));
p.add(m_titleLabel);
p.add(m_refreshPan);
Whatever m_refreshPan is, it has been added to the JPanel.

m_refreshPan.setLayout(new FlowLayout(FlowLayout.LEFT));
m_refreshPan has a FlowLayout
m_refreshPan.add(m_label);
m_refreshPan.add(m_button);
Assuming that m_button is the button (Button? JButton?) of interest, it is
in m_refreshPan which has a FlowLayout.
/* Code ends here */

--
Felix

An SSCCE would really help. So would a screen shot or other description of
the meaning of "the button is split."

I want to help, but need better to go on.

--
Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *
.


Quantcast