Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 1 of 2 12 LastLast
Results 1 to 25 of 29

Thread: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wednesday

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post I cant get my java to run LOGICAL Error PLs help me urgent need submint on wednesday

    i have attached my files pls help me urgent PLS!!!!!!!!!!

    this are the likns

    libry.java=http://www.mediafire.com/?e2gvdbye8zmopt1

    libryGUI.java=http://www.mediafire.com/?39se210w06hireh


    pls help


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    Please post your code here on the forum. Explain what the problem with the code is, show its output and describe what is wrong with it and what you would like it to be changed to.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    public class libryGUI extends JFrame implements ActionListener
    {
    private JTabbedPane body;

    private JPanel pUsername = new JPanel();
    private JPanel pEnter = new JPanel();
    private JPanel pDisplay = new JPanel();
    private JPanel pSearch = new JPanel();
    private JPanel pMiddle = new JPanel();
    private int counter = 0;
    private int counter2 = 2;
    private JLabel lbltitle3,lbltitle4;//lblusername,//lblpassword
    private JLabel lbltitle,lblbookid,lblbookname,lblamountofbook,lbl typeofbook,lblbookarriveddate,lblprice;
    private JLabel lbltitle1,lblbookid1,lblbookname1,lblamountofbook1 ,lbltypeofbook1,lblbookarriveddate1,lblprice1;
    private JLabel lbltitle2,lblbookid2,lblbookname2,lblamountofbook2 ,lbltypeofbook2,lblbookarriveddate2,lblprice2;
    private JLabel lblbookid21,lblbookname21,lblamountofbook21,lbltyp eofbook21,lblbookarriveddate21,lblprice21;
    private JLabel lblbookid211,lblbookname211,lblamountofbook211,lbl typeofbook211,lblbookarriveddate211,lblprice211;
    private JLabel lblblank1,lblblank2,lblblank3,lblblank,lblblank4,l blblank5,lblblank6,lblblank7,lblblank8,lblblank9,l blblank10,lblblank11,lblblank12,lblblank13;
    private JTextField txtid,txtname,txtprice,txtusername,txtpassword,txt amountofbook,txtbookarriveddate,txtid2,txttypeofbo ok;
    private JButton btnRest, btnSave, btnNext,btnPrevious,btnSearch,btnDisplay,btnEnter, btnSearch1,btnEnter1,btnExit,btnReturn;
    String choice;
    char []TempGra=new char[5];
    private boolean flag,flag2=false,flag3=false;
    libry[] libryRec;
    public libryGUI()
    {
    super("Library Record");
    body = new JTabbedPane();
    Font customFont=new Font("Freestyle Script",Font.PLAIN,20);
    Font customFont2=new Font("Arial",Font.BOLD,12);
    Color customBlue=new Color(50,150,255);
    Color customRed=new Color(255,150,150);
    Color customYellow=new Color(255,200,100);
    Color customGray=new Color(230,230,230);

    //////////LABLE pEntry/////////////

    lbltitle=new JLabel("LIBRARY STUDENT RECORD");
    lblbookid=new JLabel(counter+1+".Book ID");
    lblamountofbook=new JLabel("Amount Of Books");
    lbltypeofbook=new JLabel("Type Of Book");
    lblbookarriveddate=new JLabel("Book Arrived Date");
    lblprice=new JLabel("Price");

    //////////LABLE pSearch/////////////

    lbltitle1=new JLabel("LIBRARY SEARCH RECORD");
    lblbookid1=new JLabel("Book ID");
    lblamountofbook1=new JLabel("Amount Of Books");
    lbltypeofbook1=new JLabel("Type Of Book");
    lblbookarriveddate1=new JLabel("Book Arrived Date");
    lblprice1=new JLabel("Price");

    //////////LABLE pDisplay/////////////

    lbltitle2=new JLabel("LIBRARY DISPLAY RECORD");
    lblbookid2=new JLabel(counter2+1+".Book ID");
    lblamountofbook2=new JLabel("Amount Of Books");
    lbltypeofbook2=new JLabel("Type Of Book");
    lblbookarriveddate2=new JLabel("Book Arrived Date");
    lblprice2=new JLabel("Price");

    lblbookid21=new JLabel();
    lblamountofbook21=new JLabel();
    lbltypeofbook21=new JLabel();
    lblbookarriveddate21=new JLabel();
    lblprice21=new JLabel();

    lblbookid211=new JLabel();
    lblamountofbook21=new JLabel();
    lbltypeofbook211=new JLabel();
    lblbookarriveddate211=new JLabel();
    lblprice211=new JLabel();

    //////////LABLE pUsername/////////////

    lbltitle3=new JLabel("Welcome TO Libray Record");
    lbltitle4=new JLabel("Please Choose An Option");
    //lblusername=new JLabel("User Name");
    //lblpassword=new JLabel("Password");

    //////////LABLE BLANK/////////////

    lblblank1=new JLabel();
    lblblank2=new JLabel();
    lblblank3=new JLabel();
    lblblank=new JLabel();
    lblblank4=new JLabel();
    lblblank5=new JLabel();
    lblblank6=new JLabel();
    lblblank7=new JLabel();
    lblblank8=new JLabel();
    lblblank9=new JLabel();
    lblblank10=new JLabel();
    lblblank10=new JLabel();
    lblblank12=new JLabel();
    lblblank13=new JLabel();

    //////////TEXT FIELD/////////////

    txtid=new JTextField("",10);
    txtname=new JTextField("",20);
    txtprice=new JTextField("",10);
    //txtusername=new JTextField("",15);
    //txtpassword=new JTextField("",15);
    txtamountofbook=new JTextField("",10);
    txtbookarriveddate=new JTextField("",10);
    txtid2=new JTextField("",10);

    //////////BUTTON/////////////

    btnRest=new JButton("RESET");
    btnRest.setFont(customFont2);
    btnRest.setBackground(customBlue);
    btnRest.setForeground(Color.white);
    btnRest.addActionListener(this);
    btnRest.setEnabled(true);

    btnSave=new JButton("SAVE");
    btnSave.setFont(customFont2);
    btnSave.setBackground(customBlue);
    btnSave.setForeground(Color.white);
    btnSave.addActionListener(this);
    btnSave.setEnabled(true);

    btnNext=new JButton("NEXT");
    btnNext.setFont(customFont2);
    btnNext.setBackground(customBlue);
    btnNext.setForeground(Color.white);
    btnNext.addActionListener(this);
    btnNext.setEnabled(false);

    btnPrevious=new JButton("PREVIOUS");
    btnPrevious.setFont(customFont2);
    btnPrevious.setBackground(customBlue);
    btnPrevious.setForeground(Color.white);
    btnPrevious.addActionListener(this);
    btnPrevious.setEnabled(false);

    btnSearch=new JButton("SEARCH");
    btnSearch.setFont(customFont2);
    btnSearch.setBackground(customBlue);
    btnSearch.setForeground(Color.white);
    btnSearch.addActionListener(this);
    btnSearch.setEnabled(true);

    /* btnEnter=new JButton("Enter");
    btnEnter.setFont(customFont2);
    btnEnter.setBackground(customBlue);
    btnEnter.setForeground(Color.white);
    btnEnter.addActionListener(this);
    btnEnter.setEnabled(true);
    */

    btnDisplay=new JButton("Display record");
    btnDisplay.setFont(customFont2);
    btnDisplay.setBackground(customBlue);
    btnDisplay.setForeground(Color.white);
    btnDisplay.addActionListener(this);
    btnDisplay.setEnabled(false);

    btnSearch1=new JButton("Search record");
    btnSearch1.setFont(customFont2);
    btnSearch1.setBackground(customBlue);
    btnSearch1.setForeground(Color.white);
    btnSearch1.addActionListener(this);
    btnSearch1.setEnabled(true);

    btnEnter1=new JButton("Enter record");
    btnEnter1.setFont(customFont2);
    btnEnter1.setBackground(customBlue);
    btnEnter1.setForeground(Color.white);
    btnEnter1.addActionListener(this);
    btnEnter1.setEnabled(true);

    btnExit=new JButton("Exit");
    btnExit.setFont(customFont2);
    btnExit.setBackground(customBlue);
    btnExit.setForeground(Color.white);
    btnExit.addActionListener(this);
    btnExit.setEnabled(true);

    btnReturn=new JButton("Return");
    btnReturn.setFont(customFont2);
    btnReturn.setBackground(customBlue);
    btnReturn.setForeground(Color.white);
    btnReturn.addActionListener(this);
    btnReturn.setEnabled(true);

    ////////// LIBRY REC /////////////

    String input = JOptionPane.showInputDialog("Enter Number of Items in the arry");
    int num = Integer.parseInt(input);
    libryRec = new libry[num];
    for (int j=0;j<libryRec.length;j++)
    libryRec[j]=new libry();

    ////////// PANNAL 1 /////////////

    /*pUsername.setLayout(new GridLayout(7,2,0,2));
    lbltitle3.setBackground(customBlue);
    lbltitle3.setForeground(Color.black);
    lbltitle3.setFont(customFont);
    lblblank.setBackground(customBlue);
    lblblank1.setBackground(customBlue);
    pUsername.add(lbltitle3);
    pUsername.add(lblblank);
    pUsername.add(lblusername);
    pUsername.add(txtusername);
    pUsername.add(lblpassword);
    pUsername.add(txtpassword);
    pUsername.add(lblblank1);
    pUsername.add(btnEnter);
    */

    ////////// PANNAL 2 /////////////

    /* pMiddle.setLayout(new GridLayout(5,0,0,0));
    lbltitle4.setBackground(customBlue);
    lbltitle4.setForeground(Color.black);
    lbltitle4.setFont(customFont);
    lblblank4.setBackground(customBlue);
    lblblank5.setBackground(customBlue);
    pMiddle.add(lbltitle4);
    pMiddle.add(lblblank4);
    pMiddle.add(btnEnter1);
    pMiddle.add(btnSearch1);
    pMiddle.add(btnDisplay);
    pMiddle.add(lblblank5);
    */
    ////////// PANNAL 3 /////////////

    pEnter.setLayout(new GridLayout(13,2,0,2));
    lbltitle.setBackground(customBlue);
    lbltitle.setForeground(Color.black);
    lbltitle.setFont(customFont);
    lblblank2.setBackground(customBlue);
    lblblank3.setBackground(customBlue);
    pEnter.add(lbltitle);
    pEnter.add(lblblank2);
    pEnter.add(lblbookid);
    pEnter.add(txtid);
    pEnter.add(lblamountofbook);
    pEnter.add(txtamountofbook);
    pEnter.add(lbltypeofbook);
    pEnter.add(txtname);
    pEnter.add(lblbookarriveddate);
    pEnter.add(txtbookarriveddate);
    pEnter.add(lblprice);
    pEnter.add(txtprice);
    pEnter.add(btnNext);
    pEnter.add(btnReturn);


    ////////// PANNAL 3 /////////////

    pDisplay.setLayout(new GridLayout(13,2,0,2));
    lbltitle2.setBackground(customBlue);
    lbltitle2.setForeground(Color.black);
    lbltitle2.setFont(customFont);
    lblblank6.setBackground(customBlue);
    lblblank7.setBackground(customBlue);
    lblblank8.setBackground(customBlue);
    pDisplay.add(lbltitle2);
    pDisplay.add(lblblank6);
    pDisplay.add(lblbookid2);
    pDisplay.add(lblbookid21);
    pDisplay.add(lblamountofbook2);
    pDisplay.add(lblamountofbook21);
    pDisplay.add(lbltypeofbook2);
    pDisplay.add(lbltypeofbook21);
    pDisplay.add(lblbookarriveddate2);
    pDisplay.add(lblbookarriveddate21);
    pDisplay.add(lblprice2);
    pDisplay.add(lblprice21);
    pDisplay.add(lblblank8);
    pDisplay.add(btnNext);
    pDisplay.add(btnPrevious);
    pDisplay.add(btnExit);
    pDisplay.add(btnReturn);

    ////////// PANNAL 4 /////////////

    pSearch.setLayout(new GridLayout(15,2,0,2));
    lbltitle1.setBackground(customBlue);
    lbltitle1.setForeground(Color.black);
    lblblank9.setBackground(customBlue);
    lblblank10.setBackground(customBlue);
    lblblank11.setBackground(customBlue);
    pSearch.add(lbltitle1);
    pSearch.add(lblblank9);
    pSearch.add(lblbookid1);
    pSearch.add(txtid2);
    pSearch.add(btnSearch);
    pSearch.add(lblblank10);
    pSearch.add(lblamountofbook1);
    pSearch.add(lblamountofbook211);
    pSearch.add(lbltypeofbook1);
    pSearch.add(lbltypeofbook211);
    pSearch.add(lblbookarriveddate1);
    pSearch.add(lblbookarriveddate211);
    pSearch.add(lblprice1);
    pSearch.add(lblprice211);
    pSearch.add(lblblank11);
    pSearch.add(btnRest);
    pSearch.add(btnReturn);
    body.addTab("LOGIN",null,pUsername,"Login Page");
    body.addTab("ENTER",null,pEnter,"Enter Page");
    body.addTab("DISPLAY",null,pDisplay,"Display Page");
    body.addTab("SEARCH",null,pSearch,"Login Page");
    body.setBackgroundAt(0,customBlue);
    body.setBackgroundAt(1,customRed);
    body.setBackgroundAt(2,customYellow);
    body.setBackground(customGray);
    add(body);
    setSize(580,430);
    setVisible(true);
    }

    public static void main (String args[])throws AWTException
    {
    libryGUI adm = new libryGUI();

    adm.addWindowListener(new WindowAdapter()
    {
    public void windowClosing( WindowEvent e)
    {
    System.exit(0);
    }
    }

    );
    }

    public void actionPerformed(ActionEvent ae)
    {
    if(ae.getSource()==btnRest)
    Reset();
    if (ae.getSource()==btnSave)
    {
    if(flag==false)
    {
    Validate();
    }
    if(flag==true)
    {
    Save();
    Reset();
    if (counter==0)
    btnNext.setEnabled(false);
    else if (flag3 == true);
    btnNext.setEnabled(true);
    counter++;
    if(counter==1){

    btnDisplay.setEnabled(true);
    btnSearch.setEnabled(true);
    }

    lblbookid.setText(counter+1+".Book ID");
    if(counter >=libryRec.length)
    {
    counter = 0;
    lblbookid.setText(counter+1+".Book ID");
    }
    flag =false;
    }
    }
    if (ae.getSource()==btnDisplay)
    {
    Display();
    flag3 = true;
    btnDisplay.setEnabled(false);
    if(counter == 1)
    btnNext.setEnabled(false);
    if(counter !=1)
    btnNext.setEnabled(true);
    }
    if (ae.getSource()==btnNext)
    {
    counter2++;
    if(counter2==(counter-1))
    {
    btnNext.setEnabled(false);
    }
    else
    btnNext.setEnabled(true);
    if(counter2 == 4)
    btnNext.setEnabled(false);
    btnPrevious.setEnabled(true);
    lblbookid2.setText(counter2+1+".Book ID");
    Display();
    }
    if(ae.getSource()==btnPrevious)
    {
    counter2--;
    if(counter2==0)
    btnPrevious.setEnabled(false);
    else
    btnPrevious.setEnabled(true);
    btnNext.setEnabled(true);
    lblbookid2.setText(counter2+1+".Book ID");
    Display();
    }
    if(ae.getSource()==btnSearch)
    {
    Validate2();
    Search();
    }
    }//end Action Performed
    public void Reset()
    {
    txtid.setText("");
    txtid2.setText("");
    txtname.setText("");
    txtprice.setText("");
    //txtusername.setText("");
    //txtpassword.setText("");
    txtamountofbook.setText("");
    txtbookarriveddate.setText("");
    txttypeofbook.setText("");

    }//end of rest

    public void Save()
    {
    String name,username,password,id,tob,temp,temp2,temp3,tem p4;
    int aob,bad;
    double price;

    id=txtid.getText();
    libryRec[counter].setBkid(id);
    name = txtname.getText();
    libryRec[counter].setBknm(name);
    temp2 = txtprice.getText();
    price=Double.parseDouble(temp2);
    libryRec[counter].setPrice(price);
    //username = txtusername.getText();
    //libryRec[counter].setUsername(username);
    //password = txtpassword.getText();
    //libryRec[counter].setPassword(password);
    temp = txtamountofbook.getText();
    aob=Integer.parseInt(temp);
    libryRec[counter].setAmtbk(aob);
    temp4 = txtbookarriveddate.getText();
    bad=Integer.parseInt(temp4);
    libryRec[counter].setArrdate(bad);
    tob = txttypeofbook.getText();
    libryRec[counter].setTypbk(tob);

    }// end of save

    public void Display()
    {
    int temp1;
    String temp2,temp4;
    double temp3;

    lblbookid2.setText(libryRec[counter2].getBkid());
    lblbookname2.setText(libryRec[counter2].getBknm());
    temp1=libryRec[counter2].getAmtbk();
    temp2=Integer.toString(temp1);
    lblamountofbook1.setText(temp2);
    lbltypeofbook2.setText(libryRec[counter2].getTypbk());
    temp1=libryRec[counter2].getArrdate();
    temp2=Integer.toString(temp1);
    lblbookarriveddate2.setText (temp2);
    temp3=libryRec[counter2].getPrice();
    temp4=Double.toString(temp1);
    lblprice2.setText(temp2);
    }
    public void Search()
    {
    String str,temp2;
    int count=0,temp1;
    double temp3;
    flag2=true;
    String[] idArray = new String[libryRec.length];
    str=txtid2.getText();
    for(int k=0;k<libryRec.length;k++)
    {
    idArray[k]=libryRec[k].getBkid();
    if(idArray[k].equals(str))
    {
    flag=true;
    lblbookid211.setText(libryRec[k].getBkid());
    lblbookname211.setText(libryRec[k].getBknm());
    temp1=libryRec[k].getAmtbk();
    temp2=Integer.toString(temp1);
    lblamountofbook211.setText(temp2);
    lbltypeofbook211.setText(libryRec[k].getTypbk());
    temp1=libryRec[k].getArrdate();
    temp2=Integer.toString(temp1);
    lblbookarriveddate211.setText(temp2);
    temp3=libryRec[k].getPrice();
    temp2=Double.toString(temp1);
    lblprice211.setText(temp2);
    break;

    }
    else if(!(idArray[k].equals(str)))
    flag2=false;
    }
    if(flag2==false)
    JOptionPane.showMessageDialog(this,"Record Not Found");
    }//End of search

    public void Validate() throws ArithmeticException
    {
    flag=false;

    if(txtid.getText().equals("")||txtname.getText().e quals("")||txtprice.getText().equals("")||txtusern ame.getText().equals("")
    ||txtpassword.getText().equals("")||txtamountofboo k.getText().equals("")||txtbookarriveddate.getText ().equals("")||
    txttypeofbook.getText().equals(""))
    {
    JOptionPane.showMessageDialog(this,"Please Fill In The Blanks:");
    }
    else if(!txtname.getText().matches("([a-zA-Z]+|[a-zA-Z]+\\s[a-zA-Z]+)*"))
    {
    JOptionPane.showMessageDialog(this,"Invalid Name.");
    txtname.requestFocus();
    }
    else if(!txtusername.getText().matches("([a-zA-Z]+|[a-zA-Z]+\\s[a-zA-Z]+)*"))
    {
    JOptionPane.showMessageDialog(this,"Invalid Username.");
    txtusername.requestFocus();
    }


    }//end fo validate 1

    public void Validate2()
    {
    if(txtid2.getText().equals(""))
    {
    JOptionPane.showMessageDialog(this,"Please enter Search ID");
    txtid2.requestFocus();
    }
    else if(txtid2.getText().matches("\\d{8}"))
    {
    JOptionPane.showMessageDialog(this,"Invalid ID Format.");
    txtid2.requestFocus();
    }
    }//Validte 2

    }








    Error:

    --------------------Configuration: <Default>--------------------
    Exception in thread "main" java.lang.NullPointerException
    at libryGUI.<init>(libryGUI.java:292)
    at libryGUI.main(libryGUI.java:325)

    Process completed.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    Look at line 292 and see what variable used on that line has a null value. Then backtrack in the code to see why that variable does not have a valid value.

    Please Edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    bro thx for the help man relay now it can work my silly mistake but 1 mroe help pls i cant use my save button man so sad why? it dosnt save my records and the counter is still at 1 pls help urgent PLS!!!!!!!!!!



    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    public class libryGUI extends JFrame implements ActionListener
    {
    	private JTabbedPane body;
     
    	private JPanel pUsername = new JPanel();
    	private JPanel pEnter = new JPanel();
    	private JPanel pDisplay = new JPanel();
    	private JPanel pSearch = new JPanel();
    	private JPanel pMiddle = new JPanel();
    	private int counter = 0;
    	private int counter2 = 2;
    	private JLabel lbltitle3,lbltitle4;//lblusername,//lblpassword
    	private JLabel lbltitle,lblbookid,lblbookname,lblamountofbook,lbltypeofbook,lblbookarriveddate,lblprice;
    	private JLabel lbltitle1,lblbookid1,lblbookname1,lblamountofbook1,lbltypeofbook1,lblbookarriveddate1,lblprice1;
    	private JLabel lbltitle2,lblbookid2,lblbookname2,lblamountofbook2,lbltypeofbook2,lblbookarriveddate2,lblprice2;
    	private JLabel lblbookid21,lblbookname21,lblamountofbook21,lbltypeofbook21,lblbookarriveddate21,lblprice21;
    	private JLabel lblbookid211,lblbookname211,lblamountofbook211,lbltypeofbook211,lblbookarriveddate211,lblprice211;
    	private JLabel lblblank1,lblblank2,lblblank3,lblblank,lblblank4,lblblank5,lblblank6,lblblank7,lblblank8,lblblank9,lblblank10,lblblank11,lblblank12,lblblank13,lblblank14;
    	private JTextField txtid,txtname,txtprice,txtusername,txtpassword,txtamountofbook,txtbookarriveddate,txtid2,txttypeofbook;
    	private JButton btnRest, btnSave, btnNext,btnPrevious,btnSearch,btnDisplay,btnEnter,btnSearch1,btnEnter1,btnExit,btnReturn;
    	String choice;
    	char []TempGra=new char[5];
    	private boolean flag,flag2=false,flag3=false;
    	libry[] libryRec;
    	public libryGUI()
    	{
    		super("Library Record");
    		body = new JTabbedPane();
    		Font customFont=new Font("Freestyle Script",Font.PLAIN,20);
    		Font customFont2=new Font("Arial",Font.BOLD,12);
    		Color customBlue=new Color(50,150,255);
    		Color customRed=new Color(255,150,150);
    		Color customYellow=new Color(255,200,100);
    		Color customGray=new Color(230,230,230);
     
    		//////////LABLE pEntry/////////////
     
    		lbltitle=new JLabel("LIBRARY STUDENT RECORD");
    		lblbookid=new JLabel(counter+1+".Book ID");
    		lblamountofbook=new JLabel("Amount Of Books");
    		lbltypeofbook=new JLabel("Type Of Book");
    		lblbookarriveddate=new JLabel("Book Arrived Date");
    		lblprice=new JLabel("Price");
     
    			//////////LABLE pSearch/////////////
     
    		lbltitle1=new JLabel("LIBRARY SEARCH RECORD");
    		lblbookid1=new JLabel("Book ID");
    		lblamountofbook1=new JLabel("Amount Of Books");
    		lbltypeofbook1=new JLabel("Type Of Book");
    		lblbookarriveddate1=new JLabel("Book Arrived Date");
    	    lblprice1=new JLabel("Price");
     
    	    	//////////LABLE pDisplay/////////////
     
    		lbltitle2=new JLabel("LIBRARY DISPLAY RECORD");
    		lblbookid2=new JLabel(counter2+1+".Book ID");
    		lblamountofbook2=new JLabel("Amount Of Books");
    		lbltypeofbook2=new JLabel("Type Of Book");
    		lblbookarriveddate2=new JLabel("Book Arrived Date");
    		lblprice2=new JLabel("Price");
     
    		lblbookid21=new JLabel();
    		lblamountofbook21=new JLabel();
    		lbltypeofbook21=new JLabel();
    		lblbookarriveddate21=new JLabel();
    		lblprice21=new JLabel();
     
    		lblbookid211=new JLabel();
    		lblamountofbook211=new JLabel();
    		lbltypeofbook211=new JLabel();
    		lblbookarriveddate211=new JLabel();
    		lblprice211=new JLabel();
     
    			//////////LABLE pUsername/////////////
     
    		lbltitle3=new JLabel("Welcome TO Libray Record");
    		lbltitle4=new JLabel("Please Choose An Option");
    		//lblusername=new JLabel("User Name");
    		//lblpassword=new JLabel("Password");
     
    			//////////LABLE BLANK/////////////
     
    		lblblank1=new JLabel();
    		lblblank2=new JLabel();
    		lblblank3=new JLabel();
    		lblblank=new JLabel();
    		lblblank4=new JLabel();
    		lblblank5=new JLabel();
    		lblblank6=new JLabel();
    		lblblank7=new JLabel();
    		lblblank8=new JLabel();
    		lblblank9=new JLabel();
    		lblblank11=new JLabel();
    		lblblank10=new JLabel();
    		lblblank12=new JLabel();
    		lblblank13=new JLabel();
    		lblblank14=new JLabel();
     
    		//////////TEXT FIELD/////////////
     
    		txtid=new JTextField("",10);
    		txtname=new JTextField("",20);
    		txtprice=new JTextField("",10);
    		//txtusername=new JTextField("",15);
    		//txtpassword=new JTextField("",15);
    		txtamountofbook=new JTextField("",10);
    		txtbookarriveddate=new JTextField("",10);
    		txtid2=new JTextField("",10);
     
    		//////////BUTTON/////////////
     
    		btnRest=new JButton("RESET");
    		btnRest.setFont(customFont2);
    		btnRest.setBackground(customBlue);
    		btnRest.setForeground(Color.white);
    		btnRest.addActionListener(this);
    		btnRest.setEnabled(true);
     
    		btnSave=new JButton("SAVE");
    		btnSave.setFont(customFont2);
    		btnSave.setBackground(customBlue);
    		btnSave.setForeground(Color.white);
    		btnSave.addActionListener(this);
     
     
    		btnNext=new JButton("NEXT");
    		btnNext.setFont(customFont2);
    		btnNext.setBackground(customBlue);
    		btnNext.setForeground(Color.white);
    		btnNext.addActionListener(this);
    		btnNext.setEnabled(false);
     
    		btnPrevious=new JButton("PREVIOUS");
    		btnPrevious.setFont(customFont2);
    		btnPrevious.setBackground(customBlue);
    		btnPrevious.setForeground(Color.white);
    		btnPrevious.addActionListener(this);
    		btnPrevious.setEnabled(false);
     
    		btnSearch=new JButton("SEARCH");
    		btnSearch.setFont(customFont2);
    		btnSearch.setBackground(customBlue);
    		btnSearch.setForeground(Color.white);
    		btnSearch.addActionListener(this);
    		btnSearch.setEnabled(false);
     
    	/*	btnEnter=new JButton("Enter");
    		btnEnter.setFont(customFont2);
    		btnEnter.setBackground(customBlue);
    		btnEnter.setForeground(Color.white);
    		btnEnter.addActionListener(this);
    		btnEnter.setEnabled(true);
    	*/
     
    		btnDisplay=new JButton("Display record");
    		btnDisplay.setFont(customFont2);
    		btnDisplay.setBackground(customBlue);
    		btnDisplay.setForeground(Color.white);
    		btnDisplay.addActionListener(this);
    		btnDisplay.setEnabled(false);
    /*
    		btnSearch1=new JButton("Search record");
    		btnSearch1.setFont(customFont2);
    		btnSearch1.setBackground(customBlue);
    		btnSearch1.setForeground(Color.white);
    		btnSearch1.addActionListener(this);
    		btnSearch1.setEnabled(true);
     
    		btnEnter1=new JButton("Enter record");
    		btnEnter1.setFont(customFont2);
    		btnEnter1.setBackground(customBlue);
    		btnEnter1.setForeground(Color.white);
    		btnEnter1.addActionListener(this);
    		btnEnter1.setEnabled(true);
     
    		btnExit=new JButton("Exit");
    		btnExit.setFont(customFont2);
    		btnExit.setBackground(customBlue);
    		btnExit.setForeground(Color.white);
    		btnExit.addActionListener(this);
    		btnExit.setEnabled(true);
     
    		btnReturn=new JButton("Return");
    		btnReturn.setFont(customFont2);
    		btnReturn.setBackground(customBlue);
    		btnReturn.setForeground(Color.white);
    		btnReturn.addActionListener(this);
    		btnReturn.setEnabled(true);
    */
    		////////// LIBRY REC /////////////
     
    		String input = JOptionPane.showInputDialog("Enter Number of Items in the arry");
    			int num = Integer.parseInt(input);
    			libryRec = new libry[num];
    			for (int j=0;j<libryRec.length;j++)
    				libryRec[j]=new libry();
     
    		////////// PANNAL 1 /////////////
     
    		/*pUsername.setLayout(new GridLayout(7,2,0,2));
    		lbltitle3.setBackground(customBlue);
    		lbltitle3.setForeground(Color.black);
    		lbltitle3.setFont(customFont);
    		lblblank.setBackground(customBlue);
    		lblblank1.setBackground(customBlue);
    		pUsername.add(lbltitle3);
    		pUsername.add(lblblank);
    		pUsername.add(lblusername);
    		pUsername.add(txtusername);
    		pUsername.add(lblpassword);
    		pUsername.add(txtpassword);
    		pUsername.add(lblblank1);
    		pUsername.add(btnEnter);
    	*/
     
    		////////// PANNAL 2 /////////////
     
    	/*	pMiddle.setLayout(new GridLayout(5,0,0,0));
    		lbltitle4.setBackground(customBlue);
    		lbltitle4.setForeground(Color.black);
    		lbltitle4.setFont(customFont);
    		lblblank4.setBackground(customBlue);
    		lblblank5.setBackground(customBlue);
    		pMiddle.add(lbltitle4);
    		pMiddle.add(lblblank4);
    		pMiddle.add(btnEnter1);
    		pMiddle.add(btnSearch1);
    		pMiddle.add(btnDisplay);
    		pMiddle.add(lblblank5);
    	*/
    		////////// PANNAL 3 /////////////
     
    		pEnter.setLayout(new GridLayout(20,2,0,2));
    		lbltitle.setBackground(customBlue);
    		lbltitle.setForeground(Color.black);
    		lbltitle.setFont(customFont);
    		lblblank2.setBackground(customBlue);
    		lblblank14.setBackground(customBlue);
    		pEnter.add(lbltitle);
    		pEnter.add(lblblank2);
    		pEnter.add(lblbookid);
    		pEnter.add(txtid);
    		pEnter.add(lblamountofbook);
    		pEnter.add(txtamountofbook);
    		pEnter.add(lbltypeofbook);
    		pEnter.add(txtname);
    		pEnter.add(lblbookarriveddate);
    		pEnter.add(txtbookarriveddate);
    		pEnter.add(lblprice);
    		pEnter.add(txtprice);
    		pEnter.add(lblblank14);
    		pEnter.add(btnSave);
    		pEnter.add(btnRest);
     
     
    		////////// PANNAL 3 /////////////
     
    		pDisplay.setLayout(new GridLayout(20,2,0,2));
    		lbltitle2.setBackground(customBlue);
    		lbltitle2.setForeground(Color.black);
    		lbltitle2.setFont(customFont);
    		lblblank6.setBackground(customBlue);
    		lblblank7.setBackground(customBlue);
    		lblblank8.setBackground(customBlue);
    		pDisplay.add(lbltitle2);
    		pDisplay.add(lblblank6);
    		pDisplay.add(lblbookid2);
    		pDisplay.add(lblbookid21);
    		pDisplay.add(lblamountofbook2);
    		pDisplay.add(lblamountofbook21);
    		pDisplay.add(lbltypeofbook2);
    		pDisplay.add(lbltypeofbook21);
    		pDisplay.add(lblbookarriveddate2);
    		pDisplay.add(lblbookarriveddate21);
    		pDisplay.add(lblprice2);
    		pDisplay.add(lblprice21);
    		pDisplay.add(lblblank8);
    		pDisplay.add(btnNext);
    		pDisplay.add(btnPrevious);
    		pDisplay.add(btnDisplay);
    		//pDisplay.add(btnReturn);
     
    		////////// PANNAL 4 /////////////
     
    		pSearch.setLayout(new GridLayout(20,3,0,3));
    		lbltitle1.setBackground(customBlue);
    		lbltitle1.setForeground(Color.black);
    		lblblank9.setBackground(customBlue);
    		lblblank10.setBackground(customBlue);
    		lblblank11.setBackground(customBlue);
    		pSearch.add(lbltitle1);
    		pSearch.add(lblblank9);
    		pSearch.add(lblbookid1);
    		pSearch.add(txtid2);
    		pSearch.add(btnSearch);
    		pSearch.add(lblblank10);
    		pSearch.add(lblamountofbook1);
    		pSearch.add(lblamountofbook211);
    		pSearch.add(lbltypeofbook1);
    		pSearch.add(lbltypeofbook211);
    		pSearch.add(lblbookarriveddate1);
    		pSearch.add(lblbookarriveddate211);
    		pSearch.add(lblprice1);
    		pSearch.add(lblprice211);
    		pSearch.add(lblblank11);
    	//	pSearch.add(btnRest);
    	//	pSearch.add(btnReturn);
    		//body.addTab("LOGIN",null,pUsername,"Login Page");
    		body.addTab("ENTER",null,pEnter,"Enter Page");
    		body.addTab("DISPLAY",null,pDisplay,"Display Page");
    		body.addTab("SEARCH",null,pSearch,"Login Page");
    		body.setBackgroundAt(0,customBlue);
    		body.setBackgroundAt(1,customRed);
    		body.setBackgroundAt(2,customYellow);
    		body.setBackground(customGray);
    		add(body);
    		setSize(580,430);
    		setVisible(true);
    }
     
    public static void main (String args[])throws AWTException
    {
    	libryGUI adm = new libryGUI();
     
    	adm.addWindowListener(new WindowAdapter()
    	{
    		public void windowClosing( WindowEvent e)
    		{
    			System.exit(0);
    		}
    	}
     
    );
    }
     
    public void actionPerformed(ActionEvent ae)
    {
    	if(ae.getSource()==btnRest)
    		Reset();
    		if (ae.getSource()==btnSave)
    		{
    			if(flag==false)
    			{
    				Validate();
    			}
    			if(flag==true)
    			{
    				Save();
    				Reset();
    					if (counter==0)
    						btnNext.setEnabled(false);
    					else if (flag3 == true);
    						btnNext.setEnabled(true);
    					counter++;
    					if(counter==1)
    					{
    						btnDisplay.setEnabled(true);
    						btnSearch.setEnabled(true);
    					}
     
    			lblbookid.setText(counter+1+".Book ID");
    				if(counter >=libryRec.length)
    				{
    					counter = 0;
    					lblbookid.setText(counter+1+".Book ID");
    				}
     
    				flag =false;
    		}
    }
    	if (ae.getSource()==btnDisplay)
    	{
    		Display();
    		flag3 = true;
    		btnDisplay.setEnabled(false);
    	if(counter == 1)
    		btnNext.setEnabled(false);
    	if(counter !=1)
    		btnNext.setEnabled(true);
    }
    	if (ae.getSource()==btnNext)
    	{
    		counter2++;
    		if(counter2==(counter-1))
    		{
    				btnNext.setEnabled(false);
    		}
    		else
    				btnNext.setEnabled(true);
    		if(counter2 == 4)
    				btnNext.setEnabled(false);
    			btnPrevious.setEnabled(true);
    			lblbookid2.setText(counter2+1+".Book ID");
    			Display();
    	}
    	if(ae.getSource()==btnPrevious)
    	{
    		counter2--;
    		if(counter2==0)
    			btnPrevious.setEnabled(false);
    		else
    			btnPrevious.setEnabled(true);
    			btnNext.setEnabled(true);
    			lblbookid2.setText(counter2+1+".Book ID");
    			Display();
    	}
    	if(ae.getSource()==btnSearch)
    	{
    		Validate2();
    		Search();
    	}
    }//end Action Performed
    public void Reset()
    {
    	 txtid.setText("");
    	 txtid2.setText("");
    	 txtname.setText("");
    	 txtprice.setText("");
    	 //txtusername.setText("");
    	 //txtpassword.setText("");
    	 txtamountofbook.setText("");
    	 txtbookarriveddate.setText("");
    	 txttypeofbook.setText("");
     
    }//end of rest
     
    public void Save()
    {
    	String name,username,password,id,tob,temp,temp2,temp3,temp4;
    	int aob,bad;
    	double price;
    	//char[] studGrade=new char[5];
     
     
    		id=txtid.getText();
    		libryRec[counter].setBkid(id);
    		name = txtname.getText();
    		libryRec[counter].setBknm(name);
    		temp2 = txtprice.getText();
    		price=Double.parseDouble(temp2);
    		libryRec[counter].setPrice(price);
    		//username = txtusername.getText();
    		//libryRec[counter].setUsername(username);
    		//password = txtpassword.getText();
    		//libryRec[counter].setPassword(password);
    		temp = txtamountofbook.getText();
    		aob=Integer.parseInt(temp);
    		libryRec[counter].setAmtbk(aob);
    		temp4 = txtbookarriveddate.getText();
    		bad=Integer.parseInt(temp4);
    		libryRec[counter].setArrdate(bad);
    		tob = txttypeofbook.getText();
    		libryRec[counter].setTypbk(tob);
     
    	/*	for(int i=0;i<5;i++)
    		{
    			studGrade[i] = TempGra[i];
    		}
    	*/
     
     
    }// end of save
     
    public void Display()
    {
    	int temp1;
    	String temp2,temp4;
    	double temp3;
     
    	lblbookid2.setText(libryRec[counter2].getBkid());
    	lblbookname2.setText(libryRec[counter2].getBknm());
    	temp1=libryRec[counter2].getAmtbk();
    	temp2=Integer.toString(temp1);
    	lblamountofbook1.setText(temp2);
    	lbltypeofbook2.setText(libryRec[counter2].getTypbk());
    	temp1=libryRec[counter2].getArrdate();
    	temp2=Integer.toString(temp1);
    	lblbookarriveddate2.setText (temp2);
    	temp3=libryRec[counter2].getPrice();
    	temp4=Double.toString(temp1);
    	lblprice2.setText(temp2);
    }
    public void Search()
    {
    	String str,temp2;
    	int count=0,temp1;
    	double temp3;
    	flag2=true;
    	String[] idArray = new String[libryRec.length];
    	str=txtid2.getText();
    	for(int k=0;k<libryRec.length;k++)
    	{
    		idArray[k]=libryRec[k].getBkid();
    		if(idArray[k].equals(str))
    		{
    			flag=true;
    			lblbookid211.setText(libryRec[k].getBkid());
    			lblbookname211.setText(libryRec[k].getBknm());
    			temp1=libryRec[k].getAmtbk();
    			temp2=Integer.toString(temp1);
    			lblamountofbook211.setText(temp2);
    			lbltypeofbook211.setText(libryRec[k].getTypbk());
    			temp1=libryRec[k].getArrdate();
    			temp2=Integer.toString(temp1);
    			lblbookarriveddate211.setText(temp2);
    			temp3=libryRec[k].getPrice();
    			temp2=Double.toString(temp1);
    			lblprice211.setText(temp2);
    			break;
     
    		}
    		else if(!(idArray[k].equals(str)))
    			flag2=false;
    	}
    	if(flag2==false)
    		JOptionPane.showMessageDialog(this,"Record Not Found");
    	}//End of search
     
    	public void Validate() throws ArithmeticException
    	{
    		flag=false;
     
    		if(txtid.getText().equals("")||txtname.getText().equals("")||txtprice.getText().equals("")||txtusername.getText().equals("")
    			||txtpassword.getText().equals("")||txtamountofbook.getText().equals("")||txtbookarriveddate.getText().equals("")||
    			txttypeofbook.getText().equals(""))
    		{
    			JOptionPane.showMessageDialog(this,"Please Fill In The Blanks:");
    		}
    		else if(!txtname.getText().matches("([a-zA-Z]+|[a-zA-Z]+\\s[a-zA-Z]+)*"))
    		{
    			JOptionPane.showMessageDialog(this,"Invalid Name.");
    			txtname.requestFocus();
    		}
    		else if(!txtusername.getText().matches("([a-zA-Z]+|[a-zA-Z]+\\s[a-zA-Z]+)*"))
    		{
    			JOptionPane.showMessageDialog(this,"Invalid Username.");
    			txtusername.requestFocus();
    		}
     
     
    	}//end fo validate 1
     
    	public void Validate2()
    	{
    		if(txtid2.getText().equals(""))
    		{
    		JOptionPane.showMessageDialog(this,"Please enter Search ID");
    		txtid2.requestFocus();
    		}
    		else if(txtid2.getText().matches("\\d{8}"))
    		{
    		JOptionPane.showMessageDialog(this,"Invalid ID Format.");
    		txtid2.requestFocus();
    		}
    	}//Validte 2
     
    }

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    cant use my save button
    What does the code do when you press the Save button? Does it execute the code you want executed?
    Does that code do what you want?

    Try debugging the code by adding println statements to it to show where it executes and what it is doing when it executes.
    There are many variables that control what happens when the Save button is pressed. You need to print out the values of all of them as the program executes to see if they have the correct values for the program to do what you want it to do.

    There is a class definition missing so the code does not compile without errors.

    You need to compile the code with the javac program's -Xlint option to see some important warnings about the code.
    Last edited by Norm; June 25th, 2012 at 06:38 AM.
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    --------------------Configuration: <Default>--------------------
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at libryGUI.Validate(libryGUI.java:521)
    at libryGUI.actionPerformed(libryGUI.java:347)
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.jav a:6504)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3321)
    at java.awt.Component.processEvent(Component.java:626 9)
    at java.awt.Container.processEvent(Container.java:222 9)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4860)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
    at java.awt.Component.dispatchEvent(Component.java:46 86)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2713 )
    at java.awt.Component.dispatchEvent(Component.java:46 86)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:707)
    at java.awt.EventQueue.access$000(EventQueue.java:101 )
    at java.awt.EventQueue$3.run(EventQueue.java:666)
    at java.awt.EventQueue$3.run(EventQueue.java:664)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:680)
    at java.awt.EventQueue$4.run(EventQueue.java:678)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 677)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:128)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:117)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:113)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:105)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:90)



    sorry i didn't get your question cause i new to java sorry

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    --------------------Configuration: <Default>--------------------
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at libryGUI.Validate(libryGUI.java:521)
    Look at line 521 in the your source and see what variable is null. Then backtrack in the code to see why that variable does not have a valid value.
    If you can not tell which variable it is, add a println just before line 521 and print out the values of all the varibles on that line.

    i new to java
    How did you write such a large program?

    What didn't you understand about my post#6?
    Have you tried adding println statements to print out the values of variables so you can see what the computer sees when it executes the code?
    If you don't understand my answer, don't ignore it, ask a question.

  9. #9
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    LOL relay i don't understand sad cause i wore this program with a book reference for my project

  10. #10
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    temp3=libryRec[k].getPrice();
    temp2=Double.toString(temp1);
    lblprice211.setText(temp2);

    break;

    }
    else if(!(idArray[k].equals(str)))
    -> line 512 flag2=false;
    }

  11. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    I would suggest that you try learning java by writing smaller programs first. You need to learn many techniques BEFORE you try writing a 500+ line program.
    See this link for good info about using println to debug:
    http://www.javaprogrammingforums.com...t-println.html
    If you don't understand my answer, don't ignore it, ask a question.

  12. #12
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    lol but bro this is my assignment we did a little on java in my school and i need to submit this code for a presentation on Wednesday
    realy i need a help of a good java code programmer
    Realy need help hear WEDNESDAy last day

  13. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    Have you found the variable with the null value yet so you can solve the NPE problem?
    If you don't understand my answer, don't ignore it, ask a question.

  14. #14
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    yea now it shows different place

    --------------------Configuration: <Default>--------------------
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at libryGUI.Validate(libryGUI.java:536)
    at libryGUI.actionPerformed(libryGUI.java:346)


    but line 536 is: if(txtid.getText().equals("")||txtname.getText().e quals("")||txtprice.getText().equals("")||txtamoun tofbook.getText().equals("")||txtbookarriveddate.g etText().equals("")||txttypeofbook.getText().equal s(""))


    and line 346 is
    if(flag==false)
    {
    364----> Validate();
    }
    Last edited by remochap; June 25th, 2012 at 10:06 AM.

  15. #15
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    Same instructions except do it for line 536. See post#8
    If you don't understand my answer, don't ignore it, ask a question.

  16. #16
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    same error bro didn't chg

  17. #17
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    You need to find the problem and fix it.

    The first step is to find the variable that has the null value.
    Have you done that yet?

    When you find the variable, then you need to make sure it has a valid value.
    If you don't understand my answer, don't ignore it, ask a question.

  18. #18
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    but i need to insert the value when i run the program?

  19. #19
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    Is that a new problem? Or are you still trying to fix the NPE?
    If you don't understand my answer, don't ignore it, ask a question.

  20. #20
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    still trying to fix the NPE
    man i am trying that for like the past 5 hours with my reference program but still CANT FIX IT

  21. #21
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    What variable has the null value?
    If you don't understand my answer, don't ignore it, ask a question.

  22. #22
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    bro i get this error when i enter all the value and click save

  23. #23
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    bro i get this error when i enter all the value and click save and i dont have any null vlaue

    exect for my tab pane

  24. #24
    Junior Member
    Join Date
    Jun 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    well i did this project with a reference gaven by my teacher wan a take a look not all same but some are but that can save this cant save sad =(

  25. #25
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: I cant get my java to run LOGICAL Error PLs help me urgent need submint on wedne

    You need to debug your code by using a println as shown previously to find the variable with the null value.
    Until you find what variable is null, you will not be able to fix the problem.
    If you don't understand my answer, don't ignore it, ask a question.

Page 1 of 2 12 LastLast

Similar Threads

  1. i'm making a logical error here but i'm not seeing it.
    By qrts in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 5th, 2011, 05:03 AM
  2. Logical error and having trouble HELP!
    By DeathStrike in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 3rd, 2011, 07:02 PM
  3. I have a logical error
    By n00b in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 30th, 2011, 02:52 PM
  4. Sum of series program logical error
    By Neel0075 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: August 12th, 2011, 11:26 AM
  5. Proper output for Non preemptive scheduling problem
    By haygaurav in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 4th, 2009, 07:58 AM