لعبة المزرعة السعيدة لعبة الفراخ
‏إظهار الرسائل ذات التسميات GUI. إظهار كافة الرسائل

جافا : GUI من ابداعات الطالبة الاء غانم .. برنامج للتحويل من النظام العشري الى الثنائي

import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;

public class MyDecimalToBinary extends JFrame implements ActionListener{
JPanel myPanel ;
JTextField number ; 
JLabel r ;
JLabel result ;
JButton bin ;

public MyDecimalToBinary(){
myPanel = new JPanel(new GridLayout(4 ,2, 20 ,0 ));
number = new JTextField(10);
bin = new JButton("bin");

r = new JLabel(" Enter a number : ");
result = new JLabel("decimal to bin = ");
bin.addActionListener(this);
myPanel.add(r);
myPanel.add(number);
myPanel.add(result);
myPanel.add(bin);
this.add(myPanel);

}
public static void main(String[] args) {
MyDecimalToBinary first=new MyDecimalToBinary();
first.setTitle("Decimal to Binary");
first.setSize(300,200);
first.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
first.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent event) {
if( event.getSource() == bin){
int decimal =Integer.parseInt(number.getText()) ;
String bin="";
while(decimal!=0){
bin=decimal%2+bin;
decimal/=2;
}
result.setText(""+bin);
}
}

}
شاهد الموضوع

جافا: GUI برنامج للتحويل من ثنائي الى عشري من ابداعات الطالبة المتميزة الاء غانم

import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;

public class Binarytodecimal {
public static class MyBinaryToDecimal extends JFrame implements ActionListener{
JPanel myPanel ;
JTextField number ; 
JLabel r ;
JLabel result ;
JButton decimal ;

public MyBinaryToDecimal(){
myPanel = new JPanel(new GridLayout(4 ,2, 20 ,0 ));
number = new JTextField(10);
decimal = new JButton("dicemal");

r = new JLabel(" Enter a number : ");
result = new JLabel("binary to decimal = ");
decimal.addActionListener(this);
myPanel.add(r);
myPanel.add(number);
myPanel.add(result);
myPanel.add(decimal);
this.add(myPanel);

}
public static void main(String[] args) {
MyBinaryToDecimal first=new MyBinaryToDecimal();
first.setTitle("binary to decimal");
first.setSize(300,200);
first.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
first.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent event) {
if( event.getSource() == decimal){
int n = Integer.parseInt(number.getText()) ;
String decimal=""; int p=1; int s=0;
while(n > 0){
s=s+((n%10)*p);

p=p*2;
n/=10;
}
result.setText(""+s);
}
}
}
}

شاهد الموضوع

جافا : GUI برنامج لحساب الجمع والطرح والضرب من اعداد الطالبة المبدعة داليا قلالوة

import java.awt.GridLayout;

import java.awt.event.*;
import javax.swing.*;

