[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Icon for JTabbedPane

Posted on 2004-04-15
5
Medium Priority
?
1,667 Views
Last Modified: 2008-03-17
JTabbedPane tabbedPane = new JTabbedPane();
ImageIcon icon = createImageIcon("images/middle.gif");

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

The above code will display the image beside the text but is't possible to display the image above or below the text?

thanks
0
Comment
Question by:Kennywen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 10838745
Not without writing your own UI implementation.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10840790
It has to work...


Try the following sample,


import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.*;

public class TabPaneTest extends JFrame
{
      public TabPaneTest()
      {
            super();
      
            initialize();      
      }
      
      private void initialize()
      {
            JPanel panel = (JPanel)getContentPane();
            panel.setLayout(new BorderLayout());
            
            JTabbedPane pane = new JTabbedPane();
            panel.add(pane, BorderLayout.CENTER);
            
            JPanel childPanel = new JPanel();
            childPanel.setLayout(new FlowLayout());
            childPanel.add(new JTextField(10));
            childPanel.add(new JLabel("Hellow how are you?"));
            
            Icon icon = new ImageIcon("C:\\Smiley.gif");
            pane.addTab("Test Pane", icon, childPanel, "Testting of image icon on tab pane");
            
            setSize(300, 300);
            setVisible(true);
            
            setDefaultCloseOperation(EXIT_ON_CLOSE);
      }

      public static void main(String[] args)
      {
            new TabPaneTest();
      }
}


>> C:\\Smiley.gif
change this to some other image which you have


I am suspecting your "createImageIcon" method.


Regards,
Muruga
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10840798
Oops!  I misunderstood the question!

0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10840807
U can't do that way
0
 
LVL 92

Expert Comment

by:objects
ID: 10856278
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question