当前位置 : 主页 > 网络编程 > 其它编程 >

Prel,Csh界面

来源:互联网 收集:自由互联 发布时间:2023-07-02
很久没有用csh写程序了最近老在用java,perl程序突然间想写一下这3种语言的界面java,perl,csh三种 很久没有用csh写程序了,最近老在用java,perl程序,突然间想写一下,这3种语言的界面,jav
很久没有用csh写程序了最近老在用java,perl程序突然间想写一下这3种语言的界面java,perl,csh三种

很久没有用csh写程序了,最近老在用java,perl程序,突然间想写一下,这3种语言的界面,java,perl,csh三种语言的界面,你认为那种更漂亮点,我认为是perl,但java更灵活一点

1.[文件] 菜单程序.pl ~ 5KB     下载(1)

#!/usr/bin/perl -w

use Tk;

use strict;

my $ver = "1.0.0";

my $mw = MainWindow->new;

$mw->geometry("500x150");

$mw->title("Perl Gui #2");

my $main_menu = $mw->Menu();

$mw->configure(-menu => $main_menu);

# give the user a way to exit the script

my $file_menu = $main_menu->cascade(-label=>"File", -underline => 0, -tearoff=>0);

$file_menu->command(-label=>"Exit", -underline=>0, -command => sub{exit});

# everyone needs a little help

my $help_menu = $main_menu->cascade(-label => "Help", -underline => 0, -tearoff => 0);

$help_menu->command(-label => "Version", -underline => 0,

-command => sub{$mw->messageBox(-message => "Version: $ver",-type => "ok")});

