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

Similar Messages

  • How to call a Java class from another java class ??

    Hi ..... can somebody plz tell me
    How to call a Java Class from another Java Class assuming both in the same Package??
    I want to call the entire Java Class  (not any specific method only........I want all the functionalities of that class)
    Please provide me some slotuions!!
    Waiting for some fast replies!!
    Regards
    Smita Mohanty

    Hi Smita,
    you just need to create an object of that class,thats it. Then you will be able to execute each and every method.
    e.g.
    you have developed A.java and B.java, both are in same package.
    in implementaion of B.java
    class B
                A obj = new A();
                 //to access A's methods
                 A.method();
                // to access A's variable
                //either
               A.variable= value.
               //or
               A.setvariable() or A.getvariable()

  • How can I to control any element of my GUI from another class?

    How can I to control any element of my GUI from another class?

    For that, you need the external class to have the reference to your element.. If your idea is to change basic properties like width, height etc.. then you can have the constructor of the external class to take the object of the parent of your class as the parameter and modify ..
    However, if the properties to be altered/accessed are custom to your element, then you will have to have the class accept an object of your class as the parameter. No other option..
    What exactly is your requirement?

  • .How to instantiate the innerclass from another class with coded eg.

    How to instantiate the innerclass from another class(both for static & non static) please give me an eg with coding.

    It's just a preference, but I like writing factory methods:
    public class Outer {
        public class Inner {}
        public static class StaticInner {}
        public Inner innerInstance() {
            return new Inner();
        public static StaticInner staticInnerInstance() {
            return new StaticInner();
        public static void main(String[] args) {
            Outer.StaticInner si = Outer.staticInnerInstance();
            Outer outer = new Outer();
            Outer.Inner i = outer.innerInstance();
    }Often, for me, the inner class implements an interface, and the factory method
    lets you hide the implementation class:
    public class Outer {
        private class Inner implements Runnable {
            public void run() {}
        public Runnable runnerInstance() {
            return new Inner();
        public static void main(String[] args) {
            Outer outer = new Outer();
            Runnable r = outer.runnerInstance();
    }

  • Open the form from another form...

    How can I open the form from another form with the PL/SQL code???
    The my form are create from OracleDesigner and developed with OracleBuilder.
    Regards
    Basilisco Giorgio

    You can read "About calling reports, displays, and other forms from generated forms" topic in the Designer on-line help. By the way in Forms there are CALL_FORM,OPEN_FORM and NEW_FORM built-ins.
    Helena

  • Variable type Hierarchy, how to get the value from another similar variable

    Hi.
    We have created a variable, type hierarchy (using ORGEH hierarchy in HR based on 0ORGUNIT). Let's call this VAR1. We want to fill this with an User Exit, beacuse we want VAR1 to have the value from another variable, VAR2, which is also type hierarchy (and based on the same characteristic).
    However, when we program this user exit and use the VAR1 afterwards, it just behaves as if we have a single characteristic value and not a node value. As a result, we just get posts which do have the 'parent itself' as characteristic value, and none of the subnodes...  Any hints as to what we can do in our User exit to get the value passed over from VAR2 to VAR1 as a node value? Is there any spesific syntax to be used here that we are missing? ( The VAR1 and VAR2 are both defined as hierarchy variables, we have double checked...).

    Hi,
    are you on BI7.0? There you can create variables type replacement path and get the value out from a different variable without any coding.
    regards
    Cornelia

  • Can not add a picture to the JFrame from an ActionListener class

    As topic says, I can not add a picture to the JFrame from an ActionListener class which is a class inside the JFrame class.
    I have a Map.java class where I load an image with ImageIcon chosen with JFileChooser.
    I my window class (main class), I have following:
    class OpenImage_Listener implements ActionListener
         public void actionPerformed(ActionEvent e)
              int ans = open.showOpenDialog(MainProgram.this);     // "open" is the JFileChooser reference
              if(ans == open.APPROVE_OPTION)
                   File file = open.getSelectedFile();                    
                   MainProgram.this.add(new Map(file.getName()), BorderLayout.CENTER);     // this line does not work - it does not add the choosen picture on the window,
                            //but if I add the picture outside this listener class and inside the MainProgram constructor, the picture apperas, but then I cannot use the JFileChooser.
                            showMessageDialog(MainProgram.this, fil.getName() ,"It works", INFORMATION_MESSAGE);  // this popup works, and thereby the ActionListener also works.
    }So why can�t I add a picture to the window from the above listener class?

    The SSCCE:
    Ok, I think I solved it with the picture, but now I cannot add new components after adding the picture.
    Look at the comment in the actionlistener class:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class Test extends JFrame{
         JButton b = new JButton("Open");
         JFileChooser jfc = new JFileChooser(System.getProperty("user.dir"));
         Picture pane;
         Test(){
              super("Main Program");
              setLayout(new BorderLayout());
              JPanel north = new JPanel();
              add(north, BorderLayout.NORTH);
              north.add(b);
              b.addActionListener(new Listener());
              setVisible(true);
              setSize(500,500);
              pane = new Picture("");
              add(pane, BorderLayout.CENTER);
         class Listener implements ActionListener {
              public void actionPerformed(ActionEvent e){
                   int ans = jfc.showOpenDialog(Test.this);
                   if(ans == jfc.APPROVE_OPTION)
                        File file = jfc.getSelectedFile();
                        Test.this.add(new Picture(file.getName()), BorderLayout.CENTER);
                        pane.add(new JButton("NEW BUTTON")); // Why does this button not appear on the window???
                        pane.repaint();
                        pane.revalidate();
         public static void main(String[] args)
              Test t = new Test();
    class Picture extends JPanel
         Image pic;
         String filename;
         Picture(String filename)
              setLayout(null);
              this.filename = filename;
              pic = Toolkit.getDefaultToolkit().getImage(filename);
            protected void paintComponent(Graphics g)
                super.paintComponent(g);
                g.drawImage(pic,0,0,getWidth(),getHeight(),this);
                revalidate();
    }

  • When I sync a certain cd from a certain band all of the music from another band dissapears and vise versa.

    This problem has perplexed me for quite some time.  I have been trying to find a solution to this for a while now and have had no luck.  The problem I face is that I have trouble getting a cd from one band and all of the music from another band to sync to my ipod touch.  When I do manage to get one of them to sync the other one isn't synced.  I do manage to get the other one to sync but the previous one gets removed from my ipod.  In detail it is the plastic beach album from the gorillaz and a two disc greatest hits set from sublime.  I have no problem syncing other items to my ipod.  Before the last update neither of those items would sync to my ipod.  After the update I managed to get the gorillaz cd to sync but no sublime.  I unchecked the sublime music and resynced my ipod.  Then I checked the sublime music and synced my ipod.  This worked in putting the sublime music on my ipod but for some reason removed the gorillaz albume from my ipod.  When I went through the same process to try and get the gorillaz ablum back on my ipod it removes the sublime music.  I never receive any kind of error message.  I highly doubt apple support is going to help at all because I am using a pc and last time I tried to get help from apple support they tried to get me to start messing with my reg key edit.  That problem I actually ended up fixing with a hard reset so my faith in the apple support hotline has been demolished.  I was hoping there might be someone on here that has run into a similar problem and knows the fix for this.

    I would like to add something to this.  I just discovered tonight that in the case of both the specific cd and the entire sublime music they will be removed each time I sync my ipod.  But if I uncheck them, sync the ipod, then check them again sync the ipod one more time they will the on my ipod.  But upon the next sync the songs will be removed even though they are checked.

  • OBIEE Report - filter based on the result from another analysis

    Hi,
    I am using OBIEE 11g,
    I am trying to use a filter which is based on the result from another analysis. I have an analysis A which is as table 1, and I want to filter the respective columns of analysis B (Table B) based on analysis A to remove the duplicates for march 01, 02, and 07 , but it is not working properly. I took a max of start and end time when I created analysis A. Please let me know if I did anything wrong. thanks.
    Table 1
    Employee Number
    Date
    IN
    Out
    Start Time
    End Time
    xxxxxxx
    2015-02-26
    9:00
    13:00
    00:00:00
    00:00:00
    2015-02-27
    12:00
    18:00
    00:00:00
    00:00:00
    2015-02-28
    8:00
    14:00
    00:00:00
    00:00:00
    2015-03-01
    14:00
    20:00
    14:00:00
    20:00:00
    2015-03-02
    16:00
    20:00
    16:00:00
    20:00:00
    2015-03-07
    14:06
    20:02
    14:00:00
    20:00:00
    2015-03-11
    16:00
    20:00
    16:00:00
    20:00:00
    2015-03-14
    8:00
    14:00
    00:00:00
    00:00:00
    2015-03-25
    14:00
    20:00
    16:00:00
    20:00:00
    Table 2
    Employee Number
    Date
    IN
    Out
    Start Time
    End Time
    Hours
    xxxxxxx
    2015-02-26
    9:00
    13:00
    00:00:00
    00:00:00
    -3
    2015-02-27
    12:00
    18:00
    00:00:00
    00:00:00
    6
    2015-02-28
    8:00
    14:00
    00:00:00
    00:00:00
    6
    2015-03-01
    14:00
    20:00
    00:00:00
    00:00:00
    6
    14:00:00
    20:00:00
    6
    2015-03-02
    16:00
    20:00
    00:00:00
    00:00:00
    4
    16:00:00
    20:00:00
    4
    2015-03-07
    14:06
    20:02
    00:00:00
    00:00:00
    6
    14:00:00
    20:00:00
    6
    2015-03-11
    16:00
    20:00
    16:00:00
    20:00:00
    4
    2015-03-14
    8:00
    14:00
    00:00:00
    00:00:00
    6
    2015-03-25
    14:00
    20:00
    16:00:00
    20:00:00
    4

    Why avg here?
    What columns you want to show in the report?
    for a employee for given date if he have 2 rows then you may sum up hours right?
    Employee Number
    Date
    IN
    Out
    Start Time
    End Time
    Hours

  • How can I import pictures from my iphone to PC which I imported to the iphone from another PC? The folder doesn't show on my computer. I see all other pictures I took with the phone but not the imported folder.

    How can I import pictures from my iphone to PC which I imported to the iphone from another PC? The folder doesn't show on my computer. I see all other pictures I took with the phone but not the imported folder.

    Photos that were synced from a computer won't show for copying to a computer. If you want to copy them back then you will need a third-party app on your phone such as Simple Transfer which can copy them off via your wifi network. But photos are 'optimised' when they are synced to a device, any that you then copy back to a computer may not be exactly the same as they originally were on your computer (e.g. their dimensions might be different and their colours may look a bit different).

  • How come every time i'm on the phone and another call enters I answer it but it doesnt tell me anywhere who is who on each line so i can go back and forth?? it only says multiple calls and i cant hang up the other line

    how come every time i'm on the phone and another call enters I answer it but it doesnt tell me anywhere who is who on each line so i can go back and forth?? it only says multiple calls and i cant hang up the other line.

    My carrier is Sprint. But I actually have checked with others and theirs work fine.

  • TS4592 I have an ibooks file that when I make a change to a page in one chapter it throws a bunch more pages in at the end of the chapter from another chapter in the book.  Anybody have any ideas what is going on?

    I have an ibooks file that when I make a change to a page in one chapter it adds additional pages at the end of the chapter from another chapter.  Any ideas what is going on and how I can fix this?

    Text  pages?  from what you say you are getting the auto flow function to add pages either because you have  flowing text or because you  have a lot of blank lines as you would if  you  tap return to  move  blank space around.

  • TS1389 how to authorize computer in itunes for the purchased from another account

    how to authorize computer in itunes for the purchased from another account ??

    Use that account's Apple ID and password; the procedure is otherwise the same as authorizing it for the first account. If the iTunes library contains protected content from more than five iTunes Store accounts, you may not be able to fully sync it.
    (92807)

  • Get the value from another node.

    Hi, expert
    In the component BT131I_SLS , I create a enhanced attribute in the node: BT131I_SLS/Details BTADMINI
    Then i define the GET-V method to create a search help for the attribute.
    Now , i want to pass a BP number to the search help function to filter the data.
    We need to get the BP number as below:
    When create a order, we input the product id ,
    then there will be a popup window , we can choose  a vendor in the window.
    The vendor number is the value which we want to pass to the search help.
    How can i do that ?
    Thanks.
    Oliver.

    Hi , expert
    Can i use the 'get_related_entities' to get the value I need?
    I think maybe i can use the method to get the value from another view which is not in my component.
    Now I write codes in the GET-V method, as below:
    method GET_V_ZZZFLD000011.
      DATA:
        LS_MAP    TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING,
        LT_INMAP  TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB,
        LT_OUTMAP TYPE IF_BSP_WD_VALUEHELP_F4DESCR=>GTYPE_PARAM_MAPPING_TAB.
      DATA: LV_PARTNER_NO TYPE CRMT_PARTNER_NUMBER.
      data: lr_current TYPE REF TO if_bol_bo_property_access,
            lr_entity  TYPE REF TO cl_crm_bol_entity,
            lr_col     TYPE REF TO if_bol_bo_col,
            value      TYPE string.
      lr_entity ?= me->collection_wrapper->get_current( ).
      lr_col = lr_entity->get_related_entities( iv_relation_name = 'Relation_Name' ).
      lr_current = lr_col->get_current( ).
    * value =
      LS_MAP-CONTEXT_ATTR = 'EXT.ZZZFLD000011'.
      LS_MAP-F4_ATTR      = 'LGORT'.
      APPEND LS_MAP TO: LT_OUTMAP.
    *  LS_MAP-CONTEXT_ATTR = 'EXT.ZZZFLD000011'.
    *  LS_MAP-F4_ATTR      = 'LANGU'.
    *  APPEND LS_MAP TO LT_INMAP.
      IF SY-SUBRC  = 0.
      ENDIF.
      CREATE OBJECT RV_VALUEHELP_DESCRIPTOR
        TYPE
          CL_BSP_WD_VALUEHELP_F4DESCR
        EXPORTING
          IV_HELP_ID                  = 'ZHELP_ZSAKCDD'
    *      IV_HELP_ID_KIND             = IF_BSP_WD_VALUEHELP_F4DESCR=>HELP_ID_KIND_COMP
          IV_HELP_ID_KIND             = IF_BSP_WD_VALUEHELP_F4DESCR=>HELP_ID_KIND_NAME
          IV_INPUT_MAPPING            = LT_INMAP
          IV_OUTPUT_MAPPING           = LT_OUTMAP
          iv_trigger_submit           = abap_true
    *      IV_F4TITLE                  = ' '"#    EC NOTEXT
    endmethod.
    But i don't know the Relation_Name which i can get the vender's information.
    Another question : i want to trigger the code 'get_related_entities' when i click the search help,
                                   How can i do that ?
    Thanks.
    Oliver.
    Edited by: oliver.yang on Aug 7, 2009 5:56 AM

  • I updated my 4S iphone and now I am getting all the texts from another iPhone on my plan.  How do I stop this?

    I updated my 4S iPhone and now I am getting all the texts from another iPhone on my plan.  What do I need to do?

    I'm not completely clear on the GSM / LTE network frequencies in US vs Argentina, but I do know that cross-compatibility can be an issue when buying from one country and using in another. Apple products in particular have this problem. What this sounds like to me is that the phone is not compatible with Argentinian networks; or your friend had an AT&T phone and jail-broke it. This is against the end user licensing agreement, and when the phone is next updated is likely to jam the phone.
    Sorry but you lost your money.
    Wasted*

Maybe you are looking for

  • Help Needed in GUI. Please Read!!

    Hey, i am doing a element iterator and atrribute extraction from a XML script. However, I am not able to display the results on a GUI as the results from the abstractions are done in a while loop. Could you advice on how to display the extracted data

  • Oracle 8i: Business Days Calculation in a Subquery

    To Whom It May Concern: I apologize if this has been posted already, but I didn't find any threads that address my issue: I need to find the number of business days between 2 dates (excludes weekends) provided by dates from an outer query such as the

  • Output is not going to Printer Directly for XML (PDF) Output

    Hi, I am trying to print the AP Check Advice output directly to printer,using FND_REQUEST.set_print_options before submission of concurrent request. This was working perfectly,when report was RDF(with PDF) output. I changed it as XML with PDF output.

  • Flash Builder 4 with Flex SDK 4.0 for Intel App Up

    There is some misinformation on Intel AppUp and the Melrose FAQ about being able to publish with Flash Builder 4. Intel App Up Program Submission According to http://appdeveloper.intel.com/en-us/article/adobe-air-packaging-guide-atom-developer-progr

  • Pages for os x 10.6.8

    I tried to install pages but message said it was not availible for my os x ? How do i overcome this? thanks!