2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,3 +1,7 @@
|
|||
In this User Output task, the goal is to display the string "Goodbye, World!" on a [[GUI]] object (alert box, plain window, text area, etc.).
|
||||
;Task:
|
||||
Display the string '''Goodbye, World!''' on a [[GUI]] object (alert box, plain window, text area, etc.).
|
||||
|
||||
See also: [[Hello world/Text]]
|
||||
|
||||
;Related task:
|
||||
* [[Hello world/Text]]
|
||||
<br><br>
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ font "times new roman", 20,100
|
|||
color orange
|
||||
rect 10,10, 140,30
|
||||
color red
|
||||
text 10,10, "Hello World"
|
||||
text 10,10, "Goodbye, World!"
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Hello world/Graphical">
|
||||
<TextBox>Hello, World!</TextBox>
|
||||
<TextBox>Goodbye, World!</TextBox>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
(clim-stream-pane) ())
|
||||
|
||||
(define-application-frame hello-world ()
|
||||
((greeting :initform "Hello World"
|
||||
((greeting :initform "Goodbye World"
|
||||
:accessor greeting))
|
||||
(:pane (make-pane 'hello-world-pane)))
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
program hello
|
||||
use windows
|
||||
integer :: res
|
||||
res = MessageBox(0, LOC("Hello, World"), LOC("Window Title"), MB_OK)
|
||||
end program
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
program hello
|
||||
use user32
|
||||
integer :: res
|
||||
res = MessageBox(0, "Hello, World", "Window Title", MB_OK)
|
||||
end program
|
||||
40
Task/Hello-world-Graphical/Fortran/hello-world-graphical-3.f
Normal file
40
Task/Hello-world-Graphical/Fortran/hello-world-graphical-3.f
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
module handlers_m
|
||||
use iso_c_binding
|
||||
use gtk
|
||||
implicit none
|
||||
|
||||
contains
|
||||
|
||||
subroutine destroy (widget, gdata) bind(c)
|
||||
type(c_ptr), value :: widget, gdata
|
||||
call gtk_main_quit ()
|
||||
end subroutine destroy
|
||||
|
||||
end module handlers_m
|
||||
|
||||
program test
|
||||
use iso_c_binding
|
||||
use gtk
|
||||
use handlers_m
|
||||
implicit none
|
||||
|
||||
type(c_ptr) :: window
|
||||
type(c_ptr) :: box
|
||||
type(c_ptr) :: button
|
||||
|
||||
call gtk_init ()
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL)
|
||||
call gtk_window_set_default_size(window, 500, 20)
|
||||
call gtk_window_set_title(window, "gtk-fortran"//c_null_char)
|
||||
call g_signal_connect (window, "destroy"//c_null_char, c_funloc(destroy))
|
||||
box = gtk_hbox_new (TRUE, 10_c_int);
|
||||
call gtk_container_add (window, box)
|
||||
button = gtk_button_new_with_label ("Goodbye, World!"//c_null_char)
|
||||
call gtk_box_pack_start (box, button, FALSE, FALSE, 0_c_int)
|
||||
call g_signal_connect (button, "clicked"//c_null_char, c_funloc(destroy))
|
||||
call gtk_widget_show (button)
|
||||
call gtk_widget_show (box)
|
||||
call gtk_widget_show (window)
|
||||
call gtk_main ()
|
||||
|
||||
end program test
|
||||
12
Task/Hello-world-Graphical/Frege/hello-world-graphical.frege
Normal file
12
Task/Hello-world-Graphical/Frege/hello-world-graphical.frege
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package HelloWorldGraphical where
|
||||
|
||||
import Java.Swing
|
||||
|
||||
main _ = do
|
||||
frame <- JFrame.new "Goodbye, world!"
|
||||
frame.setDefaultCloseOperation(JFrame.dispose_on_close)
|
||||
label <- JLabel.new "Goodbye, world!"
|
||||
cp <- frame.getContentPane
|
||||
cp.add label
|
||||
frame.pack
|
||||
frame.setVisible true
|
||||
|
|
@ -0,0 +1 @@
|
|||
WRITE(Messagebox='!') 'Goodbye, World!'
|
||||
21
Task/Hello-world-Graphical/Java/hello-world-graphical-2.java
Normal file
21
Task/Hello-world-Graphical/Java/hello-world-graphical-2.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class HelloWorld {
|
||||
public static void main(String[] args) {
|
||||
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
JOptionPane.showMessageDialog(null, "Goodbye, world!");
|
||||
JFrame frame = new JFrame("Goodbye, world!");
|
||||
JTextArea text = new JTextArea("Goodbye, world!");
|
||||
JButton button = new JButton("Goodbye, world!");
|
||||
|
||||
frame.setLayout(new FlowLayout());
|
||||
frame.add(button);
|
||||
frame.add(text);
|
||||
frame.pack();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setVisible(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import java.awt.*
|
||||
import javax.swing.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
JOptionPane.showMessageDialog(null, "Goodbye, World!") // in alert box
|
||||
with(JFrame("Goodbye, World!")) { // on title bar
|
||||
layout = FlowLayout()
|
||||
add(JButton("Goodbye, World!")) // on button
|
||||
add(JTextArea("Goodbye, World!")) // in editable area
|
||||
pack()
|
||||
defaultCloseOperation = JFrame.EXIT_ON_CLOSE
|
||||
isVisible = true
|
||||
}
|
||||
}
|
||||
16
Task/Hello-world-Graphical/Ruby/hello-world-graphical-4.rb
Normal file
16
Task/Hello-world-Graphical/Ruby/hello-world-graphical-4.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
require 'gosu'
|
||||
|
||||
class Window < Gosu::Window
|
||||
|
||||
def initialize
|
||||
super(150, 50, false)
|
||||
@font = Gosu::Font.new(self, "Arial", 32)
|
||||
end
|
||||
|
||||
def draw
|
||||
@font.draw("Hello world", 0, 10, 1, 1, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Window.new.show
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#_Note: this code must not be executed through a GUI
|
||||
require 'green_shoes'
|
||||
|
||||
Shoes.app do
|
||||
para "Hello world"
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
require 'win32ole'
|
||||
WIN32OLE.new('WScript.Shell').popup("Hello world")
|
||||
22
Task/Hello-world-Graphical/Rust/hello-world-graphical.rust
Normal file
22
Task/Hello-world-Graphical/Rust/hello-world-graphical.rust
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// cargo-deps: gtk
|
||||
extern crate gtk;
|
||||
use gtk::traits::*;
|
||||
use gtk::{Window, WindowType, WindowPosition};
|
||||
use gtk::signal::Inhibit;
|
||||
|
||||
fn main() {
|
||||
gtk::init().unwrap();
|
||||
let window = Window::new(WindowType::Toplevel).unwrap();
|
||||
|
||||
window.set_title("Goodbye, World!");
|
||||
window.set_border_width(10);
|
||||
window.set_window_position(WindowPosition::Center);
|
||||
window.set_default_size(350, 70);
|
||||
window.connect_delete_event(|_,_| {
|
||||
gtk::main_quit();
|
||||
Inhibit(false)
|
||||
});
|
||||
|
||||
window.show_all();
|
||||
gtk::main();
|
||||
}
|
||||
|
|
@ -3,6 +3,6 @@ import swing._
|
|||
object HelloDotNetWorld {
|
||||
def main(args: Array[String]) {
|
||||
System.Windows.Forms.MessageBox.Show
|
||||
("Hello, .net world!")
|
||||
("Goodbye, World!")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue