Yes I saw that article thank you but the syntax is very different.. I need the syntax for VB not Java
Here is a port of the program, to which Dani linked to:
|
Jabaco Source
|
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
|
Private OS As String = LCase(System.getProperty("os.name"))
Public Sub Command1_Click()
Dim s As String
s = OS + vbNewLine
If isWindows() Then
s = s + "This is Windows"
Elseif isMac() Then
s = s + "This is Mac"
Elseif isUnix() Then
s = s + "This is Unix or Linux"
Elseif isSolaris() Then
s = s + "This is Solaris"
Else
s = s + "Your OS is not support!!"
End If
MsgBox s
End Sub
Public Function isWindows() As Boolean
isWindows = False
If InStr(OS, "win")>= 1 Then isWindows = True
End Function
Public Function isMac() As Boolean
isMac = False
If InStr(OS, "mac")>= 1 Then isMac = True
End Function
Public Function isUnix() As Boolean
isUnix = False
If InStr(OS, "nix")>= 1 OR InStr(OS, "nux")>= 1 Or InStr(OS, "aix")>= 1 Then isUnix = True
End Function
Public Function isSolaris() As Boolean
isSolaris = False
If InStr(OS, "sunos")>= 1 Then isSolaris = True
End Function
|
But it is strogly recommend to make no difference between the systems in case of the size of the controls.
Depending of the Java LookAndFeel, the used Look and Feel of the native system and the installed fonts, the fonts on the controls needs more or less space on each platform.
The same is with the colors. If the native LookAndFeel changed, other colors are needed.
For example: For the colors you can use the default colors of the current Java-LookAndFeel (which can differ to the colors Jabaco used).
Here an example:
|
Jabaco Source
|
1
2
3
4
5
|
Public Sub Command1_Click()
Dim b As New javax#swing#JButton()
Command1.BackColor = ColorToRGB(b.getBackground)
Me.BackColor = ColorToRGB(b.getBackground)
End Sub
|
Greatings
theuserbl