求一个java applet小程序的源代码

求一个java applet小程序的源代码,第1张

import javaappletApplet;

import javaawtButton;

import javaawtColor;

import javaawtGraphics;

import javaawtTextField;

import javaawteventActionEvent;

public class Nicki extends Applet{

private static final long serialVersionUID = 1L;

private Button ok;

private int num=32;

private int resu=0;

private boolean isRig=false;

private TextField iPut;

public Nicki(){

thissetLayout(null);

ok=new Button("OK");

oksetActionCommand(getName());

oksetBounds(150, 150, 40, 20);

iPut=new TextField();

thisadd(iPut);

iPutsetBounds(100, 150, 40, 20);

thisadd(ok);

okaddActionListener(new ButtonAction(this));

}

public void paint(Graphics g){

gsetColor(Colorwhite);

gfillRect(0, 0, thisgetWidth(), thisgetHeight());

gsetColor(ColorBLACK);

gdrawString("Please guess a number ", 10, 20);

gdrawString("between 1 and 100", 10, 40);

if(isRig==false&&resu!=0){

if(resu>num){

gdrawString(""+resu+" is too big !", 10, 100);

}else if(resu<num){

gdrawString(resu+"is too small !", 10, 100);

}

}else if(isRig==true){

gsetColor(ColorGREEN);

gdrawString("Yes,"+resu+" is the right number", 10, 80);

gdrawString("Your are great! ", 10, 100);

gsetColor(Colorred);

gdrawString(resu+"!", 70, 120);

}

iPutsetText("");

gdrawString("Input the number:", 0, 150);

}

public void ButtonActionPerformed(ActionEvent e){

if(egetActionCommand()equals("panel0")){

resu=IntegerparseInt(iPutgetText());

if(num==resu){

isRig=true;

}else{

isRig=false;

}

repaint();

}

}

}

class ButtonAction implements javaawteventActionListener{

Nicki su;

public ButtonAction(Nicki bun){

thissu=bun;

}

public void actionPerformed(ActionEvent e) {

suButtonActionPerformed(e);

}

}

你再发布活动的时候要求参与人员填写你需要的信息即可。

1如下图,点击”添加字段“输入你想要搜集的信息;然后全部勾选(勾选为必填),最后发布。

2参与人员进入的时候会看到右边d出的方框必须填写相关信息才可以进入。

3最后,通过系统”人员“模块既可以查看并导出所有参与人员填写的信息了。

免费的报名系统小程序,推荐圣诞树报名系统,可以免费开发微信报名小程序

*** 作流程

电脑浏览器搜索"圣诞树报名系统"后台,扫描登入,点报名管理→创建活动

2     添加活动名称,活动,电话,表单内容

3     点击保存后,点查看可以阅览活动

4     点报名小程序→申请添加

5     配置小程序信息(点获取方法)

6     配置后点一键授权扫码授权成功后就可以使用了!

// My car shopjava

import javaawt;

import javaawtevent;

import javaxswing;

import javaxswingborder;

public class carshop extends JFrame

