我正在開發一個項目。我的項目在一個包中包含幾個類。我的主課將Application
擴展到它。我正在使用NetBeans IDE來開發我的項目。現在我需要編寫其他類而不將應用程序擴展到它。我該怎麼做?我在下面包括我的一個類的代碼。請建議如何編輯它。在不擴展的情況下編寫javafx程序應用程序
package welcomepage;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.stage.Stage;
public class About extends Application {
@Override
public void start(Stage stage) {
BorderPane border = new BorderPane();
HBox hbox = addHBox();
border.setTop(hbox);
border.setCenter(addVBox());
border.setBottom(addHBox1());
Scene scene = new Scene(border,700,450);
stage.setScene(scene);
stage.setResizable(false);
}
private HBox addHBox() {
HBox hbox = new HBox();
hbox.setPadding(new Insets(15, 12, 15, 320));
hbox.setSpacing(10);
hbox.setStyle("-fx-background-color: #336699;");
Label lb1=new Label("ABOUT");
lb1.setAlignment(Pos.CENTER);
lb1.setFont(Font.font("Trebuchet MS",FontWeight.BOLD,20));
hbox.getChildren().addAll(lb1);
return hbox;
}
private VBox addVBox() {
VBox vbox = new VBox();
vbox.setPadding(new Insets(20));
vbox.setSpacing(5);
Label l1=new Label("C - MARK AND ATTENDANCE CALCULATOR");
l1.setFont(Font.font("Calibri",FontWeight.BOLD,20));
l1.setTextFill(Color.GREEN);
Label l2=new Label("\nSoftware to calculate C-mark and attendance easily.\n"
+ "Supported in Windows XP or above.\n"
+ "Developed using Java.\n"
+ "Advantages : Simple user interface, Easy usage.\n\n"
+ "Developed by :\n"
+ "\t\t Adarsh P.S \n"
+ "\t\t Akhilnath A.R \n"
+ "\t\t Arjun P Das \n"
+ "\t\t Tomin Jacob ");
l2.setFont(Font.font("Calibri",FontWeight.BOLD,18));
l2.setTextFill(Color.GREEN);
vbox.getChildren().addAll(l1,l2);
return vbox;
}
private HBox addHBox1()
{
HBox hbox1 = new HBox();
hbox1.setPadding(new Insets(15, 12, 15, 300));
Button btn1=new Button("BACK");
btn1.setFont(Font.font("Calibri",FontWeight.BOLD,18));
btn1.setPrefSize(100,40);
hbox1.getChildren().addAll(btn1);
return hbox1;
}
public static void main(String[] args) {
launch(args);
}
}
您需要擴展Application。你想要達到什麼目的? – Reimeus
@Reimeus當我在Stackoverflow中問及時,我曾說過只將Application擴展到主類。他們還表示不會將應用程序擴展到其他類。這就是我問這個問題的原因。 –
是的,這是有道理的,但其他classes_需要什麼? – Reimeus