Note: Create your file as gui.java because i have used Class as "gui".
full code:
import javax.swing.*;
import java.awt.*;
class gui {
public static void main(String args[]) {
//Creating the Frame
JFrame frame = new JFrame("Message Box");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 500); //Setting the frame size
//Creating the MenuBar
JMenuBar mb = new JMenuBar();
JMenu j1 = new JMenu("File"); //File Section in Menubar
JMenu j2 = new JMenu("Edit");
JMenu j3 = new JMenu("Insert"); //Insert
JMenu j4 = new JMenu("Animation"); //Animation
JMenu j5 = new JMenu("Help");
//Adding the components to the menubar...
mb.add(j1);
mb.add(j2);
mb.add(j3);
mb.add(j4);
mb.add(j5);
// Creating MenuItems for the 'File' component
JMenuItem m1 = new JMenuItem("Open");
JMenuItem m2 = new JMenuItem("Save");
JMenuItem m3 = new JMenuItem("Save as");
JMenuItem m4 = new JMenuItem("Cut");
JMenuItem m5 = new JMenuItem("Copy");
JMenuItem m6 = new JMenuItem("Paste");
j1.add(m1);
j1.add(m2);
j1.add(m3);
j1.add(m4);
j1.add(m5);
j1.add(m6);
//Creating the panel and adding components
JPanel panel = new JPanel();
JButton label = new JButton("Enter Message");
JTextField tf = new JTextField(10); // accepts upto 10 characters
JButton send1 = new JButton("Send");
JButton reset = new JButton("Reset");
JButton delete = new JButton("Delete");
// Components Added using Flow Layout
panel.add(label);
panel.add(tf);
panel.add(send1);
panel.add(reset);
panel.add(delete);
// Text Area at the Center
JTextArea ta = new JTextArea();
// JPanel panel1 = new JPanel();
// JButton label1 = new JButton("Enter Message");
// panel1.add(label1);
//Adding Components to the frame.
frame.getContentPane().add(BorderLayout.SOUTH, panel);
frame.getContentPane().add(BorderLayout.NORTH, mb);
frame.getContentPane().add(BorderLayout.CENTER, ta);
frame.setVisible(true);
}
}
CODE OUTPUT:
Display the following box using graphical user interface in Java. v the following message box, using...
User interfaces are a critical part of any system. In this lesson, a Graphical User Interface (GUI) is created. The code generated will link the components to the action. Assignment: Create a Graphical User Interface that has two buttons and a textArea (See Examples 12.3 and Example 12.4). figure 1 Create a String array to store the following messages (Enter your name where it says YourName). "Congratulations YourName!nYou completed the Java class. nYou learned to write Java programs with commonly...
In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student information system. The application should allow: 1. Collect student information and store it in a binary data file. Each student is identified by an unique ID. The user should be able to view/edit an existing student. Do not allow student to edit ID. 2. Collect Course information and store it in a separate data file. Each course is identified by an unique...
WRITE a program in JAVA using GRAPHICAL USER INTERFACE to make fruit and vegetable display panel with a toggle switch.(make two displays panel 1 for fruit and the other for vegetables , if we press the toggle switch then the 1st panel will show and if we again press the switch then the 1st will hide and other will show) and vice versa.
VII JAVA ASSIGNMENT. Write a program with a graphical interface that allows the user to convert an amount of money between U.S. dollars (USD), euros (EUR), and British pounds (GBP). The user interface should have the following elements: a text box to enter the amount to be converted, two combo boxes to allow the user to select the currencies, a button to make the conversion, and a label to show the result. Display a warning if the user does not...
Simple Java Notepad application using Swing GUI Create a help menu with shortcut ctrl+H: -Help menu includes two menu items: 1. About 2. Visit Homepage. Add a separator between these menu items. 1. Create a menu item which is About. Add a short cut for the menu item. It is ctrl+A. -When a user clicks it (an action event occurs), display a show message dialog box. Display the message shown in the figure. Display information icon. 2. Create a menu...
JAVA Create a simple Graphical User Interface (GUI) in java with the following requirements: The interface components will appear centered in the interface, and in two rows. o Row one will have a Label that reads “Please enter a valid integer:” and a Text Field to take in the integer from the user. o Row two will have a Button that when pressed converts the integer to binary The conversion will be completed using recursion – A separate...
This project allows you to create a new graphical user interface and apply what you learned in this unit to your application project. Be sure to include the following in your interface: Radio buttons that limit the user to only one choice (nested selection structure) A group box for your radio buttons Controls to prevent unwanted characters in text boxes At least one message box At least one select case statement Using Visual Basic
Need help on following Java GUI problem: Write a program that lets a user display and modify pictures. Create a window. Add four buttons so that clicking a particular button will shift the image by a small amount in the north, south, east or west direction inside the window. Add a menu bar with two menus: File and Image. The File menu should contain an Open menu item that the user can select to display JPEG and PNG files from...
Subject: Advance application development Visual studio exercise The project is to create a simple Notepad style Text Editor. This will demonstrate the C# language basics. user interface controls and how to handle user events. Controls can be found in the Toolbox pane in its default location on the left side of the IDE, with the Control Properties pane on the right side of the IDE. Include the items on the following list in the program Create a C# Windows Forms...
Using Dr Java Objective: Create a game of video poker with a graphical user interface (GUI). The player should start with $100, and then the system deals out 5 playing cards. After the player sees the cards they are then asked to wager $10, $20, $50, or $100. Next the user picks which cards they wish to throw away, and then the system deals more cards in their place. Once this has concluded money are awarded by these criteria: Nothing...