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.
Trainee
Date of registration: Feb 9th 2009
Location: Mladenovac, Serbia
Occupation: Programming
Hobbies: Programming
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 |
Function Test () As ActionListener MsgBox "proba" End Function Public Sub Command1_Click() Dim jbut As JButton=New JButton jbut.addActionListener (Test) Me.add (jbut) jbut.setBounds (10,10,30,30) End Sub |
Trainee
Date of registration: Feb 9th 2009
Location: Mladenovac, Serbia
Occupation: Programming
Hobbies: Programming
Source code |
|
1 2 3 4 |
Implements ActionListener Public Sub actionPerformed(arg2 As ActionEvent) MsgBox "dd" End Sub |
Source code |
|
1 2 3 4 5 6 7 |
Public Sub Command1_Click() Dim jb As JButton=New JButton ("test") Dim test As New Class1 jb.addActionListener (test) Me.add jb jb.setBounds 10,10,60,20 End Sub |
Quoted
is there any other solution to create event classes for java components (simple way)?
Trainee
Date of registration: Feb 9th 2009
Location: Mladenovac, Serbia
Occupation: Programming
Hobbies: Programming
Quoted
or i must add every time new class file
Trainee
Date of registration: Feb 9th 2009
Location: Mladenovac, Serbia
Occupation: Programming
Hobbies: Programming
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
Implements java#awt#Event#ActionListener Public Sub Command1_Click() Dim jb As JButton=New JButton ("Test") jb.addActionListener Cast(Form1,java#awt#Event#ActionListener) Me.add jb jb.setBounds 10,10,60,20 End Sub Public Sub actionPerformed(arg2 As ActionEvent) MsgBox "test" End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Option Explicit Import java#awt#Event Implements java#awt#Event#ActionListener Public Sub Form_Load() Dim jb As JButton = New JButton("Test") Me.add(jb) jb.addActionListener(Me) jb.setBounds 10,10,60,20 End Sub Public Sub actionPerformed(arg2 As ActionEvent) ' 2 examples how to use arg2 As ActionEvent MsgBox arg2.getActionCommand Dim jb As JButton = Cast(arg2.getSource, JButton) jb.setForeground(RgbToColor(&HFF)) End Sub |
Trainee
Date of registration: Feb 9th 2009
Location: Mladenovac, Serbia
Occupation: Programming
Hobbies: Programming