properly the data in JFrame. I use cardLayout b/c I want to switch between cards when I press one
of the bottoms. Could you please look at my code and to tell me if you see what I have to work on.
Thank you very much for any comments.
CardLayout ca;
public void addControls( Container c )
{
ca = new CardLayout();
initConvertionPanel( c );
initMeasurementPanel( c );
}
public void initConvertionPanel(Container c )
{
JButton conversionButton1, conversionButton2, exitButton;
JLabel label;
JPanel conversionButtonPanel;
conversionTypePanel = new JPanel();
conversionButtonPanel = new JPanel();
conversionTypePanel.setLayout( ca );
conversionButtonPanel.setLayout( new GridLayout(3,2) );
conversionButton1 = new JButton("Convert English to Metric");
conversionButton2 = new JButton("Convert Metric to English");
exitButton = new JButton("Exit");
label = new JLabel("Conversion Type");
conversionButton1.addActionListener( new ConversionclickListener() );
conversionButton2.addActionListener( new ConversionclickListener() );
exitButton.addActionListener( new ConversionclickListener() );
conversionButtonPanel.add(conversionButton1);
conversionButtonPanel.add(conversionButton2);
conversionButtonPanel.add(exitButton);
conversionTypePanel.add(label, BorderLayout.NORTH);
conversionTypePanel.add(conversionButtonPanel, "Convert English to Metric" );
conversionTypePanel.add(conversionButtonPanel, "Convert Metric to English" );
conversionTypePanel.add(conversionButtonPanel, "Exit" );
conversionTypePanel.add(conversionButtonPanel, BorderLayout.CENTER);
conversionTypePanel.setBackground( Color.MAGENTA );
c.add(conversionTypePanel);
}

New Topic/Question
Reply



MultiQuote






|