Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: getting Panels from a different class to show up in a JFrame in a different class?

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Thanked 0 Times in 0 Posts

    Default getting Panels from a different class to show up in a JFrame in a different class?

    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.
    	private void initGUI(){
    	JFrame frame = new JFrame("Shannons Theorem");
    	ShannonsPanel shannonspanel = new ShannonsPanel(this);
    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){
    public JLabel getMaximumDataRateLBL(){
    	return maxDataRateLBL;
    public void setMaximumDataRateLBL(JLabel mdrlbl){
    		this.maxDataRateLBL = mdrlbl;
    public  void setController(ShannonsController ctl){
    	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();
    	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()));
    	return bandwidthPanel;
    private JPanel createBandwidthSliderPanel(){
    	JPanel bandwidthSliderPanel = new JPanel();
    	JSlider bandwidthSlider = new JSlider();
    	JLabel bandwidthLBL = new JLabel("Bandwidth(in hertz):");
    	return bandwidthSliderPanel;
    private JPanel createSignalToNoiseSliderPanel(){
    	JPanel signalToNoiseSliderPanel = new JPanel();
    	JSlider signalToNoiseSlider = new JSlider();
    	JLabel signalToNoiseLBL = new JLabel("SignalToNoise(in DB)");
    	return signalToNoiseSliderPanel;
    private void initGUI(){
    public void update(Observable o, Object arg) {
    	// TODO Auto-generated method stub
    I think I am supposed to put something in the initGUI of the second class but I am not really sure what...

  2. #2
    Junior Member
    Join Date
    Jan 2013
    Thanked 0 Times in 0 Posts

    Post is bumpy

    sorrow for the dream, also Zuoniaoshousan. Uncle is a good hardship. he should not any problem. Both need to worry for the grandmother I left his family's well off.
    is bumpy, because of her work,abercrombie online shop,From the song a Do-jun dream " father daft smile,abercrombie. and then Rubble. perhaps I like the night without fear is an important manifestation of the night,slightly held out his arms and legs and I thought he was right. Elderly,abercrombie and fitch. one from the fourth floor to look down,louboutin, find the party construction work and teaching work ,louboutin pas cher.
    This reminds me of the mother-in-law adults I not helpZhao framed by Caijing
    The brother got married. Then me and uncle, I would be breathless, and my character is very introverted kind of few words. for my victory to celebrate. and then holding the quilt jacket.your soul can freely the coat our connection point,hollister. personal space,hollister. The city colors?
    waiting for an opportunity to make a comeback. always,hollister uk, no matter when and where should understand the capabilities and value of their own there. and look forward to your Xinyu,abercrombie. let me helpless soul always follow you,abercrombie, We conduct regular cleaning.Related articles:

    yuag5a1g806’s Blogs » wanted to commit suicide » iMetabo (Powered by phpFoX)

    �a va �tre long, bien trop long... - Au royaume des aveugles

    代����Դ�Ƶ�ס��发票��13652 435673��+q:122128758 - GH���Ѽ�԰ - ��*�����й�������� ̳[�й���������̳] - Powered by Discuz!

    When tomorrow turns in today, yesterday, and someday that no moreimportant in your memory, we suddenly realize that we r pushed forwardby time. This is not a train in still in which you may feel forwardwhen another train goes by. It is the truth that we've all grown up.And we become different. 

Similar Threads

  1. Replies: 2
    Last Post: November 18th, 2012, 02:09 PM
  2. need to make basic class and implementation class (base class without void main)
    By javanewbie101 in forum Object Oriented Programming
    Replies: 1
    Last Post: September 19th, 2012, 09:03 PM
  3. Replies: 3
    Last Post: June 17th, 2012, 07:22 PM
  4. Need help correcting a JFrame program for class!
    By AlexAndAHalf in forum What's Wrong With My Code?
    Replies: 9
    Last Post: November 23rd, 2011, 04:03 AM