yosof.a.a
سه شنبه 17 مرداد 1396, 13:21 عصر
من کد های زیر را درج کرده ام
سوال 1-در اخرین خط خطا میدهد باید چه کنم
سوال 2- چگونه فورمی را که ایجاد کرده ام را نمایش دهم:گریه::گریه::گریه::گریه::گ یه::گریه::گریه::گریه::گریه::گ یه::گریه::گریه::گریه::گریه:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package yosof.project;
import javax.swing.*;
import java.awt.event.*;
/**
*
* @author Pav-x2
*/
public class NewMain extends JFrame implements ActionListener{
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new NewMain();
}
JButton JB=new JButton();
public NewMain(){
JFrame JF=new JFrame();
this.setVisible(true);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
this.setSize(500,500);
JPanel JP=new JPanel();
JLabel JL=new JLabel("yosof project");
JP.add(JL);
this.add(JP);
JB.setText("yosof");
JP.add(JB);
}
public void actionPerformed(ActionEvent a){
if(a.getSource()==JB)
JB.setText("Y.A.A پایان");
}
JButton.add actionListener(NewMain);
}
سوال 1-در اخرین خط خطا میدهد باید چه کنم
سوال 2- چگونه فورمی را که ایجاد کرده ام را نمایش دهم:گریه::گریه::گریه::گریه::گ یه::گریه::گریه::گریه::گریه::گ یه::گریه::گریه::گریه::گریه:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package yosof.project;
import javax.swing.*;
import java.awt.event.*;
/**
*
* @author Pav-x2
*/
public class NewMain extends JFrame implements ActionListener{
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new NewMain();
}
JButton JB=new JButton();
public NewMain(){
JFrame JF=new JFrame();
this.setVisible(true);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE );
this.setSize(500,500);
JPanel JP=new JPanel();
JLabel JL=new JLabel("yosof project");
JP.add(JL);
this.add(JP);
JB.setText("yosof");
JP.add(JB);
}
public void actionPerformed(ActionEvent a){
if(a.getSource()==JB)
JB.setText("Y.A.A پایان");
}
JButton.add actionListener(NewMain);
}