JTable: how to prevent events?

Hello friends...
Does somebody know how to prevent a JTable to fire events at certain times when selections are made?
In this case, the selection can be made externally to the table, by a lot of objects at the same time. The goal is to fire an event ONLY when I really need it...
ThanX in advance for any help...

Hello again...
ThanX for your answers, I used a mix of both.
I used the method .setValueIsAdjusting() in ListSelectionModel that considers all coming events as one and I used a flag to enable changes.
The problem now is, I get a big array of values the table has to handle. Since it handles it as one unique event, it should be OK. But I fear that if the array is really monstruous, the method .setValueIsAdjusting() enters in "wait" mode (multi threads and all the stuff) and the flag is set to true (changes possible) without changes being made to table... Perhaps, there would be no problem at all...
Is it possible to force .setValueIsAdjusting() to do his job immediately?
ThanX a lot for your time...

Similar Messages

  • How to prevent AT SELECTION-SCREEN event on second Selection Screen

    Hi All
    I have a program in which I am entering some parameters in a selection screen and also validating them in AT SELECTION-SCREEN events. After validating them the program shows another selection screen in which I have some push-buttons. I have some events on those push-buttons also.
    However I am facing a different problem now. When I execute the second selection screen I get the report, and when I click on back button then it again triggers the AT SELECTION SCREEN event of the first selection screen and displays the related messages.
    How to prevent this ? Is there any way where I can restrict the execution of selection screen events for a particular selection screen?
    Amol

    Hi,
        try this logic when Ist selection screen validation
         is done set a flag = 'X' .
          at selection-screen.
          if glag is initial
           *screen validation
               flag = 'X..     
          endif.
    regards
    amole

  • How to prevent JFileChooser automatically changing to parent directory?

    When you show only directories, and click on the dir icons to navigate, and then dont select anything and click OK, it automatically 'cd's to the parent folder.
    My application is using the JFileChooser to let the user navigate through folders and certain details of 'foo' files in that folder are displayed in another panel.
    So we dont want the chooser automatically changing dir to parent when OK is clicked. How to prevent this behavior?
    I considered extending the chooser and looked at the Swing source code but it is hard to tell where the change dir is happening.
    thanks,
    Anil
    To demonstrate this, I took the standard JFileChooserDemo from the Sun tutorial and modified it adding these lines
              // NEW line 45 in constructor
              fc.addPropertyChangeListener((PropertyChangeListener) this);
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
          * NEW -
          * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
         public void propertyChange(PropertyChangeEvent e) {
              String prop = e.getPropertyName();
              if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
                   System.out.println("DIRECTORY_CHANGED_PROPERTY");
                   File file = (File) e.getNewValue();
                   System.out.println("DIRECTORY:" + file.getPath());
         }

    Here is the demo:
    package filechooser;
    import java.awt.BorderLayout;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import java.io.File;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.SwingUtilities;
    import javax.swing.UIManager;
    * FileChooserDemo.java uses these files:
    *   images/Open16.gif
    *   images/Save16.gif
    public class FileChooserDemo extends JPanel implements ActionListener,
              PropertyChangeListener {
         static private final String newline = "\n";
         JButton openButton, saveButton;
         JTextArea log;
         JFileChooser fc;
         public FileChooserDemo() {
              super(new BorderLayout());
              // Create the log first, because the action listeners
              // need to refer to it.
              log = new JTextArea(5, 20);
              log.setMargin(new Insets(5, 5, 5, 5));
              log.setEditable(false);
              JScrollPane logScrollPane = new JScrollPane(log);
              // Create a file chooser
              fc = new JFileChooser();
              // NEW
              fc.addPropertyChangeListener((PropertyChangeListener) this);
              fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
              // Create the open button. We use the image from the JLF
              // Graphics Repository (but we extracted it from the jar).
              openButton = new JButton("Open a File...",
                        createImageIcon("images/Open16.gif"));
              openButton.addActionListener(this);
              // Create the save button. We use the image from the JLF
              // Graphics Repository (but we extracted it from the jar).
              saveButton = new JButton("Save a File...",
                        createImageIcon("images/Save16.gif"));
              saveButton.addActionListener(this);
              // For layout purposes, put the buttons in a separate panel
              JPanel buttonPanel = new JPanel(); // use FlowLayout
              buttonPanel.add(openButton);
              buttonPanel.add(saveButton);
              // Add the buttons and the log to this panel.
              add(buttonPanel, BorderLayout.PAGE_START);
              add(logScrollPane, BorderLayout.CENTER);
          * NEW -
          * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
         public void propertyChange(PropertyChangeEvent e) {
              String prop = e.getPropertyName();
              // If the directory changed, don't show an image.
              if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
                   System.out.println("DIRECTORY_CHANGED_PROPERTY");
                   File file = (File) e.getNewValue();
                   System.out.println("DIRECTORY:" + file.getPath());
         public void actionPerformed(ActionEvent e) {
              // Handle open button action.
              if (e.getSource() == openButton) {
                   int returnVal = fc.showOpenDialog(FileChooserDemo.this);
                   if (returnVal == JFileChooser.APPROVE_OPTION) {
                        File file = fc.getSelectedFile();
                        // This is where a real application would open the file.
                        log.append("Opening: " + file.getName() + "." + newline);
                   } else {
                        log.append("Open command cancelled by user." + newline);
                   log.setCaretPosition(log.getDocument().getLength());
                   // Handle save button action.
              } else if (e.getSource() == saveButton) {
                   int returnVal = fc.showSaveDialog(FileChooserDemo.this);
                   if (returnVal == JFileChooser.APPROVE_OPTION) {
                        File file = fc.getSelectedFile();
                        // This is where a real application would save the file.
                        log.append("Saving: " + file.getName() + "." + newline);
                   } else {
                        log.append("Save command cancelled by user." + newline);
                   log.setCaretPosition(log.getDocument().getLength());
         /** Returns an ImageIcon, or null if the path was invalid. */
         protected static ImageIcon createImageIcon(String path) {
              java.net.URL imgURL = FileChooserDemo.class.getResource(path);
              if (imgURL != null) {
                   return new ImageIcon(imgURL);
              } else {
                   System.err.println("Couldn't find file: " + path);
                   return null;
          * Create the GUI and show it. For thread safety, this method should be
          * invoked from the event dispatch thread.
         private static void createAndShowGUI() {
              // Create and set up the window.
              JFrame frame = new JFrame("FileChooserDemo");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // Add content to the window.
              frame.add(new FileChooserDemo());
              // Display the window.
              frame.pack();
              frame.setVisible(true);
         public static void main(String[] args) {
              // Schedule a job for the event dispatch thread:
              // creating and showing this application's GUI.
              SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
                        // Turn off metal's use of bold fonts
                        UIManager.put("swing.boldMetal", Boolean.FALSE);
                        createAndShowGUI();
    }

  • How to prevent re-login when switching in the application between different module in 6.1.1.1.11?

    How to prevent re-login when switching in the application between different module in 6.1.1.1.11?
    Please help me to figure out this or resolve this issue?

    Be sure to check that your Remoting Container service is running. If it is not, restart the service, and if it goes down again, check the event logs.
    Make sure that the AuthenticationBridgeService is enabled in your EnvironmentSettings.config, and the remoting container user is configured using the SetupAssistant.
    <RemotingContainer>
             <ConfigInfo configChildKey="key">
                   <add key="UserID" value="@@VAR:Prodika.RemotingContainer.SysUser@@" />
             </ConfigInfo>      
            <!-- Set the following services isActive flag to 'true' or 'false' -->
             <RemoteServices configChildKey="name">
                 <Service
                     name="AuthenticationBridgeService"
                     port="@@VAR:Prodika.AuthenticationBridge.Port@@"
                     isActive="true" />
    If the Remoting Container Service fails, please contact Support with details from the event logs.

  • [2008R2] Prevent event : The shadow copies of volume D: were deleted because the shadow copy storage could not grow in time

    During the restore of data using VSS Snapshots it deleted all the snapshots, this event was written in the system log : 
    The shadow copies of volume D: were deleted because the shadow copy storage could not grow in time.  Consider reducing the IO load on the system or choose a shadow copy storage volume that is not being shadow copied.
    It only restored 20 GB of data and there should be plenty of space in the Shadow copy storage
    Used Shadow Copy Storage space: 2.692 GB (0%)
    Allocated Shadow Copy Storage space: 5.397 GB (0%)
    Maximum Shadow Copy Storage space: 694.752 GB (18%)
    When there isn't enough space it should start to delete the oldest snapshots to free up additional space, but it deleted
    all the snapshots. The problem is the IO but how to prevent this from happening again?

    Hi,
    Since the shadow copy storage space doesn’t run out, the issue could be due to the Volsnap.sys driver has encountered excessive I/O activity.
    You could refet to the article below to resolve the issue. This article is for Windows 2003 but it will also help on Windows 2008 R2 system.
    Error message when a Windows Server 2003-based computer has a high level of I/O activity: "The shadow copies of volume Volume_Name were aborted because the diff area file could not grow in time"
    http://support.microsoft.com/kb/925799
    Best Regards,
    Mandy 
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Programmatically change GUI controls/ prevent event firing

    Hi,
    I often construct GUIs where user input in one control automatically changes other controls.
    A (simple) example:
    A GUI contains controls A and B. When the user changes control A the value of control B has to be adjusted, and the other way round. So the event handler of A tells B to change its value. An event is fired, and the event handler of B tells A to change its value. An event is fired... and you have an endless event handling loop.
    Please believe me, though the example is simple: this happens frequently in real life, too. Since setting Swing controls programmatically most often triggers events, I need a mechanism to prevent event handling loops. What I do so far is
    o set a "deaf" flag
    o change the control
    o the listener gets informed about the change, but since the "deaf" flag is set it does nothing
    o reset the "deaf" flag
    Another, equally awkward way, is removing event listeners before the change and reattaching them afterwards.
    Is there any elegant way to handle this? How do you handle this kind of problem, which can't be too rare in the GUI world (although a rather extensive search with Google did not find much)?
    Chris

    Personally, I usually choose the same approach as you did, implementing a flag which I'll check when events are fired. If you do this, however, be sure to make the flag volatile, otherwise it might (very rarely) happen that a thread caches the value (even though this points to faulty code on your side, it is well near impossible to debug). I would strongly recomment not to remove and readd the listeners since it will create a lot of overhead and is rather hard to maintain.

  • Jtable on cell changed event

    How can i treat an Jtable on cell changed event, not on value changed

    Do you mean cell selection changed? One way is to add a ListSelectionListener to both the table's and the table's ColumnModel's ListSelectionModels. Something likeListSelectionListener lsl = new ListSelectionListener() {
       public void valueChanged(ListSelectionEvent e) {
          System.out.println(e.getSource());
          ListSelectionModel lsm = (ListSelectionModel) e.getSource();
          if (!lsm.getValueIsAdjusting()) {
             System.out.println("Selection changed");
    table.getSelectionModel().addListSelectionListener(lsl);
    table.getColumnModel().getSelectionModel().addListSelectionListener(lsl);Note that simultaneous change of both row and column will generate two valueChanged events.
    If that's not what you wanted to know, ask a better question.
    [http://catb.org/~esr/faqs/smart-questions.html]
    db

  • How to prevent iCloudDrive from waking computer from sleep?

    My PC wakes up periodically from sleep. After the checking the event logs, the logs show that iCloudDrive.exe process is causing the computer to wake up from sleep. I do not want to disable all system wake timers, but I do not know how to prevent iCloudDrive from waking up the computer. The expiration date keeps changing forward.
    in Command Prompt (admin):
    C:\windows\system32>powercfg -waketimers
    Timer set by [PROCESS] \Device\HarddiskVolume3\Program Files (x86)\Common Files\
    Apple\Internet Services\iCloudDrive.exe expires at 5:26:25 PM on 4/21/2015.
    In Event Viewer:
    Log Name:      System
    Source:        Microsoft-Windows-Power-Troubleshooter
    Date:          4/12/2015 3:21:56 PM
    Event ID:      1
    Task Category: None
    Level:         Information
    Keywords:     
    User:          LOCAL SERVICE
    Computer:      WIN-CBF43TVLMNC
    Description:
    The system has returned from a low power state.
    Sleep Time: 2015-04-12T18:24:08.280458300Z
    Wake Time: 2015-04-12T19:21:44.326107700Z
    Wake Source: Timer - iCloudDrive.exe
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="Microsoft-Windows-Power-Troubleshooter" Guid="{CDC05E28-C449-49C6-B9D2-88CF761644DF}" />
        <EventID>1</EventID>
        <Version>2</Version>
        <Level>4</Level>
        <Task>0</Task>
        <Opcode>0</Opcode>
        <Keywords>0x8000000000000000</Keywords>
        <TimeCreated SystemTime="2015-04-12T19:21:56.645016400Z" />
        <EventRecordID>2838</EventRecordID>
        <Correlation ActivityID="{0D44318C-F225-4D0E-AE0B-76736663674D}" />
        <Execution ProcessID="1888" ThreadID="848" />
        <Channel>System</Channel>
        <Computer>WIN-CBF43TVLMNC</Computer>
        <Security UserID="S-1-5-19" />
      </System>
      <EventData>
        <Data Name="SleepTime">2015-04-12T18:24:08.280458300Z</Data>
        <Data Name="WakeTime">2015-04-12T19:21:44.326107700Z</Data>
        <Data Name="SleepDuration">100</Data>
        <Data Name="WakeDuration">826</Data>
        <Data Name="DriverInitDuration">601</Data>
        <Data Name="BiosInitDuration">909</Data>
        <Data Name="HiberWriteDuration">0</Data>
        <Data Name="HiberReadDuration">0</Data>
        <Data Name="HiberPagesWritten">0</Data>
        <Data Name="Attributes">25612</Data>
        <Data Name="TargetState">4</Data>
        <Data Name="EffectiveState">4</Data>
        <Data Name="WakeSourceType">5</Data>
        <Data Name="WakeSourceTextLength">15</Data>
        <Data Name="WakeSourceText">iCloudDrive.exe</Data>
        <Data Name="WakeTimerOwnerLength">96</Data>
        <Data Name="WakeTimerContextLength">0</Data>
        <Data Name="NoMultiStageResumeReason">0</Data>
        <Data Name="WakeTimerOwner">\Device\HarddiskVolume3\Program Files (x86)\Common Files\Apple\Internet Services\iCloudDrive.exe</Data>
        <Data Name="WakeTimerContext">
        </Data>
      </EventData>
    </Event>

    In the Bluetooth System Preferences click the Advanced button, then uncheck the Allow Bluetooth Devices To Wake This Computer checkbox.

  • How to prevent window iconified

    Hi!
    I am wandering how to prevent window
    iconified (this - button on the right-top-
    corner on the window).
    DO_NOTHING_ON_CLOSE works for X button,
    any method to stop iconify!
    null

    You can use the JFrame method "public void processWindowEvent(WindowEvent e)" and when the WindowEvent ID is WINDOW_ICONIFIED, WINDOW_CLOSING or WINDOW_DEACTIVATING or some other event type that you're interested in, you can set the window visible again. Be careful though, if you don't program a way out of this the window will always be on top and you won't be able to perform any other window functions.
    Hope this helps.
    Steve

  • How to prevent (X button) closing window

    Hi!
    I am wondering how to prevent X button on
    the right top corner on the window closing
    the window.
    My jdev java app is intended to close window
    when user explicitly presses return button.
    That's works fine ... but how to catch
    window close event (X sys btn) and stop it?
    null

    Hi,
    You need to change the default close operation of JDialog or JFrame:
    myFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);

  • How to prevent B1 from populating the grid with components?

    Hello group,
    We have customized a form that pops up when user enters a parent item (of a template-type BOM) in the quotation grid.  The form displays the component items and lets the user mark which items to "paste" onto the quotation.  However, B1 automatically populates the grid with the component items once focus moves away from the item code column. 
    <b>How to prevent B1 from populating the grid with components <i>while</i> retaining the parent item in the item code column?</b>  I've tried trapping the Validate event, etc. with no success.

    Instead of setting the parent item up as a template type BOM, you could set up the list of parent/child items on a user table and use this user table to display the items in your pop-up screen.  As the parent item would no longer be a template BOM, Business One would no longer automatically popuplate the grid, and you could write your own code to add only the items selected in your pop-up screen into the grid.
    John.

  • How to get event press ESC when plugin's GUI is flashUI

    Hi all
    I implement my plugin use GUI is FlashUI (CSExentersion suite).
    when I pressed ESC. My GUI close imidately.
    I want to check whe n ESC press. But I can't get event pressed key for ESC
    I think that my GUI close from Illustrator. But I don't know how to get event press ESC.
    Thank for your help.

    Put a trace() to print the keyCode into the stage's keydown handler and run your extension in debug mode of flash builder, you can check whether ESC is pressed or not.
    However, I don't know how to prevent extension from closing neither.

  • How to prevent an error of [WIP work order ... is locked-]

    Hello experts
    Can someone tell me how to prevent an error which [The WIP work order associated with this transaction is currently locked and being updated by another user.  Please wait for a few seconds and try again.Transaction processor error].
    How can you prevent that error?
    P.S.
    Oracle support told me [When you make data of mtl_transaction_interface, give same transaction_header_id to all data. Then, you kick worker with appointed transaction_header_id. Or, you set up being uncompatible with workers].
    I cannot allow that making with same transaction_header_id and being uncompatible with worker on my system.

    Hi santosh,
    You can implement badi BBP_DOC_CHECK to check vendor email and issue error message.
    Kind regards,
    Yann

  • How to prevent PO changes in ME22N after Order acknowledgement?

    Hi everyone,
            Can anyone tell me how to prevent PO changes (ANY) in ME22N after Order acknowledgement?
            I would like to make it possible without release strategy process or authorizations.
            Do you know some User Exit or Customazing way?
    Regards.
    Jaime S.

    Dear Jaime S,
    You can do this by restricting in authorization SHDO and also by marking "changes not possible after release" in Release strategy procedure.
    And also you can navigate the menu to, SPRO------>IMG------>Material Management--->Purchasing(OLME)------->Purchase Order---->Define screen Layouts at Document Level---->And go to ME22n And Select the right parameter and in this you can make it display, optional or required entry for the fields.
    Regards,
    Manjunath B L

  • How to prevent error message for material description in MDG material detail screen, when user click on check action

    Dear Experts,
    I have a requirement for making material description as non mandetory in change request view of mdg material screen.
    I have done that using field usage in get data method of feeder classes, but still message is displaying.
    This message 'Material description is mandatory is displaying with check action only, but not with save or submit after i anhance field property as not mandetory.
    How to prevent error message for material description in MDG material detail screen, when user click on check action.
    Thanks
    Sukumar

    Hello Sukumar
    In IMG activity "Configure Properties of Change Request Step", you can completely deactivate the reuse area checks (but will then loose all other checks of the backend business logic as well).
    You can also set the error severity of the checks from Error to Warning (per CR type, not per check).
    Or you provide a default value for the material description, e.g. by implementing the BAdI USMD_RULE_SERVICE.
    Regards, Ingo Bruß

Maybe you are looking for

  • Loading a class

    Hi, This is my project structure out out/classes out/classes/temp.txt out/classes/news out/classes/news/trial.class now if i have to look up the file temp.txt in trail.class, i would have to use ../../temp.txt. I would like to change the context root

  • Timesten auto Recovery

    an error happened on my timesten, it dosen‘t work ,After about 30 minutes,it Recovered . why dose this error happened, i Didn’t do anything. who can help me ??? 20:28:52.04 Err : : 4839: 6757/6000000000743ff0: Assertion failed: (((np)->flags) & ((sbT

  • FDM Data Migration from 11.1.1.3 to 11.1.2.2

    Hi This is the procedure i am going to follow ,can u tell me whether it is correct or not ? 1.     Create FDQM application in Target machine using FDQM workbench client. 2.     Login to Source Machine where FDM is installed and launch workbench clien

  • Call transformation for ABAP to XML

    guys I know say a guide to create a xml from a table.

  • Printing Full Bleed (or close to it)

    I suspect this is related to the model of printer I'm using but here goes. I have a PDF and I'd like it to cover as much of the hardcopy as possible. I'm using an Epson Photo R280. When I print to it, I get a white border along all 4 sides but the ri