nitin goswami

Greenhorn
+ Follow
since Mar 01, 2005
Merit badge: grant badges
For More
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 nitin goswami

Hi team,
I am facing a problem, I am using JXTable and Sorting is enabled on it's column. My underlying OS is Windows XP 5.1 sp2 and with it I am not able to display sorting order arrow at table column header.

For other Look and Feels like Metal\Motif\GTK\Windows classic etc- the column header is able to display sorting order arrow (V or ^)

it looks to me that it is related to Windows XP 5.1 platform.

Any comment or suggestions or solution would be highly appreciated.

Thanks a lot.

With Regards
Nitin
15 years ago
Hi,
Thanks, surely will take care of this.

With Regards
Nitin
15 years ago

Following is the solution(found in one of the tech forum). This will not allow Right Click to operate on JMenuItem.

class TMGenericMenuItem extends JMenuItem
{

public TMGenericMenuItem(String str){
super(str);
}

protected void processMouseEvent(MouseEvent e)
{
if (e.getModifiers() != MouseEvent.BUTTON3_MASK)
{
super.processMouseEvent(e);
}
}

}


15 years ago
Hi,
Please help me out. My problem is, As per the current implementation of my application, when I Right Click on a JTable Row, A Popup menu appears to give me an option to "delete" the row. On "delete" JMenuItem -> I want only left mouse click should work and if someone presses left click or any othe button, it shud not react and the popup menu should remain as it is.

I tried to acheive this with MouseListener but when user clicks any other button then "left" operation doesn't happen but at the same time menu also disappears.

So Currently I am using ActionListenr on JMenuItem.

JPopupMenu popup = new JPopupMenu();
JMenuItem headItem = new JMenuItem("Permission Value");
popup.add(headItem);
popup.addSeparator();

JMenuItem menuItem = new JMenuItem("Delete: " + permissionTypeValueEntity.getValueAt(0));
popup.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
try {
String valueToDelete = permissionTypeValueEntity.getValueAt(0);
permissionTypeActionListener.deletePermissionTypeValue(valueToDelete);
model.removeEntity(permissionTypeValueEntity);
int indexToNext = table.getRowCount()-1;
// Once a value is deleted, immediate previous value should become the selected one.
permissionTypeActionListener.setSelectedPermissionValueIndex(indexToNext);
permissionTypeActionListener.loadPermissionTypeValues(permissionTypeActionListener.getSelectedPermissionType());
table.scrollRowToVisible(indexToNext);
}
catch (PermissionServiceException pse) {
MessageDialog dialog = MessageDialog.createInstance(PermissionValueListPanel.this, true);
dialog.showErrorMessage("User Message", pse.getMessage());
}
}
});

popup.show(e.getComponent(), e.getX(), e.getY());
15 years ago
Hi Friends,
Please suggest me some books on Data Structures in Java. That would be a great help!!!

Thanks and Regards,
- Nitin
16 years ago
Abstraction: For example, A 'Person' is not an 'Animal'. We can prove it by abstraction.
Drawing a line and Defining an Object's Property and Behaviour is Abstraction.

Encapsulation: After drawing a line and defining the properties and behaviour, now Hidding internal details of particular behaviour and hidding certain properties is encapsulation. Example: if you kick a dog he bites. This is the behaviour of a dog and we should be least bothered about how he will bite rather should be conceren about the fact that if we kick him, he bites.


This is my understanding about these concepts. May this helps.

Comments or Suggestions are always welcome!!!

Regards,
- Nitin
16 years ago
Just to add:

Various Environment Variables:
------------------------------
PATH: Path of the Folder/Directory which contains the executable(.exe) files should present in PATH. Generally every application keeps there .exe files in BIN directory.(e.x. JDK, Tomcat, JBoss ...etc) thus for example: for J2SDK installed in the following location then C:\j2sdk1.4.1_03\bin should be there in PATH variable.

CLASSPATH: This environment variable keeps track of all the class files which we want to make available for "Compiler Search". If you want your class to be found by javac tool, mention the location of the file(s) in CLASSPATH variable or put that file in the directory from where you are running javac command.

JAVA_HOME: Is the way to tell a Tool (ex. Tomcat ) that my JDK is installed in the specified location. Actually These tools use JAVA_HOME environment variable as the part of the implementation of various functionality knowing the fact that user can install the JDK at any location so providing a user flexibility and to generalize their functionality implementation JAVA_HOME comes into picture.

Any suggestions or comments will be appreciated.

Thanks
-Nitin
16 years ago
Hi,

Here is your answer:

user calls create() on Stateless session bean home ->
-> new EJBObject gets created
This is the only part which happens when user calls create().

Container actually maintains a pool of stateless sessin beans. How many beans it will create totally depends on container and it do not depend on the clients create method.

But if container decides to create one than only the following steps occure :-

-> new SessionContext gets created
-> new Bean Object gets created
-> setSessionContext() gets called (it comes before ejbCreate ())
-> ejbCreate () gets called.

hope you understand what I explained.
Hi Friends,
Please clarify one doubt:
HFEJB - Page:364 Q#9
--------------------
Which Method(s)from ENtityContext interface can be invoked from whitin the ejbCreate method?(Choose all that apply)
A. getEJBHome ()
B. getEJBObject () --------------> doubt here.
C. getCallerPrincipal ()
D. getUserTransaction ()
E. setRollBackOnly ()

ANS. A. B. C. E.

Doubt: Can we call getEJBObject () from ejbCreate() ? As per my understanding and the page no. 338, EJBObject gets created after ejbCreate() and after the database insert. ejbPostCreate () can no doubt get the reference of EJBObject.

I would be thankful if somebody can clarify this doubt as I am going to take the exam very soon.
Hi,
You must have a Web Server like Tomcat or anyother if you want to connect to any Database.

Thanks
-Nitin
18 years ago
Hi,
As per my understanding you want to have specific icons at specific level of the tree. To do this youhave to right a derived class of DefaultTreeCellRenderer and you have to extend method:
public Component getTreeCellRendererComponent(
JTree tree,
Object value,
boolean sel,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
if(Condition 1)
setIcon("image1")
if(Condition 2)
setIcon("image2")
...........
and so on......

}

Inside this method, your condition could be anything like you can check the object class or level or anything to decide the appropriate icon...
Ya then you have to set this TreeCellRenderer for your tree.

Let me know if you want anything else or if you feel that I've not understood your problem/requirment properly.

Thanks
-Nitin
18 years ago
Hi All,
I need to set ToolTip on mouse over on a particular column of a JTable.I would appreciate if somebody can help me in this.
Thanks
Nitin
18 years ago
Thanks for replying!!!
I was talking about the case when we type a long string in JTextField or when we set text using JTextField.setText("Long String") method....
Only the left most characters get visible.I have a requirment that in such case i want to see the text from the start,it should truncate from the right end.
thanks
18 years ago
Hi all,
Whenever I enter long text in JTextField it truncates characters from left and displays the right most characters only. Is there any way to change the order of displaying the text in order from LEFT to RIGHT instead of RIGHT to LEFT.

Kindly provide your valuable comments !!!
Thanks and regards...
18 years ago
Hello all ,
i am planning to take SCJP1.5 exam .I have Scheduled the exam on 24th September. So please help me and tell me which book and websites and refrence matterial are best because i have only 7 days to crack this exam.I have already cleared SCJP 1.4 with 90%.
Thanking you - Nitin Goswami
[ September 20, 2005: Message edited by: nitin goswami ]