So I'm thinking about making a GUI. My friend told me he knew how to do it in C#, so I went that method in setting the GUI up. Is there anyway to get a C# made GUI usable in java?
-
Maybe you can just use C# then and not bother with Java? – MajesticRa Feb 27 '12 at 01:19
6 Answers
Yes you can. You absolutely should not. I once wrote a perl application that used a VB GUI that i made, they communicated via OLE.
This is probably the worst construct you could ever do so don't :)

- 2,708
- 4
- 22
- 35
No! It would not work. Java's GUI classes are different, so even if you renamed your .cs files to .java files and made slight modifications, the code would not work.

- 14,631
- 33
- 94
- 132
No. It won't work. You can't compile Java and C# into a single executable package.

- 242,243
- 40
- 408
- 536
I think you should learn how to make a GUI in Java if you are coding in Java. However if you want both of C# and Java to interoperate, then you need a new layer which acts like a bridge between a C# program runs on CLR and Java program runs on JVM. The following link has a good explanation about how to call Java routines directly from a C# program over runtime bridges:
http://www.devx.com/interop/Article/19945/1954
You need to bind something on GUI with an appropriate logic. Such as File>New menu selection might exist for creating a new file. Therefore this menu command needs to be bound to a logic. You can not run away without writing these logic, the event handlers or without defining some other functionalities inside of GUI classes. Strictly speaking, you always need to write a lot of code on presentation layer which consists of GUI classes. So that, your friend does also need to build up the presentation layer itself. Because a useless user interface is called a prototype not a program. And also do not forget about that runtime bridges significantly decrease the performance. Eventually, I suggest you to go and learn how to make GUI in Java.

- 646
- 6
- 14
-
You _can_ run Java on the CLR, but it's not normally done. See [IKVM.net](http://www.ikvm.net). – parkovski Feb 27 '12 at 01:29
-
I did not know it, thanks. Eventhough I have never used it, I guess it wont operate well. Still this might be an alternative solution for Scaream's question if he and his friend do a good teamwork :) – ahmet Feb 27 '12 at 01:52