Quick question regarding Java and JtabbedPane - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Thread Tools Display Modes
Old 04-01-2014, 08:15 PM   #1 (permalink)
Student & Lover of Games
XGC Forsakend's Avatar
Join Date: Aug 2012
Location: USA
Posts: 1,412
Default Quick question regarding Java and JtabbedPane

Straight out, I will say that this is indeed related to an assignment but I am not asking to code out my project. I already have coded and done what the assignment requires except creating seperate tabs for each program. Even then, I already have the code to create the tabs.

So my question is:
Where do I plop down my code or how do I assign a tab to run one thing while the other runs something else? The examples and tutorial I have only create empty tabs and it was only touched on lightly.

JTabbedPane tabbedPane = new JTabbedPane();
ImageIcon icon = createImageIcon("images/middle.gif");

Here is the tutorial code only showing how to make tabs, label them and such.

JComponent panel1 = makeTextPanel("Panel #1");
tabbedPane.addTab("Tab 1", icon, panel1,
                  "Does nothing");
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);

JComponent panel2 = makeTextPanel("Panel #2");
tabbedPane.addTab("Tab 2", icon, panel2,
                  "Does twice as much nothing");
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);

JComponent panel3 = makeTextPanel("Panel #3");
tabbedPane.addTab("Tab 3", icon, panel3,
                  "Still does nothing");
tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);

JComponent panel4 = makeTextPanel(
        "Panel #4 (has a preferred size of 410 x 50).");
panel4.setPreferredSize(new Dimension(410, 50));
tabbedPane.addTab("Tab 4", icon, panel4,
                      "Does nothing at all");
tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);
Would my code simply go before the 'tabbedPane.addTab() function or I can plop it down anywhere as long as I am making a call to that panel in general?

Am I thinking too much of it?
XGC Forsakend is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick question regarding XP Home acidbath661 Microsoft Windows and Software 4 09-10-2008 09:34 PM
Quick Question regarding Video Cards Pirate_bob7 System Upgrades 6 09-01-2008 11:59 PM
Quick Question regarding PSU sailpog System Upgrades 8 12-04-2006 12:32 PM
Quick question regarding new PSU? Thrush System Upgrades 3 05-24-2006 04:22 PM

Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 05:59 PM.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2019, vBulletin Solutions, Inc.