SantoshKr Tripathi

Greenhorn
+ Follow
since Apr 21, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by SantoshKr Tripathi

I changed the ip in /etc/hosts and i am getting the results..
18 years ago
Hi William,I think the problem is not there because i was trying to
run a different program without commandline argument.i.e I was hardcoding the value..Do i have to change the java.policy in jre/lib/security....
18 years ago
I have done mkdir to create coherent directory with packages example.hello
and put in ~/example/hello the three .java files (Hello.java Server.java
Client.java.
Then i make the class files with a "javac example/hello/*.java"
(I've done things up to here to both the server and the client machines)

Then i start the rmiregistry and launch "java example.hello.Server" on the
first machine.
It says: Server ready

When i start "java example.hello.Client 192.168.10.46" (that is the ip of
the first machine) on the second machine i get these exceptions:

Client exception: java.rmi.ConnectException: Connection refused to host:
127.0.0.1; nested exception is:
java.net.ConnectException: Connection refused
java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested
exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:574)
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:94)
at
java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:179)
at
java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.sayHello(Unknown Source)
at example.hello.Client.main(Client.java:53)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:364)
at java.net.Socket.connect(Socket.java:507)
at java.net.Socket.connect(Socket.java:457)
at java.net.Socket.<init>(Socket.java:365)
at java.net.Socket.<init>(Socket.java:178)
at
sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at
sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:569)
... 7 more

Please help me to solve this problem!!!
Thank you all.
18 years ago
Hi All,
I am trying to run an application wherein graph generated takes a lot of resources and i am using JOptionPane.showMessageDialog to print some text thereafter but its not showing any text.Its just showing the ok button.Can anyboby suggest a remedy for this?
18 years ago
Hiiii,
i just added checkBoxes in a column of my table using the JTableCellRenderer and i want to make a selection of any number
of CheckBoxes i want...For that i made my own CellEditor....the code for which is given below....But i am able to select only one at atime..can anybody help plz........



class JCheckBoxEditor extends JCheckBox implements TableCellEditor
{
JCheckBox checkbox;

JCheckBoxEditor()
{
super();
//checkbox=new JCheckBox();

}






public Object getCellEditorValue() {
// TODO Auto-generated method stub
return checkbox;

}
/* (non-Javadoc)
* @see javax.swing.CellEditor#isCellEditable(java.util.EventObject)
*/
public boolean isCellEditable(EventObject arg0) {
// TODO Auto-generated method stub
return true;
}

public boolean shouldSelectCell(EventObject arg0) {
// TODO Auto-generated method stub
return true;
}

public boolean stopCellEditing() {
// TODO Auto-generated method stub
return true;
}

public void cancelCellEditing() {
// TODO Auto-generated method stub

}

public void addCellEditorListener(CellEditorListener arg0) {
// TODO Auto-generated method stub

}

public void removeCellEditorListener(CellEditorListener arg0) {
// TODO Auto-generated method stub

}

public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
// TODO Auto-generated method stub
return this;
}
18 years ago
Hiii Nathan,
I didnt want to add Different type of Strings...
It was like i want to add different types of Panels in different rows,such as a panel containing Buttons,Labels etc...and another Panel containing
TextArea,Combo etc..
18 years ago
i am trying to add different Panels in differnt rows of same column..
But each time i am getting the default panel which is being retuned by the MyTableCellRenderer class which i have implemented from TableCellRenderer .
Would you like reply whats wrong in my approach...Can anyone modify my code???



public class TablePanel extends JPanel
{

JTable alertInsertTable;
JScrollPane alertInsertPane;
String columnnames[]={"Insert Alert"};
Object[][] values={
{
new JPanel()
}
};

DefaultTableModel tableModel= new DefaultTableModel(values,columnnames);


TablePanel()
{

setLayout(new BorderLayout());
alertInsertTable= new JTable(tableModel);
alertInsertPane = new JScrollPane(alertInsertTable);
alertInsertTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

this.add(alertInsertPane,BorderLayout.CENTER);

setDataInTable();

}

public void setDataInTable()
{
int count=0;

alertInsertTable.setRowHeight(80);


MyTableCellRenderer ob=new MyTableCellRenderer();
this.alertInsertTable.getColumn("Insert Alert").setCellRenderer(ob);

JPanel panel1=new JPanel();
JPanel panel2=new JPanel();
panel1.add(new JLabel("HIiiiiiiiiiiiiiii"));
panel2.add(new JLabel("Hellooooooooooooo"));


Object[] ob1={panel1};
Object[] ob2={panel2};

model.addRow(ob1);
//its always adding to the Panel with label new JLabel("Oppsssss")
//which is the panel instance returned by MyTableCellRender

model.addRow(ob2);
// this also adding to the Panel with label new JLabel("Oppsssss")
//which is the panel instance returned by MyTableCellRender


// ? What code should i write here so that i can add panel1 and panel2
//which i have created here.

}

}








class MyTableCellRenderer extends JPanel implements TableCellRenderer
{

public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex)
{
JPanel panel = new JPanel();

panel.add(new JLabel("Oppsssss"));

return panel;
}
}
18 years ago
Hiii everybody,
Me too preparing for SCJP1.4 and planning to give the exam next month...
U can mail me at [email protected] and join me...


Regards,
Santosh.