Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

jyothi ve

Ranch Hand
+ Follow
since Aug 03, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jyothi ve

Hi,

I am new to XML.
I want to validate XML file against XML Schema from Java.

Can somebody help me sample code for doing that ??

Thanks
-Jyothi
Hi,

I have JInternalFrame, within that I have Scrollable JTable and JButton.

JTable - registred with Mouse Listener
JButton - registred with action Listener

JTable -> opens new window name 'X' when user double clicks on Jtable row
Jbutton -> opens new window 'X' when user clicks the JButton.

First time when user clicks JButton, only action lisener getting fired.
2nd time when user clicks Jbutton, both action listener and Mouse Listener getting fired.
Q is why firing both listeners when I click Jbutton (it suppose to fire only Button Listener)?

Can someone help me on this?

Its urgent.

Thanks for your help in advance
13 years ago
Hi,
I registered focus lisener on JTextField. The listener getting called 2 times during 'TAB' out.
Why does Focus Lost event gets called twice for all the JTextFields ??

I want to do some valiadtion on 'TAB' out of JTextField?
Is there any alternative for this?

Please advise ..

Thanks in advance
13 years ago
Passed EJB Certification with 80 % on Nov 26, 2004.

Preparation:
Head first EJB
EJB Specifications for couple of topics.

Used EJB Plus exam simulator

Prepared 4 weeks on avarage 4 to 5 hours per day. With Head First EJB book, I am able to finish the exam within this short period. otherwise it would have been very difficult for me with my heactic schedule preparing for the exam.

Thanks lot Kathy and Bert for giving such wonderful book.

When can we expect your UML book coming out?

Thanks
[ November 30, 2004: Message edited by: jyothi ve ]
13 years ago
why not option 1 correct?

According the spec 18.3.1 and from the Table 15

Client View: if Client Received App Exception, can attempt to continue computation in the transaction, and eventually commit the transaction.

From the spec I fee option 1 also correct.


Correct me if I am wrong??
Please find below code to add Radio buttons as one of the JTable's column

jTable1.getColumn("Primary Role").setCellRenderer(new RadioButtonRenderer()); - Registering renderer to the column
jTable1.getColumn("Primary Role").setCellEditor(new RadioButtonEditor(new JCheckBox()) - Registering editor to the column


Below code for Renderer and Editor

class RadioButtonRenderer implements TableCellRenderer {
public JRadioButton btn = new JRadioButton();

public Component getTableCellRendererComponent(JTable table, Object
value,boolean isSelected, boolean hasFocus, int row, int column) {
if (value==null) return null;

if(((Boolean)value).booleanValue())
btn.setSelected(true);
else
btn.setSelected(false);

if (isSelected) {
btn.setForeground(table.getSelectionForeground());
btn.setBackground(table.getSelectionBackground());
} else {
btn.setForeground(table.getForeground());
btn.setBackground(table.getBackground());
}
return btn;
}
}

class RadioButtonEditor extends DefaultCellEditor
implements ItemListener {
public JRadioButton btn = new JRadioButton();

public RadioButtonEditor(JCheckBox checkBox) {
super(checkBox);
}

public Component getTableCellEditorComponent(JTable table, Object
value, boolean isSelected, int row, int column) {

if (value==null) return null;
btn.addItemListener(this);
if ( ( (Boolean) value).booleanValue())
btn.setSelected(true);
else
btn.setSelected(false);

return btn;
}

public Object getCellEditorValue() {
if(btn.isSelected() == true)
return new Boolean(true);
else
return new Boolean(false);
}

public void itemStateChanged(ItemEvent e) {
super.fireEditingStopped();
}
}

[ November 05, 2004: Message edited by: jyothi ve ]
[ November 05, 2004: Message edited by: jyothi ve ]
13 years ago
Thanks Praveen for the info
13 years ago
Hi,

I have jTable with Default table model.

I want to edit the table so I set cell editable true.

I am facing problem with capturing table data.

I am able to capture edited data(new data) only when I move mouse over to another cell. If I move the mouse to submit button I am not able to get last edited data in the last cell ??

can somebody help me how to capture last edited data on the last cell of the table when I click the submit button?

Really appreciate your help?/

Thanks
13 years ago
Hi,

I have jTable with Default table model.

I want to edit the table so I set cell editable true.

I am facing problem with capturing table data.

I am able to capture edited data(new data) only when I move mouse over to another cell. If I move the mouse to submit button I am not able to get last edited data in the last cell ??

can somebody help me how to capture last edited data on the last cell of the table when I click the submit button?

Really appreciate your help?/

Thanks
13 years ago
hello all
I am facing a problem in applet servlet communication , i am enclosing two code for applet servlet communication . It is giving me EOF Exception .
Please help me debuuging it.its urgent

enclosed codes are :

//Applet Code
import java.applet.*;
import java.awt.*;
import java.net.*;
import java.io.*;
import java.awt.event.*;
import java.util.*;

public class sappletm1 extends Applet implements ActionListener
{
private String message;
TextField t;
Label l;
Button b;
Image ash;
URLConnection uc = null;

String text;

public void init()
{

t = new TextField(20);
l = new Label("Search");
b = new Button("Press");
b.addActionListener(this);
add(l);
add(t);
add(b);

try
{

uc = new URL("http://localhost:8080/servlet/ServletAppletm1").openConnection();
uc.setUseCaches(false);
uc.setDoOutput(true);
uc.setDoInput(true);
uc.setRequestProperty("Content-type", "application/octet-stream");

uc.connect();
}

catch(Exception e)
{

message = e.toString()+"first";
repaint();

}


}


public void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==b)
{

text = t.getText();


try
{

ObjectOutputStream objOu = new ObjectOutputStream(uc.getOutputStream());
objOu.writeObject(text);

objOu.flush();
objOu.close();

}


catch(Exception e)
{
message = e.toString()+"second";
repaint();

}


try
{


ObjectInputStream objIn = new ObjectInputStream(uc.getInputStream());

message = (String) objIn.readObject();
t.setText("");
repaint();
}

catch(Exception e)
{
message= e.toString()+""+"third ";
repaint();
}
}

}