public class MyGUI {
public static class GUI extends JFrame implements ActionListener{
JPanel myPanel;
JTextField number1 ; 
JTextField number2 ;
JLabel n1 ;
JLabel n2 ;

JLabel result ;
JLabel r ;
JButton add ;
JButton sub ;
JButton Mul;



public GUI(){

myPanel = new JPanel(new GridLayout(5 ,2, 20 ,20 ));
number1 = new JTextField(10);
number2 = new JTextField(10);
sub = new JButton("-");
add = new JButton("+");
Mul=new JButton("*");
result = new JLabel();
n1 = new JLabel("First number : ");
n2 = new JLabel("Second Number : ");
r = new JLabel("Result = ");
add.addActionListener(this);
sub.addActionListener(this);
Mul.addActionListener(this);

myPanel.add(n1);
myPanel.add(number1);
myPanel.add(n2);
myPanel.add(number2);
myPanel.add(r);
myPanel.add(result);

myPanel.add(add);
myPanel.add(sub);
myPanel.add(Mul);
this.add(myPanel);

}

public static void main(String[] args) {
GUI frame=new GUI();
frame.setTitle("Calculate");
frame.setSize(300,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}

@Override
public void actionPerformed(ActionEvent event) {
if(event.getSource()==add){
int num1=Integer.parseInt(number1.getText());
int num2=Integer.parseInt(number2.getText());
int sum=num1+num2;
result.setText(""+sum);
}
if(event.getSource()==sub){
int num1=Integer.parseInt(number1.getText());
int num2=Integer.parseInt(number2.getText());
int sub=num1-num2;
result.setText(""+sub);
}
if(event.getSource()==Mul){
int num1=Integer.parseInt(number1.getText());
int num2=Integer.parseInt(number2.getText());
int Mul=num1*num2;

result.setText(""+Mul);
}

}
}
}

شاهد الموضوع

جافا : GUI برنامج للتحويل من سلسيوس لفهرنهايت اعداد الطالبة المبدعة سارة الغول

import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;
/**
*
* @author hp
*/
public class CtoF {
int num1 = 0;
JFrame frame;
JPanel panel;
JTextField text;
JLabel label;
JButton conv;
CtoF (){
frame = new JFrame();
GridLayout a = new GridLayout(3 ,2,10,10);
panel = new JPanel(a);
text = new JTextField();
conv = new JButton("convert");
label = new JLabel();

conv.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e)
{
num1=Integer.parseInt(text.getText());
label.setText(Integer.toString((int) (num1*1.8 +32)));
}}
);
panel.add(text);
panel.add(conv);
panel.add(label);
frame.setTitle("Converting from C to F");
frame.add(panel);
frame.setSize(300,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setVisible(true);
}
public static void main(String[] args) {
new CtoF ();
}
}

شاهد الموضوع

جافا : GUI برنامج ايجاد مساحة الدائرة ... اعداد الطالبة آلاء غانم

import java.awt.GridLayout;
import java.awt.event.*;

import javax.swing.*;
public class Areacircle {

public static class MyareaCircle extends JFrame implements ActionListener{
JPanel myPanel ;
JTextField radius ; 
JLabel r ;
JLabel area ;

JLabel result ;
JButton click ;

public MyareaCircle(){
myPanel = new JPanel(new GridLayout(4 ,2, 20 ,0 ));
radius = new JTextField(10);
click = new JButton("click");
area = new JLabel();
r = new JLabel(" Enter radius : ");
result = new JLabel(" Area = ");
click.addActionListener(this);

myPanel.add(r);
myPanel.add(radius);
myPanel.add(result);
myPanel.add(area);
myPanel.add(click);
this.add(myPanel);

}

public static void main(String[] args) {
MyareaCircle first=new MyareaCircle();
first.setTitle("areaCircle");
first.setSize(300,200);
first.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
first.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent event) {
if( event.getSource() == click){
double r1 = Double.parseDouble(radius.getText()) ;
double a = r1 * r1 * 3.14;
area.setText(""+a);
}
}
}
}
شاهد الموضوع

JAVA GUI : برنامج لايجاد ناتج الطرح او الضرب لعددين (اعداد الطالبة نغم عبده ^^)


____________________________________________________________
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
*
* @author Abdo
*/
public class NewClass {
int num1 = 0;
int num2 = 0;
JFrame frame;
JPanel panel;
JTextField text;
JTextField text1;
JLabel label;
JButton sub;
JButton mult;

NewClass (){
frame = new JFrame();
GridLayout a = new GridLayout(3 ,2,18,18);
panel = new JPanel(a);
text = new JTextField();
text1 = new JTextField();
sub = new JButton("-");
mult = new JButton("X");
label = new JLabel();
label.setText(Integer.toString(num1-num2));

sub.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
num1=Integer.parseInt(text.getText());
num2=Integer.parseInt(text1.getText());

label.setText(Integer.toString(num1-num2));
}}
);

mult.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
num1=Integer.parseInt(text.getText());
num2=Integer.parseInt(text1.getText());

label.setText(Integer.toString(num1*num2));
}}
);

panel.add(text);
panel.add(text1);

panel.add(sub);
panel.add(mult);
panel.add(label);
frame.setTitle("sub & multi");
frame.add(panel);
frame.setSize(300,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setVisible(true);

}
public static void main(String[] args) {

new NewClass ();
}
}
شاهد الموضوع

