Convert this code to GUI

Convert this code to GUI

View Answers

March 30, 2009 at 12:00 PM

hi friend,

We have convert your code into GUI.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JOptionPane;
public class CompString implements ActionListener{

JFrame frame;
JPanel panel;
JTextField string1;
JLabel label1, label2;
JButton compareButton;
JTextField string2;
public CompString() {
frame = new JFrame("Compare String");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(new Dimension(180, 80));
panel = new JPanel(new GridLayout(3, 2));
panel.setBorder(BorderFactory.createEmptyBorder(60, 60, 20, 60));
addItems();
frame.getRootPane().setDefaultButton(compareButton);
frame.getContentPane().add(panel, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}
private void addItems() {
label1 = new JLabel("Text1", SwingConstants.LEFT);
string1 = new JTextField(20);

compareButton = new JButton("Compare");
label2 = new JLabel("Text2", SwingConstants.LEFT);
string2 = new JTextField(20);

compareButton.addActionListener(this);
panel=new JPanel(new GridLayout(4,1));
panel.add(label1);
panel.add(string1);
panel.add(label2);
panel.add(string2);
panel.add(compareButton);

label1.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
label1.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5));
}
public void actionPerformed(ActionEvent event) {
String st1=string1.getText();
String st2=string2.getText();
if (st2.compareTo(st1) > 0){
JOptionPane.showMessageDialog(null,"The second string is greater than the first one");
}
else{
JOptionPane.showMessageDialog(null,"The first string is greater than the second one");
}
}
private static void createAndShowGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);
CompString converter = new CompString();
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}

Thanks









