GuiApplication() { panel = new JPanel(new GridLayout(3, 2)); panel1 = new JPanel(new GridLayout(3, 2)); panel2 = new JPanel(new GridLayout(3, 2)); label1 = new JLabel("Enter number"); label2 = new JLabel("Result is"); text = new JTextField(15); area = new JTextArea(2, 2); pane = new JScrollPane(area); button1 = new JButton("Check"); button2 = new JButton("Prime Factors"); button1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String value = text.getText(); int i = 0; Pattern p = Pattern.compile("[A-Z,a-z]"); Matcher m = p.matcher(value); if (m.find()) { JOptionPane.showMessageDialog(null, "Please enter only numbers"); } else { int num = Integer.parseInt(value); for (i = 2; i < num; i++) { int n = num % i; if (n == 0) { area.setText("Entered number is not Prime!"); break; } } if (i == num) { area.setText("Number is Prime!"); } } } }); button2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String value = text.getText(); Pattern p = Pattern.compile("[A-Z,a-z]"); Matcher m = p.matcher(value); if (m.find()) { JOptionPane.showMessageDialog(null, "Please enter only numbers"); } else { int num = Integer.parseInt(value); int perfectNo = 0; String perfect = ""; area.setText("Factors are:"); for (int i = 1; i < num; i++) { if (num % i == 0) { perfectNo += i; perfect += Integer.toString(i) + " ";
public static void main(String[] args) { GuiApplication app = new GuiApplication(); app.setVisible(true); app.pack(); } }
Thanks
Related Pages:
Writing a GUI program - Java Beginners Writing a GUI program Hello everyone!
I'm trying to write a program... if that number is prime or not. When the second button is pressed the program... to write the code for the GUI. Could anyone please help? Hi Friend
GUI application program GUI application program Write a GUI application program that meets the following requirements:
Create an array with 100 randomly chosen integers.
Create a textfield to enter an array index and another textfield to display
writing program - Java Beginners writing program WAP to input Name of Cricketer, Number of matches, total runs scored for 250 players from the user and print data in descending order of their average runs using bubble sort. Average runs=total runs divided
Serializing GUI Components Across Network - tutorial
Serializing GUI Components Across Network
2001-03-14 The Java Specialists' Newsletter [Issue 013a] - Serializing GUI Components Across Network
Author... to as many
people as you know who might be interested in Java.
Serializing GUI
GUI problem GUI problem Create a class called CDProgram and write a GUIprogram to compute the amount of a certificate of deposit on maturity. The sample data follows:
Amount deposited: 80000.00
Years: 15
Interest Rate: 7.75
Hint
java GUI program - Java Beginners
java GUI program java program that creates the following GUI, when user enter data in the
textfield, the input will be displayed in the textarea.
Hi friend,
import javax.swing.*;
import
writing program in bluej - Java Beginners writingprogram in bluej How to write the program on follwing
WAP to inpout a string and print
Input : I stidied Hard
Hi Friend,
Try the following:
import java.util.*;
public class UserInput{
public
Java GUI Program - Java Beginners
Java GUI Program How is the following program supposed to be coded?
Write an application that prompts the user to enter the radius of a circle by Day 7 under a thread in your Team Forum called Week Three Program for 10 points
Need help writing a console program
Need help writing a console program I need help cant seems to figure it out!
Write a program that consists of three classes. The first class will be the actual program.
The second class will simply convert a string to lower
Java gui program for drawing rectangle and circle
Java guiprogram for drawing rectangle and circle how to write java guiprogram for drawing rectangle and circle?
there shoud be circle....
and the program must also show message dialog "this is a red circle" when click
want a program for cd writing in java - Java Beginners
want a program for cd writing in java Hi
Can u tell some body, doing a program on cd writing in java. I m facing some problem on it.
Thanks in advance.
Regards
sanjaya
Magic Matrix in GUI
Magic Matrix in GUI I want program in java GUI contain magic matrix for numbers
GUI convert to celsius program - Java Beginners GUI convert to celsius program how to write java GUIprogram to convert Fahrenheit to Celsius that need user to input value of Fahrenheit then click button convert and value of Celsius will display as a output. Hi
Java GUI to build a Student Registration Program
Java GUI to build a Student Registration Program Write a program... in sorted order by last name.
Demonstrate the correct operation of your program by creating a driver program to load the student data base and the course data
GUI Tips
.
Events and communication
After the GUI is constructed, the program stops execution...
Java NotesGUI Tips
[Beginning of list of GUI tips -- needs much more]
Program structure
main can be in any class, but it's often
simplest
need help on writing a program. - Java Beginners Writing first Java Program Hi, I need help to write my first Java Program other then Hello World! Thanks!! Hi Thanks for choosing roseIndia to get your query solved. check given link to see the solution of your Java
Need in desperate help in writing a console program
Need in desperate help in writing a console program Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two
Need in desperate help in writing a console program
Need in desperate help in writing a console program Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two
Need in desperate help in writing a console program
Need in desperate help in writing a console program Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two
GUI Alternatives
, it isn't difficult to build a Graphical User Interface (GUI) in Java,
but it is hard... of GUI programming simply don't scale well.
Separation of concerns
BAD: Mix...: Separate GUI from logic.
As programs grow larger, it's essential to separate
java gui-with jscroll pane
java gui-with jscroll pane Dear friends..
I have a doubt in my gui... the window manually.....but i need this through my program...How can i show that text feilds through my program....
some one please help me....
Thanks in advance
java gui-with jscroll pane
java gui-with jscroll pane Dear friends..
I have a doubt in my gui... the window manually.....but i need this through my program...How can i show that text feilds through my program....
some one please help me....
Thanks in advance
java program for writing xml file - Java Beginners
java program for writing xml file Good morning
i want to write values from my database(one table)into one xml file.
Like i have 3 coloumns in my table along with their values,so when click some button i need to generate one
GUI problem - Java Beginners GUI problem how to write java program that use JTextField to input data and JTextField to display the output when user click Display Button?? Handle the actionPerformed event for JButton and try doing something like
Rationale for GUI tutorial decisions
?
No subclass. Building a GUI entirely in a static
main program may...
Table of Contents
Rationale for GUI tutorial decisions
Java offers many... learn GUI programming?
All "normal" programs are GUI based,
so this question
GUI
GUI How to GUI in Net-beans ... ??
Please visit the following link:
http://www.roseindia.net/java/java-tips/background/30java_tools/netbeans.shtml
Java GUI code
Java GUI code Write a GUIprogram to compute the amount of a certificate of deposit on maturity. The sample data follows:
Amount deposited: 80000.00
Years: 15
Interest rate: 7.75
Total Amount:
Hint** to solve this problem
question "writing prog"
question "writing prog" Hello
I want helping for this question, please
Write a program that reads some friendsā?? names, stores them in an array, and then prints out on the screen all friends who start by a particular letter
Programming - Transform Name - GUI 0
Java: Programming - Transform Name - GUI 0
Write a GUIprogram to redisplay a name, possibly transformed.
This Java program will reformat a user's name... be good extra credit for this
program. You can easily use the Java functions
Convert the code to GUI ??
Convert the code to GUI ?? hi >>
can anyone help me to conver this code to GUI ??
/**
* @(#)RegistorClass.java
*
*.
* @author...! ***");
System.out.println("*** Please enter your program one instruction
Fill-in: Rainfall GUI
Java NotesFill-in: Rainfall GUI
Name ______________________________
(5... like
someplace on this page.
(15 points) Fill in the blanks in this program...
79
80
81
82
83
84
// RainfallGUI2.java - Provides a GUI interface
Java: Basic GUI
Java NotesBasic GUI
Next - Big Blob
This first example just shows what... program
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// structure/CalcV1.java
// Fred Swartz - December 2004
// GUI
Summary - Basic GUI Elements
Java: Summary - Basic GUI Elements
In this tutorial we will learn about Basic GUI elements in Java program.
Following table summarizes the variable... JFrame.EXIT_ON_CLOSE to terminate program when close box clicked.
w.setResizable
writing aprogram - Java Beginners writing aprogram Write a program to reverse any string Hi Friend,
Try the following code:
import java.util.*;
class StringReverse{
public static void main(String[]args){
Scanner input=new Scanner(System.in
Convert the code to GUI GUI example for beginners GUI example for beginners sory... program one instruction ***"); System.out.println("*** (or data word...("*** Type -99999 to stop entering your program. ***"); System.out.println
Convert the code to GUI
Convert the code to GUI can any one convert My code to GUI code... to Simpletron! ***"); System.out.println("*** Please enter your program one... to stop entering your program. ***"); System.out.println
GUI Interface - Java Beginners GUI Interface Respected sir,
please send me the codimg of basic calculator,functionality must be include additon ,subtraction,division... calculator program.");
class CalcGUI extends JFrame {
private final Font BIGGER
(Displaying a calendar in GUI
(Displaying a calendar in GUI (Displaying a calendar) Write a program that displays the calendar for the current month, as Use labels, and set texts on the labels to display the calendar."The Calendar and GregorianCalendar
writing programs - Java Beginners writing programs 1.write a program to display odd numbers from 1-50.
2.And Write a program to find the facorial of a number Hi Friend,
1)
class OddNumbers{
public static void main (String args
Writing and Reading A File Writing and Reading A File Hello, I've been trying to learn writing... contact information the user enters. Our assignment requires us to make GUI apps... the user input from the user through GUI components and store the data
Rainfall GUI Questions
Java NotesRainfall GUI Questions
Name ______________________________
This is part of the code to implement the GUI that was used with the Rainfall
program. The problem is that there is no button to calculate the average.
Add
without writing web.xml file we can write servlet program
without writing web.xml file we can write servlet program Sir Morning...
Sir I have one Question "without writing web.xml file we can write servlet program". if yes which way? if no why? but without use Annotation........
Plz
writing and appending to a file writing and appending to a file My input file includes data from both males and females. My code below replaces a 'male string' with the key... for females and write into a different 'female string' in the same program?
Sorry If I
File Writing - Java Beginners
File Writing Hi... I need a syntax or logic or program by which we can write into the desired shell of the Excel file from console window... Hi friend,
I am sending you a link. This is will help you. Please
Java scroll pane-java GUI
Java scroll pane-java GUI Dear friends.. Very Good morning.
I have a doubt in my gui application.
Take ex:- My gui application has 1 Jscrollpane... my program....
Thanks dears in advance
Having a hard time writing program to calculate test scores..........
Having a hard time writingprogram to calculate test scores.......... i need a program that does this:Standardized Test Scores
A local high... to have your program open the data file, count the number of elements in the file
Java GUI code- creating a circle
Java GUI code- creating a circle My assignment is to write a program... is (x,y)(x2,y2). The program should then output the circle's radius, circumference...;
//GUI components
JLabel lClx, lCly, lCircumrx, lCircumry, lRadius