- #1
Evgeny.Makarov
Gold Member
MHB
- 2,436
- 4
A https://driven2services.com/staging/mh/index.php?threads/18929/ about Java prompted me to ask about graphics in Java and C#, especially from the standpoint of teaching. I know how to create graphical applications in Java using Swing, but I know very little about C#.
Swing applications have a pretty steep learning curve. For example, here is basically the smallest program, written in a recommended, scalable way.
To fully understand this code, one must know something about:
I am wondering how this compares to creating graphical programs in C# in the context of a computer graphics course. Specifically, I have these questions.
Thanks in advance.
Swing applications have a pretty steep learning curve. For example, here is basically the smallest program, written in a recommended, scalable way.
Code:
import java.awt.*;
import javax.swing.*;
public class MinExample extends JPanel {
public MinExample() {
setBackground(Color.WHITE);
setPreferredSize(new Dimension(500, 300));
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame("Minimal Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new MinExample());
frame.pack();
frame.setVisible(true);
}
});
}
}
To fully understand this code, one must know something about:
- the libraries (AWT vs Swing),
- object oriented programming, including inheritance, interfaces ([m]Runnable[/m]) and inner classes,
- layout managers ([m]setPreferredSize[/m]),
- multithreading and thread safety ([m]invokeLater[/m]).
I am wondering how this compares to creating graphical programs in C# in the context of a computer graphics course. Specifically, I have these questions.
- Java is simpler than C++. (It does not have destructors, multiple inheritance and class friends, all non-static methods are virtual, etc.) How does C# compare with C++ and Java?
- How much does one need to know to fully understand simple graphical programs?
- Which is more complicated: Java Swing or C# graphics library?
- Are there free IDEs for writing in C#?
- Can one write graphical applications in C# in Linux? I am asking about a reliable, well-known way and not some experimental implementation.
Thanks in advance.