hafz Khan

Greenhorn
+ Follow
since Jul 04, 2010
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 hafz Khan



I am using this query in mysql for updating multiple values for the column2 in Table1 with the values in the column2 in Table2 on certain condition. but i am not able to give two entity names in the hibernate update hql. can i know how i have to write the query below in hql so that it supports all database.

UPDATE Table1 A, Table2 B SET A.column2 = B.column2 WHERE A.column1 = B.column1

Thanks,
hfz
Hi all,

I have designed screens in swing and have placed the components using setBounds()..and while i checked on screens with different resolutions , the components are unorderly placed..can anyone help me out and let me know which is the best thing to be done.

Thanks in Advance,
hfz.
13 years ago
Hi all,

I have changed the colour of the JButton and when i change the look and feel to some other, then the jbutton's colour is changing . As i want to give some good looking colours to my button..can i know which are all the standard colours which can be used.

Thank You,
hfz
13 years ago
Thank You Bear Bibeault.
Will refer the link sent by you and if any doubts on that will get back to you for further clarification.
13 years ago
Hi,

Sorry.. As I am new to the servlet programming.. could you please provide a simple example so that it would be really helpfull for me understand the concept.

Thank You,
Hfz.
13 years ago
Hi All,

Could any help me out with an example for communicating between servlets which are residing in two different servers.

Thanks in Advance,
Hfz
13 years ago
Hi All,

Thanks for your valuable help and support.
I was not able to solve this by using custom TableCellRenderer . but anyway have solved the issue in another way.

Thanks to all,
Hafz.
13 years ago
Hi All,

I want to change the colour of selected Jtable Cells on button click.
could anyone tell me how to do this. it will be very helpfull if you can provide sample code .

Thanks in advance,
hafz.
13 years ago
Hi Darryl Burke,

I have posted the code above..i will explain my problem first.
I have to give different colours for certain rows in the table according to certain condition..
after that i have to colour certain cells as red for showing that it is locked..and also user have to lock the new cells by changing its color to red while clicking an button..

I have set different colour for certain rows by overriding the prepareRenderer (TableCellRenderer renderer, int index_row, int index_col) in the JTable as below:

1. table= new JTable(myDefaultTableModel) {
2. public Component prepareRenderer (TableCellRenderer renderer, int index_row, int index_col){
3. Component comp = super.prepareRenderer(renderer, index_row, index_col);
4.
5. if( index_row < SOME_CONDITION ){
6. comp.setBackground(new Color(204,255,204));
7. } else {
8. comp.setBackground(Color.CYAN);
9. }
10.
11. if(isCellSelected(index_row, index_col)){
12. comp.setBackground(new Color(0, 0, 112));
13.
14. }
15. return comp;
16. }
17. };

now i have to set different colours for certain cells to show it is locked(red colour)...and also while clicking an button user may be able to change the colour of the selected cell to red(locked)..

can you please tell how i should do it..
the same code is written above in this post..

Thank You,
Hafz.
13 years ago
Hi pete stein ,

sorry to say that i was not able to change the cell color in JTable using the custom TableCellRenderer. but i can see the changed color only when i am selecting the cells..what i have to do to see the colour without selecting the coloured cells..
the code which iam using is given below.

public class MyTableCellRenderer extends DefaultTableCellRenderer {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if(column > 0){
if(row == 0 && column == 5){
comp.setBackground(new Color(204,255,204));
} else if(row == 4 && column == 5) {
comp.setBackground(Color.CYAN);
} else {
//comp.setBackground(Color.RED);
}
}
}

return comp;
}
}

could you please look the code above ...

Thanks,
Hafz.
13 years ago
Hi pete stein,

sorry for the earlier reply..i was using JXTreeTable which is extended from JTable ..as my code was not written neatly and it will confuse you all more thats why i have not posted it...now i have got a sample example for inserting Imageicon..let me try with that.. if the problem still persists i will get back to you..Thanks for your reply...

ThankYou,
Hafz.
13 years ago
HI pete stein ,

Sorry i was not able to give different colors to certain rows by custom TableCellRenderer..could you please give an example to do it.
before i was able to colour certain rows using prepareRenderer.but the problem was that i was not able to colour certain cells after that by using custom TableCellRenderer...can you please help me out..

Thanks,
Hafz.
13 years ago
Hi pete stein,

Thanks for your reply..i feel little difficulty in pulling out the needed code from the whole..so will you please sent some code by which i can change the icon in the cell..similar to Jtable.setValueAt("pete stein",row,column) which i am using for setting string value in the cell..

ThankYou,
Hafz.
13 years ago
Hi Guys,

Is it possible to change the colour of the JTable Cell Dynamically ?
i have set different colour for certain rows by overriding the prepareRenderer (TableCellRenderer renderer, int index_row, int index_col) in the JTable as below:



and now i have to set different colours for certain cells according to some condition what should i do for that ?
i tried by extending the DefaultTableCellRenderer class as below:



and setting it to JTable by



but i can see the color only when i am selecting the cells . As i am new i don't know whether i am doing anything wrong..

Your comments are really really appreciated.
Thanks a lot,
Hafz

13 years ago
Hi All,

I was able to insert an image to jtable ..but my problem is how i could change the image dynamically at the time of an button click..is there any way..it will be very helpful for me if you provide an sample code ..

Thanks for your value replies,
Hafz,
13 years ago