JLabel not updating text in GUI

i've spent about an hour trying to get my label to update from another class. i set the label to public and i tried to invoke setText() on it from the other class, but it doesnt change it in the GUI. i printed the getText() method of the label and it's identical to what i tried to set it to be, but it just isnt displaying the correct text.
i know to update in the GUI it needs to repaint itself, but this is automatic for setText() and it is working for the local calls to setText().
i have a method
     public void setStatus(String text)
          status.setText(text);
     }that should do exactly what i want, but it only works when called from its own class..... HELP

hey,
just a little example...
//first little class with the label in it! and a getter for the label.
public class LabelPanel extends JFrame {
     private static  JLabel label;
     public LabelPanel(){
          initGUI();
     private void initGUI() {
          label = new JLabel("old text");
          JPanel panel = new JPanel();
          ButtonPanel buttonPanel = new ButtonPanel();
          panel.add(buttonPanel.getPane());
          panel.add(label);
          setContentPane(panel);
     public static void main(String[] args)
          // Schedule a job for the event-dispatching thread:
          // creating and showing this application's GUI.
          javax.swing.SwingUtilities.invokeLater(new Runnable() {
               public void run() {
                    createAndShowGUI();
      * Create the GUI and show it.
     private static void createAndShowGUI() {
          // Create and set up the window.
          JFrame frame = new LabelPanel();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setTitle("test");
          // Display the window.
          frame.pack();
          frame.setVisible(true);
        // gets the label
     public static JLabel getLabel() {
          return label;
//second class just a button that changes the label
public class ButtonPanel implements ActionListener{
     private JPanel pane;
     private JButton button;
     public ButtonPanel(){
          init();
     private void init(){
          button = new JButton("change");
          button.addActionListener(this);
          pane = new JPanel();
          pane.add(button);
     public void actionPerformed(ActionEvent e) {
          String cmd = e.getActionCommand();
          if(cmd.equals("change")){
               button.setText("done");
                        //get the label and set the new text
               LabelPanel.getLabel().setText("new text");
          }else if(cmd.equals("done")){
               button.setText("change");
                        //get the label and set the new text
               LabelPanel.getLabel().setText("old Text");
     public JPanel getPane() {
          return pane;
}hope that helps!!! :)

Similar Messages

  • Print Preview: SAP GUI showing updated text, CRM UI not showing updated text

    Hello,
    can anyone please help me with "Print Preview" button in CRM UI:
    In the CRM UI when a certain data is changed on the document, a note on the document is updated with changes in data. When pressing the "Print Preview" button the generated PDF is not showing an updated text. If i run the SmartForm directly in SAP GUI after the data change, the generated PDF shows an updated text. If i reload the CRM UI (close the browser and run the CRM_UI transaction) the "Print Preview" shows an updated text.
    What should i do, that the Print Preview in the CRM UI would also show an updated text (without reloading the CRM UI) ?
    Im thinking it could be a problem with the parameters SFPDOCPARAMS and SFPOUTPUTPARAMS, that are used when calling the SmartForm FM. The parameters are set as this:
       ls_outputparams-nodialog = 'X'.
       ls_outputparams-getpdf = 'X'.
       ls_outputparams-connection = 'ADS'.
       CALL FUNCTION 'FP_JOB_OPEN'
         CHANGING
           ie_outputparams = ls_outputparams
         EXCEPTIONS
           cancel          = 1
           usage_error     = 2
           system_error    = 3
           internal_error  = 4
           OTHERS          = 5.
       ls_docparams-country = 'SI'.
       ls_docparams-langu = sy-langu.
       CALL FUNCTION lv_name
         EXPORTING
           /1bcdwb/docparams  = ls_docparams
           I_HEADER_GUID      = ls_orderadm_h_wrk-guid
         IMPORTING
           /1bcdwb/formoutput = ls_formoutput
         EXCEPTIONS
           usage_error        = 1
           system_error       = 2
           internal_error     = 3
           OTHERS             = 4.
    SAP gurus, please help

    I figured the solution:
    In the Code Initialization of my interface (SFP transaction) i had to initialize the buffer:
       CALL FUNCTION 'INIT_LOAD_TEXT_BUFFER'
         EXPORTING
           EXCL_ID       = ls_stxh-tdid
           EXCL_LANGUAGE = ls_stxh-tdspras
           EXCL_NAME     = ls_stxh-tdname
           EXCL_OBJECT   = ls_stxh-tdobject
         EXCEPTIONS
           NOT_FOUND     = 1
           OTHERS        = 2.
    This way the text is loaded from the updated note every time a "Print Preview" button is pressed.

  • Help!  Using GUI button to update text file

    Desperately needing help on the following:
    As you will see, I have created two classes - one for reading and writing to a text file on my hard drive, and one for the GUI with two buttons - Display and Update. The Display button works perfectly in that it displays text from a file path. The Update button, however, does not work correctly. I seek for the Update button to update any edits to the same exact text file I view using the Display button.
    Any help would be greatly appreciated. Thanks!
    Class TextFile
    import java.io.*;
    public class TextFile
        public String read(String fileIn) throws IOException
            FileReader fr = new FileReader(fileIn);
            BufferedReader br = new BufferedReader(fr);
            String line;
            StringBuffer text = new StringBuffer();
            while((line = br.readLine()) != null)
              text.append(line+'\n');
            return text.toString();
        } //end read()
        public void write(String fileOut, String text, boolean append)
            throws IOException
            File file = new File(fileOut);
            FileWriter fw = new FileWriter(file, append);
            PrintWriter pw = new PrintWriter(fw);
            pw.println(text);
            fw.close();
        } // end write()
    } // end class TextFileClass TextFileGUI
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class TextFileGUI implements ActionListener
        TextFile tf = new TextFile();
        JTextField filenameField = new JTextField (30);
        JTextArea fileTextArea = new JTextArea (10, 30);
        JButton displayButton = new JButton ("Display");
        JButton updateButton = new JButton ("Update");
        JPanel panel = new JPanel();
        JFrame frame = new JFrame("Text File GUI");
        public TextFileGUI()
            panel.add(new JLabel("Filename"));
            panel.add(filenameField);
            panel.add(fileTextArea);
            fileTextArea.setLineWrap(true);
            panel.add(displayButton);
            displayButton.addActionListener(this);
            panel.add(updateButton);
            updateButton.addActionListener(this);
            frame.setContentPane(panel);
            frame.setSize(400,400);
            frame.setVisible(true);
        } //end TextFileGUI()
        public void actionPerformed(ActionEvent e)
            if(e.getSource() == displayButton)
                String t;
                try
                    t = tf.read(filenameField.getText());
                    fileTextArea.setText(t);
                catch(Exception ex)
                    fileTextArea.setText("Exception: "+ex);
                } //end try-catch
            } //end if
            else if(e.getSource() == updateButton)
                try
                  tf.write(filenameField.getText());
                catch(IOException ex)
                    fileTextArea.setText("Exception: "+ex);
                } //end try-catch
            } //end else if
         } //end actionPerformed()
    } //end TextFileGUI

    Here's your working example.
    In my opinion u do not have to append \n when u reading the file
    Look the source, if u have some problem, please, ask me.
    Regards
    public class TextFileGUI implements ActionListener
    TextFile tf = new TextFile();
    JTextField filenameField = new JTextField(30);
    JScrollPane scrollPane = new JScrollPane();
    JTextArea fileTextArea = new JTextArea();
    JButton displayButton = new JButton("Display");
    JButton updateButton = new JButton("Update");
    JPanel panel = new JPanel();
    JFrame frame = new JFrame("Text File GUI");
    public static void main(String args[])
    new TextFileGUI();
    public TextFileGUI()
    panel.setLayout(new BorderLayout());
    JPanel vName = new JPanel();
    vName.setLayout(new BorderLayout());
    vName.add(new JLabel("Filename"), BorderLayout.WEST);
    vName.add(filenameField, BorderLayout.CENTER);
    panel.add(vName, BorderLayout.NORTH);
    scrollPane.setViewportView(fileTextArea);
    panel.add(scrollPane, BorderLayout.CENTER);
    fileTextArea.setLineWrap(true);
    JPanel vBtn = new JPanel();
    vBtn.setLayout(new FlowLayout());
    vBtn.add(displayButton);
    displayButton.addActionListener(this);
    vBtn.add(updateButton);
    updateButton.addActionListener(this);
    panel.add(vBtn, BorderLayout.SOUTH);
    frame.setContentPane(panel);
    frame.setSize(400, 400);
    frame.setVisible(true);
    } // end TextFileGUI()
    public void actionPerformed(ActionEvent e)
    if (e.getSource() == displayButton)
    String t;
    try
    t = tf.read(filenameField.getText());
    fileTextArea.setText(t);
    catch (Exception ex)
    ex.printStackTrace();
    else if (e.getSource() == updateButton)
    try
    tf.write(filenameField.getText(), fileTextArea.getText(), false);
    catch (IOException ex)
    ex.printStackTrace();
    } // end try-catch
    } // end else if
    } // end actionPerformed()
    } // end TextFileGUI
    class TextFile
    public String read(String fileIn) throws IOException
    String line;
    StringBuffer text = new StringBuffer();
    FileInputStream vFis = new FileInputStream(fileIn);
    byte[] vByte = new byte[1024];
    int vPos = -1;
    while ((vPos = vFis.read(vByte)) > 0)
    text.append(new String(vByte, 0, vPos));
    vFis.close();
    return text.toString();
    } // end read()
    public void write(String fileOut, String text, boolean append) throws IOException
    File file = new File(fileOut);
    FileWriter fw = new FileWriter(file, append);
    PrintWriter pw = new PrintWriter(fw);
    pw.println(text);
    fw.close();
    } // end write()
    } // end class TextFile

  • Problem with JButtons Text field not updating

    Im working on a program (which has its full code included below incase its part of the problem) which wants to change a Jbutton's name during a program. The way I'm trying to make it change is by having a string, "test", be called "before update". then have the jbuttons text equal test. then, in an actionlistener, it changes string test to equal "after update". This doesn't update the Jbuttons text.
    I don't get any errors when I press the button, but the buttons name is not updating. Whats causing the buttons name not to be updated?
    Thanks for help in advance.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*; 
    public class TicTac extends JFrame {
    public int Teamplaying = 0;
    public int CrossA, CrossB, CrossC, CrossD, CrossF, CrossG, CrossH, CrossI, CircleA, CircleB, CircleC, CircleD, CircleE, CircleF, CircleG, CircleH, CirclI, TLB, TMB, TRB, MLB, MMB, MRB, LLB, LMB, LRB = 0;
    String test = "Before Update";
        public TicTac() {
             JPanel TicTac = new JPanel();
             TicTac.setLayout(new GridLayout(3,4));
                  TicTac.add(new JButton(test));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  TicTac.add(new JLabel("a"));
                  setContentPane(TicTac);
             pack();
             setTitle("Add Numbers Together TicTac");
             setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             setLocationRelativeTo(null);
        class TopLeftBox implements ActionListener {
             public void actionPerformed(ActionEvent e) {
             String test = "After update";
             if (Teamplaying == 0) {
                  CrossA = CrossA + 1;
                  CrossD = CrossD + 1;
                  CrossG = CrossG + 1;
             else {
                  CircleA = CircleA + 1;
                  CircleB = CircleB + 1;
         public static void main(String[]args) {
        TicTac Toe = new TicTac();
        Toe.setVisible(true);
    }

    1) Strings are immutable meaning you can't change them.
    2) Even if you could, the two test strings are completely different variables.
    3) To change JButton text, you should call its setText method.
    4) For a JButton to perform an action on button press, it needs to have an actionlistener added to it via the addActionListener(...) method.
    5) Please read, study, and review the Sun Swing tutorials. You will benefit greatly from having a solid foundation in Swing basics before you try coding in Swing.
    Good luck.
    Edit: a small example code (SSCCE, if you will):
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class Frame extends JFrame
        public Frame()
            JPanel panel = new JPanel();
            JButton button = new JButton("Before Update");
            button.addActionListener(new ButtonListener()); // add actionlistener here
            panel.add(button);
            setContentPane(panel);
            pack();
            setTitle("Frame");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setLocationRelativeTo(null);
        private class ButtonListener implements ActionListener
            public void actionPerformed(ActionEvent e)
                // get the button that called this action
                JButton button = (JButton)e.getSource();
                // update the button's text
                button.setText("After update");
        public static void main(String[] args)
            SwingUtilities.invokeLater(new Runnable()
                @Override
                public void run()
                    new Frame().setVisible(true);               
    }Edited by: Encephalopathic on Apr 28, 2008 9:26 PM

  • BAPI_ACC_DOCUMENT_POST line item text SGTXT not updating

    Hi,
    We have copied following LSMW for opening balance upload from ECC 5  to ECC 6.
    When we upload through LSMW (BAPI_ACC_DOCUMENT_POST ) which is used for uploading opening balances of G/L accounts field Long Text (Tech Name: ITEM_TEXT) not updating.
    Form Vendor and Customer Opening balances LSMWs  Long Text (Tech Name: ITEM_TEXT) field of G/L line item is not updating. According to my observation data field  SGTXT of BSEG table. not getting updated through this LSMW. I have tried same transaction through  T Code F-02 and it is updating field SGTXT of BSEG  table. As per confirmation from business same LSMWs  are working fine in ECC 5.
    Jigar

    hi experts,
    no body faced this situation?
    Any suggestions ?
    kindly give me any inputs
    thanks & regards,
    Raghul
    Edited by: Raghul Gandhi on Aug 11, 2009 11:32 AM
    Edited by: Raghul Gandhi on Aug 11, 2009 12:56 PM

  • Invoice text(SGTXT) is not updating in payment proposal line items

    Hi,
    While doing payment proposal in F110, invoice text is not updating in payment proposal line items, which is available in ‘BSIK’  table.
    Please find the attached screen shot. Please give me suggestions How to resolve this issue.

    Hi,
    The other line item accounts are revaluation accounts. So when there is no  exchange rate, the amounts are zero.
    Ezhil.

  • Not receiving texts after new update

    I've just updated to lollipop on my Xperia Z1 Compact and have just realised no texts are coming in. I've just checked with a friend and they're receiving my texts but not vice versa. I've been using a text messenging app called Textra which is all working fine other than the main issue of not getting text messages.
    I've then tried to look at and hopefully use the original default messenger. It doesn't open just has a white screen with 'Messenger' at the top, so it then tells me it's not responding. Hope that's enough information, not sure what to do at the moment.

    Hi Piersht,
    Welcome to the community! Since you're new please be sure that you have checked out our Discussion guidelines
    You may also want to try some of the basics, such as removing the SIM card from the handset for a short period of time, once done see if messages can be received.
     - Official Sony Xperia Support Staff
    If you're new to our forums make sure that you have read our Discussion guidelines.
    If you want to get in touch with the local support team for your country please visit our contact page.

  • Bug report: text does not update on the stage

    I am not sure whether this has been reported:
    I have several groups divs into one main group div. In these are images and text. I create a new group by copying elements from a previous group and then insert new text in the copied text box. The text does not update on the stage but is correct when I run the composition and also in the text panel.

    Hi Hemanth.
    I tried all day and is intermittent, why?, 'cause the numbers are now showing but the other texts not, this happen only on Chrome and Safari when the navigator screen increases size.
    On Chrome:
    On Firefox:
    I discovered that the error appears only on the right side of the stage, if I move the buttons to center, the error disappears:
    On Chrome (Fullscreen):
    I have no idea of what is happening.

  • Yosemite not syncing texts after updating to ios 8.1

    I have updated my iphone 6+ to iOS 8.1 & text messages are not showing up on my Mac that is running Yosemite.  Both devices are on the same SSID.  Any suggestions?  Thanks in advance.

    Hi mdbrown2,
    If you are not seeing text messages within Messages on your Mac running Yosemite, you may want to double check that it is showing your Apple ID and your iPhone phone number are linked, as outlined in the following article:
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    Regards,
    - Brenden

  • HT1414 Hi All, i recently done a back up and update & restore, but ive lost my notes, my text messages and my reminders and notes on the calender, i also have lost the data i had in an app which was very important to me. Please Please help me,  i,m total

    Hi All, i recently done a back up and update & restore, but ive lost my notes, my text messages and my reminders and notes on the calender, i also have lost the data i had in an app which was very important to me. Please Please help me,  i,m total novice.
    I did this back up because i was instructed by my service provider. This was supposed to sort out my losing connection problem, which it didn't, it instead gave me a new problem. If there is anyone out there who can help me to retrieve my lost information i would appreciate it.
    Thank You in advance.

    You should be syncing your contacts with an app on your computer or cloud service (iCloud, Gmail, Yahoo, etc), and not relying on a backup.  If you haven't been doing this, start now and then restore your old backup.  You will then be able to sync the new contacts back into the phone.  However, you will lose all messages, etc newer thant the backup.

  • Not getting updated Text

    Hi,
    I have used CREATE_TEXT function module to create standard text which i am including in SAP Script using
    INCLUDE command.
    This script is attached to transaction PP40 now the problem i am facing is this Text is not getting updated even i change the Business Event , but i can see the updated text in SO10.
    Is it regarding Buffer refresh or Memory Refresh ?
    Can you please suggest me a way how to get the updated text in Script.
    Thanks & Regards,
    Amit Kade

    Hi Vijay,
    Thank you for your raply .
    I am getting the updated text in an Internal Table which i  am passing to CREATE_TEXT FM , and i can see the updated text in SO10 also but it's not reflecting in Script.
    I am using following Include statement ..
    INCLUDE ZTEXT1 OBJECT TEXT ID ST.
    Regards,
    Amit

  • Text not updated when changing the ResourceBundle

    this is an abstraction of what i have on my code:
    controller
    public class controller extends VBox{
         @FXML protected Label ex2;
         public CtrlMainMenu() throws Exception{
              FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/view/View.fxml"));
              fxmlLoader.setController(this);
              fxmlLoader.setRoot(this);
              fxmlLoader.setResources(CtrlLanguage.resource);
              fxmlLoader.load();
         @Override public void initialize(URL arg0, ResourceBundle arg1) {
              ex2.setText(arg1.getString("ex2"));
    }View
    <fx:root type="VBox" xmlns:fx="http://javafx.com/fxml">
         <children>
              <Label text="%ex1"/>
              <Label fx:id="ex2"/>
         <children>
    </fx:root>Language controller
    public class CtrlLanguage{
         private static String PATH =
              new File(
                   CtrlImageLoader.class.getProtectionDomain().getCodeSource().getLocation().getPath()
              ).getParentFile().getPath() + "/language/";
         public static ResourceBundle resource;
         public static void setLanguage(String file) throws Exception{
              try {
                   if(new File(PATH + file).exists())
                        resource = new PropertyResourceBundle(new FileInputStream(PATH + file));
                   else
                        resource = new PropertyResourceBundle(CtrlLanguage.class.getResourceAsStream("/language/"+file));
              } catch (Exception e) {
                   resource = new PropertyResourceBundle(CtrlLanguage.class.getResourceAsStream("/language/EN"));
         public static String get(String key){
              try {
                   return resource.getString(key);
              } catch (Exception e) {
                   return key;
    }problem comes when I try to change the language without changing the current root
    the elements of the view are not updated when the bundle is changed (CtrlLanguage.setLanguage("file");) until the root is changed/loaded again
    is there any way so i can make the content change without having to reload again the root?

    A method which returns an instance of the following class:
    * A localizable read only property for internationalization of string properties.
    * @author Christian Schudt
    public final class LocalizableStringProperty extends ReadOnlyStringProperty {
        private String resourceKey;
        private StringProperty text;
        private String baseName;
        private ClassLoader classLoader;
        // Keep the listener as hard reference in the class, so that it won't get GCed, until this class has no references any more.
        private ChangeListener<Locale> changeListener;
        public LocalizableStringProperty(LocaleManager localeManager, String baseName, String resourceKey) {
            this(localeManager, baseName, resourceKey, null);
        public LocalizableStringProperty(LocaleManager localeManager, String baseName, String resourceKey, ClassLoader classLoader) {
            changeListener = new ChangeListener<Locale>() {
                @Override
                public void changed(ObservableValue<? extends Locale> observableValue, Locale locale, Locale locale1) {
                    localeChanged(locale1);
            localeManager.localeProperty().addListener(new WeakChangeListener<Locale>(changeListener));
            this.baseName = baseName;
            this.classLoader = classLoader;
            this.resourceKey = resourceKey;
            text = new SimpleStringProperty();
            localeChanged(localeManager.getLocale());
        private void localeChanged(Locale locale) {
            ResourceBundle resourceBundle;
            Locale.setDefault(locale);
            if (classLoader == null) {
                resourceBundle = ResourceBundle.getBundle(baseName, locale);
            } else {
                resourceBundle = ResourceBundle.getBundle(baseName, locale, classLoader);
            text.set(resourceBundle.getString(resourceKey));
        @Override
        public String get() {
            return text.get();
        @Override
        public Object getBean() {
            return text.getBean();
        @Override
        public String getName() {
            return text.getName();
        @Override
        public void addListener(ChangeListener<? super String> changeListener) {
            text.addListener(changeListener);
        @Override
        public void removeListener(ChangeListener<? super String> changeListener) {
            text.removeListener(changeListener);
        @Override
        public void addListener(InvalidationListener invalidationListener) {
            text.addListener(invalidationListener);
        @Override
        public void removeListener(InvalidationListener invalidationListener) {
            text.removeListener(invalidationListener);
    }

  • Changes to Provider-specific Texts for Infoobjects are not updated

    Hi,
    We have some existing queries on one of our Multiproviders. We changed the description of one of the Info-objects on the Multiprovider using PROVIDER_SPECIFIC PROPERTIES.  This changed description is not updated into the existing queries. The existing queries still show the old description for the info-object.
    any ideas!!.
    thanks in advance.
    Naga

    Hi Pravendar,  Thanks for your response. we are using an older version of BEx Analyzer with 7.0, which does not have the check box you have mentioned.  So, I am thinking this is not going help us much.
    Hi Orla, Thanks for your suggestion. I tried this before posting here.. it did not work.
    rgds
    Naga

  • Can not update tab if its not the default sub-tab.

    Can not update tab if its not the default sub-tab.
    JDeveloper Version 10.1.2.1.0 (Build 1913)
    Hi. I have a problem with a “lovOpenWindowAction”
    The UIX is created with a master UIX and have several sub-tab that is included as UIX-pages.
    The lovOpenWindowAction lies in the included UIX-page
    The sub-tab I have a problem with has a table with users. Then I have a “Create New” button than I want to click on and select a new user that should be included in the table in the sub-tab.
    When I click on the button I open a LOV-window. Here I select the user that I want to add.
    In the LOV Action-class I save my new value in the database. Then in the method “onLovUpdate” I update the iterator with the new values from the database.
    But in my GUI the subtab is not updated until I click on it.
    But if I make the subtab the default subtab then it all works just fine and the GUI is updated directly.
    Here is the code for the tableAction in the subtab. This code lies in an included UIX-page. Target is the table id.
    <tableActions>
    <button text="Create New" id=" createNewRollperson" accessKey="N">
    <primaryClientAction>
    <lovOpenWindowAction destination="FiskeRollpersonerLOV.do"
    source=" createNewRollperson "
    targets="joinedRollpersfiskeer message"/>
    </primaryClientAction>
    </button>
    </tableActions>
    Here is some code from the master UIX-page
    <subTabLayout id="flikar">
    <subTabs>
    <subTabBar selectedIndex="${ui:defaulting(param.index,0)}">
    <contents>
    <link id="resorFlik" text="Resor"
    disabled="${sessionScope.fiske.id == null}"
    selected="${(param.source == 'resorFlik') or empty param.source}">
    <primaryClientAction>
    <firePartialAction event="changeTab" targets="flikar globalHeader">
    <parameters>
    <parameter key="source" value="resorFlik"/>
    </parameters>
    </firePartialAction>
    </primaryClientAction>
    </link>
    <link id="rollpersonerFlik" text="Rollpersoner"
    disabled="${sessionScope.fiske.id == null}"
    selected="${param.source == 'rollpersonerFlik'}">
    <primaryClientAction>
    <firePartialAction event="changeTab" targets="flikar globalHeader">
    <parameters>
    <parameter key="source" value="rollpersonerFlik"/>
    </parameters>
    </firePartialAction>
    </primaryClientAction>
    </link>
    </contents>
    </subTabBar>
    </subTabs>
    <contents>
    <switcher childName="${param.source}"
    defaultCase=”ResorFlik">
    <case name="resorFlik">
    <include node="${ctrl:parsePage(uix, 'includes/ResorFlik')}"/>
    </case>
    <case name="rollpersonerFlik">
    <include node="${ctrl:parsePage(uix, 'includes/FiskeRollpersonerFlik')}"/>
    </case>
    </switcher>
    </contents>
    </subTabLayout>
    What am I missing?? I can’t have this subtab as the default subtab! Please help me with a solution!

    hi,
    Change the condition type to manual entry.
    or
    for example delivery costs will be different at the time of PO and actual delivery costs then at the time of invoice we select planned delivery costs and settle them first with the actual delivery cost.
    Thanks & Regards,
    Kiran

  • Not Updating the Values in the JComboBox and JTable

    Hi Friends
    In my program i hava Two JComboBox and One JTable. I Update the ComboBox with different field on A Table. and then Display a list of record in the JTable.
    It is Displaying the Values in the Begining But when i try to Select the Next Item in the ComboBox it is not Updating the Records Eeither to JComboBox or JTable.
    MY CODE is this
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.DefaultComboBoxModel.*;
    import javax.swing.table.*;
    import java.sql.*;
    import java.util.*;
    public class SearchBook extends JDialog implements ActionListener
         private JComboBox comboCategory,comboAuthor;
         private JSplitPane splitpane;
         private JTable table;
         private JToolBar toolBar;
         private JButton btnclose, btncancel;
         private JPanel panel1,panel2,panel3,panel4;
         private JLabel lblCategory,lblAuthor;
         private Container c;
         //DefaultTableModel model;
         Statement st;
         ResultSet rs;
         Vector v = new Vector();
         public SearchBook (Connection con)
              // Property for JDialog
              setTitle("Search Books");
              setLocation(40,110);
              setModal(true);
              setSize(750,450);
              // Creating ToolBar Button
              btnclose = new JButton(new ImageIcon("Images/export.gif"));
              btnclose.addActionListener(this);
              // Creating Tool Bar
              toolBar = new JToolBar();
              toolBar.add(btnclose);
              try
                   st=con.createStatement();
                   rs =st.executeQuery("SELECT BCat from Books Group By Books.BCat");
                   while(rs.next())
                        v.add(rs.getString(1));
              catch(SQLException ex)
                   System.out.println("Error");
              panel1= new JPanel();
              panel1.setLayout(new GridBagLayout());
              GridBagConstraints c = new GridBagConstraints();
              c.fill = GridBagConstraints.HORIZONTAL;
              lblCategory = new JLabel("Category:");
              lblCategory.setHorizontalAlignment (JTextField.CENTER);
              c.gridx=2;
              c.gridy=2;
              panel1.add(lblCategory,c);
              comboCategory = new JComboBox(v);
              comboCategory.addActionListener(this);
              c.ipadx=20;
              c.gridx=3;
              c.gridwidth=1;
              c.gridy=2;
              panel1.add(comboCategory,c);
              lblAuthor = new JLabel("Author/Publisher:");
              c.gridwidth=2;
              c.gridx=1;
              c.gridy=4;
              panel1.add(lblAuthor,c);
              lblAuthor.setHorizontalAlignment (JTextField.LEFT);
              comboAuthor = new JComboBox();
              comboAuthor.addActionListener(this);
              c.insets= new Insets(20,0,0,0);
              c.ipadx=20;
              c.gridx=3;
              c.gridy=4;
              panel1.add(comboAuthor,c);
              comboAuthor.setBounds (125, 165, 175, 25);
              table = new JTable();
              JScrollPane scrollpane = new JScrollPane(table);
              //panel2 = new JPanel();
              //panel2.add(scrollpane);
              splitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,panel1,scrollpane);
              splitpane.setDividerSize(15);
              splitpane.setDividerLocation(190);
              getContentPane().add(toolBar,BorderLayout.NORTH);
              getContentPane().add(splitpane);
         public void actionPerformed(ActionEvent ae)
              Object obj= ae.getSource();
              if(obj==comboCategory)
                   String selecteditem = (String)comboCategory.getSelectedItem();
                   displayAuthor(selecteditem);
                   System.out.println("Selected Item"+selecteditem);
              else if(obj==btnclose)
                   setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
              else if(obj==comboAuthor)
                   String selecteditem1 = (String)comboAuthor.getSelectedItem();
                   displayavailablity(selecteditem1);
                   //System.out.println("Selected Item"+selecteditem1);
                   System.out.println("Selected Author"+selecteditem1);
         private void displayAuthor(String selecteditem)
              try
              {     Vector data = new Vector();
                   rs= st.executeQuery("SELECT BAuthorandPublisher FROM Books where BCat='" + selecteditem + "' Group By Books.BAuthorandPublisher");
                   System.out.println("Executing");
                   while(rs.next())
                        data.add(rs.getString(1));
                   //((DefaultComboBoxModel)comboAuthor.getModel()).setVectorData(data);
                   comboAuthor.setModel(new DefaultComboBoxModel(data));
              catch(SQLException ex)
                   System.out.println("ERROR");
         private void displayavailablity(String selecteditem1)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        rs= st.executeQuery("SELECT * FROM Books where BAuthorandPublisher='" + selecteditem1 +"'");     
                        ResultSetMetaData md= rs.getMetaData();
                        int columns =md.getColumnCount();
                        String booktblheading[]={"Book ID","Book NAME","BOOK AUTHOR/PUBLISHER","REFRENCE","CATEGORY"};
                        for(int i=1; i<= booktblheading.length;i++)
                             columnNames.addElement(booktblheading[i-1]);
                        while(rs.next())
                             Vector row = new Vector(columns);
                             for(int i=1;i<=columns;i++)
                                  row.addElement(rs.getObject(i));
                             data1.addElement(row);
                             //System.out.println("data is:"+data);
                        ((DefaultTableModel)table.getModel()).setDataVector(data1,columnNames);
                        //DefaultTableModel model = new DefaultTableModel(data1,columnNames);
                        //table.setModel(model);
                        rs.close();
                        st.close();
                   catch(SQLException ex)
    }Please check my code and give me some Better Solution
    Thank you

    You already have a posting on this topic:
    http://forum.java.sun.com/thread.jspa?threadID=5143235

Maybe you are looking for

  • Different Identity Root with different Masters in one sun IM system

    Hi! We have the problem that we have to administer identities which have completely different sources and attributes. (internal identities with sap hr as master, external identities for system a with sql db as master, external identities for system b

  • Problem while Creating Database in 10g

    Its very urgent.. Please Help..!! After installing 10g (Standard Edition) on Windows 2000 Server, I started creating database through Database Configuration Assistant. Instead of Oracle Home path, different path is specified for Database files. In 'S

  • Accounting Document for Inventory posting

    All, While posting the inventory count (MI07) ( 3 materials ) , and while seeing the accounting document , separate line items for different materials are not coming . It is clubbed and coming  total . How I can change this to different line items ?

  • Backup of database on 11.2.0.3 problem

    hi, i have database running in 11.2.0.2 on linux 5. the database is on no-arcvhive mode. I am trying to take the cold backup from rman script but the problem comes when the script tries to start database in mount but it says the the service identifie

  • Help - how to add my own data to a table

    Hello, I looked at the tutorials, but cannot get this to work. I want to load a table (each row) with data I read from other tables. I tried: RowKey rk = objectArrayDataProvider1.appendRow(); FieldKey fk = new FieldKey("A"); objectArrayDataProvider1.