1

I am working on a research project, which was described here: Searching Google Images from Java . I have the basic GUI working, minus the content that consists of the two pictures and the question, that was required there. I showed the guy who gave me the research position, and he wants to now make sure that I can up it to anywhere between those two pictures and six pictures, per panel. I figured out how to search Google programmatically, from Java, and decided to do it in Java, because it was the best language that I knew of to create GUI's in, as most of my GUI-creating experience is in Java.

This is what I have so far

enter image description here

However, the research project guy is wanting to move this to his server, and wanting me to use Node.js to make the GUI, as well as HTML/JavaScript/CSS. Is there anyway to have layouts in those client-side languages that are similar to Java's Layouts? /* If I could stay in Java, I could just use two JPanels: a picturePanel, which would have a GridLayout, and a questionPanel, which would have only the JLabel with the question in it.

Also, he told me that Node.js works really well with Java. Could someone tell me how would it work, and how to determine the contents of the panels programmatically, using Node.js? (Would the latter work in a way that is similar to writing PHP code, in the sense that you can have it live alongside HTML code?)

Community
  • 1
  • 1
Mike Warren
  • 3,796
  • 5
  • 47
  • 99
  • He also told me that using Node.js would eliminate the need for my Refresh page button. – Mike Warren Oct 23 '14 at 09:38
  • Javascript can be difficult to learn coming from Java. I would stick with Java if you can. As long as the web service is clearly defined. Also you can get rid of 'refresh' button in Swing if you know how to do asynch programming – Oliver Watkins Oct 23 '14 at 10:00
  • I know some JavaScript already... – Mike Warren Oct 23 '14 at 10:45
  • "Also, he told me that Node.js works really well with Java" Oh really? In what context? – Catfish Oct 23 '14 at 15:54
  • He made that as a comment, but without evidence (and my skepticism, as well as my cognitive dissonance, makes me want to continue this in Java), but I found out that Node.js can parse JSON, which is what I showed him that my Java code can fetch. – Mike Warren Oct 26 '14 at 04:22

2 Answers2

0

I don't know much about how to plug and play java and node js but there are very well defined templates (jade) that go well with node js. You can provide a restful api with node js and have an html page which renders the above JUI that you made in java.

Samarth
  • 431
  • 1
  • 5
  • 13
  • I am fairly new to this type of programming. Could you elaborate more on RESTful API? (I also never used Node.js) – Mike Warren Oct 23 '14 at 09:43
  • So basically if you put a button on the GUI and it has an on click event listener bound to a function, the same can happen on the web too. You'll be using the elements provided by HTML, and then on clicking the button, a url gets called ("http://mick-warren/button/click") . This url is served by your node js server. – Samarth Oct 23 '14 at 10:06
0

if you have node.js webserver, and REST API or Webservice over Java, then you can integrate your code with both node.js and Java,

if you are good in Java scripting,you can use both client and java as one langauge, javascript, there are framework like bootsstarp, that have lot of plugin for handling layout, also jQuery has lot's of open implementation

anish
  • 6,884
  • 13
  • 74
  • 140