$help_menu->command(-label => "About Program", -underline => 0, -command => \

my $greeting_frame = $mw->Frame()->pack(-side => "top");

$greeting_frame->Label(-text => "Tell me a little about yourself...")->pack();

my $info_frame = $mw->Frame()->pack(-side => "top");

my $last_name = $info_frame->Entry()->pack(-side => "right");

$info_frame->Label(-text => "Last Name")->pack(-side => "right");

my $stat = "Mr";

$info_frame->Radiobutton(-text => "Mr", -value => "Mr",

-variable => \$stat)->pack(-side => "right");

$info_frame->Radiobutton(-text => "Mrs", -value => "Mrs",

-variable => \$stat)->pack(-side => "right");

$info_frame->Radiobutton(-text => "Miss", -value => "Miss",

-variable => \$stat)->pack(-side => "right");

my $pet_info_frame = $mw->Frame()->pack(-side => "top");

$pet_info_frame->Label(-text => "Check all pets you like?")->pack(-side => "left");

my $chk1 = "no";

my $chk2 = "no";

my $chk3 = "no";

my $chk4 = "no";

my $chk5 = "no";

my $pet1_chk = $pet_info_frame->Checkbutton(-text => "Cat",

-variable => \$chk1,

-Onvalue=> "yes",

-offvalue => "no")->pack(-side => "right");

my $pet2_chk = $pet_info_frame->Checkbutton(-text => "Dog",

-variable => \$chk2,

-Onvalue=> "yes",

-offvalue => "no")->pack(-side => "right");

my $pet3_chk = $pet_info_frame->Checkbutton(-text => "Fish",

-variable => \$chk3,

-Onvalue=> "yes",

-offvalue => "no")->pack(-side => "right");

my $pet4_chk = $pet_info_frame->Checkbutton(-text => "Snake",

-variable => \$chk4,

-Onvalue=> "yes",

-offvalue => "no")->pack(-side => "right");

my $pet5_chk = $pet_info_frame->Checkbutton(-text => "Hamster",

-variable => \$chk5,

-Onvalue=> "yes",

-offvalue => "no")->pack(-side => "right");

my $button_frame = $mw->Frame()->pack(-side => "top");

$button_frame->Button(-text => "Ok", -command => \

my $output_frame = $mw->Frame()->pack(-side => "bottom");

my $output_scroll = $output_frame->Scrollbar();

my $output_text = $output_frame->Text(-yscrollcommand => [set, $output_scroll]);

$output_scroll->configure(-command => [yview, $output_text]);

$output_scroll->pack(-side => "right", -expand => "no", -fill => "y");

$output_text->pack();

sub update_output {

my $lname = $last_name->get();

if ($lname eq "") { $lname = "No Name"; }

my $output = "Hello $stat. $lname!\nI like the following too!";

if ( $chk1 eq "yes" ) { $output = "$output\nCats"; }

if ( $chk2 eq "yes" ) { $output = "$output\nDogs"; }

if ( $chk3 eq "yes" ) { $output = "$output\nFish"; }

if ( $chk4 eq "yes" ) { $output = "$output\nSnakes"; }

if ( $chk5 eq "yes" ) { $output = "$output\nHamsters"; }

$output_text->delete(0.0, end);

$output_text->insert("end", $output);

}

sub show_about {

my $help_win = $mw->Toplevel;

$help_win->geometry("300x50");

$help_win->title("About Program");

my $help_msg = "This help page is an example of using multiple windows.";

$help_win->Label(-text => $help_msg)->pack();

$help_win->Button(-text => "Ok", -command => [$help_win => destroy])->pack();

}

MainLoop;

2.[文件] Java_Gui.java ~ 3KB     下载(0)

package SudentTest2;

import java.awt.BorderLayout;

import java.awt.Color;

import java.awt.Container;

import java.awt.GridLayout;

import java.awt.event.WindowAdapter;

import java.awt.event.WindowEvent;

import javax.swing.JButton;

import javax.swing.JCheckBox;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JMenu;

import javax.swing.JMenuBar;

import javax.swing.JPanel;

import javax.swing.JRadioButton;

import javax.swing.JScrollPane;

import javax.swing.JTable;

import javax.swing.JTextArea;

import javax.swing.JTextField;

public class Java_Gui extends JFrame{

JMenu Jmen = null;

JMenuBar JmeBar = null;

JMenu Jmenx = null;

JPanel jp1,jp2,jp3,jp4,jp5,jp6,jp7;

JLabel jl1,jl2,jl3,jl4,jl5,jl6;

JButton jb1,jb2;

JTable jt1;

JTextField jtf1,jtf2,jtf3,jtf4,jtf5,jtf6;

JRadioButton jrb1,jrb2,jrb3;

JCheckBox jcb1,jcb2,jcb3,jcb4,jcb5;

JTextArea jta;

Container container;

public Java_Gui()

{

cOntainer= this.getContentPane();//获得内容窗格

JmeBar = new JMenuBar();

Jmen = new JMenu("File(F)");

Jmen.setMnemonic(F);

Jmenx = new JMenu("Help(H)");

Jmenx.setMnemonic(H);

jp1 = new JPanel();

jp3 = new JPanel();

jl1 = new JLabel("Tell me little about your self");

//把组件加入jp1中,因为jp1是流云布局

jp3.add(jl1);

jp1.add(jp3);

jp2 = new JPanel();

jrb1 = new JRadioButton("Miss"); //单选框

jrb2 = new JRadioButton("Mrs");

jrb3 = new JRadioButton("Mr");

jl2 = new JLabel("Last Name");

jtf1 = new JTextField(14);

jp2.add(jrb1);

jp2.add(jrb2);

jp2.add(jrb3);

jp2.add(jl2);

jp2.add(jtf1);

jp1.add(jp2);

jp4 = new JPanel();

jl2 = new JLabel("Check all pets you like ?");

jcb1 = new JCheckBox("Hamster");//复选框

jcb2 = new JCheckBox("Snake");

jcb3 = new JCheckBox("Fish");

jcb4 = new JCheckBox("Dog");

jcb5 = new JCheckBox("Cat");

jp4.add(jl2);

jp4.add(jcb1);

jp4.add(jcb2);

jp4.add(jcb3);

jp4.add(jcb4);

jp4.add(jcb5);

jp1.add(jp4);

jp5 = new JPanel();

jb1 = new JButton("OK");

jp5.add(jb1);

jp1.add(jp5);

jp6 = new JPanel();

jta = new JTextArea(5,40);

//jta.setLineWrap(true);

JScrollPane scrollpane1 = new JScrollPane(jta,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);//设置滚动条为水平显示

jta.setText("2013-12-7 22:30");

jp6.add(scrollpane1);

jp1.add(jp6);

//设置布局

jp1.setLayout(new GridLayout(5,1));

JmeBar.add(Jmen);

JmeBar.add(Jmenx);

this.add(jp1);

this.setJMenuBar(JmeBar);//把JmeBar加入界面中

this.setSize(510,250);

this.setLocation(70, 70); // 设置界面出现的位置

this.setTitle("天天向上,超越自我");

this.addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {

System.exit(0);

}

});

//this.setResizable(false);//设置界面的大小不能修改

//这里要把 JFrame修改成Frame,才有效

this.setBackground(Color.GREEN);

this.setVisible(true);

}

public static void main(String[] args) {

new Java_Gui();

}

}

