Results 1 to 3 of 3
  1. #1
    lanmonster is offline Member
    Join Date
    Dec 2012
    Posts
    22
    Rep Power
    0

    Default JTabbedPane to display a message

    I am making a program that displays the information I need in a tabbed window. What is the best way? What should I add after panel1.setLayout(null); to make it display the String GoBaylor?
    Java Code:
    import java.awt.*;
    import java.io.*;
    import javax.swing.*;
    
    public class Baylor extends JFrame {
    private	JTabbedPane tabbedPane;
    private	JPanel	panel1;
    private	JPanel	panel2;
    private	JPanel	panel3;
    private JPanel  panel4;
    private JPanel  panel5;
    
    public Baylor(){
    
    setTitle("Baylor Information");
    setSize(400, 300 );
    
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBackground(Color.gray);
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    getContentPane().add(topPanel);
        //GoBaylor
        String GoBaylorUsername = "blah";
        String GoBaylorPassword = "blah";
        String[] GoBaylor = {"Username: " + GoBaylorUsername, "Password: " + GoBaylorPassword};
        //Student ID
        int StudentID = 1337;
        //Housing
        int HousingConfirmationNumber = 1337;
        //Baylor Email
        String BearID = "blah";
        String Email = "blah";
        String Password = "blah";
        String[] BaylorEmail = {"BearID: " + BearID, "Email: " + Email, "Password: " + Password};
        //Bearweb
        String UserID = "1337";
        String PIN = "blah1337";
        String[] BearWeb = {"UserID: " + UserID, "PIN: " + PIN};
        
    // Create the tab pages
    createPage1();
    createPage2();
    createPage3();
    
    // Create a tabbed pane
    tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Go Baylor", panel1);
    tabbedPane.addTab("Student ID", panel2);
    tabbedPane.addTab("Housing", panel3);
    tabbedPane.addTab("Baylor Email", panel4);
    tabbedPane.addTab("BearWeb", panel5);
    topPanel.add( tabbedPane, BorderLayout.CENTER );
    }
    
    public void createPage1(){
    panel1 = new JPanel();
    panel1.setLayout(null);
    }
    public void createPage2() {
    panel2 = new JPanel();
    panel2.setLayout(null);
    }
    public void createPage3(){
    panel3 = new JPanel();
    panel3.setLayout(null);
    }
    public void createPage4(){
    panel4 = new JPanel();
    panel4.setLayout(null);
    }
    public void createPage5();
    panel5 = new JPanel();
    panel5.setLayout(null);
    }
    // Main method to get things started
    public static void main(String args[]){
    // Create an instance of the test application
    Baylor bear = new Baylor();
    bear.setVisible(true);
    }
    }
    Last edited by lanmonster; 12-13-2012 at 07:37 AM.

  2. #2
    lanmonster is offline Member
    Join Date
    Dec 2012
    Posts
    22
    Rep Power
    0

    Default Re: JTabbedPane to display a message

    nvm. I figured it out.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: JTabbedPane to display a message

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 4
    Last Post: 05-15-2011, 04:47 AM
  2. Error message does not display
    By kaga01 in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 12-31-2010, 11:52 AM
  3. how to display only the error message and exit
    By renu in forum New To Java
    Replies: 6
    Last Post: 10-08-2010, 07:50 PM
  4. swt Display and Shell in JTabbedPane : Jintilla
    By fred_from_france in forum SWT / JFace
    Replies: 3
    Last Post: 01-13-2010, 10:11 AM
  5. Display Message Without Throwing Exception
    By kailashchandra in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 09-27-2008, 09:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •