المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : JOptionPane Features - to make Simple Dialogs



A7med Baraka
10-25-2008, 01:01 AM
JOptionPane Features


Using JOptionPane, you can quickly create and customize several different kinds of dialogs. JOptionPane provides support for laying out standard dialogs, providing icons, specifying the dialog title and text, and customizing the button text. Other features allow you to customize the components the dialog displays and specify where the dialog should appear onscreen. You can even specify that an option pane put itself into an internal frame (http://java.sun.com/docs/books/tutorial/uiswing/components/internalframe.html) (JInternalFrame) instead of a JDialog
.
When you create a JOptionPane, look-and-feel-specific code adds components to the JOptionPane and determines the layout of those components.
JOptionPane's icon support lets you easily specify which icon the dialog displays. You can use a custom icon, no icon at all, or any one of four standard JOptionPane icons (question, information, warning, and error). Each look and feel has its own versions of the four standard icons. The following figure shows the icons used in the Java (and Windows) look and feel



.

Icons used by JOptionPane
(Java look and feel)
http://java.sun.com/docs/books/tutorial/figures/uiswing/components/metal-question.png question

http://java.sun.com/docs/books/tutorial/figures/uiswing/components/metal-info.png information

http://java.sun.com/docs/books/tutorial/figures/uiswing/components/metal-warning.png warning

http://java.sun.com/docs/books/tutorial/figures/uiswing/components/metal-error.png error

(Windows look and feel)

http://java.sun.com/docs/books/tutorial/figures/uiswing/components/windows-question.png question

http://java.sun.com/docs/books/tutorial/figures/uiswing/components/windows-info.png information

http://java.sun.com/docs/books/tutorial/figures/uiswing/components/windows-warning.png warning

http://java.sun.com/docs/books/tutorial/figures/uiswing/components/windows-error.png error

mahmoud_nagyp
11-10-2008, 05:00 AM
جزاك الله خيرا

A7med Baraka
01-06-2009, 08:34 PM
جزانا و أياك

fatma mansour
03-26-2009, 12:16 AM
thanks mulion
but i try to use joptionpane in netbeans
and my code was correct.and it cannot be run
i think my mistake in the kind of java project or application
to anyone can help me
tell me the right way to do that
plz

A7med Baraka
03-26-2009, 12:24 AM
thanks mulion
but i try to use joptionpane in netbeans
and my code was correct.and it cannot be run
i think my mistake in the kind of java project or application
to anyone can help me
tell me the right way to do that
plz


thnx for u reply
i dont understand your problem exactly but take care that its case sensitive
JOptionPane not joptionpane

try to explain the problem clearly so we can help u isA
also try to put the code to check it
waiting ...

fatma mansour
03-26-2009, 03:47 PM
thanks
i know that joptionpane =JOptionpane
and my question is
from the begining when i create new project and before i write the code
what's the kind of the project ,class??
and thank you again for your help

fatma mansour
03-26-2009, 03:48 PM
sorry i mean !=

fatma mansour
03-26-2009, 04:03 PM
when i try to run a simple program
the netbeans show me that message:
java.lang.NoClassDefFoundError: javaapplication5/Main
Caused by: java.lang.ClassNotFoundException: javaapplication5.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: javaapplication5.Main. Program will exit.
Exception in thread "main"
Exception in thread "main" Java Result: 1
BUILD SUCCESSFUL (total time: 6 seconds)

fatma mansour
03-26-2009, 05:41 PM
thanks much
انا خلاص شغلتة
وهو كان برنامج بسيط للمقارنة بين رقمين وهو دة الكود لو حد عايز يجربة

fatma mansour
03-26-2009, 05:46 PM
import javax.swing.JOptionPane;

public class Main {


public static void main(String[] args) {
String Fristnumber;
String Secondnumber;
String Result;
int number1;
int number2;
Fristnumber =JOptionPane.showInputDialog("enter frist value");
Secondnumber =JOptionPane.showInputDialog("enter second value");
number1 =Integer.parseInt(Fristnumber);
number2 =Integer.parseInt(Secondnumber);
Result="";
if(number1==number2)
Result=number1+"=="+number2;
if(number1!=number2)
Result=number1+"!=" +number2;
if(number1<number2)
Result= Result + "\n"+number1+"<"+number2;
if(number1>number2)
Result= Result+"\n"+number1+">"+number2;
if(number1<=number2)
Result= Result+"\n"+number1+"<="+number2;
if(number1>=number2)
Result= Result+"\n"+number1+">="+number2;
JOptionPane.showMessageDialog(null,Result,"comparion result",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}

A7med Baraka
03-26-2009, 09:58 PM
الحمد لله أن المشكلة أتحلت و إذا أحتاجتى أى حاجة أسألى و أن شاء الله نقدر نساعدك

fatma mansour
03-27-2009, 04:21 PM
thank muchhhhhhhhh for your help
i hope you have a great luck in your life