How to disable row of a jtable
hi,
i am making an application in which i have jtable what i wants to do is that i am selecting row and inserting the values of this row into another jtable now what i wanst is to disable the already selected row so that i can not be selected again.
Thanks in advance.
You never bother replying to your old postings to thank people tor the suggestions given, so I won't bother making any more suggestions.
Similar Messages
-
How to Disable Row Detail in Sales Module
Dear Experts,
how to disable row detail option in sales module. how it is posible. we are using SAP Business One 2007. PL42
ThanxAOA Rahil,
I have just solved this problem, I was also facing the same one
I am using B1DE, I have handled this on before menu click when open the form
<B1Listener(BoEventTypes.et_MENU_CLICK, true)> _
Public Overridable Function OnBeforeMenuClick(ByVal pVal As MenuEvent) As Boolean
'GENERATED CODE
Me.LoadForm()
1*** Dim Form As Form = B1Connections.theAppl.Forms.ActiveForm
2 *** Form.Settings.EnableRowFormat = False
Return false
End Function
1--Capture the current form
2--Disable Row Detail Form
It worked for me
Best Regards,
Umer Nasim Mirza
03004003633 -
How to add row in a JTable at runtime.
Hi,
How to add a row in JTable at runtime? I am using my own TableModel object extended from AbstractTableModel.
Thanks in advance.try this link... i have answered this forum.
http://forum.java.sun.com/thread.jspa?threadID=5242581 -
Once I create a JTable, how can I hide a specific number of rows during runtime?
Thanks,
Surath.
09/23/2001You program the getValueAt(r, c) method of your table model to return the value you want to appear in that row and column. In your particular example that could mean returning values in row r if r<cutoff and values in row r+n otherwise.
-
How to disable arrow keys in JTable.
Hi ,
I'm using Jtable and when pressing shift + arrow keys the rows get selected. I want to avoid this situation.
Thanks
ManjulaThis posting shows how to remove a default Action;
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=657819 -
How to disable row in tabular form when checkbox checked?
Hi.... this is what i want to do....
I created tabular form for offering items... there is a checkbox that is used to select item with lowest price...
But i have also one column that shows item options ( option is for example... i want offer for 22" monitor Samsung, but seller have only 22" LG monitor.... so in my offering will be shown item (22" monitor Samsung) that i want, and in row below item (22" LG monitor) that seller have... both items will have same order id....
Next thing i want to do is when i select checkbox with item (22" LG monitor) as lowest price, i want that row with same order id (22" samsung monitor) is disabled.
Is that possible to do?
This is my code for creating tabular form:
SELECT
CASE WHEN RED_BR_OPCIJE = 0 THEN '-' ELSE TO_CHAR(RED_BR_OPCIJE) END RED_BR_OPCIJE,
apex_item.hidden(1, ID_STAVKE)||
apex_item.hidden(2, ID_STAVKE_IZ_ZAHTJEVA)|| ---order_id
apex_item.hidden(3, ID_PONUDE)||
apex_item.hidden(4, ODABIR_NAJPOVOLJNIJE_STAVKE)||
apex_item.checkbox(5, '#ROWNUM#', null, decode(ODABIR_NAJPOVOLJNIJE_STAVKE, 'X', '#ROWNUM#')) Odabir, ---checkbox_lowest price
apex_item.textarea(6, NAZIV_ARTIKLA_TRAZENO, 3, 40, 'readonly="readonly"') NAZIV_ARTIKLA_TRAZENO,
apex_item.textarea(7, NAZIV_ARTIKLA, 3, 40, 'readonly="readonly"') NAZIV_ARTIKLA,
apex_item.text(8, SIFRA_ARTIKLA, 8, 20, 'readonly="readonly"') SIFRA_ARTIKLA,
apex_item.text(9, JMJ, 5, 20, 'readonly="readonly"') JMJ,
apex_item.text(10, KOLICINA, 6, 20, 'readonly="readonly"') KOLICINA,
apex_item.text(11, JEDINICNA_CIJENA, 12, 20, 'readonly="readonly"') JEDINICNA_CIJENA, ---price
apex_item.text(12, IZNOS_STAVKE, 12, 30, 'readonly="readonly"') IZNOS_STAVKE,
apex_item.text(13, IZNOS_RABATA, 12, 20, 'readonly="readonly"') IZNOS_RABATA,
apex_item.text(14, JEDINICNA_CIJENA_NAKON_POPUSTA, 12, 20, 'readonly="readonly"') JEDINICNA_CIJENA_NAKON_POPUSTA,
apex_item.text(15, IZNOS_STAVKE_NAKON_POPUSTA, 12, 20, 'readonly="readonly"') IZNOS_STAVKE_NAKON_POPUSTA
from PONUDE_STAVKE
where ID_PONUDE = :P34_ID_PON
ORDER BY ID_PONUDE ASC, ID_STAVKE_IZ_ZAHTJEVA ASC, RED_BR_OPCIJE ASC
And this is example table with a few column names:
order_id option_number item_name price checkbox_lowest price
1086 - Samsung 22" monitor 100$ null ---this row should be disabled because next row is selected as lowest price
1086 1 LG 22" Monitor 90$ X --- both rows have same order_id
1050 - Router 100$ XHi snake2903,
{thread:id=998140}
{thread:id=1554583}
{thread:id=2249233}
Hope it helps!
Regards,
Kiran -
How to disable Row label from the aggregation function in Pivot table
Hello everyone,
I have table in Power Pivot like shown below:
Item_Name
Category
Vendor
Sales_Amount
Item 1
Category 1
Vendor 1
30
Item 2
Category 1
Vendor 2
25
Item 3
Category 2
Vendor 3
50
Item 3
Category 2
Vendor 3
60
Item 3
Category 2
Vendor 3
20
Item 2
Category 1
Vendor 2
10
Item 2
Category 1
Vendor 2
30
Item 2
Category 1
Vendor 2
100
Item 2
Category 1
Vendor 1
20
By using above table i have to create Rank(Based on Sales amount) by Category and Item name in Pivot table, i have done easily like added two dimension attribute(Category, Item_Name) into row label and Sales_Amount into aggregation tab then I calculated
rank:=RANKX(ALL(Sales[Item_Name]),[Sum of Sales_Amount]) so finally pivot table looks like shown below:
But end user want to see the vendor name also in the pivot table but the Rank suppose to be based on Sales amount by Category and Item name. if i added the vendor name also into the row label, rank calculated based on on Sales amount by Category, Item
name and vendor.
I would be really grateful if anyone advise how to fix this problem as it will be helpful my most of the reports.
Regards,
RobertDarren Gosbell,
Thanks for your reply.
Item_Name
Category
Vendor
Sales_Amount
Item 1
Category 1
Vendor 1
30
Item 2
Category 1
Vendor 2
25
Item 3
Category 2
Vendor 3
50
Item 3
Category 2
Vendor 3
60
Item 3
Category 2
Vendor 3
20
Item 2
Category 1
Vendor 2
10
Item 2
Category 1
Vendor 2
30
Item 2
Category 1
Vendor 2
100
Item 2
Category 1
Vendor 2
20
Item 4
Category 1
Vendor 2
3
Item 4
Category 1
Vendor 2
50
Item 4
Category 1
Vendor 2
3
The above is my new source data.
I used this function to calculate Rank:=RANKX(ALL(Sales[Item_Name]),[Sum of Sales_Amount])
and also used yours below:
Rank2:=RANKX(SUMMARIZE(ALL(Sales),[Item_Name],[Category]),CALCULATE([Sum of Sales_Amount],ALLEXCEPT(Sales,Sales[Item_Name],Sales[Category])))
The Preceding screenshot is the result of our two function but i wanna pivot table like shown below:
Could please help me to fix it out. -
How to disable moving Columns in JTable
Hi,
How can I make sure that the columns in my JTable cannot be moved?
Any ideas?
thanksHow about:myTable.getTableHeader().setReorderingAllowed(false);
-
How to disable a particular cell in JTable ?
I having a problem on how to set disable a particular cell in JTable. At the first place to load the JTable, I want to set some of the cell to disabled, it only will run at the first time, is there anyway to do it ?
This is the function that disable/enable cells in JTables.
Are you looking for this?
public boolean isCellEditable(int row, int col)
if(((new Integer((String)(getValueAt(row,0)).toString()).intValue()>9))&&(col==1))
return true;
if(row!=4&&col!=5)
return true;
return false;
this metod belong to the TableModel function
and what I gave you is only an example of what you can do with it.
if it return false it disable and if true it enable the cell...but I think this you allready know!
Regards Amnon -
Next row in JTable (skip disabled rows)
When I press the down button on my keyboard how can I move to the next available row. It should skip all disabled rows.
My subclass of JTable looks like this:
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend) {
if (list[rowIndex].isEnabled()) {
super.changeSelection(rowIndex, columnIndex, toggle, extend);
All the disabled rows is not selectable. Right now it just stop when the next row is disabled.Well, I think the right way to it would be something like..
public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)
// Get to the right row..
while (!list[rowIndex].isEnabled())
++rowIndex;
rowIndex %= list.length;
// Change selection to the row found.
super.changeSelection(rowIndex, columnIndex, toggle, extend);
The last one is good asuming there must be at least one enabled row, otherwise you should handle this case also... -
Does anyone know how to disable a row in a JTable? I essentially want a row to be grayed out and I want to be able to dynamically change which row(s) are disabled.
You'll need a custom TableCellRenderer to display the row
as grayed out. You may need a custom ListSelectionListener
if you don't want the row to be selectable. You may need a custom
TableModel to override isCellEditable() to stop the user from
editing those cells. -
How to disable JTable Column Dragging (only single column)
How could i disable a single column from being dragged in JTable?
I need to fix the first column from being dragged in JTable and all other columns except the first can be dragged. how would i accomplish this task ?
well, i know how to fix all column in jtable from being dragged using
table.getTableHeader().setReorderingAllowed(false);But dont know how to fix only a single column. is there any method for doing this. or i have to implement any other logic?
Please help me !
ThanksThe question is why do you have this requirement. I figure if the user wants to reorder the colum, let them, the table won't break.
Maybe something like this would be acceptable:
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
public class FixedColumnScrollPane extends JScrollPane
public FixedColumnScrollPane(JTable main, int fixedColumns)
super( main );
// Use the table to create a new table sharing
// the DataModel and ListSelectionModel
JTable fixed = new JTable( main.getModel() );
fixed.setFocusable( false );
fixed.setSelectionModel( main.getSelectionModel() );
fixed.getTableHeader().setReorderingAllowed( false );
// fixed.getTableHeader().setResizingAllowed( false );
fixed.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
main.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
// Remove the fixed columns from the main table
for (int i = 0; i < fixedColumns; i++)
TableColumnModel columnModel = main.getColumnModel();
columnModel.removeColumn( columnModel.getColumn( 0 ) );
// Remove the non-fixed columns from the fixed table
while (fixed.getColumnCount() > fixedColumns)
TableColumnModel columnModel = fixed.getColumnModel();
columnModel.removeColumn( columnModel.getColumn( fixedColumns ) );
// Add the fixed table to the scroll pane
fixed.setPreferredScrollableViewportSize(fixed.getPreferredSize());
setRowHeaderView( fixed );
setCorner(JScrollPane.UPPER_LEFT_CORNER, fixed.getTableHeader());
public static void main(String[] args)
// Build your table normally
JTable table = new JTable(10, 8);
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
JScrollPane scrollPane= new FixedColumnScrollPane(table, 1 );
JFrame frame = new JFrame("Table Fixed Column Demo");
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.getContentPane().add( scrollPane );
frame.setSize(400, 300);
frame.setVisible(true);
}Or maybe you should be using a Row Header. A row header is like the column header of JTable. It remains fixed on the left side of the scroll pane. Search the forum for examples using "setrowheaderview". -
How to refresh an existing row of a JTable
Hi all,
I have to refresh the data of an existing row of a JTable after some time in thread. The code snippet is
DefaultTableModel model=new DefaultTableModel(data,columnNames);
table = new JTable(model)
public boolean isCellEditable(int row, int col)
return false;
Now I also add rows to this table within the run() of the thread as
model.addRow(new Object []{sub1,sub6,sub12,sub3,sub18});
My problem is that I want to refresh the data of this added row within the thread.
Any help is highly appreciable. Thanks in advance.
Regards,
Har KrishanHmmm. His qhestion does not seem to be with how to change the value of a field, but how to get the table to recognize the change. I thought such things were automatic. The model fires a value changed event and the JTable picks up the event and refreshes. I'm not sure why your table is not refreshing under these circumstances. Perhaps a more complete code snippet. Please use the open and close code tags to format your code if you include it.
-
How to delete the selected rows in a JTable on pressing a button?
How to delete the selected rows in a JTable on pressing a button?
You are right. I did the same.
Following is the code where some of them might find it useful in future.
jTable1.selectAll();
int[] array = jTable1.getSelectedRows();
for(int i=array.length-1;i>=0;i--)
DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
model.removeRow(i);
} -
How to disable a Entire row in a Matrix in Find Mode (User Form)
Hi,
How to disable a Entire row in a Matrix in Find Mode (User Form)
Regards
JambuHi,
Iam using Bubble event = false in click event but the matrix row
is allow to edit but we cant save the document in Find Mode That is fine.
What is my actual requirement is In find mode matrix Row not allow to enter the data .
For examble In ADD mode i enter the data in Three rows (Item Section - Matrix) and
save the document. Whwn i open the document in find mode the three row is not allow
to editable like the same functionality of PO, sales Order, etc ..
Regards
Jambu
Maybe you are looking for
-
I am really sorry if this is the wrong forum to post this query in, but I have done countless searches on Google and haven't had much luck. I would like to be able to archive some business paperwork using my HP all-in-one printer/scannner. What's the
-
Generate Report in fiori application
Hi friends, i create a fiori application with sap web ide and i want to generate report with my data and export it. Could some one please help me Best Regards, Ameni,
-
How to install forms 6i ?
Hi How to install forms 6i runtime only? I want to install only forms 6i runtime and report 6i runtime. Can any body help me......... Arif.
-
Hi, situation : Suse Linux Enterprise server 9 sp2 (64bit) Oracle 9.2.0.4 64bit I have an oracle database & listener running. When I start the intelligent agent as user oracle by using 'agentctl start', then the proces dbsnmp is taking 99%. Also the
-
Hi, I wrote some code to serialize and deserialize an object. It does that all good, but when I try to send the object back to the main file (like in loading a game), it won't let me. The error is "cannot return a value from method whose result type