{

// JPanel to hold all pictures

private JPanel windowJPanel;

private String[] cars = { "","阿斯顿马丁", "美洲虎", "凯迪拉克",

"罗孚", "劳斯莱斯","别克"};

private int[] jiage = { 0,150000, 260000, 230000,

140000, 290000, 150000};

// JLabels for first snack shown

private JLabel oneJLabel;

private JLabel oneIconJLabel;

// JLabels for second snack shown

private JLabel twoJLabel;

private JLabel twoIconJLabel;

// JLabels for third snack shown

private JLabel threeJLabel;

private JLabel threeIconJLabel;

// JLabels for fourth snack shown

private JLabel fourJLabel;

private JLabel fourIconJLabel;

// JLabels for fifth snack shown

private JLabel fiveJLabel;

private JLabel fiveIconJLabel;

// JLabels for sixth snack shown

private JLabel sixJLabel;

private JLabel sixIconJLabel;

// JTextField for displaying snack price

private JTextArea displayJTextArea;

// JLabel and JTextField for user input

private JLabel inputJLabel;

private JComboBox selectCountryJComboBox;

private JLabel inputJLabel2;

private JTextField inputJTextField2;

// JButton to enter user input

private JButton enterJButton;

//JButton to clear the components

private JButton clearJButton;

// no-argument constructor

public carshop()

{

createUserInterface();

}

// create and position GUI components; register event handlers

private void createUserInterface()

{

// get content pane for attaching GUI components

Container contentPane = getContentPane();

// enable explicit positioning of GUI components

contentPanesetLayout( null );

// set up windowJPanel

windowJPanel = new JPanel();

windowJPanelsetBounds( 10, 20, 340, 200 );

windowJPanelsetBorder( new LineBorder( ColorBLACK ) );

windowJPanelsetLayout( null );

contentPaneadd( windowJPanel );

// set up oneIconJLabel

oneIconJLabel = new JLabel();

oneIconJLabelsetBounds( 10, 20, 100, 65 );

oneIconJLabelsetIcon( new ImageIcon( "images/阿斯顿马丁jpg" ) );

windowJPaneladd( oneIconJLabel );

// set up oneJLabel

oneJLabel = new JLabel();

oneJLabelsetBounds( 10, 60, 100, 70 );

oneJLabelsetText( "阿斯顿马丁" );

oneJLabelsetHorizontalAlignment( JLabelCENTER );

windowJPaneladd( oneJLabel );

// set up twoIconJLabel

twoIconJLabel = new JLabel();

twoIconJLabelsetBounds( 120, 20, 100, 65 );

twoIconJLabelsetIcon( new ImageIcon( "images/美洲虎jpg" ) );

windowJPaneladd( twoIconJLabel );

// set up twoJLabel

twoJLabel = new JLabel();

twoJLabelsetBounds( 110, 60, 100, 70 );

twoJLabelsetText( "美洲虎" );

twoJLabelsetHorizontalAlignment( JLabelCENTER );

windowJPaneladd( twoJLabel );

// set up threeIconJLabel

threeIconJLabel = new JLabel();

threeIconJLabelsetBounds( 230, 20, 100, 65 );

threeIconJLabelsetIcon( new ImageIcon(

"images/凯迪拉克jpg" ) );

windowJPaneladd( threeIconJLabel );

// set up threeJLabel

threeJLabel = new JLabel();

threeJLabelsetBounds( 230, 60, 100, 70);

threeJLabelsetText( "凯迪拉克" );

threeJLabelsetHorizontalAlignment( JLabelCENTER );

windowJPaneladd( threeJLabel );

// set up fourIconJLabel

fourIconJLabel = new JLabel();

fourIconJLabelsetBounds( 10, 100, 100, 65 );

fourIconJLabelsetIcon( new ImageIcon( "images/罗孚jpg" ) );

windowJPaneladd( fourIconJLabel );

// set up fourJLabel

fourJLabel = new JLabel();

fourJLabelsetBounds( 10, 150, 50, 70 );

fourJLabelsetText( "罗孚" );

fourJLabelsetHorizontalAlignment( JLabelCENTER );

windowJPaneladd( fourJLabel );

// set up fiveIconJLabel

fiveIconJLabel = new JLabel();

fiveIconJLabelsetBounds( 120, 100, 100, 65 );

fiveIconJLabelsetIcon( new ImageIcon(

"images/劳斯莱斯jpg" ) );

windowJPaneladd( fiveIconJLabel );

// set up fiveJLabel

fiveJLabel = new JLabel();

fiveJLabelsetBounds( 110, 150, 100, 70 );

fiveJLabelsetText( "劳斯莱斯" );

fiveJLabelsetHorizontalAlignment( JLabelCENTER );

windowJPaneladd( fiveJLabel );

// set up sixIconJLabel

sixIconJLabel = new JLabel();

sixIconJLabelsetBounds( 230, 100, 100, 65 );

sixIconJLabelsetIcon( new ImageIcon( "images/别克jpg" ) );

windowJPaneladd( sixIconJLabel );

// set up sixJLabel

sixJLabel = new JLabel();

sixJLabelsetBounds( 230, 150, 100, 70 );

sixJLabelsetText( "别克" );

sixJLabelsetHorizontalAlignment( JLabelCENTER );

windowJPaneladd( sixJLabel );

// set up enterJButton

enterJButton = new JButton();

enterJButtonsetBounds( 390, 160, 135, 30 );

enterJButtonsetText( "Enter" );

contentPaneadd( enterJButton );

enterJButtonaddActionListener(

new ActionListener() // anonymous inner class

{

// event handler called when enterJButton is clicked

public void actionPerformed( ActionEvent event )

{

enterJButtonActionPerformed( event );

}

} // end anonymous inner class

); // end call to addActionListener

// set up clearJButton

clearJButton = new JButton();

clearJButtonsetBounds( 390, 200, 135, 30 );

clearJButtonsetText( "Clear" );

contentPaneadd( clearJButton );

// set up inputJLabel

inputJLabel = new JLabel();

inputJLabelsetBounds( 390, 25, 135, 25 );

inputJLabelsetText( "Please make selection:" );

contentPaneadd( inputJLabel );

selectCountryJComboBox = new JComboBox( cars );

selectCountryJComboBoxsetBounds( 390, 50, 135, 21 );

selectCountryJComboBoxsetMaximumRowCount( 3 );

contentPaneadd( selectCountryJComboBox );

// set up inputJTextField

inputJLabel2 = new JLabel();

inputJLabel2setBounds( 390, 80, 150, 20 );

inputJLabel2setText( "Input the Numble:" );

contentPaneadd( inputJLabel2 );

// set up inputJTextField

inputJTextField2 = new JTextField();

inputJTextField2setBounds( 390, 100, 135, 25 );

inputJTextField2setHorizontalAlignment( JTextFieldRIGHT );

contentPaneadd( inputJTextField2 );

clearJButtonaddActionListener(

new ActionListener() // anonymous inner class

{

// event handler called when clearJButton is clicked

public void actionPerformed( ActionEvent event )

{

clearJButtonActionPerformed( event );

}

} // end anonymous inner class

);

// set up displayJTextField

displayJTextArea = new JTextArea();

displayJTextAreasetBounds( 10, 237,515, 70 );

displayJTextAreasetEditable( false );

contentPaneadd( displayJTextArea );

// set properties of application's window

setTitle( "My car Shop" ); // set title bar string

setSize( 550, 360 ); // set window size

setVisible( true ); // display window

} // end method createUserInterface

private void clearJButtonActionPerformed( ActionEvent event )

{

// clear the JTextFields

inputJTextField2setText( "" );

displayJTextAreasetText("");

} // end method clearJButtonActionPerformed

private void enterJButtonActionPerformed( ActionEvent event )

{

double z;

double c;

int x;

int y;

x=selectCountryJComboBoxgetSelectedIndex();

y=IntegerparseInt(inputJTextField2getText());

double discountRate;

int amount = IntegerparseInt( inputJTextField2getText());

switch (amount/5)

{

case 0:

discountRate = 0;

break;

case 1:

discountRate = 1;

break;

case 2:

discountRate = 2;

break;

case 3:

discountRate = 3;

break;

default:

discountRate = 4;

} // end switch statement

c=1-discountRate/100;

z=jiage[x]yc;

displayJTextAreaappend("你选择的是:"+cars[x]+";"+

"它的单价是:"+jiage[x]+";" +"你购买该产品的数量是:"+y+"," +"\n"+"该数量的折扣是:"

+discountRate + " %"+";"+"本次消费的总价格是:"+z+"元"+"!"+"\n");

}

public static void main( String args[] )

{

carshop application = new carshop();

applicationsetDefaultCloseOperation( JFrameEXIT_ON_CLOSE );

} // end method main

} // end class carshop

这个看你自己需不需要源码,需要源码的话可能会贵一点,朋友找他们合作,要了源码版本的,以便自己后期进行二次开发,具体你要多了解看看,根据自己的实际情况来选择合适自己的。小程序开发底价

想要了解更多有关小程序开发的相关信息,推荐咨询猪八戒网。猪八戒网成立于2006年,是中国领先的企业服务平台,服务交易独角兽企业。猪八戒网现有注册用户2800万、在全国布局线下数字化创业园区超过100个。十余年来,累计有10万余个人通过平台孵化成长为公司,超过100万人通过平台实现灵活就业,千万企业通过平台解决专业服务需求;专业性值得选择。

以上就是关于求一个java applet小程序的源代码全部的内容,包括:求一个java applet小程序的源代码、微信报名系统怎么做 微信活动报名系统的制作方法、免费的微信报名系统,小程序哪个最好用等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/9342186.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-27
下一篇 2023-04-27

发表评论

登录后才能评论

评论列表(0条)

保存