You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

theuserbl

Intermediate

  • "theuserbl" started this thread

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

1

Friday, July 24th 2009, 9:13pm

A little JabacoJava

If anybody think around, how Jabaco works, here a little Java-example:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
For example:

We have in Jabaco created a little program.
Form1 have a Height of 280 and a Width of 360.
In there we have drawn a Button on the position
150 from Top and 60 from Left. It have a Height of 100
and a Width of 250.
Then we have double-clicked on the Button "Command1"
and write in the command field:

Public Sub Command1_Click()
   System.out.println("Hi together!")
End Sub

Here the similar in Java:

*/

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class BasicJava extends JFrame implements ActionListener {
  private static JFrame Form1;
  private static JButton Command1;

  public static void main(String[] args) {
    Form1 = new JFrame("Form");
//    Form1.setSize(360,280);  // this would create the Frame to
//                             // that size, but we need the area
//                             // inside the Frame.
    JPanel p = new JPanel();   // And this is for the area size.
    p.setLayout(null);
    Command1 = new JButton("Command1");
    Command1.setBounds(60,150,250,100);
    Command1.addActionListener(new BasicJava());
    p.add(Command1);
    p.setPreferredSize(new Dimension(360,280));
    Form1.add(p);
    Form1.pack();
    Form1.setVisible(true);
    WindowListener l = new WindowAdapter()
    {
      public void windowClosing(WindowEvent we)
      {
        System.exit(0);
      }
    };
    Form1.addWindowListener(l);
  }

  public void actionPerformed(ActionEvent event) {
    if (event.getSource() == Command1) {
      Command1_Click();
    }
  }

  /* All things before have to be generated atomatically
     Now there comes the only part you will see as text in the IDE.
     But with BASIC-syntax. And later directly compiled to .class-files,
     so that people who have only a JRE and not the full JDK, can compile
     it.
  */

  public void Command1_Click() {
    System.out.println("Hi together!");
  }

}

Rate this thread
WoltLab Burning Board