Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
using scroll pane
oghenekaro EFEKODO
Ranch Hand
Posts: 56
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
need help in putting my program into a scroll pane or in away that when i click the next button it goes the next page.thanks in advance.
//package personalData; import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class Parent extends JPanel { //private JLabel ; private JSeparator labelseparator,personalseparator; private JLabel picLabel; private JPanel picP; private JButton browseB; private Image image; private ImageIcon passport; private JTextField surnameF,othernameF,rankF,sexF,bloodgroupF,maritalF, maidenF,children1F,children2F,dateofbirth1F,placeofbirth1F,stateoforiginF, lgaF,nationalityF,homeaddressF,contactF,telF,emailF,nextofkinF,nextofkinaddressF, qualificationF,daybox,additionalqualificationF,dateofappointmentF,typeofappointmentF, ageofentryF,dateofpresappointmentF,dateofconfirmationF,dateoflastpromotionF,presentcommandF, previouscommandF,dateoflastpostingF,postingtypeF,presentdesignationF,basictrainingF, venueF,approvedcourseF,institutionF,dateenrolledF,durationF,completiondateF,appointedF, salaryF,stepsF,basicsalaryF; String fileName,fileS; private JFileChooser fc; private File file; /*public void init() {try{ ParentGUI(); } catch(Exception e){System.err.println(e);} }*/ public Parent() { setLayout(null); JLabel logo=new JLabel(new ImageIcon("flower.gif")); logo.setBounds(10,10,200,120); add(logo); JLabel label1=new JLabel("FEDERAL REPUBLIC OF NIGERIA"); JLabel label2=new JLabel("FEDERAL ROAD SAFETY COMMISSION"); JLabel label3=new JLabel("NATIONAL HEADQUARTERS,WUSE,ABUJA"); JLabel label4=new JLabel("CMPUTER DATA FORM"); label1.setBounds(220,15,300,20); label1.setFont(new Font("SanSerif", Font.BOLD, 12)); label1.setForeground(Color.blue); label2.setBounds(210,35,300,20); label2.setFont(new Font("SanSerif", Font.BOLD, 12)); label2.setForeground(Color.blue); label3.setBounds(200,55,300,20); label3.setFont(new Font("SanSerif", Font.BOLD, 12)); label3.setForeground(Color.blue); label4.setBounds(230,70,300,20); label4.setFont(new Font("SanSerif", Font.BOLD, 12)); label4.setForeground(Color.blue); add(label1); add(label2); add(label3); add(label4); labelseparator=new JSeparator(); labelseparator.setBounds(10,140,570,20); add(labelseparator); fc=new JFileChooser(); File f1=new File("My Pictures"); fc.setCurrentDirectory(f1); /*passLab=new JLabel("Passport"); passLab.setBounds(430,10,60,20); add(passLab); */ picP=new JPanel(); picP.setLayout(new BorderLayout()); picP.setBounds(450,10,140,120); picLabel=new JLabel(); picP.add(picLabel); browseB=new JButton("Browse"); browseB.setOpaque(false); browseB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int returnVal=fc.showOpenDialog(Parent.this); if(returnVal==JFileChooser.APPROVE_OPTION) { file=fc.getSelectedFile(); fileName=""+file+""; passport=new ImageIcon(fileName); picLabel.setIcon(passport); } else{} } }); browseB.setBounds(600,100,80,25); add(browseB); picP.setBorder(new BevelBorder(BevelBorder.LOWERED)); add(picP); JLabel personaldata=new JLabel("PERSONAL DATA:"); personaldata.setFont(new Font("SanSerif",Font.BOLD,12)); personaldata.setForeground(Color.darkGray); personaldata.setBounds(10,150,200,20); add(personaldata); personalseparator=new JSeparator(); personalseparator.setBounds(10,170,100,20); add(personalseparator); JLabel surname=new JLabel("Surname:"); surname.setBounds(10,190,100,20); add(surname); surnameF=new JTextField(20); surnameF.setBounds(70,190,150,20); add(surnameF); JLabel othername=new JLabel("Other Names:"); othername.setBounds(260,190,150,20); add(othername); othernameF=new JTextField(20); othernameF.setBounds(350,190,300,20); add(othernameF); JLabel rank=new JLabel("Rank:"); rank.setBounds(10,210,50,20); add(rank); rankF=new JTextField(20); rankF.setBounds(70,210,150,20); add(rankF); JLabel sex=new JLabel("Sex:"); sex.setBounds(310,210,90,20); add(sex); sexF=new JTextField(10); sexF.setBounds(350,210,90,20); add(sexF); JLabel bloodgroup=new JLabel("Blood Group:"); bloodgroup.setBounds(450,210,150,20); add(bloodgroup); bloodgroupF=new JTextField(10); bloodgroupF.setBounds(530,210,120,20); add(bloodgroupF); JLabel marital=new JLabel("Marital Status:"); marital.setBounds(10,230,150,20); add(marital); maritalF=new JTextField(20); maritalF.setBounds(100,230,100,20); add(maritalF); JLabel maiden=new JLabel("Maiden Name:"); maiden.setBounds(260,230,100,20); add(maiden); maidenF=new JTextField(20); maidenF.setBounds(350,230,300,20); add(maidenF); JLabel m=new JLabel("M"); m.setBounds(115,250,40,20); add(m); JLabel f=new JLabel("F"); f.setBounds(145,250,40,20); add(f); JLabel children=new JLabel("No. of Children:"); children.setBounds(10,270,100,20); add(children); children1F=new JTextField(5); children1F.setBounds(100,270,40,20); add(children1F); children2F=new JTextField(5); children2F.setBounds(135,270,40,20); add(children2F); JLabel dateofbirth=new JLabel("Date of Birth:"); dateofbirth.setBounds(210,270,150,20); add(dateofbirth); dateofbirth1F=new JTextField(10); dateofbirth1F.setBounds(290,270,80,20); add(dateofbirth1F); JLabel placeofbirth=new JLabel("Place of Birth:"); placeofbirth.setBounds(410,270,150,20); add(placeofbirth); placeofbirth1F=new JTextField(30); placeofbirth1F.setBounds(500,270,150,20); add(placeofbirth1F); JLabel stateoforigin=new JLabel("State of Origin:"); stateoforigin.setBounds(10,290,100,20); add(stateoforigin); stateoforiginF=new JTextField(20); stateoforiginF.setBounds(100,290,150,20); add(stateoforiginF); JLabel lga=new JLabel("LGA:"); lga.setBounds(257,290,150,20); add(lga); lgaF=new JTextField(10); lgaF.setBounds(290,290,100,20); add(lgaF); JLabel nationality=new JLabel("Nationality:"); nationality.setBounds(425,290,100,20); add(nationality); nationalityF=new JTextField(10); nationalityF.setBounds(500,290,150,20); add(nationalityF); JLabel homeaddress=new JLabel("Permanent Home Address:"); homeaddress.setBounds(10,310,250,20); add(homeaddress); homeaddressF=new JTextField(200); homeaddressF.setBounds(170,310,480,20); add(homeaddressF); JLabel contact=new JLabel("Contact Address:"); contact.setBounds(60,330,150,20); add(contact); contactF=new JTextField(200); contactF.setBounds(170,330,480,20); add(contactF); JLabel tel=new JLabel("Tel. No:"); tel.setBounds(118,350,100,20); add(tel); telF=new JTextField(15); telF.setBounds(170,350,100,20); add(telF); JLabel email=new JLabel("E-mail:"); email.setBounds(290,350,150,20); add(email); emailF=new JTextField(20); emailF.setBounds(330,350,320,20); add(emailF); JLabel nextofkin=new JLabel("Next of Kin Name:"); nextofkin.setBounds(60,370,250,20); add(nextofkin); nextofkinF=new JTextField(200); nextofkinF.setBounds(170,370,480,20); add(nextofkinF); JLabel nextofkinaddress=new JLabel("Next of Kin Address:"); nextofkinaddress.setBounds(47,390,250,20); add(nextofkinaddress); nextofkinaddressF=new JTextField(200); nextofkinaddressF.setBounds(170,390,480,20); add(nextofkinaddressF); JLabel qualification=new JLabel("Qualification at Entry:"); qualification.setBounds(40,410,250,20); add(qualification); qualificationF=new JTextField(200); qualificationF.setBounds(170,410,250,20); add(qualificationF); JLabel date=new JLabel("Date"); date.setBounds(430,410,40,20); add(date); daybox=new JTextField(10); daybox.setBounds(460,410,190,20); add(daybox); JLabel additionalqualification=new JLabel("Additional Qualifications Acquired:"); additionalqualification.setBounds(10,430,250,20); add(additionalqualification); additionalqualificationF=new JTextField(100); additionalqualificationF.setBounds(214,430,437,20); add(additionalqualificationF); JLabel info=new JLabel("RECORD OF SERVICE:"); info.setFont(new Font("SanSerif",Font.BOLD,12)); info.setForeground(Color.darkGray); info.setBounds(10,450,200,20); add(info); JSeparator infos=new JSeparator(); infos.setBounds(10,470,120,20); add(infos); JLabel dateofappointment=new JLabel("Date of First Appointment:"); dateofappointment.setBounds(10,490,200,20); add(dateofappointment); dateofappointmentF=new JTextField(10); dateofappointmentF.setBounds(170,490,80,20); add(dateofappointmentF); JLabel typeofappointment=new JLabel("Type of Appointment:"); typeofappointment.setBounds(260,490,200,20); add(typeofappointment); typeofappointmentF=new JTextField(50); typeofappointmentF.setBounds(400,490,160,20); add(typeofappointmentF); JLabel ageofentry=new JLabel("Age of Entry:"); ageofentry.setBounds(600,490,100,20); add(ageofentry); ageofentryF=new JTextField(10); ageofentryF.setBounds(680,490,80,20); add(ageofentryF); JLabel dateofpresappointment=new JLabel("Date Pres. of Appointment:"); dateofpresappointment.setBounds(10,510,200,20); add(dateofpresappointment); dateofpresappointmentF=new JTextField(10); dateofpresappointmentF.setBounds(170,510,80,20); add(dateofpresappointmentF); JLabel dateofconfirmation=new JLabel("Date of Confirmation:"); dateofconfirmation.setBounds(260,510,200,20); add(dateofconfirmation); dateofconfirmationF=new JTextField(10); dateofconfirmationF.setBounds(400,510,80,20); add(dateofconfirmationF); JLabel dateoflastpromotion=new JLabel("Date of Last Promotion:"); dateoflastpromotion.setBounds(530,510,200,20); add(dateoflastpromotion); dateoflastpromotionF=new JTextField(20); dateoflastpromotionF.setBounds(680,510,80,20); add(dateoflastpromotionF); JLabel presentcommand=new JLabel("Present Command/Dept:"); presentcommand.setBounds(10,530,200,20); add(presentcommand); presentcommandF=new JTextField(20); presentcommandF.setBounds(170,530,190,20); add(presentcommandF); JLabel previouscommand=new JLabel("Immediate Previous Command/Dept:"); previouscommand.setBounds(400,530,250,20); add(previouscommand); previouscommandF=new JTextField(20); previouscommandF.setBounds(610,530,150,20); add(previouscommandF); JLabel dateoflastposting=new JLabel("Date of Last Posting:"); dateoflastposting.setBounds(10,550,200,20); add(dateoflastposting); dateoflastpostingF=new JTextField(20); dateoflastpostingF.setBounds(170,550,100,20); add(dateoflastpostingF); JLabel postingtype=new JLabel("Posting Type:"); postingtype.setBounds(300,550,100,20); add(postingtype); postingtypeF=new JTextField(20); postingtypeF.setBounds(400,550,100,20); add(postingtypeF); JLabel presentdesignation=new JLabel("Present Designation:"); presentdesignation.setBounds(530,550,200,20); add(presentdesignation); presentdesignationF=new JTextField(20); presentdesignationF.setBounds(660,550,100,20); add(presentdesignationF); JLabel basictraining=new JLabel("Year of FRSC Basic Training:"); basictraining.setBounds(10,570,570,20); add(basictraining); basictrainingF=new JTextField(20); basictrainingF.setBounds(180,570,120,20); add(basictrainingF); JLabel venue=new JLabel("Venue:"); venue.setBounds(450,570,80,20); add(venue); venueF=new JTextField(20); venueF.setBounds(510,570,250,20); add(venueF); JLabel approvedcourse=new JLabel("Approved Course of Study (if on course):"); approvedcourse.setBounds(50,590,300,20); add(approvedcourse); approvedcourseF=new JTextField(20); approvedcourseF.setBounds(290,590,350,20); add(approvedcourseF); JLabel institution=new JLabel("Institution:"); institution.setBounds(50,610,80,20); add(institution); institutionF=new JTextField(20); institutionF.setBounds(120,610,150,20); add(institutionF); JLabel dateenrolled=new JLabel("Date Enrolled:"); dateenrolled.setBounds(320,610,80,20); add(dateenrolled); dateenrolledF=new JTextField(20); dateenrolledF.setBounds(430,610,150,20); add(dateenrolledF); JLabel duration=new JLabel("duration of Study:"); duration.setBounds(50,630,100,20); add(duration); durationF=new JTextField(20); durationF.setBounds(160,630,150,20); add(durationF); JLabel completiondate=new JLabel("Completion Date:"); completiondate.setBounds(320,630,100,20); add(completiondate); completiondateF=new JTextField(20); completiondateF.setBounds(430,630,150,20); add(completiondateF); JLabel profession=new JLabel("PROFESSION:"); profession.setFont(new Font("SanSerif",Font.BOLD,12)); profession.setForeground(Color.darkGray); profession.setBounds(10,650,200,20); add(profession); JSeparator infos1=new JSeparator(); infos1.setBounds(10,670,80,20); add(infos1); JLabel appointed=new JLabel("Appointed As:"); appointed.setBounds(10,690,100,20); add(appointed); appointedF=new JTextField(20); appointedF.setBounds(120,690,150,20); add(appointedF); JLabel remuneration=new JLabel("REMUNERATION:"); remuneration.setFont(new Font("SanSerif",Font.BOLD,12)); remuneration.setForeground(Color.darkGray); remuneration.setBounds(10,710,100,20); add(remuneration); JSeparator ren=new JSeparator(); ren.setBounds(10,710,100,20); add(ren); JLabel salary=new JLabel("Salary Happss:"); salary.setBounds(10,730,100,20); add(salary); salaryF=new JTextField(20); salaryF.setBounds(110,730,50,20); add(salaryF); JLabel steps=new JLabel("Steps:"); steps.setBounds(170,730,50,20); add(steps); stepsF=new JTextField(20); stepsF.setBounds(220,730,50,20); add(stepsF); JLabel basicsalary=new JLabel("Basic Salary:"); basicsalary.setBounds(270,730,100,20); add(basicsalary); basicsalaryF=new JTextField(20); basicsalaryF.setBounds(370,730,50,20); add(basicsalaryF); } public static void main(String k[]) { Parent p=new Parent(); //Container c=f.getContentPane(); JFrame f=new JFrame(); Container c=f.getContentPane(); f.setSize(700,700); c.add(p); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); //f.setTitle("") } }
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to open a file using Java
ActionListener problem
MY LOTTERY CLASS
TEXTFIELDS TO INT
Problem with JSplitPane and JFrame
More...