Mmsh350's Posts
Nairaland Forum › Mmsh350's Profile › Mmsh350's Posts
1 (of 1 pages)
Thanks mkwayisi |
thank you my dear mashnino but i want u to know that i know what am doing,and i also want u to know that the word GUI stand for Graphical user interface so as you can see JOptionpane is a way of display message Graphically. And the reason why am in this forum is because i want to learn more on what are know and to also help my friends with what they don't know. |
dis is my email:sani.muhammad37@yahoo.com |
1 /* 2 * To change this template, choose Tools | Templates 3 * and open the template in the editor. 4 */ 5 package helloworld.java; 6 7 /** 8 * 9 * @author MUHAMMAD 10 */ 11 public class HelloworldJava { 12 13 /** 14 * @param args the command line arguments 15 */ 16 public static void main(String[] args) { 17 System.out.println("welcome muhammad sani" ;18 } 19 } 20 21 [color=#770077][/color] |
import javax.swing.JFrame; public class GUI1Test { public static void main(String arg[]){ GUI1 g=new GUI1(); g.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); g.setSize(200, 300); g.setVisible(true); }//end of main method }//end of class GUI1Test |
import java.awt.Color; import java.awt.FlowLayout; import java.awt.event.ActionListener; import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JOptionPane; public class GUI1 extends JFrame{ private JTextField F; private JLabel Text; private JTextField Field; public GUI1(){ super("This is the Title" ;setLayout(new FlowLayout()); Text=new JLabel("Hi Welcome to my windows" ;add(Text); Field=new JTextField(5); add(Field); Handler h=new Handler(); Field.addActionListener(h); }//end of constructor private class Handler implements ActionListener{ public void actionPerformed(ActionEvent event){ String S=""; if(event.getSource()==Field){ S=String.format("Hi How Are You %s",event.getActionCommand()); }//end of if statements F=new JTextField(S); F.setForeground(Color.red); add(F); }//end of method actionPerformed }//end of class Handler }//end of class GUI1 [color=#006600][/color] |
ok am waiting!!! |
I can teach you the best i know, |
Thank u ![]() |
mmsh350: import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; public class Calculator{ public static void main(String args[]){ int sum=0; String ans=" "; int number=0; ans=JoptionPane.showInputDialog(null,"Enter a number pls:" ;number=Integer.parseInt(ans); For (int i=1; i < number;i++ ) sum+=i; JoptionPane.showMessageDialog(null,"The total sum of the numbers is ="+sum); } } |
1 (of 1 pages)
;