 |
 |
 |
 |
| Programming & Packaging A place to discuss programming and packaging. |

19th July 2012, 04:25 PM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Quote:
Originally Posted by ah7013
Yup I think I'm defenitly running out of GUI toolkits with Perl bindings 
|
There are still the Perl bindings for the Java Swing classes: http://search.cpan.org/~philcrow/Java-Swing-0.14/
It requires the Inline and Inline::Java modules. The Fedora repos have the Inline module (yum install perl-inline), but you'll have to get Inline::Java here: http://search.cpan.org/~patl/Inline-Java-0.53/
You should try it!  If you're unfamiliar with the Swing API, just look at the Swing examples here so far, and use those to modify the 'calc' Perl script in the Java-Swing-0.14 example directory.
Latest update: we now have 30 examples.
Here's a summary of what we have right now, first organized by toolkit with the corresponding language bindings:
- GTK+: Haskell, Python, Perl, C++, Vala, Genie, C
- Qt: Python, C++, Java, Perl, Ruby
- Tk: Tcl, Perl, Python, Ruby
- Swing: Java, Python, Ruby
- XForms: C
- GNUstep: Objective-C
- Motif: C
- wxWidgets: Perl
- Icon: Icon
- Prima: Perl
- FOX: C++
- FLTK: C++
- MGUI: C
- EZWGL: C
- SWT: Java
Here's the list organized by programming language with the corresponding toolkit: - Perl: Tk, wxWidgets, Prima, GTK+, Qt
- C: XForms, Motif, MGUI, EZWGL, GTK+
- C++: Qt, FOX, FLTK, GTK+
- Python: Tk, Qt, GTK+, Swing
- Java: Swing, Qt, SWT
- Ruby: Tk, Swing, Qt
- Tcl: Tk
- Objective-C: GNUstep
- Haskell: GTK+
- Icon: Icon
- Vala: GTK+
- Genie: GTK+
I have another C-based example that I'll post soon (which will put C in the lead over Perl unless ah7013 hurries up  ), and possibly one with a language that hasn't appeared yet.
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

19th July 2012, 09:51 PM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's an example in the R programming language -- normally used for statistical computing -- using the built-in Tk bindings. R is in the Fedora repos (yum install R).
Here's the code:
Code:
#!/usr/bin/env Rscript
suppressPackageStartupMessages(library(tcltk))
sink("/dev/null", type="output")
win <- tktoplevel()
tkwm.title(win, "R/Tk Example Window")
tkwm.geometry(win, "400x150")
tkconfigure(win, bg="darkslateblue")
msg <- tklabel(win, text="Welcome!", font="Sans 32", bg="darkslateblue", fg="white")
tkpack(msg, pady=10)
ok_cb <- function()quit("yes")
.Tcl.callback(ok_cb)
ok <- tkbutton(win, text="OK", command=ok_cb)
tkpack(ok, pady=20)
tkwait.window(win)
That code can be run as a standalone executable script.
Here's the screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

