is there a way to convert java to javascript?

i'd like to convert this program to javascript please

Page 1 of 1

10 Replies - 14334 Views - Last Post: 30 April 2010 - 07:51 AM

#1 god?  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-April 10

is there a way to convert java to javascript?

Posted 27 April 2010 - 05:45 AM

i was wondering if it was possible to convert this java code into javascript.

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

public class AL extends Frame implements WindowListener,ActionListener {
	
	public static void main(String[] args) {
		AL myWindow = new AL("My first window");
		mywindow.setSize(350,100);
		mywindow.setVisible(true);
	}

	public AL(String title) {

		super(title);
		setLayout(new FlowLayout());
		addWindowListener(this);
		b = new Button("Click me");
		add(B)/>;
		b.addActionListener(this);
	}

	public void actionPerformed(ActionEvent e) {
		for (int x=0; x<10; x++){
		AL myWindow = new AL("My first window");
		mywindow.setSize(350,100);
		mywindow.setVisible(true);
		}
		
	}

	public void windowClosing(WindowEvent e) {
		for (int x=0; x<10; x++){
			AL myWindow = new AL("My first window");
			mywindow.setSize(350,100);
			mywindow.setVisible(true);
			}
		
	}

	public void windowOpened(WindowEvent e) {}
	public void windowActivated(WindowEvent e) {}
	public void windowIconified(WindowEvent e) {}
	public void windowDeiconified(WindowEvent e) {}
	public void windowDeactivated(WindowEvent e) {}
	public void windowClosed(WindowEvent e) {}

}


Is This A Good Question/Topic? 0
  • +

Replies To: is there a way to convert java to javascript?

#2 revolutionx  Icon User is offline

  • D.I.C Head

Reputation: 60
  • View blog
  • Posts: 229
  • Joined: 23-July 09

Re: is there a way to convert java to javascript?

Posted 27 April 2010 - 06:58 AM

There isn't a converter that will take that code and give you javascript.

You'll have to re-code it in Javascript,

I recommend looking into Jquery which is a Javascript framework. You can make a button popup a modal box etc.

This post has been edited by revolutionx: 27 April 2010 - 06:58 AM

Was This Post Helpful? 0
  • +
  • -

#3 jrm402  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 51
  • View blog
  • Posts: 333
  • Joined: 18-March 10

Re: is there a way to convert java to javascript?

Posted 27 April 2010 - 09:59 AM

If you did want to code it in Javascript it shouldn't be too hard - it looks like a relatively simple program (although I haven't done JAVA in years). Check out http://www.w3schools...js/js_intro.asp for good web programming tutorials.
Was This Post Helpful? 0
  • +
  • -

#4 god?  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-April 10

Re: is there a way to convert java to javascript?

Posted 29 April 2010 - 11:51 AM

ok maybe i said it wrong, how would i go about to make that code out of javascript?
Was This Post Helpful? 0
  • +
  • -

#5 revolutionx  Icon User is offline

  • D.I.C Head

Reputation: 60
  • View blog
  • Posts: 229
  • Joined: 23-July 09

Re: is there a way to convert java to javascript?

Posted 29 April 2010 - 12:24 PM

Well what exactly do you want to do in Javascript,

Please explain the functionality you want, ie a Button, and then you press it...
Was This Post Helpful? 0
  • +
  • -

#6 god?  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-April 10

Re: is there a way to convert java to javascript?

Posted 29 April 2010 - 05:26 PM

View Postrevolutionx, on 29 April 2010 - 11:24 AM, said:

Well what exactly do you want to do in Javascript,

Please explain the functionality you want, ie a Button, and then you press it...


umm well have u tried to run the code i posted? if u did then u might know what i'm attepting. if not:

i'd just like to know how to make a button that when u press it, it opens a second window with a different button.
Was This Post Helpful? 0
  • +
  • -

#7 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: is there a way to convert java to javascript?

Posted 29 April 2010 - 05:44 PM

god? we shouldn't have to open an IDE and compile/run the code you're posting, that really isn't part of the deal. It is, however, your job to explain what you're trying to do and what functionality you're looking for when asking for help, so please get rid of the attitude or no one will want to help you :)
Was This Post Helpful? 0
  • +
  • -

#8 god?  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-April 10

Re: is there a way to convert java to javascript?

Posted 29 April 2010 - 05:58 PM

View PostPsychoCoder, on 29 April 2010 - 04:44 PM, said:

god? we shouldn't have to open an IDE and compile/run the code you're posting, that really isn't part of the deal. It is, however, your job to explain what you're trying to do and what functionality you're looking for when asking for help, so please get rid of the attitude or no one will want to help you :)


im sorry, i didn't mean it in a nasty way or anything. all i'd like to know is how to make a button that when u press it, it opens a second window with a different button.
Was This Post Helpful? 0
  • +
  • -

#9 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10803
  • View blog
  • Posts: 40,257
  • Joined: 27-December 08

Re: is there a way to convert java to javascript?

Posted 29 April 2010 - 06:03 PM

No need to use Javascript for this, as you can do it with HTML. If you use the target attribute for the <a> tag, you can set <a href="page.ext" target="_blank"><input type="button"></a>, where page.ext is the path and extension of the page you are trying to load.
Was This Post Helpful? 0
  • +
  • -

#10 god?  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 27-April 10

Re: is there a way to convert java to javascript?

Posted 30 April 2010 - 05:12 AM

View Postmacosxnerd101, on 29 April 2010 - 05:03 PM, said:

No need to use Javascript for this, as you can do it with HTML. If you use the target attribute for the <a> tag, you can set <a href="page.ext" target="_blank"><input type="button"></a>, where page.ext is the path and extension of the page you are trying to load.


i don't have a page to load from though, i'm trying to write it from scratch. you know how in java you can make JFrames? how can you do something like that in HTML or Javascript?
Was This Post Helpful? 0
  • +
  • -

#11 JMRKER  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 129
  • View blog
  • Posts: 837
  • Joined: 25-October 08

Re: is there a way to convert java to javascript?

Posted 30 April 2010 - 07:51 AM

Is this what you want to do?
See: http://www.pageresou...pt/jwinopen.htm
or: http://www.javascrip...aq/openinga.htm
or: http://www.yourhtmls...pupwindows.html

or something else?
Do a search for "javascript open new window" or some other word combination.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1