Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


santosh satnami
Tabbed in java
1 Answer(s)      3 years and 4 months ago
Posted in : Java Beginners


hello sir i want to use tabbed in my project and i want that if i clicked one tabbed then open one form and if i click another tabbed then it open another form

can plz help me

Thank you


Advertisement
View Answers

December 22, 2010 at 11:12 AM


Hello Friend,

Try the following code:

import java.awt.*;
import javax.swing.*;

class Information {
JFrame f;
JPanel p1,p2;
JTabbedPane tp;
JLabel l1, l2, l3, l4,l5,l6,l7,l8;
JTextField tf1,tf2,tf3,tf4,tf5,tf6,tf7,tf8;
JButton add1,add2 ;

Information(){
f=new JFrame("Form");
p1=new JPanel(new GridLayout(5,2));
p2=new JPanel(new GridLayout(5,2));
tp=new JTabbedPane();
l1=new JLabel("Name:");
l2=new JLabel("Address:");
l3=new JLabel("Contact No:");
l4=new JLabel("Email:");

l5=new JLabel("Highschool:");
l6=new JLabel("Intermediate:");
l7=new JLabel("Graduation:");
l8=new JLabel("Post Graduation:");
tf1=new JTextField(12);
tf2=new JTextField(12);
tf3=new JTextField(12);
tf4=new JTextField(12);
tf5=new JTextField(12);
tf6=new JTextField(12);
tf7=new JTextField(12);
tf8=new JTextField(12);
add1=new JButton(" Add ");
add2=new JButton(" Add");
p1.add(l1);
p1.add(tf1);
p1.add(l2);
p1.add(tf2);
p1.add(l3);
p1.add(tf3);
p1.add(l4);
p1.add(tf4);
p1.add(add1);

p2.add(l5);
p2.add(tf5);
p2.add(l6);
p2.add(tf6);
p2.add(l7);
p2.add(tf7);
p2.add(l8);
p2.add(tf8);
p2.add(add2);

f.getContentPane().add(tp);
tp.addTab("Personal Information",p1);
tp.addTab("Professional Information",p2);

f.setSize(350,180);
f.setVisible(true);
f.setResizable(true);
}
public static void main(String z[]){
new Information();
}
}

Thanks



Related Tutorials/Questions & Answers:
Tabbed in java
Tabbed in java  hello sir i want to use tabbed in my project and i want that if i clicked one tabbed then open one form and if i click another tabbed then it open another form can plz help me Thank you   Hi Friend
Tabbed in java
Tabbed in java  hello sir i want to use tabbed in my project and i want that if i clicked one tabbed then open one form and if i click another tabbed then it open another form can plz help me Thank you   Hello Friend
Advertisements
Set the Color of a Tab in a Tabbed Pane Container in Java
Set the Color of a Tab in a Tabbed Pane Container in Java... will learn how to set colors for a tab in a tabbed pane container in Java Swing... shows you how to set the color for each tab in the tabbed pane container
tabbed panel Helppp !!!! - Struts
tabbed panel help  i need struts tabbed panel example. Hi everybody plz ,im newbie on struts. i have to developpe a web application using struts 1.1, somebody advise me to use Tabbed Panel but i don't know how to use them
color changing - Java Beginners
in java swing  Hi Friend, Try the following code: import javax.swing....){ JFrame frame = new JFrame("Tabbed Pane Frame..., BorderLayout.CENTER); tab.add("Tab 1", new JLabel("This is Tabbed Pane 1")); tab.add
java JTabbedPane() - Java Beginners
java JTabbedPane()  how to add layout manager in JTabbedPane() plese...; private JPanel panel3; public TabbedPaneTest(){ setTitle("Tabbed Pane... createPage1(); createPage2(); createPage3(); // Create a tabbed pane
java swings - Java Beginners
java swings  Hi , I need the JFileDialog simple example using jbutton. I need to put the browse option for my tabbed pane screen. Please send the favourable example code. Thanks, Valarmathi  Hi Friend, Try
java swings - Java Beginners
java swings   Hi, I have two classes(two tabbed panes). how can i get the one class jtextfield value into another class method. Please send the code as sson as possible. Thanks, Valarmathi  Hi Friend, Try
XML and swings - Java Beginners
XML and swings  I have an xml file where all the contents that should be present in the tabbed pane are there. i would like to know how to parse the xml such that, whenever it reads the component type as label, it should create
java - Java Beginners
(); Component panel1 = makeTextPanel("Java Tutorial"); tabbedPane.addTab("One", icon... panel2 = makeTextPanel("Java, JavaScript,JSP"); tabbedPane.addTab("Two", icon, panel2, "Does twice as much nothing"); Component panel3 = makeTextPanel("Java
java - Java Beginners
two Panels(p1 and p2) and one tabbed pane(tp) in which i have added second panel(p2). on panel 1 i have one button(Go to Tabbed Pane). I want, when i will click on this button, then the tabbed pane should be added to the frame like
Jtabbedpane - Java Beginners
with the user by this button. So...;Java Example for adding abstarct JButton...(tab, BorderLayout.CENTER); JButton   Java Example for adding abstarct... = new JFrame("Tabbed Pane Frame"); frame.setDefaultCloseOperation
JAVA SWING JTabbedPane - Java Beginners
JAVA SWING JTabbedPane  Hi all, I would like to ask a question... = makeTextPanel("Java Tutorial"); tabbedPane.addTab("One", icon, panel1, "Does... = makeTextPanel("Java, JavaScript,JSP"); tabbedPane.addTab("Two", icon
java - Java Beginners
"); } } } how can i add the path from my tabbed pane textbox . I didnt get the path... the path to the tabbed pane in OperatingSystem.java file? Thanks  ...(osType); javapathname = new JLabel(" Java Path
Tomahawk pannelTabbedPane tag
to create a tabbed pane. Its has the capability of switching the tabs at client... when the element is clicked.  ondblclick : It is used for Java...; onmousedown : It is used for Java Script code to be invoked when the pointing
java - Java Beginners
regarding os information and java information for the same class using java swing tabbed panes. this is my code .please revert the mistake and send it to me... = new JScrollPane(area3); label4 = new JLabel("Java Path"); area4 = new
java
java  diff bt core java and java
java
java  what is java
java
java   why iterator in java if we for loop
java
java  explain technologies are used in java now days and structure java
java
java  different between java & core java
Java
Java   Whether Java is pure object oriented Language
JAVA
JAVA  how the name came for java language as "JAVA
java
java  is java open source
java
java  what is java reflection
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
Java Complication Error - Java Beginners
Java Complication Error  Hello there, I was assigned to do a project in java that I have to set up tabs and in each tab have something in them. Well...(); // Creates a tabbed pane jtabbedPane = new JTabbedPane
Hi ..I am Sakthi.. - Java Beginners
that is available in java and also starts with javax. package HEMAL RAJYAGURU  ... tabbedPane = new JTabbedPane(); Component panel1 = makeTextPanel("Java... = makeTextPanel("Java, JavaScript,JSP"); tabbedPane.addTab("Two", icon, panel2
java
java   What is ?static? keyword
java
java  RARP implementation using java socket
java
java  sample code for RARP using java
java
java  Does java allows multiline comments
Java
Java  how to do java in command prompt
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  Write a java code to print "ABABBABCABABBA
java
java  write a program in java to acess the email
java
java  send me java interview questions
java
java  how use java method
java
java  what are JAVA applications development tools
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  is java purely object oriented language
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java   difference between class and interface
 

 

 

DMCA.com