My first java program

Im.Just.a.Fool

Junior member
  • Apr 2, 2009
    202
    19
    18
    කියන්නෙම නෑ
    Congratulations bro. I checked your program. A good first application from a beginner.


    Kattiya me program eka download karala run karala balanna. Baya wenna epa. It's free of spyware and malware. I decompiled the program and checked the source code.


    podi podi adu padu tikak thiyenawa. habai ewa hada ganna puluwan. First application eka hatiyata meka godak hondai.
     

    Im.Just.a.Fool

    Junior member
  • Apr 2, 2009
    202
    19
    18
    කියන්නෙම නෑ
    malli Question eka display karana window eke text box eka edit karanna bari unanam hondai neda? Users are not expected to edit the text in the TextArea that displays the question.
    E.g.

    Code:
    jTextArea1.setFont(new Font("Dialog", 0, 21));
            jTextArea1.setBorder(null);
            jTextArea1.setText("Another morphological feature that could be seen in a plant that bears leaves wi" +
    "th reticular venation is,"
    [COLOR=Red]jTextArea1.setEditable(false);[/COLOR] [COLOR=SeaGreen]// me property eka set kalanam hari[/COLOR]
     

    Im.Just.a.Fool

    Junior member
  • Apr 2, 2009
    202
    19
    18
    කියන්නෙම නෑ
    And the following code doesn't work, unless the database exists on the user's machine.

    Class name: student

    Code:
    public void jButton1_actionPerformed(ActionEvent e)
        {
            try
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); /[COLOR=SeaGreen]/ driver eka hamba une nathnam methana exception ekak throw karanawa[/COLOR]
                Connection conn = DriverManager.getConnection("jdbc:odbc:emp"); [COLOR=Green]// driver eka load kalath database eka nathi hinda methanadi exception ekak throw karanawa[/COLOR]
                Statement stmt = conn.createStatement();
                String s1 = jTextField1.getText();
                String s2 = jTextField2.getText();
                String s3 = MAINWINDOW.cc.toString();
                stmt.executeUpdate((new StringBuilder()).append("INSERT INTO Employee VALUES ('").append(s1).append("','").append(s2).append("','").append(s3).append("')").toString());
                conn.commit();
                conn.close();
                stmt.close();
            }
            catch(Exception f)
            {
                f.printStackTrace();
            }
            dispose();
            Marks m1 = new Marks();
        }
    }
     

    chamidilk

    Active member
  • Nov 18, 2006
    1,053
    4
    38
    Moratuwa
    malliyo
    anith eka oyage interface user friendly madi ne
    put radio buttons for answers and place a next button to go to next Qn
    -djdil
     

    jithendra

    Active member
  • Nov 10, 2006
    758
    57
    28
    HTTP 404
    Im.Just.a.Fool said:
    malli Question eka display karana window eke text box eka edit karanna bari unanam hondai neda? Users are not expected to edit the text in the TextArea that displays the question.
    E.g.

    Code:
    jTextArea1.setFont(new Font("Dialog", 0, 21));
            jTextArea1.setBorder(null);
            jTextArea1.setText("Another morphological feature that could be seen in a plant that bears leaves wi" +
    "th reticular venation is,"
    [COLOR=Red]jTextArea1.setEditable(false);[/COLOR] [COLOR=SeaGreen]// me property eka set kalanam hari[/COLOR]

    tnxs aiya mama meka hoya hoyamai hitiye
     

    jithendra

    Active member
  • Nov 10, 2006
    758
    57
    28
    HTTP 404
    Im.Just.a.Fool said:
    And the following code doesn't work, unless the database exists on the user's machine.

    Class name: student

    Code:
    public void jButton1_actionPerformed(ActionEvent e)
        {
            try
            {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); /[COLOR=SeaGreen]/ driver eka hamba une nathnam methana exception ekak throw karanawa[/COLOR]
                Connection conn = DriverManager.getConnection("jdbc:odbc:emp"); [COLOR=Green]// driver eka load kalath database eka nathi hinda methanadi exception ekak throw karanawa[/COLOR]
                Statement stmt = conn.createStatement();
                String s1 = jTextField1.getText();
                String s2 = jTextField2.getText();
                String s3 = MAINWINDOW.cc.toString();
                stmt.executeUpdate((new StringBuilder()).append("INSERT INTO Employee VALUES ('").append(s1).append("','").append(s2).append("','").append(s3).append("')").toString());
                conn.commit();
                conn.close();
                stmt.close();
            }
            catch(Exception f)
            {
                f.printStackTrace();
            }
            dispose();
            Marks m1 = new Marks();
        }
    }

    mata database eketa kelinma connect karanna puluwan code ekek hambuna mama dan eke test karanawa