JAVA GUI : برنامج لحساب المضروب


_______________________________________________


import java.awt.GridLayout;
import java.awt.event.*;
import javax.swing.*;

public class Factorial extends JFrame implements ActionListener{
JTextField number;
JButton press;
JLabel Result;
JPanel myPanel;

public Factorial(){
myPanel = new JPanel(new GridLayout(3 ,1, 20 ,0 ));
number = new JTextField(10);

myPanel=new JPanel();
number=new JTextField(10);
press=new JButton("press");
Result=new JLabel(" ");

press.addActionListener(this);
myPanel.add(number);
myPanel.add(press);
myPanel.add(Result);
this.add(myPanel);

public static void main(String[]args){
Factorial fact=new Factorial();
fact.setTitle("Factorial");
fact.setSize(300,100);
fact.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fact.setVisible(true);
}

@Override
public void actionPerformed(ActionEvent event) {
if(event.getSource()==press){
int num = Integer.parseInt(number.getText()) ; 
int fact=1;
for(int i=1;i<=num;i++)
fact*=i;
Result.setText(""+fact);
}

}

}

شاهد الموضوع

جافا : GUI simple calc


import java.awt.*;
import java.awt.event.*;

import javax.swing.*;
import javax.swing.border.Border;


public class Ca extends JPanel implements ActionListener {
    double q ;
    double w ; 
    double e ;
JFrame a;
JPanel ma;
    JPanel but;
    JPanel win;
    JPanel in;
    JButton add;
    JButton min;
    JButton mul;
    JButton div;
    JTextField in1;
    JTextField in2;
    JTextField out;
    Ca(){
Border border = BorderFactory.createLineBorder(Color.GRAY);
a = new JFrame();
ma = new JPanel(new BorderLayout());
but = new JPanel( );
win = new JPanel(new GridLayout(2,1));
add=new JButton("add");
min=new JButton("min");
mul=new JButton("mul");
div=new JButton("div");
in1 = new JTextField();
in2 = new JTextField();
out = new JTextField();
in= new JPanel(new GridLayout(2,2));
JLabel s = new JLabel("first");
JLabel d = new JLabel("second");
in1.setHorizontalAlignment(SwingConstants.CENTER);
in2.setHorizontalAlignment(SwingConstants.CENTER);
out.setHorizontalAlignment(SwingConstants.CENTER);
out.setFont(new Font("serif",Font.BOLD,20));
s.setHorizontalAlignment(SwingConstants.CENTER);
d.setHorizontalAlignment(SwingConstants.CENTER);
      s.setBorder(border);
      d.setBorder(border);
add.addActionListener(this);
min.addActionListener(this);
mul.addActionListener(this);
div.addActionListener(this);
but.add(add);
but.add(min);
but.add(mul);
but.add(div);
but.setBackground(Color.BLUE);
        in.add(s);
in.add(d);
in.add(in1);
in.add(in2);
in.setBackground(Color.CYAN);
win.add(in);
win.add(out,FlowLayout.CENTER);
ma.add(but,BorderLayout.SOUTH);
ma.add(win,BorderLayout.NORTH);
   ma.setBackground(Color.BLACK);
a.add(ma);
        a.setTitle("Simple Calc");
a.setSize(400,150);
a.setLocationRelativeTo(a);
a.setResizable(false);
a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
a.setVisible(true);
}
public static void main (String [ ] st){
new Ca();
}
public void actionPerformed(ActionEvent at) {
try{ q=Integer.parseInt(in1.getText());
w=Integer.parseInt(in2.getText());
if (at.getSource()==add)e = q+w;
else if (at.getSource()==min)e= q-w;
else if (at.getSource()==mul)e=q*w;
else if(at.getSource()==div)if(w!=0)e=q/w;else e=0;
out.setText(Double.toString(e));
}catch(Exception e){
JOptionPane.showMessageDialog(a, "Error","Error",0);
}
}}

شاهد الموضوع
لعبة من سيربح المليون لعبة زوما