Window creation: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
Line 1: Line 1:
{{task}}
[http://licohwar.homeblock.com/library/html/nadia-mistero/ nadia mistero pietra azzurra] [http://benevolently.freehostia.com/content/view/alias-prima/ alias. prima serie] [http://licohwar.homeblock.com/library/html/chicas-calatas/ chicas calatas todo] [http://saline-joy.freehostia.com/web/lito.htm lito] [http://greensticky.freehostia.com/library/html/fuoritempo/ fuoritempo] [http://saline-joy.freehostia.com/web/western-digital.htm western digital s-ata 120gb] [http://kopapguw.homeblock.com/topic/caravan-of/ caravan of love housemartins] [http://mcwardlo.t35.com/library/html/victoria-gemme/ victoria gemme snc] [http://kopapguw.homeblock.com/topic/code-pirate/ code pirate tv numerique] [http://wainfan.t35.com/view/new/web-messenger.htm web messenger] [http://grahrens.125mb.com/view/new/hotel-video/ hotel video] [http://coarmago.t35.com/content/view/disco-pacha/ disco pacha 2004] [http://www.freewebtown.com/starbriteyellow/resources/articles/amd-.htm amd 64 bit 3000 socket 939] [http://failtoexpress.freehostia.com/html/ricerca-libri.htm ricerca libri] [http://greensticky.freehostia.com/library/html/scanner-hp/ scanner hp scanjet 2400] [http://www.freewebtown.com/starbriteyellow/resources/articles/ingegneri-acustica.htm ingegneri acustica] [http://getm0ney.freewebpage.org/lib/mitchell-sir/ mitchell, sir thomas livingstone] [http://scaleslea.freewebpage.org/text/directory/saeco-magic/ saeco magic cappuccino] [http://coarmago.t35.com/content/view/falciatura/ falciatura] [http://coarmago.t35.com/content/view/www-cicpc/ www cicpc gov ve] [http://licohwar.homeblock.com/library/html/foto-hard/ foto hard cacca] [http://oedi.freehostia.com/text/directory/gigi-d/ gigi d alessi] [http://beshennayabelka.freehostia.com/content/view/magazzino-fatturazione.htm magazzino fatturazione] [http://saline-joy.freehostia.com/web/garnero.htm garnero] [http://saline-joy.freehostia.com/web/canon-.htm canon - scanner canoscan 9950f] [http://benevolently.freehostia.com/content/view/autunno-inverno/ autunno inverno diesel pantaloni uomo] [http://kopapguw.homeblock.com/topic/indeo-xp/ indeo xp for windows download] [http://saline-joy.freehostia.com/web/schaub-lorenz.htm schaub lorenz videoregistratori] [http://www.freewebtown.com/starbriteyellow/resources/articles/fiesta-de.htm fiesta de la] [http://lorcaxon.homeblock.com/data/mosella/ mosella] [http://gawelzba.t35.com/library/html/stivali-oxs.htm stivali oxs] [http://boreldar.t35.com/text/directory/fiat-panda.htm fiat panda anno 2002] [http://scaleslea.freewebpage.org/text/directory/sony-/ sony - dcr hc22e] [http://www.freewebtown.com/starbriteyellow/resources/articles/vacanza-europa.htm vacanza europa] [http://zoelverd.freeweb7.com/description/lib/aldo-biscardi/ aldo biscardi] [http://zoelverd.freeweb7.com/description/lib/codigo-morse/ codigo morse] [http://getraylo.freeweb7.com/img/styles/audi-.htm audi a6 2.7 v6 t quattro advance] [http://www.freewebtown.com/prncessprncipe/library/html/marcia-nunziale.htm marcia nunziale midi] [http://beshennayabelka.freehostia.com/content/view/teanna-kai.htm teanna kai] [http://scaleslea.freewebpage.org/text/directory/acer-centrino/ acer centrino 1 7] [http://zoelverd.freeweb7.com/description/lib/yattaman-vol/ yattaman. vol. 01] [http://benevolently.freehostia.com/content/view/ritorno-dalle/ ritorno dalle acque maledette] [http://www.freewebtown.com/boogiejames/topic/sony-cyber.htm sony cyber dsc t7] [http://grahrens.125mb.com/view/new/fucky-it/ fucky it] [http://getraylo.freeweb7.com/img/styles/lucia-tova.htm lucia tova] [http://huruple.125mb.com/text/directory/nudismo-chat/ nudismo chat] [http://getm0ney.freewebpage.org/lib/casalinghe-belle/ casalinghe belle] [http://grahrens.125mb.com/view/new/ufficio-san/ ufficio san vito capo] [http://www.freewebtown.com/prncessprncipe/library/html/ombre-rosse.htm ombre rosse dvd] [http://greensticky.freehostia.com/library/html/don-omar/ don omar baila morena] [http://oedi.freehostia.com/text/directory/dvd-hdmi/ dvd hdmi yamaha] [http://mauballe.125mb.com/web/foto-cocorico/ foto cocorico] [http://wainfan.t35.com/view/new/p-sci.htm p60 sci] [http://getm0ney.freewebpage.org/lib/andrea-tofanelli/ andrea tofanelli] [http://zoelverd.freeweb7.com/description/lib/frasi-auguri/ frasi auguri 50 anni matrimonio] [http://coarmago.t35.com/content/view/gigaset-sl/ gigaset sl150 colour] [http://grahrens.125mb.com/view/new/ilmenite/ ilmenite] [http://greensticky.freehostia.com/library/html/video-decapitazione/ video decapitazione giapponese] [http://oedi.freehostia.com/text/directory/viaggi-crociera/ viaggi crociera] [http://zoelverd.freeweb7.com/description/lib/hect/ hect] [http://gawelzba.t35.com/library/html/sempron.htm sempron 754] [http://coarmago.t35.com/content/view/video-giochi/ video giochi pc] [http://getraylo.freeweb7.com/img/styles/grass.htm grass] [http://zoelverd.freeweb7.com/description/lib/linda-e/ linda e il brigadiere. episodio 1] [http://mcwardlo.t35.com/library/html/www-ytv/ www ytv com] [http://www.freewebtown.com/prncessprncipe/library/html/silenzioso-inganno.htm silenzioso inganno] [http://coarmago.t35.com/content/view/david-banner/ david banner] [http://oedi.freehostia.com/text/directory/lottu/ lottu] [http://www.freewebtown.com/starbriteyellow/resources/articles/motorola-v.htm motorola v1050 cellulari] [http://beshennayabelka.freehostia.com/content/view/memory-stick.htm memory stick adattatore] [http://www.freewebtown.com/prncessprncipe/library/html/blocca-porta.htm blocca porta] [http://scaleslea.freewebpage.org/text/directory/voli-su/ voli su ibiza] [http://huruple.125mb.com/text/directory/viersen/ viersen] [http://getm0ney.freewebpage.org/lib/dlink-dbt/ d-link dbt 120] [http://failtoexpress.freehostia.com/html/www-hotmail.htm www hotmail com fr] [http://coarmago.t35.com/content/view/bai-ling/ bai ling] [http://boreldar.t35.com/text/directory/controrapina.htm controrapina] [http://lorcaxon.homeblock.com/data/la-mer/ la mer snc] [http://grahrens.125mb.com/view/new/lft/ lft] [http://oedi.freehostia.com/text/directory/la-stanza/ la stanza misteriosa] [http://wainfan.t35.com/view/new/conte-di.htm conte di montecristo dumas libri] [http://saline-joy.freehostia.com/web/meis-hot.htm meis hot tango] [http://getm0ney.freewebpage.org/lib/sony-vaio/ sony vaio desktop] [http://selemku.t35.com/text/directory/mercedes-c.htm mercedes c 240] [http://zoelverd.freeweb7.com/description/lib/honda-civic/ honda civic 1.4] [http://scaleslea.freewebpage.org/text/directory/asus-anslideluxe/ asus a8n-sli-deluxe] [http://mcwardlo.t35.com/library/html/modellino-della/ modellino della uno turbo] [http://getm0ney.freewebpage.org/lib/delonghi-climatizzatori/ delonghi climatizzatori] [http://huruple.125mb.com/text/directory/donna-delle/ donna delle pulizie] [http://coarmago.t35.com/content/view/notte-forse/ notte forse] [http://selemku.t35.com/text/directory/molluschicoltura.htm molluschicoltura] [http://lorcaxon.homeblock.com/data/finger/ finger] [http://zoelverd.freeweb7.com/description/lib/protezione-lcd/ protezione lcd] [http://greensticky.freehostia.com/library/html/culla-culle/ culla culle e lettini] [http://grahrens.125mb.com/view/new/cd-cocciante/ cd cocciante notre dame] [http://www.freewebtown.com/prncessprncipe/library/html/mappa-autostrade.htm mappa autostrade] [http://www.freewebtown.com/starbriteyellow/resources/articles/nuovi-dettagli.htm nuovi dettagli su pro evolution soccer per psp] [http://failtoexpress.freehostia.com/html/principio-di.htm principio di heisemberg] [http://saline-joy.freehostia.com/web/grease-italiano.htm grease italiano canzoni e musica] [http://scaleslea.freewebpage.org/text/directory/home-businesses/ home businesses] [http://selemku.t35.com/text/directory/sei-la.htm sei la vita] [http://beshennayabelka.freehostia.com/content/view/muro-di.htm muro di berlino] [http://mcwardlo.t35.com/library/html/volano-chat/ volano chat] [http://mauballe.125mb.com/web/triband-nokia/ triband nokia cellulari] [http://www.freewebtown.com/starbriteyellow/resources/articles/kingston-mmc.htm kingston mmc rs dv 512] [http://grahrens.125mb.com/view/new/avi-lettori/ avi lettori dvd] [http://grahrens.125mb.com/view/new/motorizazione-livorno/ motorizazione livorno] [http://licohwar.homeblock.com/library/html/sfondo-paesaggio/ sfondo paesaggio esotichi] [http://www.freewebtown.com/boogiejames/topic/jaguar-x.htm jaguar x] [http://benevolently.freehostia.com/content/view/trans-i/ trans i] [http://gawelzba.t35.com/library/html/congelatore-tavolo.htm congelatore tavolo] [http://greensticky.freehostia.com/library/html/ombrelloni/ ombrelloni] [http://flheddin.125mb.com/content/view/rafael-dropulic.htm rafael dropulic] [http://grahrens.125mb.com/view/new/letti-castello/ letti castello] [http://saline-joy.freehostia.com/web/dll.htm dll] [http://gawelzba.t35.com/library/html/immagini-e.htm immagini e clip art gratuite] [http://greensticky.freehostia.com/library/html/ficino/ ficino] [http://gawelzba.t35.com/library/html/patricia-faria.htm patricia faria] [http://lorcaxon.homeblock.com/data/buoni-e/ buoni e cattivi mid] [http://boreldar.t35.com/text/directory/power-rangers.htm power rangers] [http://oedi.freehostia.com/text/directory/piccola-fiammiferaia/ piccola fiammiferaia] [http://licohwar.homeblock.com/library/html/slovenia-terme/ slovenia terme] [http://beshennayabelka.freehostia.com/content/view/rosa-tigre.htm rosa tigre] [http://huruple.125mb.com/text/directory/programma-di/ programma di fotoritocco] [http://www.freewebtown.com/starbriteyellow/resources/articles/vedo-sento.htm vedo sento hellen] [http://www.freewebtown.com/starbriteyellow/resources/articles/marta-marta.htm marta marta] [http://grahrens.125mb.com/view/new/solo-eammon/ solo eammon] [http://lorcaxon.homeblock.com/data/xp-pro/ xp pro siemens notebook] [http://greensticky.freehostia.com/library/html/jacket-equilibratori/ jacket equilibratori] [http://getm0ney.freewebpage.org/lib/dual-shock/ dual shock pc] [http://www.freewebtown.com/prncessprncipe/library/html/noleggio-audi.htm noleggio audi a3] [http://boreldar.t35.com/text/directory/istituto-luce.htm istituto luce] [http://www.freewebtown.com/prncessprncipe/library/html/filmore.htm filmore] [http://scaleslea.freewebpage.org/text/directory/abby-winters/ abby winters] [http://zoelverd.freeweb7.com/description/lib/album-digitale/ album digitale] [http://beshennayabelka.freehostia.com/content/view/goldriver.htm goldriver] [http://getraylo.freeweb7.com/img/styles/ovation-cc.htm ovation cc047] [http://huruple.125mb.com/text/directory/roberto-cavalli/ roberto cavalli arancione] [http://flheddin.125mb.com/content/view/primi-sintomo.htm primi sintomo gravidanza] [http://flheddin.125mb.com/content/view/encarta-com.htm encarta com mx] [http://huruple.125mb.com/text/directory/pr/ pr] [http://gawelzba.t35.com/library/html/mp.htm mp3 60] [http://zoelverd.freeweb7.com/description/lib/creed-my/ creed my sacrifice] [http://boreldar.t35.com/text/directory/sfondi-con.htm sfondi con sommergibili] [http://grahrens.125mb.com/view/new/opel-corsa/ opel corsa 1.7 cdti] [http://benevolently.freehostia.com/content/view/neffa-come/ neffa come mai] [http://beshennayabelka.freehostia.com/content/view/crans-montana.htm crans montana] [http://greensticky.freehostia.com/library/html/pam-grier/ pam grier play boy] [http://www.freewebtown.com/starbriteyellow/resources/articles/paffendorf-africa.htm paffendorf africa] [http://getm0ney.freewebpage.org/lib/www-carismi/ www carismi it] [http://lorcaxon.homeblock.com/data/eva-contro/ eva contro] [http://www.freewebtown.com/boogiejames/topic/adsl-azienda.htm adsl azienda] [http://beshennayabelka.freehostia.com/content/view/margarita-laso.htm margarita laso] [http://scaleslea.freewebpage.org/text/directory/monitor-per/ monitor per bambino] [http://mcwardlo.t35.com/library/html/little-girl/ little girl] [http://failtoexpress.freehostia.com/html/hilary-duff.htm hilary duff film dvd] [http://saline-joy.freehostia.com/web/centri-riabilitazione.htm centri riabilitazione] [http://getraylo.freeweb7.com/img/styles/acer-pentium.htm acer pentium 4] [http://wainfan.t35.com/view/new/blockbusters.htm blockbusters] [http://licohwar.homeblock.com/library/html/il-mistero/ il mistero del castello nero] [http://failtoexpress.freehostia.com/html/macarena-mp.htm macarena mp3] [http://getm0ney.freewebpage.org/lib/monteclair/ monteclair] [http://wainfan.t35.com/view/new/vini-italiani.htm vini italiani] [http://flheddin.125mb.com/content/view/testo-f.htm testo f u right back] [http://www.freewebtown.com/starbriteyellow/resources/articles/parrucche-e.htm parrucche e trecce] [http://kopapguw.homeblock.com/topic/athlon-fx/ athlon fx 55] [http://www.freewebtown.com/boogiejames/topic/rowenta.htm rowenta 2000] [http://failtoexpress.freehostia.com/html/lugares-turisticos.htm lugares turisticos de xalapa] [http://saline-joy.freehostia.com/web/peer-to.htm peer to peer] [http://huruple.125mb.com/text/directory/sogni-ad/ sogni ad occhi aperti] [http://www.freewebtown.com/prncessprncipe/library/html/drda-jan.htm drda, jan] [http://beshennayabelka.freehostia.com/content/view/standard-telecom.htm standard telecom cordless] [http://huruple.125mb.com/text/directory/due-a/ due a mano] [http://mcwardlo.t35.com/library/html/la-primera/ la primera ves] [http://wainfan.t35.com/view/new/bologna-annuncio.htm bologna annuncio] [http://oedi.freehostia.com/text/directory/soo-garay/ soo garay] [http://www.freewebtown.com/boogiejames/topic/mini-brescia.htm mini brescia] [http://wainfan.t35.com/view/new/mappatura-dei.htm mappatura dei processi] [http://coarmago.t35.com/content/view/philips-key/ philips key ring digital camera] [http://www.freewebtown.com/starbriteyellow/resources/articles/www-annunci.htm www annunci 69 it] [http://zoelverd.freeweb7.com/description/lib/missione-caracas/ missione caracas] [http://getm0ney.freewebpage.org/lib/la-signora/ la signora del terzo piano] [http://boreldar.t35.com/text/directory/indici-economici.htm indici economici] [http://getraylo.freeweb7.com/img/styles/forse.htm forse] [http://licohwar.homeblock.com/library/html/collezionismo-cartoline/ collezionismo cartoline] [http://selemku.t35.com/text/directory/legend-of.htm legend of 1900] [http://failtoexpress.freehostia.com/html/dragon-din.htm dragon din tae] [http://gawelzba.t35.com/library/html/ligabue-nome.htm ligabue nome e cognome] [http://oedi.freehostia.com/text/directory/roma-colonia/ roma colonia] [http://www.freewebtown.com/starbriteyellow/resources/articles/partition-magic.htm partition magic 8] [http://beshennayabelka.freehostia.com/content/view/cartelera-cinepolis.htm cartelera cinepolis] [http://coarmago.t35.com/content/view/rtl/ rtl102 5] [http://oedi.freehostia.com/text/directory/e-maze/ e maze] [http://grahrens.125mb.com/view/new/fabio-borriello/ fabio borriello] [http://oedi.freehostia.com/text/directory/albergo-bordighera/ albergo bordighera] [http://flheddin.125mb.com/content/view/telefonino-tri.htm telefonino tri band] [http://greensticky.freehostia.com/library/html/programma-scaricare/ programma scaricare mp3] [http://coarmago.t35.com/content/view/elaborazione-top/ elaborazione top] [http://benevolently.freehostia.com/content/view/swat-it/ swat it] [http://zoelverd.freeweb7.com/description/lib/orologio-festina/ orologio festina] {{task}}


==[[C]]==
==[[C]]==
Line 35: Line 35:
}
}


