Edit a JTable cell, click save button, value isn't stored in JTable
I'm editing a JTable cell, just using default editor provided by JTable
I click a save button elsewhere in my GUI
The value typed into the cell so far isn't stored in the TableModel yet and so doesn't get saved.
How can I make sure the value gets stored in the JTable in the above scenario when the JButton is pressed but before saving.
Preferably I'd like the code with the JButton not to have to know about the JTable at all.
Cheers,
D
I the forums 100s of times.Many thanks. If they had a decent search on this forum I might have found it as I did try.
Come to think of it - Sun have completely fcukd up this forum.
Similar Messages
-
To Disble the Field in Table Control after clicking Save button
Hi,
I have a requirement as follows. i need to disable one field in the table control after clicking save button. i tried with SCREEN elements but it disabling whole the table control but i need to disable that particular one record only in the table control. i found Structure CXTAB_COLUMN in documentaion. it has the properties like invisible. can any body tell how can we disble that particular field in table control only for the one record. and how can we use CXTAB_COLUMN.
Thanks in advance.hi,
do like this...
in USER_COMMAND_1000 module of PAI,
MODULE user_command_1000 INPUT.
CASE ok_code.
WHEN 'BACK' OR 'UP' OR 'CANC'.
LEAVE PROGRAM.
WHEN 'SAVE'.
fl = 1.
GET CURSOR LINE lin.
ENDCASE.
ENDMODULE. " user_command_1000 INPUT
and make on module disable in Loop Endloop in PBO.
and write like this...
MODULE disable OUTPUT.
LOOP AT SCREEN.
IF tab1-current_line = lin AND fl = 1.
screen-input = 0.
ELSEIF tab1-current_line < lin.
screen-input = 0.
ELSE.
screen-input = 1.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDMODULE. " disable OUTPUT
here fl and lin both are type i.....
and there will b one module in PBO
MODULE tab1_change_tc_attr.
in that put if condition....
MODULE tab1_change_tc_attr OUTPUT.
IF sy-ucomm <> '' AND sy-ucomm <> 'SAVE'.
DESCRIBE TABLE itab LINES tab1-lines.
ENDIF.
ENDMODULE. "TAB1_CHANGE_TC_ATTR OUTPUT
ur problem will solve...
reward if usefull....
Edited by: Dhwani shah on Jan 2, 2008 1:17 PM -
Show Top of the Page after Click Save button
Hi all,
i have requirement i want show top of the page after click of save button.if you know answer please give reply.
Regards
VeerendraNadhHi,
Would you mind providing more details(screenshot would be better) about your requirement? It would make others easier to find a solution for you.
Suppose that there is a scenario like this: Edit a page, when content grows too large, page will scroll to the bottom of the page. When clicking “Save” button in the
ribbon, by default, page will scroll to the top just like it is first loaded in the browser.
Feel free to reply if this is not what you really mean.
Best regards
Patrick Liang
TechNet Community Support -
Shading part of a JTable Cell dependent upon the value of the cell
Hi
Was hoping some one woudl be able to provide some help with this. I'm trying to create a renderer that will "shade" part of a JTable cell's background depending upon the value in the cell as a percentage (E.g. if the cell contains 0.25 then a quarter of the cell background will be shaded)
What I've got so far is a renderer which will draw a rectangle whose width is the relevant percentage of the cell's width. (i.e. the width of the column) based on something similar I found in the forum but the part I'm struggling with is getting it to draw this rectangle in any cell other than the first cell. I've tried using .getCellRect(...) to get the x and y position of the cell to draw the rectangle but I still can't make it work.
The code for my renderer as it stands is:
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.TableCellRenderer;
public class PercentageRepresentationRenderer extends JLabel implements TableCellRenderer{
double percentageValue;
double rectWidth;
double rectHeight;
JTable table;
int row;
int column;
int x;
int y;
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value instanceof Number)
this.table = table;
this.row = row;
this.column = column;
Number numValue = (Number)value;
percentageValue = numValue.doubleValue();
rectHeight = table.getRowHeight(row);
rectWidth = percentageValue * table.getColumnModel().getColumn(column).getWidth();
return this;
public void paintComponent(Graphics g) {
x = table.getCellRect(row, column, false).x;
y = table.getCellRect(row, column, false).y;
setOpaque(false);
Graphics2D g2d = (Graphics2D)g;
g2d.fillRect(x,y, new Double(rectWidth).intValue(), new Double(rectHeight).intValue());
super.paintComponent(g);
}and the following code produces a runnable example:
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
public class PercentageTestTable extends JFrame {
public PercentageTestTable()
Object[] columnNames = new Object[]{"A","B"};
Object[][] tableData = new Object[][]{{0.25,0.5},{0.75,1.0}};
DefaultTableModel testModel = new DefaultTableModel(tableData,columnNames);
JTable test = new JTable(testModel);
test.setDefaultRenderer(Object.class, new PercentageRepresentationRenderer());
JScrollPane scroll = new JScrollPane();
scroll.getViewport().add(test);
add(scroll);
public static void main(String[] args)
PercentageTestTable testTable = new PercentageTestTable();
testTable.pack();
testTable.setVisible(true);
testTable.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}If anyone could help or point me in the right direction, I'd appreciate it.
RuanaeThis is an example I published some while ago -
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
public class Fred120 extends JPanel
static final Object[][] tableData =
{1, new Double(10.0)},
{2, new Double(20.0)},
{3, new Double(50.0)},
{4, new Double(10.0)},
{5, new Double(95.0)},
{6, new Double(60.0)},
static final Object[] headers =
"One",
"Two",
public Fred120() throws Exception
super(new BorderLayout());
final DefaultTableModel model = new DefaultTableModel(tableData, headers);
final JTable table = new JTable(model);
table.getColumnModel().getColumn(1).setCellRenderer( new LocalCellRenderer(120.0));
add(table);
add(table.getTableHeader(), BorderLayout.NORTH);
public class LocalCellRenderer extends DefaultTableCellRenderer
private double v = 0.0;
private double maxV;
private final JPanel renderer = new JPanel(new GridLayout(1,0))
public void paintComponent(Graphics g)
super.paintComponent(g);
g.setColor(Color.CYAN);
int w = (int)(getWidth() * v / maxV + 0.5);
int h = getHeight();
g.fillRect(0, 0, w, h);
g.drawRect(0, 0, w, h);
private LocalCellRenderer(double maxV)
this.maxV = maxV;
renderer.add(this);
renderer.setOpaque(true);
renderer.setBackground(Color.YELLOW);
renderer.setBorder(null);
setOpaque(false);
setHorizontalAlignment(JLabel.CENTER);
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col)
final JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
if (value instanceof Double)
v = ((Double)value).doubleValue();
return renderer;
public static void main(String[] args) throws Exception
final JFrame frame = new JFrame("Fred120");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new Fred120());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
} -
How to call a popup window when click save button
Hi, expert
the scenario is :
we we create a order , we click the 'save' button,
then there will show a popup window,
in the window, there are buttons like 'confirm' , 'cancel' and also show some info about the order.
how can i do that.
Thanks
Oliver.Hi ,
Try to redefine the method and use the IV_TEXT parameter in the CREATE_POPUP_2_CONFIRM method (usaully comes from the Component Controller ).
Regards
Vikranth -
When i click save button the data get cleared
Hi All,
I am using oracle Apps r12 and forms 10g.
I have a form when the user enters the data and click save option the data get cleared in the form and asked the user to enter to reenter the data again.Can any pls tell me the reason behind this.I have commited the clear_block and clear_form in the coding. Again its coming.
Regards
SrikkanthHi,
I have used template fmb. When i click after save after entering the data for the first time the data got cleared,but when again when i enter the data and click save the data got inserted. Can you please give me some clue how to find this.
thanks & Regards
Srikkanth -
JTable cell color overriding Boolean values displayed as checkboxes. Fix?
I have a JTable column of Boolean values that automatically appear as checkboxes. When I apply my DefaultTableCellRenderer to this column, the checkbox disappears and a "false" or "true" appears instead. But if I mouseclick on the cell, the checkbox will appear momentarily.
Any suggestions for getting the Boolean value displayed as a checkbox and seeing my colors change? (I suppose the easy way is using JCheckBox, but I'm curious if I can do it using Boolean)
Thanks for the help. Code follows for the cell renderer.
class ColorRenderer extends DefaultTableCellRenderer{
public ColorRenderer() {
super();
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (isSelected == true) {
setBackground(Color.getHSBColor(100, 100, 1));
setForeground(Color.BLACK);
} else {
setBackground(Color.LIGHT_GRAY);
setForeground(Color.WHITE);
if (hasFocus == true) {
setBackground(Color.RED);
setForeground(Color.WHITE);
setOpaque(true);
setValue(value);
return this;Wouldn't extend DefaultTableCellRenderer as that extends a JLabel
I would extend a JCheckBox and implement TableCellRenderer. -
I edited my raw image in Photoshop CS6, selected 'Save As', and changed the file type from .psed to .jpg. I also selected 12 and large file when the window popped up, concluding my 'saving as'. My computer does not recognize the file type and won't open them. Can someone help me? Thanks!
When naming files, stick to the letters of the ENGLISH alphabet, numbers and underscores. Do not use illegal characters like apostrophes, commas, asterisks, ampersands, hatch or pound signs, diacritics or accented characters, slashes, etc.
While the period (dot) is not an illegal character per se, your file names should have only one period and that should always be followed by the file type extension.
EDITED typo: se
Message was edited by: station_two -
I am using Windows 7 SP1(cannot confirm the IE version, suppose IE8).When I tried to edit a survey item, click Save and Close button. Data cannot be saved.No problem with my account or permission since I can change it on another computer.Below action cannot
fix the problem:clean IE catch, reset IE, reinstall IE, rebuild windows profile.
error can be seen at the IE status bar
Erros on this webpage might cause it to work incorrectly
'length' is null or not an object
custom_ows.js
'undefined' is null or not an object
custom_ows.js
Code:0
URI: http://server/_layouts/1033/custom_ows.jsMainstream Support for SharePoint 2003 has already ended and it does not list IE8 as a supported browser:
http://office.microsoft.com/en-us/technet/system-requirements-HA001160515.aspx?pid=CH011719821033
You can always try to add the site to Compatibility Mode, but there is no guarantee that it will work in this scenario,
http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-8
Dimitri Ayrapetov (MCSE: SharePoint) -
In Editable ALV the BACK/CANCEL/EXIT buttons are not working?
Hello,
I wrote a editable FM based ALV, working fine that when user changes the data and press SAVE button, values are transfering into prog. But, i need to put a validation that, if user changes the values and press BACK/CANCEL/EXIT button, i need to popup the message that "Do you want to save changes", my PF-STATUS is good(because, SAVE is working).
But, its not working that when user done changes and press BACK button (forgot to press SAVE button), system taking me to selection screen/screen 0!! I my code is as below,
FORM pick USING v_ucomm TYPE syucomm
it_selfield TYPE slis_selfield.
DATA: v_answer TYPE char1.
READ TABLE it_z_tbl INDEX it_selfield-tabindex
INTO w_z_tbl.
CASE v_ucomm.
WHEN '&IC1'.
" working fine this functionality
ELSE.
MESSAGE i000 WITH 'Double click on key field'.
ENDIF.
WHEN 'SAVE'.
" working fine this functionality
WHEN BACK' " OR 'CANCEL' OR 'EXIT'.
PERFORM popup_for_user_decision CHANGING v_answer.
CHECK v_answer = '1'.
PERFORM now_update.
ENDCASE.
ENDFORM.
when i put the break point on the first line of this piece of code, its not stopping on pressing BACK/CANCEL/EXIT buttons!! (its stoppig for SAVE press or double click)
Its stopping at this point,
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.
EXPORTING
i_callback_user_command = 'PICK'
IMPORTING
EXCEPTIONS
IF sy-subrc <> 0 =================> its stopping at this point!
ENDIF.
Pls. let me know why system is not recognising that i hv a PICK form (SAVE and Double clicks are working fine)?
Thank youHi,
Actually BACK is standard user command so it is not stopping and going to selection screen.
Give some other use command like 'BCK' and try.... -
Problem in activating Radio buttons and need to hit save button
Hi Gurus,
I added custom fields in CJ06,CJ07,CJ08 T-CODES. As per user requirement , I created radio button fields in sub screen and user selects radio buttons FROM A1 TO A3 fields and also user wants to click "SAVE button" in that subscreen, that fields data should store in database table. Is there any Note to implement for this and suggest me how to proceed further.
Thanks,
Chiru.
Edited by: chiranjeevi Rao on Apr 1, 2010 2:24 PMHi Chandrasekhar,
Can you explain, in detail.
Inside the EXIT, EXIT_SAPLIMR0_001, I am writing logic to insert or modify the Z-Table for custom screen.
Here, I need to make that SAP Updates ie Triggers the "SAVE" Button, so that the logic gets executed for updating the Z-Table.
Motto: is to have single LUW or SAVE Button.
Thanks.
Vijayanand.
Message was edited by:
Vijayanand Annamalai -
Hello everyone.
I'm using jDev 11.1.2.1.0
I have a table in which I have to add another one column at the end with one button.
So, If there are 15 records shown, there will be 15 buttons at the end of each record.
Button's functionality should be to save only the changes that correspond to the button's record. A record level save button.
How is this possible to be achieved? Do you have any advice?
Thanks a lot
~apostolosapostolosk wrote:
Hello everyone.
I'm using jDev 11.1.2.1.0
I have a table in which I have to add another one column at the end with one button.
So, If there are 15 records shown, there will be 15 buttons at the end of each record.
Button's functionality should be to save only the changes that correspond to the button's record. A record level save button.
How is this possible to be achieved? Do you have any advice?
Thanks a lot
~apostolosI would say instead of allowing editing in table give a button called EDIT which takes you to bounded task flow with Single record in a FORM and give Commit button there which will take back to table view of records.
providing SAVE button with every record will be confusing to users as they could forgot to click Save button with every record result lost transaction.
Zeeshan -
When I click SAVE PDF i need to get default dynamic name to save the PDF document.
Hi All,
When I click SAVE PDF option I need to get default dynamic name. In my case lets say Sales Order Number.pdf.
Thanks,
SP.Hi,
I have created SAP Abobe Form for Patient Order.
So when we execute we will see output as a PDF. If I want to save the PDF From, and click on the SAVE button, by default it comes up with my SAP FORM name, which I don’t want.
What I want is when I click SAVE button by default it should come up with the Patient Number on the PDF Form, so that i can directely save without changing the name.
For Example if I view the 101010 Patient Number then i should save the pdf from by 101010.pdf, same way if i view 202020 Patient number then i should save the pdf form by 202020.pdf.
Please let us know is this possible.
Thanks,
SP -
Click close button in infopath form shuld be redirect to site page not a list by default
Hi
I am custmizing a list in infopath
i created a view created by user and
i created a site page and assigned a created by user view to a webpart on this page
here i need when this list opens in edit mode , when i click close button this form shuld be redirect to site page
now its rediricting to list>all items
all items is default view for this list
adilHi adil,
According to your description, my understanding is that you wanted the redirect to another page once InfoPath form had been closed.
You can add a Content Edit web part above the InfoPath form web part with the following code:
$(document).ready(function(){
if($('#DialogFinalMessage').children().length>0)
window.location.href = "<Desired destination page URL>";
For more information:
http://shareapointkiran.blogspot.in/2011/12/infopath-form-redirect-to-any-page-once.html
Here are some similar posts for you to take a look at:
http://blogs.technet.com/b/sharepointwarrior/archive/2012/03/16/sp-2010-how-to-redirect-infopath-form-to-a-custom-thank-you-page.aspx
http://www.graphicalwonder.com/?p=666
http://social.technet.microsoft.com/Forums/en-US/1e732bb8-9090-40c4-b1a3-1dad8960c3c1/redirecting-to-the-home-page-when-clicking-on-close-button-of-the-item-in-a-list?forum=sharepointcustomizationprevious
http://social.technet.microsoft.com/Forums/en-US/69839309-d6d9-4a25-9100-82b2393f9054/click-on-infopaht-close-button-redirect-to-another-page?forum=sharepointgeneralprevious
I hope this helps.
Thanks,
Wendy
Wendy Li
TechNet Community Support -
Clicking "Save" brings up "Save as" box - Adobe Reader X
In our production environment, our end users open PDFs through our application. They then edit the PDF and click "Save." Prior to Reader X, this would automatically save to the correct folder supplied by our application. Now, however, it always displays a "Save as" box and the user must choose where to save it. We can't have this at all as the file structure should be transparent to our users and we don't want them accidentally saving over another file or deleting one. What can I change in the settings to fix this?
Automatic (scripted) save to disk arbitrary locations are disallowed by Reader X for security reasons.
http://blogs.adobe.com/asset/2010/11/inside-adobe-reader-protected-mode-part-3-broker-proc ess-policies-and-inter-process-communication.html
has the details.
If the environment is controlled, if you white list the folder that is being saved to, the prompt will longer be forced. Download the Application security guide from http://learn.adobe.com/wiki/display/security/Application+Security+Library and look at chapter 3.6.2
Maybe you are looking for
-
2 Step Stock Transfer Using WM Transport Order??
Dear SAP expertes, I have a problem, I think a lot of you too; that is stock transfer in 2 steps from one storage location to another (mov. types 313-315), but using o referencing a reservation. SAP says that is not possible create reservations for 2
-
I forgot how to input value into ring control. Could anyone tell me how?
-
I think I restricted iTunes app on my iPad, and now I can't find it. How do I retrieve it?
-
Deployment is taking very long time
Hi I have a 1GB RAM and 3 Mhz PC and my server is having 8 GB RAM. Im trying to deploy a mapping but it is taking a very long time more than 48 hours to deploy. The Mapping contains 2 tables with 20 data rules each. If i disabled this data rules then
-
A contract modified in IS-U not updated at CRM
Hi!!! I'm try to update the data of crm contract from sap isu contract, but isn't works fine, the status and the description of CRM contract for example is not updated. The Bdoc SI_CONTRACT is generated correctly, and the Badi's DOWNLOAD on ISU and C