GUI resizes when calling JLabel.setText()

Case:
I have a GUI with a GridbagLayout.
This is the code for building the GUI.
Important bits:
please note the scrollConsole and adding it way at the end, because that's getting bigger:
NOTE: KwartoButtons are a selfmade class that behaves like a button.
     setSize(600,600);
          Container p1 = getContentPane();
          p1.setLayout(new GridBagLayout());
                    GridBagConstraints c = new GridBagConstraints();
                    c.gridx = 0;
                    c.insets.set(5,8,5,8);
               p1.setBackground(Color.DARK_GRAY);
                      panelVeld = new JPanel(new GridLayout(4,4));
                      panelStukken = new JPanel(new GridLayout(4,4));
                      labelVeld = new JLabel("Speelveld");
                      labelOngespeeld = new JLabel("Ongespeelde Stukken");
                    buttonStop = new JButton("Stop");
                      buttonConsole = new JButton("Hide/Show Console");
                      buttonStart = new JButton("Start");
               textAreaConsole = new JTextArea("");
               buttonPanel = new JPanel(new FlowLayout());
               textAreaConsole.setFont(new Font("Courier",Font.PLAIN, 12));
               aanZet = new JLabel("Niemand aan zet");
                      labelVeld.setForeground(Color.LIGHT_GRAY);
                      labelOngespeeld.setForeground(Color.LIGHT_GRAY);   
                   aanZet.setForeground(Color.LIGHT_GRAY);
                   scrollConsole = new JScrollPane(textAreaConsole,                   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
                  buttonPanel.add(buttonStart);
                  buttonPanel.add(buttonStop);
                  buttonPanel.setBackground(Color.DARK_GRAY);
                 for(int i=0; i < veld.length; i++)
                      veld[i] = new KwartoButton(null, i, true);
                      veld.addMouseListener(this);
               veld[i].setEnabled(false);
               panelVeld.add(veld[i]);
          Set<Stuk> stukkenSet = spel.getOngespeeld();
          int i=0;
          for(Stuk stuk: stukkenSet)
               stukken[i] = new KwartoButton(stuk, i, false);
               stukken[i].addMouseListener(this);
               stukken[i].setEnabled(false);
               panelStukken.add(stukken[i]);
               i++;
          c.fill = GridBagConstraints.NONE;     
          c.gridx = 0;
               p1.add(labelVeld, c);
          c.gridx = 1;
               p1.add(labelOngespeeld, c);
          c.weightx = 0.5;
          c.weighty = 0.9;
          c.fill = GridBagConstraints.BOTH;     
          c.gridx = 0;
               p1.add(panelVeld, c);
          c.gridx = 1;
               p1.add(panelStukken, c);
          c.fill = GridBagConstraints.VERTICAL;
          c.gridx=0;
          c.gridwidth=2;
          c.weightx=0;
          c.weighty=0;
          p1.add(aanZet,c);
          c.fill = GridBagConstraints.VERTICAL;     
          c.weighty = 0.0;               
          c.gridy=3;
          c.gridwidth=1;
          c.gridx=0;
               p1.add(buttonPanel, c);
          c.gridx=1;
               p1.add(buttonConsole, c);
          c.gridwidth = GridBagConstraints.REMAINDER;     
          c.gridx=0;
          c.gridy=4;
          c.weightx = 1.0;
c.weighty = 0.1;     
               c.fill = GridBagConstraints.BOTH;
          p1.add(scrollConsole, c);          
This is the code I run when the resize happens:
public void setMessage(String s)  {
String message =""
message =s
              if(!message.equals("")) {
                   addToConsole(message);
                   aanZet.setText(message);
public void addToConsole(String s)  {
               // Determine whether the scrollbar is currently at the very bottom position.
               JScrollBar vbar = scrollConsole.getVerticalScrollBar();
               boolean autoScroll = ((vbar.getValue() + vbar.getVisibleAmount()) == vbar.getMaximum());
               // append to the JTextArea (that's wrapped in a JScrollPane named 'scrollPane'
               textAreaConsole.append(s+"\n");
               // now scroll if we were already at the bottom.
               if( autoScroll ) textAreaConsole.setCaretPosition( textAreaConsole.getDocument().getLength() );
     }What my GUI does: When I invoke setMessage(), my scrollConsole grows about one line, until it overpowers the entire GUI (except the buttons).
If I remove the 'auto-scrolldown' functionality of addToConsole, it still resizes, so I reckon that's not the problem.

Here you go.
Thanks in advance.
import java.awt.*;
import javax.swing.*;
* SSCCE Class for my problem.
* Problem: GUI Resizes after calling the update method.
public class TestingClass extends JFrame {
               private JTextArea textAreaConsole;
               private JLabel aanZet;
               private JScrollPane scrollConsole;
     public void update(String s) {          //the problematic method
                   addToConsole(s);                         
                   aanZet.setText(s);
   public void addToConsole(String s) { //adds text to console
               // Determine whether the scrollbar is currently at the very bottom position.
               JScrollBar vbar = scrollConsole.getVerticalScrollBar();
               boolean autoScroll = ((vbar.getValue() + vbar.getVisibleAmount()) == vbar.getMaximum());
               // append to the JTextArea (that's wrapped in a JScrollPane named 'scrollPane'
               textAreaConsole.append(s+"\n");
               // now scroll if we were already at the bottom.
               if( autoScroll ) textAreaConsole.setCaretPosition( textAreaConsole.getDocument().getLength() );
     public TestingClass() {
          super("Test");
          buildGUI();
          setVisible(true);
          update("a");
          update("b");
          update("c");
               update("d");
                    update("e");
                         update("f");
                              update("g");
                                   update("h");
                                        update("i");
                                             update("j");
                                                  update("k");
                                                       update("l");
                                                            update("m");
                                                                 update("n");
                                                                      update("o"); //add more to see more effect, remove to kill problem
     public void buildGUI() { //building the gui
          setSize(600,600);
          Container p1 = getContentPane();
          p1.setLayout(new GridBagLayout());
                    GridBagConstraints c = new GridBagConstraints();
                    c.gridx = 0;
                    c.insets.set(5,8,5,8);
                    JPanel panelVeld = new JPanel(new GridLayout(4,4));
            JPanel panelStukken = new JPanel(new GridLayout(4,4));
                    textAreaConsole = new JTextArea("");
                    textAreaConsole.setFont(new Font("Courier",Font.PLAIN, 12));
                    aanZet = new JLabel("Test!");
                  scrollConsole = new JScrollPane(textAreaConsole, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
             for(int i=0; i < 16; i++)
                      panelVeld.add(new JButton("x"));
                      panelStukken.add(new JButton("y"));
      c.weightx = 0.5;
      c.weighty = 0.9;
      c.fill = GridBagConstraints.BOTH;     
      c.gridx = 0;
            p1.add(panelVeld, c);
      c.gridx = 1;
               p1.add(panelStukken, c);
             c.fill = GridBagConstraints.VERTICAL;
             c.gridx=0;
             c.gridwidth=2;
             c.weightx=0;
             c.weighty=0;
                  p1.add(aanZet,c);
             c.gridwidth = GridBagConstraints.REMAINDER;     
             c.gridx=0;
             c.gridy=4;
             c.weightx = 1.0;
      c.weighty = 0.1;                    
               c.fill = GridBagConstraints.BOTH;            
                  p1.add(scrollConsole, c);
public static void main(String[] args) { //starting up!
          new TestingClass();
}

Similar Messages

  • GUI crashes when calling native code..

    Hi,
    I have interfaced to an existing C program using the Java Native Interface and I am controlling the C program using a GUI. The problem is that everytime I click on the button to call the native method, the GUI crashes... The bizarre thing is that the C code seems to actually execute properly and no exceptions are thrown..
    Anyone come across this problem?
    /john

    Hi,
    Thanks for the replies...
    The GUI completely disappears. No error file is generated. No exceptions are thrown. Here it is in more detail..
    The C code is invoked using the java native interface. The C code converts a MIDI file to a text file. It is normally run in DOS and accepts two parameters. You would run it in DOS normally as follows:
    mf2t Example1.mid Example1.txt.
    In the GUI I select the MIDI file and specify the output file (Example1.txt). I then pass these two parameters to the C code. The C code originally used argc and argv to accept the parameters. I replaced these with "fileArray" and "parameter"... "mf2t" replaces "main" in the native code...
    On the java side the code looks like this:
    static public native boolean mf2t(String s6, String s7);
    public String infile; // Input MIDI file
    public String textOut; // Output text file
    private void MIDIButtonActionPerformed(java.awt.event.ActionEvent evt) {
    Object target=evt.getSource();
    if(target == MIDIButton) {
    if(mf2t(infile,textOut)){
    InfoLabel.setText("MIDI to text conversion complete");
    The code is built on the C side into a DLL using MS Visual Studio.
    On the C side the code looks something like this:
    static char *fileArray[5];
    static int argument=3;
    static char midiArray[25];
    static char txtArray[25];
    void mf2t(int argument,char * fileArray[]);
    // Entry point to native C code is here
    JNIEXPORT jboolean JNICALL
    Java_MainWindow_mf2t (JNIEnv *env, jobject j1, jstring midi, jstring txt)
    const jbyte *midiFile;
    const jbyte *txtFile;
    midiFile=(*env)->GetStringUTFChars(env,midi, NULL);
    txtFile=(*env)->GetStringUTFChars(env,txt, NULL);
    // The lines above just convert the java string into a C equivalent..
    strcpy(midiArray,midiFile);
    strcpy(txtArray,txtFile);
    fileArray[0]="mf2t.exe"; // Here I get fileArray to point to the converted strings
    fileArray[1]=midiArray;
    fileArray[2]=txtArray;
    mf2t(argument,fileArray); // Then I pass this to a native method
    (*env)->ReleaseStringUTFChars(env,midi, midiFile);
    (*env)->ReleaseStringUTFChars(env,txt, txtFile);
    return 1;
    void mf2t(int argument,char * fileArray[]){
    // native code in here
    I think it may have something to do with threads.. I'm not sure though.. It's impossible to know whats going on in the C code when the GUI crashes. If anything looks strange it's because I left out some code here for the sake of brevity... Still if you see anything that stands out let me know..
    Thanks,
    John

  • JTextField update problem when called from PropertyChangeEvent

    Hi,
    I'm trying to create forms that can be dynamically loaded with Class.forname(formName).
    Those forms should always inherit some methods that make it easy to pass data to
    them and receive data from them. The idea is that the data comes from a table which
    sends a hashmap (String column/JTextField-name + String Value pairs) with firePropertyChanged
    as soon as a new row is seleceted. The JTextFields in the form are marked with setName("FieldName") that has to correspond to the name of the columns of the table.
    My problem is that I can't update the fields in my form when I'm calling getRow(HashMap)
    from within propertyChangeEvent but that's necessary to keep the forms flexible.
    JTextFieldName.setText(newText) just won't work. But it works when I call getRow(HashMap)
    from the constructor. SwingWorker and threads to update the form didn't help.
    I don't need to call pack() / update() / repaint() on the JFrame, do I ??
    update() / validate() / repaint() etc. didn't work on the JTextField themselves.
    Below is the code for one of the test-forms (just a JPanel that is inserted in a frame)
    with all of it's methods. Does anybody have a solution to this problem ??
    Thanks for taking time for that !!
    Benjamin
    * testTable.java
    * Created on 15. April 2004, 16:12
    package viewcontrol.GUI;
    * @author gerbarmb
    import javax.swing.*;
    import java.awt.*;
    import java.beans.*;
    import java.util.*;
    public class testTable extends javax.swing.JPanel
              implements
                   java.awt.event.KeyListener,
                   java.beans.PropertyChangeListener {
          * public static void main(String[] argv) { testTable tt = new testTable();
          * JFrame jf = new JFrame(); jf.setContentPane(tt); jf.setVisible(true); }
         /** Creates new customizer testTable */
         public testTable() {
              initComponents();
              HashMap hm = new HashMap();
               * Only for debugging, to see that the method getRow() works when
               * called from the constructor.
               hm.put("ttext", "TEst");
               this.getRow(hm);
          * This method is called from within the constructor to initialize the form.
          * WARNING: Do NOT modify this code. The content of this method is always
          * regenerated by the FormEditor.
         private void initComponents() {//GEN-BEGIN:initComponents
              java.awt.GridBagConstraints gridBagConstraints;
              jLabel1 = new javax.swing.JLabel();
              textIn = new javax.swing.JTextField();
              jLabel2 = new javax.swing.JLabel();
              intIn = new javax.swing.JTextField();
              jLabel3 = new javax.swing.JLabel();
              numIn = new javax.swing.JTextField();
              jLabel4 = new javax.swing.JLabel();
              dateIn = new javax.swing.JTextField();
              jLabel5 = new javax.swing.JLabel();
              dateTimeIn = new javax.swing.JTextField();
              jLabel6 = new javax.swing.JLabel();
              jCheckBox1 = new javax.swing.JCheckBox();
              keepValues = new javax.swing.JCheckBox();
              jButton1 = new javax.swing.JButton();
              setLayout(new java.awt.GridBagLayout());
              jLabel1.setText("Text");
              add(jLabel1, new java.awt.GridBagConstraints());
              textIn.setName("ttext");
              textIn.setPreferredSize(new java.awt.Dimension(100, 21));
              textIn.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent evt) {
                        textInActionPerformed(evt);
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridwidth = 2;
              add(textIn, gridBagConstraints);
              jLabel2.setText("Integer");
              add(jLabel2, new java.awt.GridBagConstraints());
              intIn.setName("tint");
              intIn.setPreferredSize(new java.awt.Dimension(50, 21));
              add(intIn, new java.awt.GridBagConstraints());
              jLabel3.setText("Number");
              add(jLabel3, new java.awt.GridBagConstraints());
              numIn.setName("tnum");
              numIn.setPreferredSize(new java.awt.Dimension(50, 21));
              add(numIn, new java.awt.GridBagConstraints());
              jLabel4.setText("Date");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 0;
              gridBagConstraints.gridy = 1;
              add(jLabel4, gridBagConstraints);
              dateIn.setName("tdate");
              dateIn.setPreferredSize(new java.awt.Dimension(50, 21));
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 1;
              gridBagConstraints.gridy = 1;
              add(dateIn, gridBagConstraints);
              jLabel5.setText("DateTime");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 2;
              gridBagConstraints.gridy = 1;
              add(jLabel5, gridBagConstraints);
              dateTimeIn.setName("tidate");
              dateTimeIn.setPreferredSize(new java.awt.Dimension(80, 21));
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridy = 1;
              add(dateTimeIn, gridBagConstraints);
              jLabel6.setText("Bit");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridy = 1;
              add(jLabel6, gridBagConstraints);
              jCheckBox1.setName("tbit");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridy = 1;
              add(jCheckBox1, gridBagConstraints);
              keepValues.setText("keep values");
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 7;
              gridBagConstraints.gridy = 3;
              add(keepValues, gridBagConstraints);
              jButton1.setText("Send");
              jButton1.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent evt) {
                        jButton1ActionPerformed(evt);
              gridBagConstraints = new java.awt.GridBagConstraints();
              gridBagConstraints.gridx = 7;
              gridBagConstraints.gridy = 2;
              add(jButton1, gridBagConstraints);
         }//GEN-END:initComponents
         private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
              sendRow();
         }//GEN-LAST:event_jButton1ActionPerformed
         private boolean sendRow() {
              java.util.HashMap hm = new java.util.HashMap();
              Component[] cs = this.getComponents();
              for (int i = 0; i < cs.length; i++) {
                   if (((Component) cs).getName() != null) {
                        if (cs[i] instanceof JCheckBox) {
                             String value = ((JCheckBox) cs[i]).isSelected() ? "1" : "0";
                             hm.put(cs[i].getName(), value);
                        } else if (cs[i] instanceof JCheckBox) {
                             hm.put(cs[i].getName(), ((JTextField) cs[i]).getText());
              } // end for
              firePropertyChange("rowChanged", null, hm);
              return true;
         private void getRow(java.util.HashMap hm) {
              //if (! this.keepValues.isSelected()) {
              Component[] cs = this.getComponents();
              for (int i = 0; i < cs.length; i++) {
                   if (cs[i].getName() != null && hm.containsKey(cs[i].getName())) {
                        Component component = cs[i];
                        String componentName = cs[i].getName();
                        String componentValue = (String) hm.get(component.getName());
                        if (cs[i] instanceof JTextField) {
                             // output for debugging
                             System.out.println("Setting " + cs[i].getName() + " = "
                                       + componentValue);
                             ((JTextField) component).setText(componentValue);
                        } else if (cs[i] instanceof JCheckBox) {
                             // output for debugging
                             System.out.println("JCheckBox found");
                             JCheckBox cb = (JCheckBox) component;
                             boolean selected = (componentValue == null ? false : (componentValue.equals("1")
                                       ? true
                                       : false));
                             ((JCheckBox) component).setSelected(selected);
              } // end for
              /* Uncomment this code snippet to retrieve the text that has been set
              for the components (that means JTextFields)
              This is just for debugging !
              Component[] cs = this.getComponents(); for (int i = 0; i < cs.length;
              i++) { if (cs[i].getName() != null) { if (cs[i] instanceof
              JTextField) { System.out.println("Value of " +cs[i].getName() + " = " +
              ((JTextField) cs[i]).getText()); } } } // end for
         private void textInActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textInActionPerformed
         }//GEN-LAST:event_textInActionPerformed
         public void keyPressed(java.awt.event.KeyEvent e) {
              if (e.getKeyCode() == java.awt.event.KeyEvent.VK_ENTER) {
                   sendRow();
         public void keyReleased(java.awt.event.KeyEvent e) {
         public void keyTyped(java.awt.event.KeyEvent e) {
         public void propertyChange(java.beans.PropertyChangeEvent evt) {
              if (evt.getPropertyName().equals("newRow")) {
                   final PropertyChangeEvent finalEvt = evt;
                   Runnable makeChanges = new Runnable () {
                        public void run() {
                             getRow((java.util.HashMap) finalEvt.getNewValue());
         // Variables declaration - do not modify//GEN-BEGIN:variables
         private javax.swing.JTextField dateIn;
         private javax.swing.JTextField dateTimeIn;
         private javax.swing.JTextField intIn;
         private javax.swing.JButton jButton1;
         private javax.swing.JCheckBox jCheckBox1;
         private javax.swing.JLabel jLabel1;
         private javax.swing.JLabel jLabel2;
         private javax.swing.JLabel jLabel3;
         private javax.swing.JLabel jLabel4;
         private javax.swing.JLabel jLabel5;
         private javax.swing.JLabel jLabel6;
         private javax.swing.JCheckBox keepValues;
         private javax.swing.JTextField numIn;
         private javax.swing.JTextField textIn;
         // End of variables declaration//GEN-END:variables

    The problem of the change in the form not being comitted is that
    I forgot SwingUtilities.invokeLater(makeChanges); in the bottom
    part in public void propertyChange(java.beans.PropertyChangeEvent evt)
    after having created a new Runnable.
    Changes to the UI often have to be comitted by SwingUtitlities.invokeLater()
    though I don't know that much about Swing yet.
    Thanks to everybody who tried to solve that problem.
    Benjamin

  • JLabel setText() immediately

    Hi,
    I have a status bar (JPanel) at the bottom of my GUI that only consists of a JLabel. I am executing external commands via a TranslateId utility class to perform tasks such as translating from host name to IP address, IP address to host name, MAC to IP, IP to MAC, etc. These tasks may take a while, and I want the status bar to say "Please Wait..." while the task is processing. I have the following snipet of code that attempts to do that.
    statusBar.setMsg("Please Wait...Resolving machine name.");
    try
      nameToAdd = TranslateId.IpToName(ipAddrToAdd);
    catch(IOException e){}
    if(nameToAdd.length() == 0 || nameToAdd.equals(ipAddrToAdd))
      JOptionPane.showMessageDialog(null,
        "The machine name was unable to be resolved from the provided " +
        "information.  Please specify the machine name.",
        "Machine Name Unknown",
        JOptionPane.ERROR_MESSAGE);
      statusBar.setMsg("");
      return;
    statusBar.setMsg("");The problem is that the first line of code statusBar.setMsg(...) (this simply calls label.setText()) does not actually set the StatusBar text until after the external command is executed. The reason I know this is because if I pass an invalid IP address, and the JOptionPane error dialog is displayed, the status bar text does not get displayed until the JOptionPane is shown. There is a noticable passage of time when the external command is being processed where the StatusBar text is not displayed.
    It may be worth mentioning that all this code is within an actionPerformed() routine.
    Any ideas on how I can get the status text to display before the external command is run?
    Thanks,
    Geoff Wilson

    you can try to use the SwingWorker class to run the external command, freeing up the event dispatch thread (which both actionPerformed and the repaint by setText use) to process the new text..

  • Eliminating logon when calling R/3 transaction via BSP

    Is it possible to eliminate logon when calling SAP R/3 tcode via BSP. I run
    http://<FQDN>:<port>/sap/bc/gui/sap/its/webgui/!?client=%3c100%3e&transaction=SE80
    but have to login each time. I could embed my username/pwd on the url string, but is there another method?
    I also thought about using the URL iView parameters (Mapped User, Mapped Password) within Property Editor, but content admins will be able to see username and password when opening the iview. Any suggestions?
    Regards,
    James

    I figured this one out.
    Regards,
    James

  • Set the default field value to transaction code field, when calling from WD

    Hi all,
    Can we pass the value in a input field of a standard transaction calling from WD application. Suppose we are calling a transaction VA03 in an external window, then how will be pass the value in the VBAK_VBELN screen field.
    Is there any way to pass the value to this transaction field. I have also tried out to set the parameter ID 'AUN' for VA03 transaction VBELN field. But it did not work for me.
    Is there any way to set the default field value to transaction code field, when calling from WD?
    Please suggest, if anyone have any idea.
    Thanks
    Sanket

    Hi,
    I am using the below code to open a standard transaction. It will help you to explain my point more easily.
    DATA: url TYPE string,
              host TYPE string,
              port TYPE string.
    *Call below method to get host and port
      cl_http_server=>if_http_server~get_location(
         IMPORTING host = host
                port = port ).
    *create URL
      CONCATENATE 'http'
      '://' host ':' port
      '/sap/bc/gui/sap/its/webgui/?sap-client=&~transaction=' 'VA03'
       INTO url.
    *get the window manager as we are opening t code in external window.
      DATA lo_window_manager TYPE REF TO if_wd_window_manager.
      DATA lo_api_component TYPE REF TO if_wd_component.
      DATA lo_window TYPE REF TO if_wd_window.
      lo_api_component = wd_comp_controller->wd_get_api( ).
      lo_window_manager = lo_api_component->get_window_manager( ).
    call the url which we created above
      lo_window_manager->create_external_window(
      EXPORTING
      url = url
      RECEIVING
      window = lo_window ).
      lo_window->open( ).
    Note*
    One more query I want to add to this thread, that is there any possibility to call a custom transaction as well?

  • Displaying in the GUI from another called class

    Hi,
    New to creating GUIs in java and I'm having two problems:
    1- How do I display several images in my GUI in different areas of the GUI window?
    2- For these images and my text boxes, how do I display things when it's not the class the GUI was created in, but another class that is called by the main? Basically, my main initializes my GUI and then calls another class that does all of the actual work in the program, but I need to display text and images that are being manipulated in those classes.
    Sorry for the long-winded questions and thanks for any help that anyone can provide.

    You might want to start out by looking at the demo Swing applications to study how they work. These are part of your JDK install under $JAVA_HOME/demo/jfc
    Also keep in mind that all calls to directly manipulate the Swing UI after it is mapped on the screen need to take place on the event thread. For more information on this, take a look at:
    http://java.sun.com/products/jfc/tsc/articles/threads/threads3.html
    http://java.sun.com/docs/books/tutorial/ui/swing/threads.html

  • Communication error when calling web service for checkin and checkout files

    Hello,
    I am trying to checkout  and also to checkin files within the DMS via web service. The files are stored in the VAULT (=TRESOR) without the data server parth and DVA computer.
    For checkout:
    Original zum Ändern auschecken
      CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTMODIFY2'
        EXPORTING
          documenttype    = pi_documenttype
          documentnumber  = pi_documentnumber
          documentpart    = pi_documentpart
          documentversion = pi_documentversion
          documentfile    = lf_documentfiles
          pf_http_dest    = ''
          pf_ftp_dest     = ''
        statusextern    = lf_status
        IMPORTING
          return          = lf_return
          checkedoutfile  = ls_checkedoutfile.
    and for checkin:
    Dokument einchecken
      CALL FUNCTION 'BAPI_DOCUMENT_CHECKIN2'
        EXPORTING
          documenttype    = pi_documenttype
          documentnumber  = pi_documentnumber
          documentpart    = pi_documentpart
          documentversion = pi_documentversion
          hostname        = ''
          statusintern    = ''
       statusextern    = lf_status
          statuslog       = ''
        IMPORTING
          return          = lf_return
        TABLES
          documentfiles   = lt_files.
    But it is not working cause I always get a 'communication error' from the function CV120_FTP_START_REG_SERVER when calling one of these BAPIs via web service:
    IF pf_check_gui = 'X'.
        CLEAR: gf_gui_exist,
               gf_gui_checked.
        CALL FUNCTION 'RFC_PING'
             DESTINATION 'SAPGUI'
             EXCEPTIONS: communication_failure = 1 MESSAGE lf_msg_text
                         system_failure        = 2 MESSAGE lf_msg_text.
        IF sy-subrc = 0.
          gf_gui_exist = 'X'.
        ELSE.
          CLEAR gf_gui_exist.
        ENDIF.
        gf_gui_checked = 'X'.
      ENDIF.
    Afterwards the following function is called where I got the error 'Program no longer started via RFC. No return possible.':
    -> Vault with DVA -> ** Start FTP on the client
      CALL FUNCTION 'SYSTEM_START_REG_SERVER'
           EXPORTING: progname    = 'sapftp'
                      startmode   = ''                          " X
                      exclusiv    = 'Y'
                      waittime    = 500
                      startcomp   = 'C'    " G=gui, C=RFC
                      startpara   = ' '
          IMPORTING: err_code    = lf_errno
                     err_mess    = lf_error_msg
                     destination = pfx_destination.
    Regards
    Jens

    Hi! As mentioned below I had the same problem.
    There are two notes concerning security setting of the SAP Gateway:
    1069911 - GW: Changes to the ACL list of the gateway (reginfo)
    1480644 -  gw/acl_mode versus gw/reg_no_conn_info
    Your basis team should check if the Gateway settings allow external programs to register on the gateway.
    Best regards
    Dominik

  • Running  BDC in 'A' mode when called from Enterprise portal

    HI All,
    I have created a RFC which contains a BDC program that update data in SAP R/3. The RFC is called from Enterprise portal. Is it possible to run the rfc in A(all screen display) mode while calling from EP. I have tried it but it gives following 2 errors on EP
       cm_no_data_received
       rfc_error_communication
    what changes i have to do so that i can run the BDC in 'A ' mode  when called from Enterprise portal

    it would not be related to EP administration issues but something to do with GUI usage. it is loggically fare enough not to give options of viewing the debug screen in as it might concern security issues inway the data could be edited at any point of time. Moreover the screens u see in R3 are ABAP but whereas in EP it is purely based on Java and the calls to SAP is done via JCO thus enabling ABAP functionalities in EP. Maybe for these technical reasons or constraints it wont be possibel to view the screen in EP eventhough u had ext.bp activated

  • WDA app not launched with SSO when called from portal

    Hi,
    we have configured our systems so that our portal (NW Portal 7.0) is issuing logon tickets and ERP6.0 is receiving them in the backend for single sign-on.
    When launching a SAP GUI for Windows transaction (System admin->Support->SAP Application) to test if the SSO is set up correctly, all goes well and I'm able to call e.g. SU01 with logon tickets from the portal.
    My problem is that when calling a Web Dynpro for ABAP application in the same backend system from the same portal, I get an error "SSO logon not possible; logon tickets not activated on the server" and need to login manually when starting the application.
    When looking at the WDA app URL, I see http://<backend server>.<domain1>.com/... and the portal is sitting on http://<portal server>.<domain2>.com. Could it be a problem if the backend system is in another domain? And if yes, how come the SAP GUI for Windows launch then works (related to an http connection and domain relaxing?)? How to go forward and make it work all right?
    Best regards,
    Mikko

    Hi Navarro,
    Merry Xmas:)
    >>We did the same test with the demo app from you (MS)
    http://msdn.microsoft.com/en-us/library/windows/apps/hh202967(v=vs.105).aspxand it still don't work. (remember to setup
    fast app resume)
    Yes, I can reproduce your issue using the official sample.
    I think this issue is caused by the mechanism of Fast app resume, please refer to the following reference:
    #Fast app resume for Windows Phone 8
    http://msdn.microsoft.com/en-us/library/windows/apps/jj735579(v=vs.105).aspx
    Quote:
    With Fast Resume, when an app is resumed, the system creates a new page instance for the target of the launch point and this page is placed on top of the app’s existing backstack.
    This official sample can also help us to understand how it works:
    https://code.msdn.microsoft.com/windowsapps/Fast-app-resume-backstack-f16baaa6
    We could find that the Application.Launching event will not be triggered if we used Fast app resume, this will affect responding Toast's parameter(Deep Link).
    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.
    Click
    HERE to participate the survey.

  • Environment.Exit hangs when called from an application domain exception handler

    I've implemented a handler for exceptions not thrown in the main GUI thread of my C# WinForms application, as follows:
        AppDomain.CurrentDomain.UnhandledException  += OnUnhandledExceptionThrown;
    This handler is called from a background thread. The last statement in this handler is a call to
    Environment.Exit with the application exit code. However, the application hangs in this call. From within Visual Studio, it hangs and I'm unable to break the application; I have to use Task Manager to terminate Visual Studio. Environment.Exit
    works fine when called from the unhandled exception handler for the GUI thread. Is there a better way to terminate the application in the context of an unhandled exception thrown by a background thread?

    Are you just trying to avoid a crash? Environment.Exit can cause deadlocking if exiting in the wrong kind of scenario; if you're just trying to avoid a crash, use
    GetCurrentProcess with
    TerminateProcess to terminate your own process.  It skips the notification phases that Environment.Exit uses which prevents the common deadlock scenarios.
    WinSDK Support Team Blog: http://blogs.msdn.com/b/winsdk/

  • Server actions when calling dbms_error_code

    Hi all,
    The database is Oracle 10g 10.2 , and the GUI is Forms R6i with patch 17.
    Our application has a logout process , using the logout built-in, if the user does nothing during a certain number of time.
    In our pll library code there is a call to the dbms_error_code built-in executed when the ON-ERROR forms trigger is raised. It is logical that the ON-ERROR trigger is raised after the logout process if the user wants to do something.
    Our customer complains that there is a Forms alert saying that there is an error when calling the dbm_error_code built-in. I tested the scenario but I could not produce the error.
    So I want to know the actions involved into the database when calling the dbms_eror_code from Forms.
    Thank yiou very much indeed

    Sorry you had to discover this bug, Michael. It is a known issue we outlined in the release notes, and have since repaired it in the upcoming release. This is only an issue when your API returns an array of strings, as is the case for the default ValuesController
    file. Sorry about that, but know that we've fixed it. 

  • (Rfc) error  when called from bitztalk side

    Hello,
    I developed an RFC for payroll posting .RFC is working properly at R/3 end, But it is throwing an error "Control Framework: Fatal error - GUI cannot be reached" when it is called from Biztalk side.
    Thanks in advance.
    venu.

    You could try to set the enviroment with something like:-
    30 5 * * * su - oracle -c rman...........
    HTH
    PS. The .profile must be executable in a non-interactive mode as there is no terminal associated when called by CRON. Maybe the profile could check this using the stty command.

  • Correct clipping when calling "paint()" from thread

    How do I achieve correct clipping around JMenus or JTooltips when calling paint() for a Component from a background thread?
    The whole story:
    Trying to implement some blinking GUI symbols (visualizing alerts), I implemented a subclass of JPanel which is linked to a Swing timer and thus receives periodic calls to its "actionPerformed()" methods.
    In the "actionPerformed()" method, the symbol's state is toggled and and repainting the object should be triggered.
    Unfortunately, "repaint()" has huge overhead (part of the background would need to be repainted, too) and I decided to call "paint( getGraphics() )" instead of it.
    This works fine as long as there is nothing (like a JMenu, a JComboBox or a JTooltip) hiding the symbol (partially or completely). In such case the call to paint() simply "overpaints" the object.
    I suppose setting a clipping region would help, but where from can I get it?
    Any help welcome! (I alread spent hours in search of a solution, but I still have no idea...)

    For all those interested in the topic:
    It seems as if there is no reliable way to do proper clipping when calling
    "paint()".
    The problem was that when my sub-component called "repaint()" for itself, the underlying component's "paintComponent()" method was called as well. Painting of that component was complex and avoiding complexity by restricting
    on the clipping region is not easily possible.
    I have several sub-components to be repainted regularly, resulting in lots of calls to my parent component's "paintComponent()" method. This makes the
    repainting of the sub-components awfully slow; the user can see each one begin painted!
    Finally I decided I had to speed up the update of the parent component. I found two possible solutions:
    a) Store the background of each of the sub-components in a BufferedImage:
    When "paintComponent()" is called: test, if the clipping rectangle solely
    contains the region of a sub-component. If this is true check if there
    is a "cached" BufferedImage for this region. If not, create one, filling
    it with the "real" "paintComponent()" method using the Graphic object of
    the BufferedImage. Once we have such a cached image, simply copy it the
    the screen (i.e. the Graphics object passed as method parameter).
    b) To avoid the handling of several of such "cached" image tiles, simply
    store the whole parent component's visible part ("computeVisibleRect()")
    in a BufferedImage. Take care to re-allocate/re-paint this image each
    time the visible part changes. (I need to restrict the image buffer to
    the visible part since I use a zooming feature: Storing the whole image
    would easily eat up all RAM!) In the "paintComponent()", simple check
    if the currently buffered image is still valid - repaint if not -
    and copy the requested part of it (clip rect) to the screen. That's it!
    The whole procedure works fine.
    Best regards,
    Armin

  • I can record voice memos fine using the built-in iPhone 4 mic.  And my Bluetooth headset (Jawbone Era) works fine when I leave messages on voice mail systems etc. when calling on the iPhone 4.  However, I cannot record voice memos with my Bluetooth mic.

    I can record voice memos fine using the built-in iPhone 4 mic.  And my Bluetooth headset (Jawbone Era) works fine when I leave messages on voice mail systems etc. when calling on the iPhone 4, so it appears my headset mic is fine.  I can also use voice activated dialing, although it fails miserably interpreting numbers.  However, I cannot record voice memos with my Bluetooth mic.   I just get barely audible static.  Any suggestions?   Thanks.

    Hello, did you ever get an answer to your question? I just picked up a Jawbone Era and using on an iPhone 4s running 5.0.1. Seems to work fine on regular calls, but not on the built in Voice memos application. It worked fine on my older Jawbone Icon, but haven't tested on the 4s or iOS 5.
    Thanks!

Maybe you are looking for

  • Anyway to get a 1080p signal from fios?

    A couple of weeks ago, I purchased a 32 Inch Sony Bravia 720p but yet 1080p compatible HDTV. I know my TV is capable of receiving 1080p signals as most HDTV's are in the modern era. However, Fios via the HD DVR only broadcast up to a 1080I signal. My

  • Changing email address at log in

    I am trying to change my account id to my new email address. I have changed location and no longer have the same email address that was my old user id with my apple account. When I try to change my user id to my new email address which is through .Ma

  • Help: How to use Case statement in Interface ODI11g?

    Hi From my Source base i am getting 'Year' Values and i want translate these values into a code in interface and after translate want to push to Target system. Example: From source Database i am getting value for Year 2010 2011 2012 When i get Year 2

  • PDK for EP 7.0

    Hi all, We installed EP 7.0 successfully. But we couldn't find the PDK for EP 7.0 anywhere. The links which were mentioned in other threads are not working. I couldn't find any info regarding PDK download. Any inputs on the path to download PDK for E

  • Outline Stroke in cs4 adds unwanted duplicate/overlapping point, why?

    When I create an outline of a line, say a simple 2 point straight line, I get the result of a filled 4 point rectangle, or so it would seem. When I individually drag each point out using the direct selection tool I find that there are actually 5 poin