[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

need a awt tab class java 1.1

Hi,
I am looking for tab class control that I could use in my applet.

The tab control should have the basics:
such as the ability to add grids or form controls onto each tab pane.

But I also want to be able to hide and show  or disable or enable certain tabs through code.

any help would be great.

0
vbguy
Asked:
vbguy
1 Solution
 
shaveriCommented:
try the foll.code

import javax.swing.*;
import java.awt.*;
import java.applet.Applet;
/*<applet code=TabbedPanel.class width=300 height=300> </applet>*/
public class TabbedPanel extends Applet{
      public void init(){
            JFrame f=new JFrame();
            f.getContentPane().add(new Tab());
            f.setVisible(true);
            f.pack();
           
      }
}
class Tab extends JPanel {
                        String tabs[] = {"One", "Two", "Three", "Four"};
                        public JTabbedPane tabbedPane = new JTabbedPane();

                        public Tab() {
                                                setLayout (new BorderLayout());
                        for (int i=0;i<tabs.length;i++)
                          tabbedPane.addTab (tabs[i], null,
                                             createPane (tabs[i]));
                        tabbedPane.setSelectedIndex(0);
                        tabbedPane.setEnabledAt(1,false); //tag "two" is disabled
                        add (tabbedPane, BorderLayout.CENTER);
                      }
                       JPanel createPane(String s) {
                        JPanel p = new JPanel();
                        p.add(new JLabel(s));
                        return p;
                      }
                    }
0
 
heyhey_Commented:
>> "need a awt tab class java 1.1"

basically you can use CardLayout for pages and render the Tabs yourself (and track for mouse clicks ...) - I have such a component, but can't publish it ...

or you can search the web ...
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now