Results 1 to 3 of 3
Thread: JTabbedPane to display a message
- 12-13-2012, 07:32 AM #1
Member
- Join Date
- Dec 2012
- Posts
- 22
- Rep Power
- 0
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.
- 12-21-2012, 05:15 PM #2
Member
- Join Date
- Dec 2012
- Posts
- 22
- Rep Power
- 0
Re: JTabbedPane to display a message
nvm. I figured it out.
- 12-21-2012, 05:37 PM #3
Similar Threads
-
JOptionPane - Message dialog box does not display
By aibao in forum NetBeansReplies: 4Last Post: 05-15-2011, 04:47 AM -
Error message does not display
By kaga01 in forum JavaServer Faces (JSF)Replies: 1Last Post: 12-31-2010, 11:52 AM -
how to display only the error message and exit
By renu in forum New To JavaReplies: 6Last Post: 10-08-2010, 07:50 PM -
swt Display and Shell in JTabbedPane : Jintilla
By fred_from_france in forum SWT / JFaceReplies: 3Last Post: 01-13-2010, 10:11 AM -
Display Message Without Throwing Exception
By kailashchandra in forum JavaServer Faces (JSF)Replies: 0Last Post: 09-27-2008, 09:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks