Question

Select one favorite application of yours (in e-commence, education, games, and so on). Design a Java...

Select one favorite application of yours (in e-commence, education, games, and so on). Design a Java FxGUI for a "customer" to access the application of your design. the application of your design.

1. Makes sure you have sufficient components (2 or more buttons, text fields/areas, a selection list, 1 or more images and other optional components of your choice). In addition, add an "account" information so that a customer/user may access or utilize the application. Your GUI application shall also allow the customer/user information be entered on the screen.

2. Plan your layout and arrange them into groups when appropriate.

3. Implement your design in Java FxGUI.

screenshot of GUI along with Java code

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.beans.property.SimpleObjectProperty;
import javafx.event.EventHandler;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.effect.DropShadow;
import javafx.scene.effect.Reflection;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Path;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.stage.Stage;
import javafx.util.Duration;


/**
*
* @author Akshay Bisht
*/
public class Connect4 extends Application {

/**
* @param args the command line arguments
*/
  
private SimpleObjectProperty<Color> colorProps = new SimpleObjectProperty<Color>(Color.RED);
private int ran;
private int can;
  
  
public static void main(String[] args) {
launch(args);
}
  
@Override
public void start(Stage primaryStage) {
  
final BorderPane rt = new BorderPane();
final GridPane gird = new GridPane();
primaryStage.setTitle("JavaFX Connect Four");
primaryStage.setResizable(true);
  
final Button addCells = new Button("Add Grids");
  
Scene sc = new Scene(rt, 750, 680, true);
sc.setFill(Color.BLACK);
sc.getStylesheets().add("net/glyphsoft/styles.css");
  
gird.setTranslateY(20);
gird.setAlignment(Pos.CENTER);
  
gird.getColumnConstraints().addAll(new ColumnConstraints(100,100,Double.MAX_VALUE),
new ColumnConstraints(100,100,Double.MAX_VALUE),
new ColumnConstraints(100,100,Double.MAX_VALUE),
new ColumnConstraints(100,100,Double.MAX_VALUE));
gird.getRowConstraints().addAll(new RowConstraints(100,100,Double.MAX_VALUE),
new RowConstraints(100,100,Double.MAX_VALUE),
new RowConstraints(100,100,Double.MAX_VALUE),
new RowConstraints(100,100,Double.MAX_VALUE));
  
createCol(gird);
  
rt.setCenter(gird);
  
DropShadow drops = new DropShadow();
drops.setColor(Color.BLUE);
addCells.setEffect(drops);
  
addCells.setTranslateY(10);
addCells.setTranslateX(10);
  
rt.setTop(addCells);
  
addCells.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void hands(MouseEvent arg0) {
addingRow(gird);
}

@Override
public void handle(MouseEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});

primaryStage.setScene(sc);
primaryStage.setResizable(false);
primaryStage.show();
}
  
//Add Column and Row
private void addingRow(final GridPane gird){
gird.getColumnConstraints().addAll(new ColumnConstraints(100,100,Double.MAX_VALUE));
gird.getRowConstraints().addAll(new RowConstraints(100,100,Double.MAX_VALUE));
createCol(gird);
}
  
//Create Grids
private void createCol(final GridPane gird){
gird.getChildren().clear();
for(ran=0;ran<gird.getColumnConstraints().size(); ran++){
for(can=0; can<gird.getColumnConstraints().size(); can++){
  
Rectangle rec = new Rectangle(100,100);
Circle cir = new Circle(47);
cir.centerXProperty().set(50);
cir.centerYProperty().set(50);
Shape sh = Path.subtract(rec, cir);
sh.setFill(Color.BLUE);
sh.setStroke(Color.BLUE);
sh.setOpacity(.8);
DropShadow drops = new DropShadow();
drops.setSpread(.2);
drops.setRadius(25);
drops.setColor(Color.BLUE);
sh.setEffect(drops);
  
  
final Circle prev = new Circle(40);
prev.setOpacity(.5);
prev.setFill(Color.TRANSPARENT);
  
prev.setOnMouseEntered(new EventHandler<MouseEvent>(){
public void hands(MouseEvent arg0) {
prev.setFill(Color.WHITE);
if(colorProps.get()==Color.RED){
prev.setFill(Color.RED);
}else{
prev.setFill(Color.YELLOW);
}
}

@Override
public void handle(MouseEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
  
prev.setOnMouseExited(new EventHandler<MouseEvent>(){
public void hands(MouseEvent arg0) {
prev.setFill(Color.TRANSPARENT);
}

@Override
public void handle(MouseEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
  
final Circle cirDisk = new Circle(40);
cirDisk.fillProperty().bind(colorProps);
cirDisk.setOpacity(.5);
cirDisk.setTranslateY(-(100*(ran+1)));
  
  
final TranslateTransition transitions = new TranslateTransition(Duration.millis(300), cirDisk);
  
cirDisk.setOnMouseEntered(new EventHandler<MouseEvent>(){
public void hands(MouseEvent arg0) {
prev.setFill(Color.WHITE);
if(colorProps.get()==Color.RED){
prev.setFill(Color.RED);
}else{
prev.setFill(Color.YELLOW);
}
}

@Override
public void handle(MouseEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
  
cirDisk.setOnMouseExited(new EventHandler<MouseEvent>(){
public void hands(MouseEvent arg0) {
prev.setFill(Color.TRANSPARENT);
}

@Override
public void handle(MouseEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
  
cirDisk.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void hands(MouseEvent arg0) {
if(cirDisk.getTranslateY()!=0){
transitions.setToY(0);
transitions.play();
if(colorProps.get()==Color.RED){
colorProps.set(Color.YELLOW);
cirDisk.fillProperty().bind(new SimpleObjectProperty<Color>(Color.RED));
}else{
colorProps.set(Color.RED);
cirDisk.fillProperty().bind(new SimpleObjectProperty<Color>(Color.YELLOW));
}
}
}

@Override
public void handle(MouseEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
  
prev.setOnMouseClicked(new EventHandler<MouseEvent>(){
public void hands(MouseEvent arg0) {
if(cirDisk.getTranslateY()!=0){
transitions.setToY(0);
transitions.play();
if(colorProps.get()==Color.RED){
colorProps.set(Color.YELLOW);
cirDisk.fillProperty().bind(new SimpleObjectProperty<Color>(Color.RED));
}else{
colorProps.set(Color.RED);
cirDisk.fillProperty().bind(new SimpleObjectProperty<Color>(Color.YELLOW));
}
}
}

@Override
public void handle(MouseEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
});
  
  
StackPane stck = new StackPane();
  
stck.getChildren().addAll(sh, prev, cirDisk);
  
gird.add(stck, can, ran);
  
if(ran==gird.getColumnConstraints().size()-1){
stck.setEffect(new Reflection());
}
}
  
}
}
}

Output:

Rate the answer an upvote.........Thankyou

Hope this helps.....

Add a comment
Know the answer?
Add Answer to:
Select one favorite application of yours (in e-commence, education, games, and so on). Design a Java...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in Java, design your favorite GUI application, and allow new customer/user to be entered on the...

    in Java, design your favorite GUI application, and allow new customer/user to be entered on the GUI so that a customer (or user) can access your application.   

  • JAVA Developing a graphical user interface in programming is paramount to being successful in the business...

    JAVA Developing a graphical user interface in programming is paramount to being successful in the business industry. This project incorporates GUI techniques with other tools that you have learned about in this class. Here is your assignment: You work for a flooring company. They have asked you to be a part of their team because they need a computer programmer, analyst, and designer to aid them in tracking customer orders. Your skills will be needed in creating a GUI program...

  • Question 1 (Marks: 50 Develop a Java GUI application that will produce an investment report based...

    Question 1 (Marks: 50 Develop a Java GUI application that will produce an investment report based on various criteria, such as investment amount, investment type and term. On the form create two text fields, one to capture the customer name and (10) Q.1.1 another to capture the amount to invest. Also create a combo box for the user to select the investment type which will be moderate or aggressive. Finally add three radio buttons for the user to select the...

  • use java to design the application, the GUI should appear as in the picture shown ....

    use java to design the application, the GUI should appear as in the picture shown . Use java language: Requirements Document A local bank intends to install a new automated teller machine (ATM) to allow users (i.e., bank customers) to perform basic financial transactions. Each user can have only one account at the bank. ATM users should be able to view their account balance, withdraw cash (i.e., take money out of an account) and deposit funds (i.e., place money into...

  • Programming language: Java Design an application that has three classes. The first one, named Book describes...

    Programming language: Java Design an application that has three classes. The first one, named Book describes book object and has title and number of pages instance variables, constructor to initialize their values, getter methods to get their values, method to String to provide String representation of book object, and method is Long that returns true if book has over 300 pages, and returns false othewise. Provide also method char firstChard) that returns first cahracter of the book's title. The second...

  • Project overview: Create a java graphics program that displays an order menu and bill from a...

    Project overview: Create a java graphics program that displays an order menu and bill from a Sandwich shop, or any other establishment you prefer. In this program the design is left up to the programmer however good object oriented design is required. Below are two images that should be used to assist in development of your program. Items are selected on the Order Calculator and the Message window that displays the Subtotal, Tax and Total is displayed when the Calculate...

  • please help!! hoose a Tool to Design Your Wireframes You may use any tool available to...

    please help!! hoose a Tool to Design Your Wireframes You may use any tool available to you that will allow you to create simple skeletal sketches of each screen or page, and to label the location of the key elements described in Part B of the assignment. You should save the sketches in one of the following formats: docx, .pptx, .sketch, .psd, .pdf, .png, .jpg, .gif, .png, or .rtf. Possible tools include Paint, PowerPoint, Word, Adobe Illustrator, Visual Studio, Visio,...

  • Help Please on JAVA Project: Validating the input is where I need help. Thank you Requirements...

    Help Please on JAVA Project: Validating the input is where I need help. Thank you Requirements description: Assume you work part-time at a sandwich store. As the only employee who knows java programming, you help to write a sandwich ordering application for the store. The following is a brief requirement description with some sample output. 1. Selecting bread When the program starts, it first shows a list/menu of sandwich breads and their prices, then asks a user to select a...

  • In java language here is my code so far! i only need help with the extra...

    In java language here is my code so far! i only need help with the extra credit part For this project, you will create a Rock, Paper, Scissors game. Write a GUI program that allows a user to play Rock, Paper, Scissors against the computer. If you’re not familiar with Rock, Paper, Scissors, check out the Wikipedia page: http://en.wikipedia.org/wiki/Rock-paper-scissors This is how the program works: The user clicks a button to make their move (rock, paper, or scissors). The program...

  • Java Painter Class This is the class that will contain main. Main will create a new...

    Java Painter Class This is the class that will contain main. Main will create a new Painter object - and this is the only thing it will do. Most of the work is done in Painter’s constructor. The Painter class should extend JFrame in its constructor.  Recall that you will want to set its size and the default close operation. You will also want to create an overall holder JPanel to add the various components to. It is this JPanel that...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT