java写一个自动程序开始先怎么写

Python010

java写一个自动程序开始先怎么写,第1张

使用Eclipse编写自己的第一个Java代码。

编写如下:

1、首先打开自己安装的Eclipse软件。

2、然后选择File->New->JavaProject。

3、然后找到工程打开,右击src选择->New->Class。

4、填入类名,选择下面的publicstaticvoidmain(String[]args)。

5、然后写入代码publicclassDemo{publicstaticvoidmain(String[]args){//TODOAuto-generatedmethodstubSystem.out.println(HelloWorld)。

6、点击上面的运行按钮,点击确认,可以看到代码运行结果。

等等我写下。你看看怎么样

import javafx.application.Application

import javafx.geometry.Pos

import javafx.scene.Scene

import javafx.scene.control.Button

import javafx.scene.control.ComboBox

import javafx.scene.control.TextField

import javafx.scene.layout.BorderPane

import javafx.scene.layout.GridPane

import javafx.scene.layout.HBox

import javafx.scene.layout.Pane

import javafx.scene.layout.VBox

import javafx.stage.Stage

public class Login extends Application{

public static void main(String[] args) {

Application.launch(args)

}

@Override

public void start(Stage primaryStage) throws Exception {

BorderPane loginPane = new BorderPane()

HBox btnBox = new HBox()

VBox content = new VBox()

ComboBox<String> loginType = new ComboBox<>()

loginType.getItems().addAll("student", "teacher")

loginType.setStyle("-fx-color: red")

loginType.setValue("student")

loginType.autosize()

ComboBox<String> classNum = new ComboBox<>()

classNum.getItems().addAll("班级一", "新建班级")

classNum.setStyle("-fx-color: red")

classNum.setValue("班级一")

ComboBox<String> chanelNum = new ComboBox<>()

chanelNum.getItems().addAll("01", "02","03", "04"

,"05", "06","07", "08","09", "10","11", "12"

,"13", "14","15", "16","17", "18","19", "20"

,"21", "22","23", "24","25", "26","27", "28"

,"29", "30","31")

chanelNum.setStyle("-fx-color: red")

chanelNum.setValue("01")

TextField loginName = new TextField()

TextField loginPassword = new TextField()

Button btnLogin = new Button("登录")

Button btnCancel = new Button("取消")

content.getChildren().add(loginType)

content.getChildren().add(loginName)

content.getChildren().add(loginPassword)

content.getChildren().add(classNum)

content.getChildren().add(chanelNum)

btnBox.getChildren().add(btnLogin)

btnBox.getChildren().add(btnCancel)

btnBox.setAlignment(Pos.CENTER)

loginPane.setCenter(content)

loginPane.setBottom(btnBox)

primaryStage.setScene(new Scene(loginPane,400,400))

primaryStage.setTitle("登录")

primaryStage.show()

}

}