==[[C plus plus|C ]]==
==[[C plus plus|C++]]==
[[Category:C plus plus]]
[[Category:C plus plus]]
===[[Qt]] 4===
===[[Qt]] 4===
Line 58: Line 58:
[[Category:Gtk]]
[[Category:Gtk]]


'''Compiler command:''' g filename.cc -o test `pkg-config --cflags --libs gtkmm-2.4`
'''Compiler command:''' g++ filename.cc -o test `pkg-config --cflags --libs gtkmm-2.4`


#include <iostream>
#include <iostream>
Line 73: Line 73:
}
}
catch( std::exception const
catch( std::exception const & exc )
{
std::cout << exc.what() << std::endl ;
exit( -1 ) ;
}
exit( 0 ) ;
}

==[[C sharp|C#]]==
[[Category:C sharp]]
'''Platform:''' [[.NET]] 1.1 (or higher)

'''Compiler:''' [[Visual C sharp|Visual C#]] 2003

'''Using:''' [[System.Windows.Forms.dll]]

using System;
using System.Windows.Forms;
public class Window
{
[STAThread]
static void Main()
{
Form newForm = new Form();
newForm.Text = "It's a new Window!";
newForm.Show();
}
}

==[[E]]==
[[Category:E]]

===Java AWT/Swing===

'''Implementation:''' E-on-Java

when (currentVat.morphInto("awt")) -> {
def w := <swing:makeJFrame>("Window")
w.setContentPane(<swing:makeJLabel>("Contents"))
w.pack()
w.show()
}

==[[IDL]]==
[[Category:IDL]]

With some example values filled in:

Id = WIDGET_BASE(TITLE='Window Title',xsize=200,ysize=100)
WIDGET_CONTROL, /REALIZE, id


==[[Java]]==
[[Category:Java]]

'''Library:''' [[Swing]]

[[Category:Swing]]

import javax.swing.JFrame;
import javax.swing.WindowConstants;
public class SimpleWindow {
public static void main(String[] args) {
JFrame window = new JFrame("This is a title!");
window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
window.setSize(800, 600);
window.setVisible(true);
}
}

==[[JavaScript]]==
[[Category:JavaScript]]
window.open("webpage.html", "windowname", "width=800,height=600");

==[[mIRC Scripting Language]]==
[[Category:mIRC Scripting Language]]

'''Interpreter:''' [[mIRC]]
'''Switches:'''
C = Center Window
p = Picture Window
d = Desktop Window

alias CreateMyWindow {
.window -Cp +d @WindowName 600 480
}

==[[Perl]]==
[[Category:Perl]]

'''Interpreter:''' [[Perl]] 5.8.8

Using [[Tk]]:

use Tk;
$mw = MainWindow->new();
MainLoop;

==[[Python]]==
[[Category:Python]]

'''Interpreter:''' [[Python]] 2.4, 2.5

===[[Tkinter]]===

[[Category:Tkinter]]

import Tkinter
w = tkinter.Tk()
w.mainloop()

===[[wxPython]]===

[[Category:wxPython]]

from wxPython.wx import *
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "Hello from wxPython")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()

===[[Pythonwin]]===

[[Category:Pythonwin]]

import win32ui
from pywin.mfc.dialog import Dialog
d = Dialog(win32ui.IDD_SIMPLE_INPUT)
d.CreateWindow()

===[[PyGTK]]===

[[Category:PyGTK]]

import gtk
window = gtk.Window()
window.show()
gtk.main()

==[[Ruby]]==
[[Category:Ruby]]

'''Interpreter:''' [[Ruby]] 1.8.5

===[[Tk]]===

[[Category:Tk]]

require 'tk'
window = TkRoot::new()
window::mainloop()

===[[GTK]]===
require 'gtk2'
window = Gtk::Window.new.show
Gtk.main

==[[RapidQ]]==
[[Category:RapidQ]]

create form as qform
center
width=500
height=400
end create
form.showModal

==[[Tcl]]==
[[Category:Tk]]

Loading the "Tk" package is all that is required to get an initial window:

package require Tk

If you need an additional window:

toplevel .top

If you are using the increasingly popular [http://www.equi4.com/tclkit.html tclkit] under MS Windows, all you have to do is associate the tcklkit with the extension ".tcl" and then create an <i>empty</i> file with the name (e.g.) <tt>nothing.tcl</tt>. Douple-clicking that will "open a window" (an empty one).

==[[Toka]]==
[[Category:Toka]]

'''Library:''' [[SDL]]
[[Category:SDL]]

Toka does not inherently know about graphical environments, but can interact with
them using external libraries. This example makes use of the [[SDL]] library bindings
included with Toka.

needs sdl
needs case

sdl_event_size malloc is-data event
800 600 sdl_setup drop

#! Process events, exiting when the window is closed
[
event SDL_WaitEvent drop

event sdl_event_type switch
SDL_QUIT [ bye ] case

TRUE
] keep whileTrue

==[[Visual Basic .NET]]==
[[Category:Visual Basic .NET]]

Framework: [[.NET]]
Dim newForm as new Form
newForm.Text = "It's a new window"
newForm.Show()

Revision as of 16:17, 12 August 2007

Task
Window creation
You are encouraged to solve this task according to the task description, using any language you may know.

C

Standard: ANSI C (AKA C89):

Compiler: GCC 4.0.3

Library: SDL

Compile Command: gcc -lSDL SDL_Window.c -o window

/*
 *   Opens an 800x600 16bit color window. 
 *   Done here with ANSI C.
 */

#include <stdio.h>
#include <stdlib.h>
#include "SDL/SDL.h"

main(){

SDL_Surface *screen;

if (SDL_Init(SDL_INIT_VIDEO) != 0) {
  fprintf(stderr, "Unable to initialize SDL: %s\n", SDL_GetError());
  return(1);
}
atexit(SDL_Quit);
screen = SDL_SetVideoMode( 800, 600, 16, SDL_SWSURFACE | SDL_HWPALETTE );
}

C++

Qt 4

Compiler command: qmake -pro; qmake

#include <QApplication>
#include <QMainWindow>

int main(int argc, char *argv[])
{
 QApplication app(argc, argv);
 QMainWindow window;
 window.show();
 return app.exec();
}

Gtk

Compiler command: g++ filename.cc -o test `pkg-config --cflags --libs gtkmm-2.4`

#include <iostream>
#include <gtkmm.h>

int
main( int argc, char* argv[] )
{
 try
 {
  Gtk::Main m( argc, argv ) ;
  Gtk::Window win ;
  m.run( win ) ;
 }
 
 catch( std::exception const & exc )
 {
  std::cout << exc.what() << std::endl ;
  exit( -1 ) ;
 }
 
 exit( 0 ) ;
}

C#

Platform: .NET 1.1 (or higher)

Compiler: Visual C# 2003

Using: System.Windows.Forms.dll

 using System;
 using System.Windows.Forms;
 
 public class Window
 {
   [STAThread]
   static void Main()
   {
     Form newForm = new Form();
     newForm.Text = "It's a new Window!";
     newForm.Show();
   }
 }

E

Java AWT/Swing

Implementation: E-on-Java

when (currentVat.morphInto("awt")) -> {
    def w := <swing:makeJFrame>("Window")
    w.setContentPane(<swing:makeJLabel>("Contents"))
    w.pack()
    w.show()
}

IDL

With some example values filled in:

Id = WIDGET_BASE(TITLE='Window Title',xsize=200,ysize=100)
WIDGET_CONTROL, /REALIZE, id


Java

Library: Swing

   import javax.swing.JFrame;
   import javax.swing.WindowConstants;
   
   public class SimpleWindow {
   
   	public static void main(String[] args) {
   
   		JFrame window = new JFrame("This is a title!");
   		
   		window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
   		window.setSize(800, 600);
   		window.setVisible(true);
   	}
   
   }

JavaScript

   window.open("webpage.html", "windowname", "width=800,height=600");

mIRC Scripting Language

Interpreter: mIRC

Switches: C = Center Window p = Picture Window d = Desktop Window

alias CreateMyWindow {
 .window -Cp +d @WindowName 600 480
}

Perl

Interpreter: Perl 5.8.8

Using Tk:

 use Tk;
 
 $mw = MainWindow->new();
 MainLoop;

Python

Interpreter: Python 2.4, 2.5

Tkinter

 import Tkinter
 
 w = tkinter.Tk()
 w.mainloop()

wxPython

 from wxPython.wx import *
 
 class MyApp(wxApp):
   def OnInit(self):
     frame = wxFrame(NULL, -1, "Hello from wxPython")
     frame.Show(true)
     self.SetTopWindow(frame)
     return true
 
 app = MyApp(0)
 app.MainLoop()

Pythonwin

 import win32ui
 from pywin.mfc.dialog import Dialog
 
 d = Dialog(win32ui.IDD_SIMPLE_INPUT)
 d.CreateWindow()

PyGTK

 import gtk
 
 window = gtk.Window()
 window.show()
 gtk.main()

Ruby

Interpreter: Ruby 1.8.5

Tk

require 'tk'

window = TkRoot::new()
window::mainloop()

GTK

require 'gtk2'

window = Gtk::Window.new.show
Gtk.main

RapidQ

  create form as qform
     center
     width=500
     height=400
  end create
  form.showModal

Tcl

Loading the "Tk" package is all that is required to get an initial window:

  package require Tk

If you need an additional window:

  toplevel .top

If you are using the increasingly popular tclkit under MS Windows, all you have to do is associate the tcklkit with the extension ".tcl" and then create an empty file with the name (e.g.) nothing.tcl. Douple-clicking that will "open a window" (an empty one).

Toka

Library: SDL

Toka does not inherently know about graphical environments, but can interact with them using external libraries. This example makes use of the SDL library bindings included with Toka.

 needs sdl
 needs case
 sdl_event_size malloc is-data event
 800 600 sdl_setup drop
 #! Process events, exiting when the window is closed
 [
   event SDL_WaitEvent drop
   event sdl_event_type switch    
   SDL_QUIT [ bye ] case
   TRUE
 ] keep whileTrue

Visual Basic .NET

Framework: .NET

   Dim newForm as new Form
   newForm.Text = "It's a new window"
  
       newForm.Show()