Click here to Skip to main content
15,887,267 members
Home / Discussions / Java
   

Java

 
AnswerRe: how to do this string problem? Pin
ZurdoDev17-Nov-16 1:13
professionalZurdoDev17-Nov-16 1:13 
GeneralRe: how to do this string problem? Pin
Jebastin koilraj17-Nov-16 3:28
Jebastin koilraj17-Nov-16 3:28 
QuestionHow to implement FTP in given chat application? Pin
Member 1281417416-Nov-16 8:31
Member 1281417416-Nov-16 8:31 
AnswerRe: How to implement FTP in given chat application? Pin
NotPolitcallyCorrect16-Nov-16 9:43
NotPolitcallyCorrect16-Nov-16 9:43 
GeneralRe: How to implement FTP in given chat application? Pin
Member 1281417416-Nov-16 9:47
Member 1281417416-Nov-16 9:47 
GeneralRe: How to implement FTP in given chat application? Pin
NotPolitcallyCorrect16-Nov-16 9:56
NotPolitcallyCorrect16-Nov-16 9:56 
AnswerRe: How to implement FTP in given chat application? Pin
Richard MacCutchan16-Nov-16 22:24
mveRichard MacCutchan16-Nov-16 22:24 
QuestionEvent Handling, bt1.addActionListener(this); here "this" is refer to what ?? Pin
Member 127857914-Nov-16 5:54
Member 127857914-Nov-16 5:54 
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Demoswing extends JFrame implements ActionListener
{
JPanel p1;
JTextField txt;
JButton bt1,bt2,bt3;
JLabel l1;
JLabel l2;
JPasswordField pf;

Demoswing()
{

l1 = new JLabel("UserName");
txt= new JTextField(10);
l2 = new JLabel("Password");
pf = new JPasswordField(10);
bt1 = new JButton("Login");
bt2 = new JButton("Cancel");
bt3 = new JButton("Exit");
p1 = new JPanel();
p1.setLayout(null);
l1.setBounds(70,100,100,25);
txt.setBounds(200,100,100,25);
l2.setBounds(70,150,100,25);
pf.setBounds(200,150,100,25);
bt1.setBounds(60,200,100,25);
bt2.setBounds(190,200,100,25);
bt3.setBounds(310,200,80,25);

p1.add(l1);
p1.add(txt);
p1.add(l2);
p1.add(pf);
p1.add(bt1);
p1.add(bt2);
p1.add(bt3);
add(p1);
bt1.addActionListener(this);
bt2.addActionListener(this);
bt3.addActionListener(this);
setVisible(true);
setSize(500,500);
setTitle("Layout frame");
setResizable(false);
setLocation(100,50);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==bt1)
{
String user = txt.getText();//to get username textfield detail
String pwd = pf.getText();//to get passwordfield detail
if(user.equals("appin")&&pwd.equals("123"))
JOptionPane.showMessageDialog(null,"valid user","Authentication",1);//to get dialog box when both the fields are same
else
JOptionPane.showMessageDialog(this,"invalid user","error",0);
}
else if(ae.getSource()==bt2)
{
pf.setText("");
txt.setText("");
}
else
{
System.exit(0);
}
}





public static void main(String arg[])
{
Demoswing ob = new Demoswing();
}
}
AnswerRe: Event Handling, bt1.addActionListener(this); here "this" is refer to what ?? Pin
NotPolitcallyCorrect4-Nov-16 5:59
NotPolitcallyCorrect4-Nov-16 5:59 
RantRe: Event Handling, bt1.addActionListener(this); here "this" is refer to what ?? Pin
Richard Deeming4-Nov-16 6:01
mveRichard Deeming4-Nov-16 6:01 
Questionwhatis class and object ? Pin
Member 128308483-Nov-16 4:10
Member 128308483-Nov-16 4:10 
AnswerRe: whatis class and object ? Pin
Richard Deeming3-Nov-16 6:22
mveRichard Deeming3-Nov-16 6:22 
QuestionImprove performance-reg Pin
Member 128282182-Nov-16 23:36
Member 128282182-Nov-16 23:36 
AnswerRe: Improve performance-reg Pin
Richard MacCutchan2-Nov-16 23:54
mveRichard MacCutchan2-Nov-16 23:54 
Generalpassing java object to c through jni Pin
Member 1159649327-Oct-16 0:34
Member 1159649327-Oct-16 0:34 
GeneralRe: passing java object to c through jni Pin
Richard MacCutchan27-Oct-16 1:51
mveRichard MacCutchan27-Oct-16 1:51 
QuestionIs it just me or is java (by design) the most disorganized language ever.. Pin
sislermi20-Oct-16 11:32
professionalsislermi20-Oct-16 11:32 
AnswerRe: Is it just me or is java (by design) the most disorganized language ever.. Pin
Richard MacCutchan20-Oct-16 20:49
mveRichard MacCutchan20-Oct-16 20:49 
QuestionJava Pin
Member 1179503614-Oct-16 4:32
Member 1179503614-Oct-16 4:32 
AnswerRe: Java Pin
Richard MacCutchan14-Oct-16 6:48
mveRichard MacCutchan14-Oct-16 6:48 
Questionjava Pin
Member 1189993512-Oct-16 0:54
Member 1189993512-Oct-16 0:54 
AnswerRe: java Pin
Richard MacCutchan13-Oct-16 21:10
mveRichard MacCutchan13-Oct-16 21:10 
QuestionHow to convert 2d array into 1d array in java Pin
Member 1278579110-Oct-16 4:33
Member 1278579110-Oct-16 4:33 
QuestionRe: How to convert 2d array into 1d array in java Pin
Richard MacCutchan10-Oct-16 4:55
mveRichard MacCutchan10-Oct-16 4:55 
AnswerRe: How to convert 2d array into 1d array in java Pin
Member 1278579110-Oct-16 5:35
Member 1278579110-Oct-16 5:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.