Results 1 to 7 of 7
  1. #1
    ajwilliams96 is offline Member
    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0

    Default Why won't my project run?

    Hello. I am new to Java, and I tried to write a code that has the user input a number, and the output states the text for each input number, but the code isn't running. I don't know where this thread belongs, so I am posting it here. Here is my code:

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

    public class Project3 extends JFrame {

    private GUI GUIObject;
    private JButton numberAB, GUI;
    private JTextArea TextArea;
    private JTextField TextField;
    private JLabel numberinst;

    public Project3()
    {
    createUserInterface();
    }

    private void createUserInterface()
    {
    Container contentPane = getContentPane();
    contentPane.setLayout(null);

    numberinst = new JLabel();
    numberinst.setText( "Type in the number you want to be extracted" );
    numberinst.setBounds( 150, 0, 500, 100);
    numberinst.setFont( new Font( "", Font.PLAIN, 20));
    numberinst.setVisible(false);
    contentPane.add( numberinst );

    TextField = new JTextField();
    TextField.setText( "" );
    TextField.setBounds( 300, 100, 100, 50);
    TextField.setVisible(false);
    TextField.setFont( new Font( "", Font.PLAIN, 20));
    contentPane.add( TextField );


    TextArea = new JTextArea();
    TextArea.setText( "" );
    TextArea.setBounds( 50, 325, 600, 125);
    TextArea.setVisible(false);
    TextArea.setEditable(false);
    contentPane.add( TextArea );

    numberAB = new JButton();
    numberAB.setText( "Convert" );
    numberAB.setBounds( 300, 200, 100, 40 );
    numberAB.setVisible(false);
    contentPane.add( numberAB );
    numberAB.addActionListener(

    new ActionListener()
    {

    public void actionPerformed ( ActionEvent event )
    {
    numberConvertActionPerformed( event );
    }

    }

    );
    }

    private void numberJTextFieldKeyPressed( KeyEvent event )
    {
    TextArea.setText("");
    }
    private void numberConvertActionPerformed( ActionEvent event )
    {
    int number = Integer.parseInt(TextField.getText());
    if(number > 0 && number < 1000000)
    {
    int first = number / 100000;
    int second = number / 10000 - first * 10;
    int third = number / 1000 - first * 100 - second * 10;
    int fourth = number / 100 - first * 1000 - second * 100 - third * 10;
    int fifth = number / 10 - first * 10000 - second * 1000 - third * 100 - fourth * 10;
    int sixth = number - first * 100000 - second * 10000 - third * 1000 - fourth * 100 - fifth * 10;


    if( number > 99999)
    {
    switch(first)
    {
    case 1: TextArea.append("one hundred ");
    break;
    case 2: TextArea.append("two hundred ");
    break;
    case 3: TextArea.append("three hundred ");
    break;
    case 4: TextArea.append("four hundred ");
    break;
    case 5: TextArea.append("five hundred ");
    break;
    case 6: TextArea.append("six hundred ");
    break;
    case 7: TextArea.append("seven hundred ");
    break;
    case 8: TextArea.append("eight hundred ");
    break;
    case 9: TextArea.append("nine hundred ");
    break;
    }

    if(second< 20 && second>9)
    {
    switch(second)
    {
    case 10: TextArea.append("ten thousand ");
    break;
    case 11: TextArea.append("eleven thousand ");
    break;
    case 12: TextArea.append("twelve thousand ");
    break;
    case 13: TextArea.append("thirteen thousand ");
    break;
    case 14: TextArea.append("fourteen thousand ");
    break;
    case 15: TextArea.append("fifteen thousand ");
    break;
    case 16: TextArea.append("sixteen thousand ");
    break;
    case 17: TextArea.append("seventeen thousand ");
    break;
    case 18: TextArea.append("eighteen thousand ");
    break;
    case 19: TextArea.append("nineteen thousand ");
    break;
    }
    }
    else if(true)
    {
    switch(second)
    {
    case 0: TextArea.append("thousand");
    break;
    case 2: TextArea.append("twenty ");
    break;
    case 3: TextArea.append("thirty ");
    break;
    case 4: TextArea.append("fourty ");
    break;
    case 5: TextArea.append("fifty ");
    break;
    case 6: TextArea.append("sixty ");
    break;
    case 7: TextArea.append("seventy ");
    break;
    case 8: TextArea.append("eighty ");
    break;
    case 9: TextArea.append("ninety ");
    break;
    }
    }
    switch(third)
    {
    case 0: TextArea.append("");
    break;
    case 1: TextArea.append("one thousand ");
    break;
    case 2: TextArea.append("two thousand ");
    break;
    case 3: TextArea.append("three thousand ");
    break;
    case 4: TextArea.append("four thousand ");
    break;
    case 5: TextArea.append("five thousand ");
    break;
    case 6: TextArea.append("six thousand ");
    break;
    case 7: TextArea.append("seven thousand ");
    break;
    case 8: TextArea.append("eight thousand ");
    break;
    case 9: TextArea.append("nine thousand");
    break;
    }
    switch(fourth)
    {
    case 1: TextArea.append("one hundred ");
    break;
    case 2: TextArea.append("two hundred ");
    break;
    case 3: TextArea.append("three hundred ");
    break;
    case 4: TextArea.append("four hundred ");
    break;
    case 5: TextArea.append("five hundred ");
    break;
    case 6: TextArea.append("six hundred ");
    break;
    case 7: TextArea.append("seven hundred ");
    break;
    case 8: TextArea.append("eight hundred ");
    break;
    case 9: TextArea.append("nine hundred ");
    break;
    }
    if(fifth<20 && fifth>9)
    {
    switch(fifth)
    {
    case 10: TextArea.append("ten thousand ");
    break;
    case 11: TextArea.append("eleven thousand ");
    break;
    case 12: TextArea.append("twelve thousand ");
    break;
    case 13: TextArea.append("thirteen thousand ");
    break;
    case 14: TextArea.append("fourteen thousand ");
    break;
    case 15: TextArea.append("fifteen thousand ");
    break;
    case 16: TextArea.append("sixteen thousand ");
    break;
    case 17: TextArea.append("seventeen thousand ");
    break;
    case 18: TextArea.append("eighteen thousand ");
    break;
    case 19: TextArea.append("nineteen thousand ");
    break;
    }
    switch(sixth)
    {
    case 0: TextArea.append("");
    break;
    case 1: TextArea.append("one ");
    break;
    case 2: TextArea.append("two ");
    break;
    case 3: TextArea.append("three ");
    break;
    case 4: TextArea.append("four. ");
    break;
    case 5: TextArea.append("five ");
    break;
    case 6: TextArea.append("six ");
    break;
    case 7: TextArea.append("seven ");
    break;
    case 8: TextArea.append("eight ");
    break;
    case 9: TextArea.append("nine ");
    break;
    }

    }
    }
    }


    GUI = new JButton("Home");
    GUI.setBounds(200,350,100,50);
    contentPane.add(GUI);
    GUI.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent event)
    {
    GUIObject = new GUI();
    setVisible(false);
    }
    }
    );

    {


    }
    setTitle("Input Project");
    setVisible(true);
    setSize(500,500);
    setResizable(true);
    setBackground(Color.black);

    }
    public static void main(String[] args)
    {
    Project3 application = new Project3();
    application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    GUI GUIObject = new GUI();

    }

    }

  2. #2
    Tombomb is offline Member
    Join Date
    Jan 2012
    Posts
    33
    Rep Power
    0

    Default Re: Why won't my project run?

    Well, I ran this code and the first issue was there is no GUI object, which you have on line 8 of that code, unless you have your own class you are using named GUI in which case we can't even try to run this code without it. :/

  3. #3
    ajwilliams96 is offline Member
    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0

    Default Re: Why won't my project run?

    Quote Originally Posted by Tombomb View Post
    Well, I ran this code and the first issue was there is no GUI object, which you have on line 8 of that code, unless you have your own class you are using named GUI in which case we can't even try to run this code without it. :/
    Sorry. I forgot to include this (which is a different class):


    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class GUI extends JFrame
    {
    private JButton Project1, Project2, Project3, Project4;
    private JTextArea ProjectTitle;
    private Project1 Project1Object;
    private Project2 Project2Object;
    private Project3 Project3Object;
    private Project4 Project4Object;
    public GUI()

    {
    createUserInterface();
    }

    private void createUserInterface()
    {
    Container contentPane = getContentPane();
    contentPane.setLayout(null);

    ProjectTitle = new JTextArea("My Project");
    ProjectTitle.setBounds(150,10,350,20);
    ProjectTitle.setEditable(false);
    ProjectTitle.setForeground(Color.white);
    ProjectTitle.setBackground(Color.black);
    contentPane.add(ProjectTitle);

    Project1 = new JButton("Square Root Project");
    Project1.setBounds(175,50,150,100);
    contentPane.add(Project1);
    Project1.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent p)
    {
    Project1Object = new Project1();
    setVisible(false);
    }
    }
    );

    Project2 = new JButton("Triangle Project");
    Project2.setBounds(175,150,150,100);
    contentPane.add(Project2);
    Project2.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent event)
    {
    Project2Object = new Project2();
    setVisible(false);
    }
    }
    );
    Project3 = new JButton("Input Project");
    Project3.setBounds(175,250,150,100);
    contentPane.add(Project3);
    Project3.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent p)
    {
    Project3Object = new Project3();
    setVisible(false);
    }
    }
    );
    Project4 = new JButton("Prime Factor Project");
    Project4.setBounds(175,350,150,100);
    contentPane.add(Project4);
    Project4.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent event)
    {
    Project4Object = new Project4();
    setVisible(false);
    }
    }
    );


    setTitle("My Project");
    setSize(500,500);
    setResizable(false);
    setBackground(Color.black);
    setVisible(true);
    }
    }
    Last edited by ajwilliams96; 01-14-2012 at 11:18 PM.

  4. #4
    Tombomb is offline Member
    Join Date
    Jan 2012
    Posts
    33
    Rep Power
    0

    Default Re: Why won't my project run?

    Yeah, that is needed and so is Project1,Project2, and Project4 lol, because GUI implements one of each of those as well. I'm not sure if the mods would care if that much code got posted or not, usually they request SSCCE which is just a few lines of compile-able code.

  5. #5
    ajwilliams96 is offline Member
    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0

    Default Re: Why won't my project run?

    Okay. Here's Project1:


    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.text.DecimalFormat;

    import javax.swing.*;

    public class Project1 extends JFrame
    {

    private JLabel numberJLabel;
    private JTextField numberJTextArea;
    private JTextField resultJTextArea;
    private JLabel resultJLabel;
    private JButton calculateJButton;
    private JButton GUI, Reset;
    private GUI GUIObject;

    public Project1()
    {
    createUserInterface();
    }

    private void createUserInterface()
    {

    Container contentPane = getContentPane();
    contentPane.setLayout( null );

    GUI = new JButton("Home");
    GUI.setBounds(200,350,100,50);
    contentPane.add(GUI);
    GUI.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent p)
    {
    GUIObject = new GUI();
    setVisible(false);
    }
    }
    );

    Reset = new JButton("Reset");
    Reset.setBounds(125,160,270,24);
    contentPane.add(Reset);
    Reset.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent p)
    {
    numberJTextArea.setText("");
    resultJTextArea.setText("");
    }
    }
    );

    numberJLabel = new JLabel();
    numberJLabel.setText( "Enter Number:" );
    numberJLabel.setBounds( 16, 56, 230, 21 );
    contentPane.add( numberJLabel );


    numberJTextArea = new JTextField();
    numberJTextArea.setText( "0" );
    numberJTextArea.setBounds( 148, 56, 230, 21 );
    numberJTextArea.setHorizontalAlignment( JTextField.RIGHT );
    contentPane.add( numberJTextArea );

    resultJLabel = new JLabel();
    resultJLabel.setText( "Square Root:" );
    resultJLabel.setBounds( 16, 125, 230, 21 );
    contentPane.add( resultJLabel );

    resultJTextArea = new JTextField();
    resultJTextArea.setText( "0" );
    resultJTextArea.setBounds( 148, 125, 230, 21 );
    resultJTextArea.setEditable(false);
    resultJTextArea.setHorizontalAlignment( JTextField.RIGHT );
    contentPane.add( resultJTextArea );

    calculateJButton = new JButton();
    calculateJButton.setText( "Calculate Square Root" );
    calculateJButton.setBounds( 125, 88, 270, 24 );
    contentPane.add( calculateJButton );
    calculateJButton.addActionListener(


    new ActionListener()
    {
    public void actionPerformed( ActionEvent event )
    {
    squareRoot();
    }

    }

    );

    setTitle( "Square Root Project" );
    setSize( 500, 500 );
    setVisible( true );
    }

    private void squareRoot()
    {

    try
    {
    resultJTextArea.setText(" ");
    double n ;
    double y=1;
    double x=1;

    DecimalFormat root = new DecimalFormat("0.000000");
    n =Double.parseDouble(numberJTextArea.getText());

    while (true)
    {
    x= (0.5) * ( y+ (n/y));

    if ((root.format(x)).equals (root.format(y)))
    {

    resultJTextArea.setText(root.format(x));
    break;
    }

    else
    {
    y=x;
    }


    }
    }

    catch (Exception e)
    {
    JOptionPane.showMessageDialog(null,
    "Please enter a positive integer.",
    "ERROR",
    JOptionPane.ERROR_MESSAGE);
    }

    }

    public static void main( String[] args )
    {
    Project1 application = new Project1();
    application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    }
    {
    Container contentPane2 = getContentPane();

    setSize(500,500);
    setBackground(Color.DARK_GRAY);
    setResizable(false);

    }
    public static void main1(String[] args)
    {

    GUI GUIObject = new GUI();


    }

    }

  6. #6
    ajwilliams96 is offline Member
    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0

    Default Re: Why won't my project run?

    Here's Project2 (which also does not work):

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

    public class Project2 extends JFrame {

    private JButton GUI, triangleAB;
    private GUI GUIObject;
    private JLabel triangleinst, triangleXYlabel;
    private JTextField triangleXTF1, triangleXTF2, triangleXTF3, triangleYTF1, triangleYTF2, triangleYTF3;
    private JTextArea triangleATF1;

    public Project2()
    {
    createUserInterface();
    }

    private void createUserInterface()
    {
    Container contentPane = getContentPane();
    contentPane.setLayout(null);

    triangleinst = new JLabel();
    triangleinst.setText( "Type in the coordinates of your triangle" );
    triangleinst.setBounds( 150, 0, 500, 100);
    triangleinst.setFont( new Font( "", Font.PLAIN, 20));
    triangleinst.setVisible(false);
    contentPane.add( triangleinst );

    triangleXYlabel = new JLabel();
    triangleXYlabel.setText( "X , Y" );
    triangleXYlabel.setBounds( 274, 30, 200, 100);
    triangleXYlabel.setFont( new Font( "", Font.PLAIN, 20));
    triangleXYlabel.setVisible(false);
    contentPane.add( triangleXYlabel );

    triangleXTF1 = new JTextField();
    triangleXTF1.setText( "" );
    triangleXTF1.setBounds( 250, 100, 60, 25);
    triangleXTF1.setVisible(false);
    contentPane.add( triangleXTF1 );
    triangleXTF1.addKeyListener(
    new KeyAdapter()
    {
    public void keyPressed( KeyEvent event )
    {
    triangleJTextFieldKeyPressed( event );
    }
    }
    );

    triangleXTF2 = new JTextField();
    triangleXTF2.setText( "" );
    triangleXTF2.setBounds( 250, 150, 60, 25);
    triangleXTF2.setVisible(false);
    contentPane.add( triangleXTF2 );
    triangleXTF2.addKeyListener(
    new KeyAdapter()
    {
    public void keyPressed( KeyEvent event )
    {
    triangleJTextFieldKeyPressed( event );
    }
    }
    );


    triangleXTF3 = new JTextField();
    triangleXTF3.setText( "" );
    triangleXTF3.setBounds( 250, 200, 60, 25);
    triangleXTF3.setVisible(false);
    contentPane.add( triangleXTF3 );
    triangleXTF3.addKeyListener(
    new KeyAdapter()
    {
    public void keyPressed( KeyEvent event )
    {
    triangleJTextFieldKeyPressed( event );
    }
    }
    );

    triangleYTF1 = new JTextField();
    triangleYTF1.setText( "" );
    triangleYTF1.setBounds( 370, 100, 60, 25);
    triangleYTF1.setVisible(false);
    contentPane.add( triangleYTF1 );
    triangleYTF1.addKeyListener(
    new KeyAdapter()
    {
    public void keyPressed( KeyEvent event )
    {
    triangleJTextFieldKeyPressed( event );
    }
    }
    );

    triangleYTF2 = new JTextField();
    triangleYTF2.setText( "" );
    triangleYTF2.setBounds( 370, 150, 60, 25);
    triangleYTF2.setVisible(false);
    contentPane.add( triangleYTF2 );
    triangleYTF2.addKeyListener(
    new KeyAdapter()
    {
    public void keyPressed( KeyEvent event )
    {
    triangleJTextFieldKeyPressed( event );
    }
    }
    );

    triangleYTF3 = new JTextField();
    triangleYTF3.setText( "" );
    triangleYTF3.setBounds( 370, 200, 60, 25);
    triangleYTF3.setVisible(false);
    contentPane.add( triangleYTF3 );
    triangleYTF3.addKeyListener(
    new KeyAdapter()
    {
    public void keyPressed( KeyEvent event )
    {
    triangleJTextFieldKeyPressed( event );
    }
    }
    );

    triangleATF1 = new JTextArea();
    triangleATF1.setText( "" );
    triangleATF1.setBounds( 50, 325, 600, 125);
    triangleATF1.setVisible(false);
    triangleATF1.setEditable(false);
    contentPane.add( triangleATF1 );

    triangleAB = new JButton();
    triangleAB.setText( "Check" );
    triangleAB.setBounds( 250, 250, 180, 40 );
    triangleAB.setVisible(false);
    contentPane.add( triangleAB );
    triangleAB.addActionListener(

    new ActionListener()
    {

    public void actionPerformed ( ActionEvent event )
    {
    triangleCheckActionPerformed( event );
    }

    }

    );

    private void triangleCheckActionPerformed( ActionEvent event )
    {
    int x1 = Integer.parseInt(triangleXTF1.getText());
    int y1 = Integer.parseInt(triangleYTF1.getText());
    int x2 = Integer.parseInt(triangleXTF2.getText());
    int y2 = Integer.parseInt(triangleYTF2.getText());
    int x3 = Integer.parseInt(triangleXTF3.getText());
    int y3 = Integer.parseInt(triangleYTF3.getText());

    double d1 = ((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
    double d2 = ((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3));
    double d3 = ((x3-x1)*(x3-x1) + (y3-y1)*(y3-y1));
    Math.sqrt(d1);
    Math.sqrt(d2);
    Math.sqrt(d3);

    if( d1 != d2 && d2 != d3 && d1 != d3)
    {
    triangleATF1.append("Scalene Triangle");
    }
    else if( d1 == d2 && d2 == d3)
    {
    triangleATF1.append("Equalateral Triangle");
    }
    else if(d1 == d2 || d1 == d3 || d2 == d3)
    {
    triangleATF1.append("Isosceles Triangle");
    }

    }
    private void triangleJTextFieldKeyPressed( KeyEvent event )
    {
    triangleATF1.setText("");
    }

    GUI = new JButton("Home");
    GUI.setBounds(200,350,100,50);
    contentPane.add(GUI);
    GUI.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent event)
    {
    GUIObject = new GUI();
    setVisible(false);
    }
    }
    );

    {
    Container contentPane2 = getContentPane();
    }

    setTitle("Triangle Project");
    setVisible(true);
    setSize(500,500);
    setBackground(Color.black);
    setResizable(true);

    }
    public static void main(String[] args)
    {

    GUI GUIObject = new GUI();

    }

    }

  7. #7
    ajwilliams96 is offline Member
    Join Date
    Jan 2012
    Posts
    5
    Rep Power
    0

    Default Re: Why won't my project run?

    Here's Project4:

    import java.awt.*;
    import java.awt.event.*;

    import javax.swing.*;

    public class Project4 extends JFrame
    {
    private JTextArea resultJTextArea;
    private JLabel numberJLabel;
    private JTextField numbersJTextField;
    private GUI GUIObject;
    private JLabel resultJLabel;
    private JTextField resultJTextField;
    private JButton calculateJButton, GUI;
    private JScrollPane resultJScrollPane;


    public Project4()
    {
    createUserInterface();
    }


    public void createUserInterface()
    {

    Container contentPane = getContentPane();
    contentPane.setLayout( null );

    GUI = new JButton("Home");
    GUI.setBounds(200,250,100,50);
    contentPane.add(GUI);
    GUI.addActionListener(
    new ActionListener()
    {
    public void actionPerformed(ActionEvent p)
    {
    GUIObject = new GUI();
    setVisible(false);
    }
    }
    );

    numberJLabel = new JLabel();
    numberJLabel.setText( "Enter Number:" );
    numberJLabel.setBounds( 16, 16, 170, 21 );
    contentPane.add(numberJLabel);

    resultJTextArea = new JTextArea();
    resultJTextArea.setEditable(false);
    resultJTextArea.setBounds( 148, 75, 250, 150 );
    contentPane.add(resultJTextArea);

    resultJScrollPane = new JScrollPane(resultJTextArea);
    resultJScrollPane.setBounds( 148, 75, 250, 150 );
    contentPane.add(resultJScrollPane);

    numbersJTextField = new JTextField();
    numbersJTextField.setText( "" );
    numbersJTextField.setEditable(true);
    numbersJTextField.setBounds( 148, 16, 80, 21 );
    numbersJTextField.setHorizontalAlignment( JTextField.RIGHT );
    numbersJTextField.setVisible(true);
    contentPane.add( numbersJTextField );
    numbersJTextField.addKeyListener(

    new KeyAdapter()
    {

    public void keyPressed( KeyEvent event )
    {
    numbersJTextFieldKeyPressed( event );
    }

    }

    );


    resultJLabel = new JLabel();
    resultJLabel.setText( "Total:" );
    resultJLabel.setBounds( 16, 75, 130, 21 );



    resultJTextField = new JTextField();
    resultJTextField.setBounds( 244, 16, 86, 21 );
    resultJTextField.setHorizontalAlignment(
    JTextField.RIGHT );
    resultJTextField.setEditable( false );



    calculateJButton = new JButton();
    calculateJButton.setText( "Factor" );
    calculateJButton.setBounds( 148, 48, 126, 24 );
    calculateJButton.addActionListener(

    new ActionListener()
    {

    public void actionPerformed( ActionEvent event )
    {
    resultJTextArea.setText("");
    printPrimeFactors();
    }

    }

    );

    contentPane.add(calculateJButton);
    setTitle( "Prime Factorization" );
    setSize( 450, 350 );
    setBackground(Color.gray);
    setVisible( true );

    }


    private void printPrimeFactors()
    {
    try
    {
    int number = Integer.parseInt(numbersJTextField.getText());
    resultJTextArea.append("" + "" + String.valueOf(number) + "\n");
    int counter = 2;
    int b = 0;
    int n = 0;
    while( counter < number)
    {
    if(Prime(counter))
    {
    if(number % counter == 0)
    {
    n = 0;
    resultJTextArea.append(String.valueOf(counter) + " ");
    number = number / counter;
    resultJTextArea.append(String.valueOf(number + "\n\n"));

    b++;
    while(n < b)
    {
    resultJTextArea.append(" ");
    n++;
    }


    }

    }
    if(number % counter != 0)
    {
    counter++;
    }
    }
    }
    catch(Exception e)
    {
    JOptionPane.showMessageDialog(null,
    "Please enter a positive integer.",
    "Error",
    JOptionPane.ERROR_MESSAGE);
    }
    }


    private boolean Prime(int a)
    {
    for(int c = 2; c < a; c++)
    {
    if( a % c == 0)
    {
    return false;
    }

    }
    return true;

    }


    private void numbersJTextFieldKeyPressed( KeyEvent event )
    {
    resultJTextField.setText(" ");

    }



    public static void main( String[] args )
    {
    Project4 application = new Project4();
    application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    GUI GUIObject = new GUI();

    }
    }

Similar Threads

  1. Creating a project in eclipse from existing project
    By Suraiya in forum New To Java
    Replies: 1
    Last Post: 10-08-2011, 10:14 AM
  2. How to convert from Ant project to maven project?
    By jiapei100 in forum New To Java
    Replies: 0
    Last Post: 06-08-2011, 11:01 AM
  3. Adding a project to an existing project
    By Seijuro in forum NetBeans
    Replies: 4
    Last Post: 08-08-2010, 11:15 AM
  4. open existing project project ..
    By itaipee in forum Eclipse
    Replies: 1
    Last Post: 12-28-2008, 09:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •