有哪些有趣的安卓小程序适合开发初学者做的

有哪些有趣的安卓小程序适合开发初学者做的,第1张

1、Android开发

主要开发语言是Java(当然还有Kotlin/Scala/Groovy,暂时不在本文讨论的范围内);

另外使用xml文件来描述界面;

使用xmlgradle文件来配置项目;

2、微信小程序开发

主要开发语言是javascript;

使用wxmlwxss文件来描述界面;

使用appjsonappwxss文件来配置项目;

3、微信小程序开发仅最近新增的能力:

允许个人开发者申请注册小程序、

公众号可以打开小程序、

可以在App分享、

支持识别二维码打开小程序、

可以支持第三方平台配置、

新增数据分析接口、

代码包大小从1M扩大到2M、

推出小程序码、

公众号关联小程序新规则、

公众平台新增快速创建小程序、

从开发费用来看,安卓Android开发难度高,费用高。小程序只需要开发一个版本,具有跨手机 *** 作系统平台的兼容性,因此开发费用相对较低。另外微信小程序的开发模式是比原生Andorid要先进一些的。

JAVA小程序的英文名字叫JAVA APPLET,是相对于JAVA APPLICATION而言的,它的运行不是独立的,要依靠HTML也就是必须嵌入网页里借助浏览器运行。除此之外,它也可以在DOS命令状态下用APPLETVIWER命令来运行。

总之,JAVA小程序就是一种依靠浏览器来运行的一种JAVA小程序。

//第一题:

import javaioBufferedReader;

import javaioIOException;

import javaioInputStreamReader;

import javautilArrayList;

import javautilList;

import javautilArrayList;

import javautilList;

public class ManageName {

List<String> namelist = new ArrayList<String>();

public void PrintMenu() {

Systemoutprintln("\n\r1Add new name " + "2Display all name"

+ " 3Quit"

+ "\nPlease select menu(1,2,3)");

}

public void displayname() {

for (int w = 0; w < thisnamelistsize(); w++) {

Systemoutprintln("Name" + w+":" + thisnamelistget(w));

}

}

public List addName(String name) {

namelistadd(name);

return namelist;

}

public static void main(String[] args) throws IOException {

ManageName a = new ManageName();

aaddName("jing5083394");

BufferedReader in = new BufferedReader(new InputStreamReader(Systemin));

while (true) {

aPrintMenu();

String content = inreadLine();

if (contentequalsIgnoreCase("3")) {

break;

} else if (contentequalsIgnoreCase("1")) {

String name;

BufferedReader in2 = new BufferedReader(new InputStreamReader(

Systemin));

Systemoutprintln("Please input the Name to add new user");

String content2 = inreadLine();

name = content2;

aaddName(name);

Systemoutprintln("Add name successfully\r\n");

}

else if (contentequalsIgnoreCase("2")) {

adisplayname();

}

else {

Systemoutprintln("Invalid selections!\n");

}

}

}

}

//第二题: 把文件放到namefiletxt

/

从namefiletxt文件中读入的字符串全部转换成大写字母,

再按原来的顺序输出到yoursDatatxt文件中。

/

import javalangCharacter;

import javaio;

//将一个文件复制到另一个文件中(覆盖)

public class Filestream {

public static void main(String args[]) {

try {

File inFile = new File("c:\\namefiletxt");

File outFile = new File("c:\\yoursDatatxt");

FileInputStream fis = new FileInputStream(inFile); // 读输入文件

FileOutputStream fos = new FileOutputStream(outFile);

int c;

while ((c = fisread()) != -1) {

c = CharactertoUpperCase(c);

foswrite(c);

}// 写入文件中

Systemoutprintln("Output file finish");

fisclose();

fosclose();

} catch (FileNotFoundException e) {

Systemoutprintln("FileStreamsTest: " + e);

} catch (IOException e) {

Systemerrprintln("FileStreamsTest: " + e);

}

}

}

我这有一个编程开发工具压缩包,你在学习Java的时候用到的工具几乎都放在这里面

大概的工具有这些

IDEA是 Java 语言开发的集成环境,IDEA 在业界被公认为最好的 Java 开发工具之一,但是收费的软件,对应我们这些穷小子来说,是个坏消息。所有我们有中国魔法。

一些常用编辑器都放在IDEA开发工具包里

IDEA比较新的版本包括破解步骤都在这里

轻轻松松给它干到2089年,到那个时候你的工资足够付的几十个甚至几百个IDEA的钱了,先用着等有钱再还给它

Java版本,jdk8,也是Java普及最快的版本,除了本身性能提升外,新增的函数式编程特性也让开发效率更高,推荐使用。包括一些公司常用的和新的jdk版本也在这里 (位置:常用工具\常用工具\jdk)

web容器,tomcat,也是微服务项目首选容器。Nginx (engine x) 是一个高性能的和web服务器。

(位置:常用工具\常用工具\服务器)

第三方中间件和插件,包括:dubbo,redis,mycat等等 (位置:常用工具\常用工具\第三方中间件)

还有一些乐字节老师用过比较好用的编程人员用到的工具包

一些常用的数据库

其他的工具包小编就不一一介绍了,基本上你在学习Java的时候能用到的东西都在这个包里,不再担心下载到一堆的广告软件,也不用担心外网下载慢了。

感谢乐字节分享所有的工具包。

需要的同学们sx我哦!!!!

// 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

以上就是关于有哪些有趣的安卓小程序适合开发初学者做的全部的内容,包括:有哪些有趣的安卓小程序适合开发初学者做的、JAVA小程序是什么、哪位高手帮写个JAVA入门小程序,估计就几十行代码等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存