GUI Keyboard Simulator

  • (2 Pages)
  • +
  • 1
  • 2

24 Replies - 1760 Views - Last Post: 25 February 2012 - 10:39 PM Rate Topic: -----

#16 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10667
  • View blog
  • Posts: 39,615
  • Joined: 27-December 08

Re: GUI Keyboard Simulator

Posted 23 February 2012 - 07:25 PM

You should check out the Yahoo APIs.
http://developer.yah...everything.html

Also, I want to expand on a couple of points made. First, the switch block in Fuzzyness' code sample is legal only if you are using Java 7. Previous versions do not support switch blocks for Strings. Second, for the non-special keys (enter, shift, caps-lock, etc.), you can handle them all with one general algorithm: get the JButton's text and append it to the JTextArea (with your only concern being casing for letters).
Was This Post Helpful? 0
  • +
  • -

#17 wilson9493  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 21-February 12

Re: GUI Keyboard Simulator

Posted 23 February 2012 - 07:38 PM

Hello guys, I reckoned the switch block problem as well but I managed to use a more basic way to do it.

Apologise that's quite a lot to ask, but very unfortunately I do not have a few weeks to practise it over....

I wouldn't have turned to you guys if it isn't that desperate.

Maybe you can just point me to the right direction, like any tutorials online or stuff of similar sort so I can have a look at it, prolly I can get some codes

done and come to you guys when I have developed something? Instead of asking you guys to build sth from scratch ??

Anything helpful will be much appreciated (:

Cheers!
Was This Post Helpful? 0
  • +
  • -

#18 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10667
  • View blog
  • Posts: 39,615
  • Joined: 27-December 08

Re: GUI Keyboard Simulator

Posted 23 February 2012 - 07:41 PM

We have a bunch of tutorials on DIC you can take advantage of. :)
Was This Post Helpful? 0
  • +
  • -

#19 wilson9493  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 21-February 12

Re: GUI Keyboard Simulator

Posted 24 February 2012 - 02:59 PM

Hello there, I have some codes here which I can get data from the Yahoo Finance Service.

However, it returned a statement like Missing Symbol Lists.

Anyone can help me where my code goes wrong?

Thanks!

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Scanner;

public class StockInfo 
{
	
	

	public String StockInfo(String yahooFIn)
	{
		StringBuilder buf = new StringBuilder();
		Scanner in = null;

		try {
			URL yahooFin = new URL("http://finance.yahoo.com/d/quotes.csv?s=");
			in = new Scanner(yahooFin.openStream());

			while (in.hasNextLine()) {
				buf.append(in.nextLine() + "\n");
			}

			return buf.toString();
		} catch (MalformedURLException e) {
			System.err.println(e);
		} catch (IOException e) {
			System.err.println(e);
		} finally {
			if (in != null) 
			{
				in.close();
			}
		}
		return null;
	}

	
}


Was This Post Helpful? 0
  • +
  • -

#20 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: GUI Keyboard Simulator

Posted 24 February 2012 - 08:39 PM

What is the use of String yahooFIn that you pass as parameter to your method ?
Was This Post Helpful? 0
  • +
  • -

#21 wilson9493  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 21-February 12

Re: GUI Keyboard Simulator

Posted 24 February 2012 - 08:43 PM

That was intended to be the stock symbol that the user typed in. (?)
Was This Post Helpful? 0
  • +
  • -

#22 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: GUI Keyboard Simulator

Posted 24 February 2012 - 08:50 PM

so where do you pass it to the Yahoo API ?
Was This Post Helpful? 0
  • +
  • -

#23 wilson9493  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 21-February 12

Re: GUI Keyboard Simulator

Posted 25 February 2012 - 07:42 AM

OH!!!!!
I got it!

Is this the way I should put it?

try {
			URL yahooFin = new URL("http://finance.yahoo.com/d/quotes.csv?s=" +symbol + "&f=snl1pdj1xe1");
			URLConnection con = yahooFin.openConnection();


but what I get is the info displayed in one line

can I get them to display on the next line for each info??

Thanks!!!
Was This Post Helpful? 0
  • +
  • -

#24 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8342
  • View blog
  • Posts: 31,880
  • Joined: 06-March 08

Re: GUI Keyboard Simulator

Posted 25 February 2012 - 02:11 PM

Where do you display something ?
Was This Post Helpful? 0
  • +
  • -

#25 wilson9493  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 21-February 12

Re: GUI Keyboard Simulator

Posted 25 February 2012 - 10:39 PM

Back in the codes I posted before, there are two jlabels input and output

I was trying to display it next to the output jlabel.

Cheers
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2