Results 1 to 3 of 3
- 09-27-2011, 06:14 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 2
- Rep Power
- 0
how to make the check button get user input and display it
import javax.swing.*;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MyFrame extends JFrame
{
private JLabel text1,text2,text3;
private JTextField tf,tf2;
private JButton btn;
private JPanel p1,p2,p3;
public static void main (String[]args)
{
MyFrame fr=new MyFrame("Check Your DOB");
fr.setSize(300,200);
fr.setVisible(true);
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public MyFrame(String t)
{
setTitle(t);
setLayout(new FlowLayout(FlowLayout.CENTER));
text1=new JLabel("Name:");
tf=new JTextField(15);
text2=new JLabel("\nEnter First 6 Digit of Your IC Number:");
tf2=new JTextField(15);
btn=new JButton("Check");
btn.addActionListener(new ButtonListener());
text3=new JLabel("Click the button");
p1=new JPanel();
p1.add(text1);
p1.add(tf);
p2=new JPanel();
p2.add(text2);
p2.add(tf2);
p3=new JPanel();
p3.add(btn);
p3.add(text3);
add(p1);
add(p2);
add(p3);
- 09-27-2011, 06:24 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Re: how to make the check button get user input and display it
I encourage you to write a more thorough and precise question as to what you want, as well as wrap your code in code tags. I for one have no clue what you are asking (and presume I'm not the only one, but you never know).
-
Re: how to make the check button get user input and display it
This was suggested to you in your other thread -- that you learn how to ask answerable questions -- advice that you've seemed to have ignored.
Similar Threads
-
How can I check/ compare the user input to the values in my array?
By mindofastudent in forum New To JavaReplies: 3Last Post: 09-14-2011, 08:07 PM -
Display occurrence of number based off user input… array
By Jason in forum New To JavaReplies: 14Last Post: 09-12-2011, 11:54 PM -
How do I check if user clicks on an image?
By rajkobie in forum New To JavaReplies: 10Last Post: 05-04-2011, 04:45 AM -
Make a button class that uses your button image.
By eLancaster in forum New To JavaReplies: 1Last Post: 04-26-2011, 11:32 AM -
How to display queries results from Oracle according to user input?
By NeVerEveR in forum JDBCReplies: 1Last Post: 10-18-2010, 07:14 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks