Hey, I am trying to get my panels to show up in my JFrame that's in a different class. When I run the program I get a blank frame.
I think I am supposed to put something in the initGUI of the second class but I am not really sure what...private void initGUI(){ JFrame frame = new JFrame("Shannons Theorem"); frame.setSize(350,300); ShannonsPanel shannonspanel = new ShannonsPanel(this); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.add(shannonspanel); } package network; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Observable; import java.util.Observer; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.JTextField; public class ShannonsPanel extends JPanel implements Observer { private ShannonsController controller; private ShannonsModel model; private JLabel maxDataRateLBL; public ShannonsPanel(ShannonsController ctl){ ctl.addObserver(this); initGUI(); } public JLabel getMaximumDataRateLBL(){ return maxDataRateLBL; } public void setMaximumDataRateLBL(JLabel mdrlbl){ this.maxDataRateLBL = mdrlbl; } public void setController(ShannonsController ctl){ ctl.addObserver(this); this.controller = ctl; } private JPanel createSignalToNoisePanel(){ JPanel signalToNoisePanel = new JPanel(); signalToNoisePanel.setLayout(new BoxLayout(signalToNoisePanel, BoxLayout.LINE_AXIS)); JLabel signalToNoiseLBL = new JLabel("Signal To Noise(in DB):"); final JTextField signalToNoiseTXTFLD = new JTextField(); signalToNoisePanel.add(signalToNoiseLBL); signalToNoisePanel.add(signalToNoiseTXTFLD); signalToNoiseTXTFLD.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { model.setSignalToNoise( Double.parseDouble(signalToNoiseTXTFLD.getText())); } }); return signalToNoisePanel; } private JPanel createBandwidthPanel(){ JPanel bandwidthPanel = new JPanel(); bandwidthPanel.setLayout(new BoxLayout(bandwidthPanel, BoxLayout.LINE_AXIS)); JLabel bandwidthLBL = new JLabel("Bandwidth(in hertz):"); final JTextField bandwidthTXTFLD = new JTextField(); bandwidthTXTFLD.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { model.setBandwidth( Double.parseDouble(bandwidthTXTFLD.getText())); } }); bandwidthPanel.add(bandwidthLBL); bandwidthPanel.add(bandwidthTXTFLD); return bandwidthPanel; } private JPanel createBandwidthSliderPanel(){ JPanel bandwidthSliderPanel = new JPanel(); JSlider bandwidthSlider = new JSlider(); bandwidthSlider.setValue(0); JLabel bandwidthLBL = new JLabel("Bandwidth(in hertz):"); bandwidthSliderPanel.add(bandwidthSlider); bandwidthSliderPanel.add(bandwidthLBL); bandwidthSliderPanel.setVisible(true); return bandwidthSliderPanel; } private JPanel createSignalToNoiseSliderPanel(){ JPanel signalToNoiseSliderPanel = new JPanel(); JSlider signalToNoiseSlider = new JSlider(); signalToNoiseSlider.setValue(0); JLabel signalToNoiseLBL = new JLabel("SignalToNoise(in DB)"); signalToNoiseSliderPanel.add(signalToNoiseSlider); signalToNoiseSliderPanel.add(signalToNoiseLBL); return signalToNoiseSliderPanel; } private void initGUI(){ } public void update(Observable o, Object arg) { // TODO Auto-generated method stub } }