naruto9's Profile User Rating: -----

Reputation: 1 Apprentice
Group:
Members
Active Posts:
22 (0.03 per day)
Joined:
06-November 12
Profile Views:
304
Last Active:
User is offline Jul 10 2014 08:27 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   naruto9 has not set their status

Posts I've Made

  1. In Topic: Trouble with Thread.sleep() to Timer conversion on JApplet

    Posted 8 Jul 2014

    Yeah, I was aware of the typo and I did reproduce it XD.

    Im very rusty on event listener but this is my code after cleaning up a bit:

    Is it possible you could show me how i can make 'fetchUrl()' run every 6 seconds using timer?
    //imports not shown for brevity
    
    public class NamecSub extends JApplet implements ActionListener {
    	int DELAY = 6000;
                                                                    //can ignore these
    	JLabel question = new JLabel("Enter name to check: ");
    	JLabel question2 = new JLabel("Check how long? (in minutes)");
    	JLabel result = new JLabel("Status");
    	JTextField resp = new JTextField(12);
    	JTextField timeLength = new JTextField(5);
    	JButton enter = new JButton("Check Availability");
    	//JButton reset = new JButton("Reset Fields");
    	Font tnr = new Font("TimesRoman", Font.PLAIN, 20);
    	Color forum = new Color(17, 26, 45);
    	FlowLayout flow = new FlowLayout();
    	Container c;
    	JPanel test = new JPanel(new BorderLayout());
    	Timer t;                                        //declare Timer t
    	URL rsUrl;
    	BufferedReader br;
    	
    	public void init() {
    		
    		c = getContentPane();
    		c.setLayout(flow);
    		c.setBackground(forum);	
    		
    		question.setForeground(Color.white);
    		question.setFont(tnr);	
    		question2.setForeground(Color.white);
    		question2.setFont(tnr);
    		result.setForeground(Color.white);
    		result.setFont(tnr);	
    		resp.setBorder(BorderFactory.createBevelBorder(0));
    		timeLength.setBorder(BorderFactory.createBevelBorder(0));
    		c.add(question);	
    		c.add(resp);
    		c.add(question2);
    		c.add(timeLength);
    		c.add(enter);
    		c.add(result);
    		resp.requestFocus();
    		enter.addActionListener(this);
    		t = new Timer(DELAY, this);               //is this right?
    	}
    	public void actionPerformed(ActionEvent e) {
    		final String n1;
    		int timeMin, timeSec, count = 0, maxCount;
    		if (e.getSource() == enter) {	
    			timeMin = Integer.parseInt(timeLength.getText());
    			timeSec = timeMin * 60;
    			maxCount = (int)(timeSec/6);
    			n1 = resp.getText();
    			while (count < maxCount) {
    				fetchUrl(n1);                       //just want this method to run every 6 seconds
    				t.start();
    				count++;
    			}	
    		}
    	}
    	public void fetchUrl(String name) {
    		//not shown for brevity	
    }
    
    
  2. In Topic: Trouble with Thread.sleep() to Timer conversion on JApplet

    Posted 8 Jul 2014

    I'm not sure what other route to take to put it in a webpage. I made an applet because its not too big of a project I'm doing.
  3. In Topic: Cstrings using strtok function

    Posted 1 Mar 2014

    Thanks for this, was able to pass it by. I knew what you meant but I couldn't think in terms of functions for C strings. I used strcpy() at the end of the function to pass it by reference.
  4. In Topic: Software Engineering/Comp Sci vs. Computer Engineering

    Posted 10 Feb 2014

    View PostLogik22, on 10 February 2014 - 07:34 AM, said:

    I feel like anything relating to either of the fields is going to be good. When people say "<computer field 1> is bad" I think they really mean "<computer field 1> is not as good as <computer field 2>". I will note that I graduated from a bad school (Devry) with a Bachelors in Computer Information System. I got a job with no experience as a software engineer (I had work experience for the past 7 years though) for $45k/year (average entry level salary). After a year of experience a customer of my previous employer contacted me to do the same work for $67k.

    I think a career is what you make it. If you were debating software engineering and art I would argue that software engineering is the safer choice. However, either of the choices you have are a safe bet. Just pick which one you would prefer. If you could see yourself doing both then just pick one and keep your options open. When I started in college my major was CIS, then I switched to networking, then I switched back to CIS. On the down side I wasted money on networking classes, on the up side I'm 4 classes away from a second bachelors degree in a good field if I ever wanted one.


    I see what you mean, You make a good point. In the end I may try to get both of the fields in as much as I can. Thanks for the advice.
  5. In Topic: Inputting 'true' for a boolean variable.

    Posted 8 Feb 2014

    Thank you for your inputs. I think that is what I was meant to do but I couldn't understand the assignment wording lol.

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

naruto9 hasn't added any friends yet.

Comments

naruto9 has no profile comments yet. Why not say hello?