Nadine
2004-01-06 19:13:50 UTC
Hi there,
the following problem occurred to me:
1)
I have a scrollPane and within that a Panel with several components
(Choice, TextField, CheckBox, ...).
It all works fine, except for the fact that it puts all of the
components in one row.
I just want to have 2 components in each row...
I tried the GridLayout, as it should fill the rows from left to right
first; instead it fills the columns first.
The problem is, that the number of components that can show up is
flexible and is calculated dynamically.
Part of the code:
[...]
panel1.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20));
//panel1.setLayout(new GridLayout(2 ,4, 20, 20));
[...]
panel1.add((java.awt.Component)o[i++]);
panel1.add((java.awt.Component)o[i]);
[...]
scrollPane1.add(panel1);
scrollPane1.getVAdjustable().setUnitIncrement(1);
scrollPane1.getHAdjustable().setUnitIncrement(1);
panel4.add(scrollPane1);
scrollPane1.setBounds(250, 100, 750, 95);
pack();
2)
Is there a possiblity to color the items of a List when a specific
event takes place?
the following problem occurred to me:
1)
I have a scrollPane and within that a Panel with several components
(Choice, TextField, CheckBox, ...).
It all works fine, except for the fact that it puts all of the
components in one row.
I just want to have 2 components in each row...
I tried the GridLayout, as it should fill the rows from left to right
first; instead it fills the columns first.
The problem is, that the number of components that can show up is
flexible and is calculated dynamically.
Part of the code:
[...]
panel1.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20));
//panel1.setLayout(new GridLayout(2 ,4, 20, 20));
[...]
panel1.add((java.awt.Component)o[i++]);
panel1.add((java.awt.Component)o[i]);
[...]
scrollPane1.add(panel1);
scrollPane1.getVAdjustable().setUnitIncrement(1);
scrollPane1.getHAdjustable().setUnitIncrement(1);
panel4.add(scrollPane1);
scrollPane1.setBounds(250, 100, 750, 95);
pack();
2)
Is there a possiblity to color the items of a List when a specific
event takes place?