3.[文件] csh.pl ~ 2KB     下载(1)

#!/bin/csh

set gui_out = $GENESIS_TMP/gui_out.$$

set gui_in = $GENESIS_TMP/gui_in.$$

echo "WIN 200 200" > $gui_in

echo "FG 000000" >> $gui_in

echo "BG 168899" >> $gui_in

echo "FONT tbr14" >> $gui_in

echo "LABEL " >> $gui_in

echo "LABEL Tell me a little about yourself " >> $gui_in

echo "LABEL " >> $gui_in

echo "FONT tbr14" >> $gui_in

echo "FORM " >> $gui_in

#echo "LABEL "have not layer: gko"" >> $gui_in

echo "ENDFORM " >> $gui_in

echo "FORM" >> $gui_in

echo "RADIO dfd Choose H 1 990000" >> $gui_in

echo Miss >> $gui_in

echo Mrs >> $gui_in

echo Mr >> $gui_in

echo END >> $gui_in

set X = "";

echo "TEXT wpnlx 16 " Last Name"" >> $gui_in

echo "dTEXT wpnlx $X " >> $gui_in

echo ENDFORM >> $gui_in

echo "FORM" >> $gui_in

echo "LABEL Check" >> $gui_in

echo "LABEL all" >> $gui_in

echo "LABEL pets" >> $gui_in

echo "LABEL you" >> $gui_in

#echo "LABEL like" >> $gui_in

set Name = "like?"

echo "RADIO dfdx $Name H 1 990000" >> $gui_in

echo Hamster >> $gui_in

echo Snake >> $gui_in

echo Fish >> $gui_in

echo Dog >> $gui_in

echo cat >> $gui_in

echo END >> $gui_in

echo "LABEL " >> $gui_in

echo ENDFORM >> $gui_in

echo "FORM" >> $gui_in

set KOng= "+ +"

echo "LABEL $Kong" >> $gui_in

set Option = "+ "

echo "OPTION Select_BanCai $Option H 1 88000 " >> $gui_in

echo OK >> $gui_in

echo END >> $gui_in

echo "LABEL +" >> $gui_in

echo ENDFORM >> $gui_in

echo "FORM" >> $gui_in

set LAY_ARRY = (1 2 3 4 5 6 7 8 9);

echo LIST output 2 m 1 >> $gui_in

foreach LAYER ($LAY_ARRY)

echo $LAYER >> $gui_in

end

echo END >> $gui_in

echo ENDFORM >> $gui_in

#echo "CLABEL OK" >> $gui_in

$GENESIS_EDIR/all/gui $gui_in > $gui_out

source $gui_out

echo "ok"

4.[图片] csh.jpg

09142724_1XBF.jpg

5.[图片] java.jpg

09142724_Ieoe.jpg

6.[图片] perl.jpg

09142724_l4Ej.jpg

网友评论