> i have been trying to do this for the last two days,
> it is part of a bigger program and i cant get it
> right. so it is not that im trying to get someone to
> do it for me...im asking for help!big difference.
Did you read the link I gave? Did that answer your question? If not, post what you have so far and what's wrong with it.
yes i read it, it helped.
This is what i have so far.
public void addComponentsToPane(final Container pane) {
final JPanel compsToExperiment = new JPanel();
compsToExperiment.setLayout(experimentLayout);
experimentLayout.setAlignment(FlowLayout.TRAILING);
JPanel controls = new JPanel();
controls.setLayout(new FlowLayout());
prompt1JLabel = new JButton(prompt1);
prompt1JLabel.setActionCommand(prompt1);
prompt1JLabel.setSelected(true);
prompt2JLabel = new JButton(prompt2);
prompt2JLabel.setActionCommand(prompt2);
//Add buttons to the experiment layout
compsToExperiment.add(new JButton("Button 1"));
compsToExperiment.add(new JButton("Button 2"));
compsToExperiment.add(new JButton("Button 3"));
compsToExperiment.add(new JButton("Long-Named Button 4"));
compsToExperiment.add(new JButton("5"));
//Left to right component orientation is selected by default
compsToExperiment.setComponentOrientation(
ComponentOrientation.LEFT_TO_RIGHT);
> yes i read it, it helped.
> This is what i have so far.
>
>
> public void addComponentsToPane(final Container pane)
> {
> final JPanel compsToExperiment = new
> JPanel();
>
> ompsToExperiment.setLayout(experimentLayout);
>
> xperimentLayout.setAlignment(FlowLayout.TRAILING);
> JPanel controls = new JPanel();
> controls.setLayout(new FlowLayout());
>
> prompt1JLabel = new JButton(prompt1);
> prompt1JLabel.setActionCommand(prompt1);
> prompt1JLabel.setSelected(true);
> prompt2JLabel = new JButton(prompt2);
> prompt2JLabel.setActionCommand(prompt2);
>
> //Add buttons to the experiment layout
> compsToExperiment.add(new JButton("Button
> 1"));
> compsToExperiment.add(new JButton("Button
> 2"));
> compsToExperiment.add(new JButton("Button
> 3"));
> compsToExperiment.add(new JButton("Long-Named
> Button 4"));
>compsToExperiment.add(new JButton("5"));
> //Left to right component orientation is selected by
> default
>compsToExperiment.setComponentOrientation(
> ComponentOrientation.LEFT_TO_RIGHT);
what about :
Container c = getContentPane();
c.setLayout(new FlowLayout());
//create your Panel and add components.
(not tested but it should be good)