Related Tutorials/Questions & Answers:
Convert the code to GUI
How to Convert the code to GUI   How to convert a code into GUI
Convert the code to GUI
GUI code  GUI code
Advertisements
Convert the code to GUI
Java Code to GUI   can any one convert My code to GUI code
Convert the code to GUI
GUI Example  GUI Example code to learn
Convert the code to GUI
Is it possible to convert a code into GUI  Is it possible to convert a code into GUI
Convert the code to GUI
Convert the code   How to convert a code to GUI look alike
Convert the code to GUI
GUI Application example  GUI Application example
Convert the code to GUI
GUI Java JSP application  GUI Java JSP application
Convert the code to GUI
Java and GUI application Example  Java and GUI application Example
Convert the code to GUI
Java GUI Class Example  Java GUI Class Example
Convert the code to GUI
GUI Application Development   GUI Application Development
Convert the code to GUI
Write a GUI Application  best way to write a GUI based application
Convert the code to GUI
How to create GUI application in Java   How to create GUI application in Java
Convert the code to GUI ??
Convert the code to GUI ??  hi >> can anyone help me to conver this code to GUI ?? /** * @(#)RegistorClass.java * *. * @author...("*** Invalid operation code ***"); halt= true; // break
Convert the code to GUI
Convert the code to GUI   can any one convert My code to GUI code...: System.out.println("*** Invalid operation code... ??? System.out.println(); } } `print("code sample");` thanks
Convert the code to GUI
GUI example for beginners  GUI example for beginners  sory ,, I will posted my code again import java.util.Scanner; public class...; default: System.out.println("*** Invalid operation code
HOW TO CONVERT THIS CODE INTO GUI
HOW TO CONVERT THIS CODE INTO GUI   System.out.println("\n\t UGANDA CHRISTIAN UNIVERSITY\n"); System.out.println("\n\tFACULTY OF SCIENCE AND TECHNOLOGY\n"); System.out.println("\n BACHELOR OF SCIENCE IN COMPUTER
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks
convert this code to GUI
convert this code to GUI  hello.. this is my code.. import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; //"this" keyword
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; //"this" keyword
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; //"this" keyword
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; //"this" keyword
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; //"this" keyword
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; //"this" keyword
convert this code to GUI
convert this code to GUI  import java.util.Scanner; public class StudentGrade { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks; //"this" keyword
convert this code to GUI
convert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return name.equals
convert this code to GUI
convert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return name.equals
Convert this code to GUI - Java Beginners
); } }  hi friend, We have convert your code into GUI...Convert this code to GUI  I have written this.i need to convert the following code to GUI:- import java.awt.*; import java.applet.*; import
How to convert this Java code into GUI?
How to convert this Java code into GUI?   import java.util.Scanner; public class StudentMarks { double totalMarks; String grade; public void setTotalMarks(double totalMarks) { this.totalMarks = totalMarks
"Urgent" convert this code to GUI - Swing AWT
"Urgent" convert this code to GUI   please convert for me this code to GUI THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. //CLASS CashDispenser public class
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI    THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. // class ATM import javax.swing.*; import java.awt.*; public
please convert for me this code to GUI - Swing AWT
please convert for me this code to GUI  THE CODES ARE BELOW, CLASS ATMCaseStudy is the driver class that runs all the other classes. its very urgent. // class ATM import javax.swing.*; import java.awt.*; public class ATM
convert to GUI
convert to GUI  import java.util.Scanner; public class Exam { public static void main (String args[]) { int numberStudent, mark, markAplus = 0, markA = 0, markBplus = 0, markB = 0, markBminus = 0, i; int markCplus = 0, markC
Java GUI code
Java GUI code  Write a GUI program to compute the amount of a certificate of deposit on maturity. The sample data follows: Amount deposited... the following code: import java.awt.*; import javax.swing.*; import java.awt.event.
covert this code to GUI
covert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return
covert this code to GUI
covert this code to GUI  import java.util.*; class Author{ public String name; public BookList<Book>books=new BookList<Book>(); public Author(){ } public boolean equals(Object node){ return
GUI convert to celsius program - Java Beginners
GUI convert to celsius program  how to write java GUI program to convert Fahrenheit to Celsius that need user to input value of Fahrenheit... friend, Code to convert Fahrenheit to Celsius : import java.awt.
Rental Code GUI - Java Beginners
Rental Code GUI  dear sir... i would like to ask some code of java GUI form that ask the user will choose the menu to input Disk #: type: title: record company: price: director: no. of copies
Java GUI code- creating a circle
Java GUI code- creating a circle  My assignment is to write a program..., and area. I did my code but I can't seem to figure out the mathematical code...; //GUI components JLabel lClx, lCly, lCircumrx, lCircumry, lRadius
GUI and how to convert a distance - Java Beginners
GUI and how to convert a distance  i need help.. how to create a GUI application that can be is used to convert a distance unit in miles into its... JLabel("In Inches"); l5=new JLabel("In CM"); b=new JButton("Convert
Catching Exceptions in GUI Code - Java Tutorials
.style1 { text-align: center; } Catching uncaught exception in GUI In this section, we will discuss how to catch uncaught exceptions in GUI. Lets see the given below code to identify the uncaught exception : import
Java code to convert pdf file to word file
Java code to convert pdf file to word file  How to convert pdf file to word file using Java
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
GUI
GUI  Write a GUI application for the WebBuy Company that allows a user to compose the three parts of a complete email message: the â??To:â??, â??Subject:â?? and â??Message:â?? text. The â??To:â??, and â??Subject:â?? Text areas
how to convert war file into .exe file using java code
how to convert war file into .exe file using java code  hi,I am beginner in the java,I want to convert my java maven project to .exe file,plz tell me which is required jar files and how i convert this..?Thanks in advance
How to solve this java code by adding the student marks not in the list of the table. For example -10 and 156 in GUI?
How to solve this java code by adding the student marks not in the list of the table. For example -10 and 156 in GUI?  import java.awt.*; import javax.swing.*; import java.awt.event.*; public class MarkStudent { double
gui question
gui question  design a gui application for me and write its code in which the user enters a no. in a textfield and onn clicking the button the sum of the digits of the no. should be displayed. hint: suppose the user enters 12
GUI framework
GUI framework  what do u mean by GUI framework

Ads