public void paint(Graphics g)
{

g.drawString (message, 25, 75);
// g.drawString (text, 25, 75);

//g.drawImage(ash,0,0,this);

}

}


--------------------------------------------------------------------------------------------------------------------------------

//Servlet code


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;

public class ServletAppletm1 extends HttpServlet
{
String message,client,mani;
Statement s;
Connection c;
PreparedStatement p;
ResultSet rs;

public void init(ServletConfig config) throws ServletException
{
super.init(config);

try

{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c= DriverManager.getConnection("jdbc dbc:mapping");
s = c.createStatement();
}
//_______________________try ends____________________

catch(Exception ee)
{
System.out.println("Check your dsn connection!"+ee);
}
}


public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{

res.setContentType("application.octet-stream");
try
{

ObjectInputStream objIn = new ObjectInputStream(req.getInputStream());
client = (String) objIn.readObject();


}
catch(Exception e)
{
e.printStackTrace();
}

try

{
rs.next();

rs = s.executeQuery("select imgsource from map where colony = '" + client + "'");
mani = rs.getString("imgsource");


if (mani!=null)
{

ObjectOutputStream objOu = new ObjectOutputStream(res.getOutputStream());
objOu.writeObject(mani);

objOu.close();
}
else
{


ObjectOutputStream objOu = new ObjectOutputStream(res.getOutputStream());
objOu.writeObject("your mani is null");

objOu.close();
}

}

catch(Exception e)
{
e.printStackTrace();

}

}
}

______________________________________________________________________

The gives me problem when i press the button it diaplays the Exception (EOFEXCEPTION). I want when i press the button the applet text field contents should go to servlet and servlet while checking into the data base so give path of the image .

the table i have construted in acess consist of two coloums one by the name of colony other by the name of imgsource.

waiting for your reply

thanks
13 years ago
Hi,
I would like to learn how to get Objects from JApplet and send to web page(.jsp).

I also would like to learn how to send Objects(like arraylist) from a web page(.jsp) into JApplet.

I have to display data in Tabular form using JTable within Applet.. And also once user modifies the data on the table need to send updated data to the server to store in the database.

Any examples would be appriciated.

Please help

Thanks
13 years ago
Hi Ramesh R G V S,
How are you preparing for the SQL and PL/SQL exam?
I am also interested in taking this exam....
15 years ago
Thanks for all of your replies
15 years ago
Thanks Muhammad Farooq for your valuable suggetion & prompt reply. I will participate in this forum from now on for OC program
15 years ago