20th July 2012, 04:16 AM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's an example in OCaml, using the Tk bindings (yum install ocaml-labltk-devel):
Code:
open Tk ;;
let top = openTk () ;;
Wm.title_set top "OCaml/Tk Example Window" ;;
Wm.geometry_set top "400x150" ;;
Toplevel.configure ~background:(`Color "#483D8B") top ;;
let msg = Label.create ~text:"Welcome!" ~font:"Sans 32"
~foreground:`White ~background:(`Color "#483D8B") top ;;
pack [msg] ~pady:10 ~side:`Top ;;
let ok = Button.create ~text:"OK" ~command:(fun () -> closeTk (); exit 0) top ;;
pack [ok] ~pady:20 ~side:`Bottom ;;
let _ = Printexc.print mainLoop () ;;
Save that in a file called ocamltkwindow.ml then compile and run it like this:
Code:
ocamlc -o ocamltkwindow -I +labltk labltk.cma ocamltkwindow.ml
./ocamltkwindow
Here's the screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

20th July 2012, 02:24 PM
|
 |
Registered "Cashew" User
|
|
Join Date: May 2010
Location: Adelaide, Australia
Age: 18
Posts: 614

|
|
|
Re: Programming challenge: Create a GUI window
Quote:
Originally Posted by RupertPupkin
There are still the Perl bindings for the Java Swing classes: http://search.cpan.org/~philcrow/Java-Swing-0.14/
It requires the Inline and Inline::Java modules. The Fedora repos have the Inline module (yum install perl-inline), but you'll have to get Inline::Java here: http://search.cpan.org/~patl/Inline-Java-0.53/
You should try it!  If you're unfamiliar with the Swing API, just look at the Swing examples here so far, and use those to modify the 'calc' Perl script in the Java-Swing-0.14 example directory.
|
Thanks for the links  . I installed Inline (urpmi perl-Inline) and both Inline::Java and Java::Swing off CPAN and got the 'calc' example up and running. Will see if I can get something deveopled in the next couple of days.
__________________
Running Mageia 3 (KDE 4.10) on an ASUS K55V (Core i5, 16GB RAM, 750GB HDD, Nvidia 610M)
|

20th July 2012, 03:53 PM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's an example in Pure, another functional language with Tk bindings. You can install Pure from the Fedora repos (yum install pure-devel), but you'll have to get the Tk bindings from here. All I had to do was modify the Makefile to use /usr/lib64 instead of /usr/lib, then ran make, then did "cp gnocl.pure tk.pure tk.so /usr/lib64/pure".
Here's the code:
Code:
using tk;
main = init_app $$ tk_main;
init_app = () when
tk "wm title . \"Pure-Tk Example Window\"";
tk "wm geometry . 400x150";
tk ". configure -bg darkslateblue";
tk "label .msg -font { -size 32 } -text \"Welcome!\" -bg darkslateblue -fg white";
tk "pack .msg -pady 10";
tk "button .ok -text OK -command exit";
tk "pack .ok -pady 20";
end;
if compiling then () else main;
Save that in a file called puretkwindow.pure then compile it like this:
Code:
pure -c puretkwindow.pure -o puretkwindow
Alternatively, you could run the file directly with "pure puretkwindow.pure", or by putting "#!/usr/bin/pure -x" at the top of puretkwindow.pure and running it as a standalone executable script.
Here's the screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

21st July 2012, 04:34 AM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's an example with the ancient SNOBOL -- yes, that SNOBOL! -- using its Tk bindings. For this don't bother with the version 1.3 snobol and snobol-devel packages in the Fedora repos, their Tcl/Tk support is busted (trying the example in the snobol4tcl man page bombs out with a signal 11). Instead grab the latest 1.4.1 version here: http://www.snobol4.org/csnobol4/curr/
I ran the configure script with just the --with-tcl option and got working Tcl/Tk support.
Here's the code:
Code:
-INCLUDE 'stcl.sno'
INTERP = STCL_CREATEINTERP()
STCL_EVAL(INTERP, "package require Tk") :F(END)
STCL_EVAL(INTERP,
+ 'wm title . "SNOBOL/Tk Example Window";'
+ 'wm geometry . 400x150;'
+ 'wm protocol . WM_DELETE_WINDOW {exit};'
+ '. configure -bg darkslateblue;'
+ 'label .msg -text "Welcome!" -font {-size 32} -bg darkslateblue -fg white;'
+ 'pack .msg -pady 10;'
+ 'button .ok -text OK -command {exit};'
+ 'pack .ok -pady 20;'
+ 'vwait ok')
OUTPUT = STCL_GETVAR(INTERP, "ok")
END
Save that in a file called snoboltkwindow.sno and run it like this:
Code:
snobol4 -b snoboltkwindow.sno
Here's the screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
Last edited by RupertPupkin; 21st July 2012 at 04:38 AM.
|

21st July 2012, 06:37 PM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's another C example, this time using Tk. You'll need the the tcl-devel and tk-devel packages installed for this to work.
Code:
#include <stdlib.h>
#include <tcl.h>
#include <tk.h>
int Tk_AppInitProc(Tcl_Interp *interp) {
if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR;
if (Tk_Init(interp) == TCL_ERROR) return TCL_ERROR;
Tcl_Eval(interp, "wm title . \"C/Tk Example Window\"");
Tcl_Eval(interp, "wm geometry . 400x150");
Tcl_Eval(interp, ". configure -bg darkslateblue");
Tcl_Eval(interp, "label .msg -text \"Welcome!\" -font {-size 32} -bg darkslateblue -fg white");
Tcl_Eval(interp, "pack .msg -pady 10");
Tcl_Eval(interp, "button .ok -text OK -command exit");
Tcl_Eval(interp, "pack .ok -pady 20");
Tk_MainLoop();
exit(0);
}
void main(int argc, char *argv[]) {
Tk_Main(argc, argv, Tk_AppInitProc);
}
Save that in a file called ctkwindow.c and compile it like this:
Code:
gcc -o ctkwindow ctkwindow.c -ltcl -ltk
Here's the screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

22nd July 2012, 11:49 AM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's an example in the Lua scripting language, using ltcltk, which provides Tk bindings. If you don't want to compile ltcltk from source (which takes a little tweaking of the Makefile to compile for 64-bit F17), you could install the luarocks package from the Fedora repos (yum install luarocks) then do "luarocks install ltcltk" as root.
Here's the code (to be run as an executable script):
Code:
#!/usr/bin/lua
require "ltk"
ltk.wm{'title', '.', "Lua/Tk Window Example"}
ltk.wm{'geometry', '.', "400x150"}
ltk.wcmd('.'){'configure', background="darkslateblue"}
msg = ltk.label{text="Welcome!", font={'Sans',32}, bg="darkslateblue", fg="white"}
ltk.pack{msg, pady=10}
ok = ltk.button{text="OK", command=function() ltk.exit() end}
ltk.pack{ok, pady=20}
ltk.mainloop()
Screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

23rd July 2012, 06:05 AM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's another Tcl example, this time using the GTK+ bindings available through the Gnocl package. Version 0.9.96 seems to have problems on 64-bit systems, but I did get version 0.9.95 to compile in F17 x86_64; you can get it here. I then did
Code:
mkdir /usr/lib64/tcl8.5/gnocl0.9.95; cp gnocl.so pkgIndex.tcl /usr/lib64/tcl8.5/gnocl0.9.95
from the source directory and had a working Gnotcl.
Here's the code, which can be run as a script:
Code:
#!/usr/bin/tclsh
package require Gnocl
set msg [gnocl::label -text {%<<span foreground="white">Welcome!</span>} -baseFont {Sans 32}]
set ok [gnocl::button -text "OK" -onClicked {exit}]
set okBox [gnocl::box -orientation horizontal -borderWidth 0 -expand 1 -children "$ok"]
set vbox [gnocl::box -orientation vertical -borderWidth 0 -spacing 40 -children "$msg $okBox"]
set win [gnocl::window -title "Gnocl Window Example" -defaultWidth 400 -defaultHeight 150 \
-onDestroy {exit} -child $vbox -borderWidth 15 -backgroundColor darkslateblue]
gnocl::mainLoop
Here's the screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

23rd July 2012, 12:47 PM
|
 |
Registered "Cashew" User
|
|
Join Date: May 2010
Location: Adelaide, Australia
Age: 18
Posts: 614

|
|
|
Re: Programming challenge: Create a GUI window
Quote:
Originally Posted by ah7013
Thanks for the links  . I installed Inline (urpmi perl-Inline) and both Inline::Java and Java::Swing off CPAN and got the 'calc' example up and running. Will see if I can get something deveopled in the next couple of days.
|
Having a few issues with it so will be another few days I think.
__________________
Running Mageia 3 (KDE 4.10) on an ASUS K55V (Core i5, 16GB RAM, 750GB HDD, Nvidia 610M)
|

23rd July 2012, 04:24 PM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's another Tcl example, this time using the Qt bindings available through the qtcl package. I had to make a couple changes to the configure script, the qtcl.pri file generated by qmake, and the lib/QTclMessageBox.cpp source file in order to compile qtcl in F17 x86_64. If anyone's interested in the details let me know.
Here's the code, which can be run as an executable script:
Code:
#!/usr/bin/env qtcl
qt create QMainWindow .win windowTitle "Qtcl Window Example" geometry "500 450 400 150"
.win setStyleSheet "QMainWindow, QLabel { background-color: #483D8B; color: white }"
qt create QLabel .win.msg text "Welcome!" geometry "85 20 230 50" font "Sans, 32" alignment AlignHCenter
qt create QPushButton .win.ok text "OK" geometry "175 100 50 30"
.win.ok connect clicked() .win close()
.win show
Screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

23rd July 2012, 09:03 PM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Another Java example, this time using plain old AWT, the default GUI in Java before Swing came along. This one required explicitly setting the background of the button since in AWT -- unlike in Swing -- the button automatically inherits the colors of its parent container.
Code:
import java.awt.*;
import java.awt.event.*;
public class awtjavawindow {
public static void main(String[] args) {
Frame f = new Frame("Java AWT Window Example");
f.setSize(400,175);
f.setLayout(new BorderLayout());
f.setBackground(new Color(72,61,139));
Label msg = new Label("Welcome!", Label.CENTER);
msg.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 32));
msg.setForeground(Color.WHITE);
f.add(msg, BorderLayout.CENTER);
Panel bottom = new Panel();
Button ok = new Button("OK");
ok.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
System.exit(0);
}
});
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent event) {
System.exit(0);
}
});
bottom.add(ok);
ok.setBackground(new Color(222,222,222)); //Reset to default gray87
f.add(bottom, BorderLayout.SOUTH);
f.setVisible(true);
}
}
Save that code in a file called awtjavawindow.java then compile and run it like this:
Code:
javac awtjavawindow.java
java awtjavawindow
Screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

24th July 2012, 01:18 AM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Another C example, this time using the XView toolkit (which used to be the basis of OpenWindows, the default GUI in Solaris before CDE came along). XView has been out of the Fedora repos for a long time; the last RPMs were for Fedora 8, which you can get here (download the xview and xview-devel RPMs and use rpm -ivh to install them). It's 32-bit only, so to get it to work you'll need to install the following 32-bit packages in Fedora: glibc.i686, libXext.i686, libX11.i686, libxcb.i686, libXau.i686.
Here's the code:
Code:
#include <xview/xview.h>
#include <xview/frame.h>
#include <xview/panel.h>
#include <xview/font.h>
#include <xview/cms.h>
Frame frame;
void quit() {
xv_destroy_safe(frame);
}
void main(int argc, char *argv[]) {
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
static Xv_singlecolor cms_colors[] = {
{ 72, 61, 139 },
{ 255, 255, 255 },
{ 71, 61, 139 }
};
Cms cms = (Cms)xv_create(ROOT_FRAME, CMS,
CMS_CONTROL_CMS, FALSE,
CMS_TYPE, XV_STATIC_CMS,
CMS_SIZE, 3,
CMS_COLORS, cms_colors,
NULL);
frame = (Frame)xv_create(ROOT_FRAME, FRAME,
FRAME_LABEL, "XView Example Window",
XV_WIDTH, 400,
XV_HEIGHT, 150,
NULL);
Panel panel = (Panel)xv_create(frame, PANEL,
WIN_CMS, cms,
WIN_BACKGROUND_COLOR, 0,
NULL);
Font font = (Font)xv_find(XV_NULL, FONT,
FONT_NAME, "-adobe-helvetica-medium-r-normal--34-240-100-100-p-176-iso8859-1", NULL);
(void) xv_create(panel, PANEL_MESSAGE,
XV_X, 125,
XV_Y, 30,
PANEL_LABEL_STRING, "Welcome!",
PANEL_LABEL_FONT, font,
PANEL_ITEM_COLOR, 1,
NULL);
(void) xv_create(panel, PANEL_BUTTON,
XV_X, 180,
XV_Y, 115,
PANEL_LABEL_STRING, "OK",
PANEL_NOTIFY_PROC, quit,
PANEL_ITEM_COLOR, 1,
NULL);
xv_main_loop(frame);
exit(0);
}
Save that in a file called xvwindow.c and compile it like this:
Code:
gcc -m32 -o xvwindow xvwindow.c -lxview -I/usr/openwin/include -L/usr/openwin/lib
Screenshot (taken under the XView-based olvwm window manager in F17):
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

24th July 2012, 06:26 AM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Latest update: we now have 40 examples.
Here's a summary of what we have right now, first organized by programming language with the corresponding toolkit: - C: XForms, Motif, MGUI, EZWGL, GTK+, Tk, XView
- Perl: Tk, wxWidgets, Prima, GTK+, Qt
- C++: Qt, FOX, FLTK, GTK+
- Python: Tk, Qt, GTK+, Swing
- Java: Swing, Qt, SWT, AWT
- Ruby: Tk, Swing, Qt
- Tcl: Tk, GTK+, Qt
- Objective-C: GNUstep
- Haskell: GTK+
- Icon: Icon
- Vala: GTK+
- Genie: GTK+
- R: Tk
- OCaml: Tk
- Pure: Tk
- SNOBOL: Tk
- Lua: Tk
So C has taken the lead over Perl since the last summary.
Here's the list organized by toolkit with the corresponding language bindings: - Tk: Tcl, Perl, Python, Ruby, R, OCaml, Pure, SNOBOL, C, Lua
- GTK+: Haskell, Python, Perl, C++, Vala, Genie, C, Tcl
- Qt: Python, C++, Java, Perl, Ruby, Tcl
- Swing: Java, Python, Ruby
- XForms: C
- GNUstep: Objective-C
- Motif: C
- wxWidgets: Perl
- Icon: Icon
- Prima: Perl
- FOX: C++
- FLTK: C++
- MGUI: C
- EZWGL: C
- SWT: Java
- AWT: Java
- XView: C
So Tk has taken the lead over GTK+ since the last summary.
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|

24th July 2012, 04:41 PM
|
 |
Registered User
|
|
Join Date: Nov 2006
Location: Detroit
Posts: 4,621

|
|
|
Re: Programming challenge: Create a GUI window
Here's an example in the JVM-based language Scala, using its built-in Swing capabilities. The code below works with Scala 2.9.2.
Code:
import scala.swing._
import scala.swing.event._
import scala.swing.BorderPanel._
object scalawindow extends SimpleSwingApplication {
def top = new MainFrame {
title = "Scala Window Example"
object msg extends Label {
text = "Welcome!"
foreground = new Color(255,255,255)
font = new Font("Sans",0,32)
}
object ok extends Button {
text = "OK"
}
object bottom extends FlowPanel {
contents.append(ok)
background = new Color(72,61,139)
}
contents = new BorderPanel {
background = new Color(72,61,139)
layout(msg) = Position.Center
layout(bottom) = Position.South
preferredSize = new Dimension(400,150)
}
pack
listenTo(ok)
reactions += {
case ButtonClicked(ok) => quit()
}
}
}
Save that in a file called scalawindow.scala, then compile and run it like this:
Code:
scalac scalawindow.scala
scala -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true scalawindow
Screenshot:
__________________
OS: Fedora 18 x86_64 | CPU: AMD64 3700+ 2.2GHz | RAM: 2GB PC3200 DDR | Disk: 160GB PATA | Video: ATI Radeon 7500 AGP 64MB | Sound: Turtle Beach Santa Cruz CS4630 | Ethernet: Realtek 8110SC
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 20:16 (Saturday, 25-05-2013)
|
|
 |
 |
 |
 |
|
|