Narayanan Jayaraman

Ranch Hand
+ Follow
since Apr 09, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Narayanan Jayaraman

I use dispose() method to close the frame. But the background process has to run forever. Is it possible to start the process in different JVM ?
21 years ago
This one is Java process.
21 years ago
How to start a background process from Swing application. In my swing application I start a background process thread by clicking a button. But When I close the application it also closes the thread. Any idea how to do it ?.
Thanks
21 years ago
Hi Nathan,
I have re-installed JDK 1.3 and it seems to be apperaring fine. But yet to do full blown testing. I 'll update accordingly. Thanks for your help.
21 years ago
OK. I have listed Cell renderer/Editor. Regarding Table freezing issue, I display two tables in One single dialog window. when I click on data rows in left Table , Right side table changes it value. It works fine in windows. But in Solaris, Right side table doesnt change value and also I am unable to select rows in it. Please let me know if you need any more details. Thanks
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import javax.swing.tree.*;
import java.awt.event.MouseEvent;
import java.util.EventObject;
abstract public class AbstractCellEditor implements TableCellEditor {
protected EventListenerList listenerList = new EventListenerList();
protected Object value;
protected ChangeEvent changeEvent = null;
protected int clickCountToStart = 1;
//------------------------------------------------------------------------------
public void addCellEditorListener(CellEditorListener l) {
listenerList.add(CellEditorListener.class, l);
}
//------------------------------------------------------------------------------
public void cancelCellEditing() {
fireEditingCanceled();
}
//------------------------------------------------------------------------------
protected void fireEditingCanceled() {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i]==CellEditorListener.class) {
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
((CellEditorListener) listeners[i+1]).editingCanceled(changeEvent);
}
}
}
//------------------------------------------------------------------------------
protected void fireEditingStopped() {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length-2; i>=0; i-=2) {
if (listeners[i] == CellEditorListener.class) {
if (changeEvent == null)
changeEvent = new ChangeEvent(this);
((CellEditorListener) listeners[i+1]).editingStopped(changeEvent);
}
}
}
//------------------------------------------------------------------------------
public Object getCellEditorValue() {
return value;
}
//------------------------------------------------------------------------------
public int getClickCountToStart() {
return clickCountToStart;
}
//------------------------------------------------------------------------------
public boolean isCellEditable(EventObject anEvent) {
if (anEvent instanceof MouseEvent) {
if (((MouseEvent)anEvent).getClickCount() < clickCountToStart)
return false;
}
return true;
}
//------------------------------------------------------------------------------
public void removeCellEditorListener(CellEditorListener l) {
listenerList.remove(CellEditorListener.class, l);
}
//------------------------------------------------------------------------------
public void setCellEditorValue(Object value) {
this.value = value;
}
//------------------------------------------------------------------------------
public void setClickCountToStart(int count) {
clickCountToStart = count;
}
//------------------------------------------------------------------------------
public boolean shouldSelectCell(EventObject anEvent) {
return true;
}
//------------------------------------------------------------------------------
public boolean stopCellEditing() {
fireEditingStopped();
return true;
}
//------------------------------------------------------------------------------
}
BulbEditor.java
=========================================
public class BulbEditor extends AbstractCellEditor {
BulbRenderer renderer = new BulbRenderer();
public BulbEditor() {
renderer.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
setCellEditorValue(Boolean.TRUE);
fireEditingStopped();
}
});
}
});
}
//------------------------------------------------------------------------------
public Component getTableCellEditorComponent(
JTable table, Object value,
boolean isSelected,
int row, int col) {
return renderer.getTableCellRendererComponent(
table, value, true, true,
row, col);
}
//------------------------------------------------------------------------------
}
BulbRenderer.java
==========================================
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class BulbRenderer extends DefaultTableCellRenderer {
private ImageIcon darkBulb = null; //new ImageIcon("button.jpg")
private ImageIcon brightBulb = null; //new ImageIcon("button_lit.jpg");
//------------------------------------------------------------------------------
public BulbRenderer() {
setHorizontalAlignment(JLabel.CENTER);
}
//------------------------------------------------------------------------------
public BulbRenderer(ImageIcon darkBulb, ImageIcon brightBulb) {
setHorizontalAlignment(JLabel.CENTER);
this.darkBulb = darkBulb;
this.brightBulb = brightBulb;
}
//------------------------------------------------------------------------------
public Component getTableCellRendererComponent(
JTable table, Object value,
boolean isSelected,
boolean hasFocus,
int row, int col) {
Boolean b = (Boolean)value;
setIcon(b.booleanValue() ? brightBulb : darkBulb);
return this;
}
//------------------------------------------------------------------------------
}
21 years ago
1. I have used TableCellRenderers/TableCellEditors used in the JTable.
2. Data value comes from database. I am not able to scroll through tables
3. Here is my code for setting column size
public static void sizeColumnsForTable(JTable table) {
TableColumnModel tcm = table.getColumnModel();
for(int i=0; i < tcm.getColumnCount(); ++i) {
TableColumn column = tcm.getColumn(i);
int w = getPreferredWidthForColumn(table, column);
column.setMinWidth(w);
//column.setMaxWidth(w);
}
}
//---------------------------------------------------------------------------------
public static int getPreferredWidthForColumn(JTable table, TableColumn col) {
int hw = columnHeaderWidth(table, col), // hw = header width
cw = widestCellInColumn(table, col); // cw = column width
return hw > cw ? hw+10 : cw+10;
}
//---------------------------------------------------------------------------------
public static int widestCellInColumn(JTable table, TableColumn col) {
int c = col.getModelIndex(), width=0, maxw=0;
for(int r=0; r < table.getRowCount(); ++r) {
TableCellRenderer renderer =
table.getCellRenderer(r,c);
Component comp =
renderer.getTableCellRendererComponent(
table, table.getValueAt(r,c),
false, false, r, c);
width = comp.getPreferredSize().width;
maxw = width > maxw ? width : maxw;
}
return maxw;
}
Appreciate your help. Thanks
21 years ago
Thanks for your link. I use JDK 1.3 in both windows and Solaris system. I have used basic Jframes and JTables and don't have any custom piece in it. When I run the application (I bring up through X-Manager) it doesnt display data in Jtables properly and also unable to navigate through JTables. Any Idea ?. What do I need to change font.properties file ? Appreciate your help.
Thanks
21 years ago
Did you do anything "special" when deployed in Linux system ?
21 years ago
I do have the same problem. Everything looks/works great in Windows. I am using SystemDefault Look&Feel. But when I deploy to Sun solrais everything goes havoc. And also I get this error ....
Font specified in font.properties not found [-urw-itc zapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecific]
Any help ???
"Write Once and debug everywhere ? "
21 years ago
I have few questions regarding IIOP protocol.
1. Is it connection based ?.
2. Is it stateful ?.
3. In a distributed environment, do EJB servers talk through IIOP ?. How is session info maintained in it ?.
4. When Adding EJB servers for scalability do we need to change anything in already deployed applications ?.
Thanks
I have few questions regarding IIOP protocol.
1. Is it connection based ?.
2. Is it stateful ?.
3. In a distributed environment, do EJB servers talk through IIOP ?. How is session info maintained in it ?.
4. When Adding EJB servers for scalability do we need to change anything in already deployed applications ?.
Thanks
21 years ago
Can someone tell me how to change Look and feel of an application dynamically. I have given option in Menu bar to change look and feel of an application. But not sure how to re-draw/ refresh the application. Thanks
21 years ago
I have couple of questions.
1. How different is life cycle management for Single EJB server Vs Multiple EJB servers (Clustered EJB servers ) ?
2. is IIOP connection based and state based protocol ?.
Thanks
I have couple of questions.
1. My understanding is DNS Round-robin is for Load sharing and not for load balancing. But Oracle site (Under EJB link) says it is for load balancing.
2. what problem arises when clustering EJB servers ?
Thanks
Congrulations. Did you get any questions on Deployment descriptior file ?