Drawing "Hello world" on screen
Hello
this is also a program for beginners that draws a "Hello world" in the screen :-
Code :
import waba.ui.*;
import waba.fx.*;
public class HelloWorld extends MainWindow
{
public void onPaint(Graphics g)
{
g.setColor(0, 0, 0);
g.drawText("Hello World", 0, 0);
}
}
Re: Drawing "Hello world" on screen
Please note you cannot do this unless you have the waba framework & wabaJDK installed on your machine.
EDIT: Thanks JavaPF
Chris
Re: Drawing "Hello world" on screen
hi,
heres a sample code that draw hello world. :)
Code :
import javax.swing.JFrame;
import javax.swing.*;
public class ex {
public static JFrame frame = new JFrame("Hello Java Forums!!!");
public static JLabel label;
public static void createAndShowGUI() {
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
label = new JLabel("Hello World");
frame.add(label);
frame.setSize(300, 200);
frame.setVisible(true);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
};
}
Cheers,
Truffy
:cool:
Re: Drawing "Hello world" on screen
This is a much better example Truffy. Thanks. The code posted by shikh_albelad requires non standard imports.
Re: Drawing "Hello world" on screen
Quote:
Originally Posted by
JavaPF
This is a much better example Truffy. Thanks. The code posted by shikh_albelad requires non standard imports.
Yup. Maybe he went to the waba tutorial site. Better use the existing one. :)
Cheers,
Truffy