Accessing GUI Components in SingleFrameApplication

Hi. I started a new project w/ Netbeans and use the "Desktop Application" template. I can get the program to run and have it open a file chooser in response to a button click on the main frame panel (the file chooser is a separate form). I can access, open and read from the file chosen from another class, "processFile.java", that I want to process the open file.
What I want is for this "processFile" class is to load some jTextFields in the main panel w/ strings parsed form the open file. The issue is I can't figure out how to access the text fields from this "processFile" class -- I don't see the instance handle to the frame that contains them. Any help or thoughts will be greatly appreciated.
--- Mike

You'd better do it the other way round: your UI class should invoke the business logic class processFile, and this latter should just return the result of processing the file (as an array, List, Map, or as a custom result class). Then the UI class can use those results to populate the textfield.
This is much better practice than exposing those textfields to another class (think encapsulation).

Similar Messages

  • Accessing XI Components from SAP GUI

    hi folks,
    I was just wordering, can we Access XI Components(IR, ID, SLD..etc) from with in SAP GUI ,i.e. is there any transaction used to see XI components and can we build the Application from with in it...!!
    help and Suggestions wud be appreciated.
    Thanks
    Jeet.

    Hi,
    Refer to following weblog for quick transactions.
    /people/morten.wittrock/blog/2006/03/23/getting-started-with-xi-part-1-xi-30-cheat-sheet
    Thanks,
    Prateek

  • GUI components not clearing from JDialog closing

    Greetings,
    I have developed an application which works on several different computers with several different JVMs, but which does not operate as anticipated on my (new) tablet PC. It leaves GUI components on the main JFrame from various Jdialog boxes (after closing them) that I throw at the user when the program starts.
    I also have a username/password prompt at the beginning which is another JFrame that doesn't appear correctly. The input areas do not appear with a white background and the Username and Password JLabels have echoed themselves into that area.
    I'm guessing this is Windows XP, Tablet Edition issue. I'd like to know if anyone else has experienced anything similar?
    FYI, this programs works quite well on Windows 98, Windows XP Home and Professtional, Windows 2000, and Windows ME.
    Any help would be most appreciated.
    Regards

    Hi all,
    I am trying to develop a Java application on the Tablet PC. I am new to this platform and could not find much information about Java related Tablet PC development .So I am posting this question here
    Details
    I have developed a Swing Application in Java (J2SDK 1.4.2) for a Client, which currently runs on Windows XP on the Standard Laptop. The application uses the following
    1) Menus
    2) Panels
    3) Dialogs
    It consists of an entry form, which is saved as an XML file on the user's computer. Also it uses an Access Database.
    The other thing that the application uses is a Signature Capture Device to capture a user's signature
    I would like to move this application to the Tablet PC.
    I have the following questions
    1) What SDK do I use for the Tablet PC? Also what version of Java web start and Run time?
    2) What kind of changes do I need to make in my application?
    3) Can I make use of the "Ink" feature, which is provided with a Tablet PC in Java?
    4) Where can I find user samples if any for Java Tablet PC development?
    BTW I am using Toshiba Prot�g� 3500 for my project.
    Thanks,
    Raja

  • GUI Components on WEB

    How to create GUI Components that can be used on WEB(Servlet,JSP) without using Applet?

    Well, there are GUI components in HTML (namely form elements).
    Or you could write a standalone java app (not in a browser) that accesses a web server and any servlets or JSP there.
    Don't know if that's what you want.

  • Event handling in custom Non-GUI components

    I have a class which needs to fire events to outside. These events maybe captured by several objects in outside world. How can I achieve this? In so many places I read, they always refer to AWT and Swing whereas my objects don't have any dependency to GUI.
    I simply need to fire an event from an object, and capture that event from other objects by registering event handlers.
    I have experience in .Net programming with Events and Delegates (function pointers), but cannot find something like that in Java. All it offers is various kinds of GUI related Listeners where I can't find a proper help resource using them in Non-GUI components.

    ravinsp wrote:
    I have a class which needs to fire events to outside. These events maybe captured by several objects in outside world. How can I achieve this? In so many places I read, they always refer to AWT and Swing whereas my objects don't have any dependency to GUI.
    I simply need to fire an event from an object, and capture that event from other objects by registering event handlers.
    I have experience in .Net programming with Events and Delegates (function pointers), but cannot find something like that in Java. All it offers is various kinds of GUI related Listeners where I can't find a proper help resource using them in Non-GUI components.If you want to make your own Listener make your Listener. Create an event class that encapsulates the event as you want, create a listener interface that has a method like handleMyEvent(MyEvent me) and then add addMyEventListener, removeMyEventListener methods to your original class. Add a List<MyEvent> to your original class and add the listeners to it and then when events happen
    MyEvent someEvent = new MyEvent();
    for(MyEventListener mel : eventlisteners)
       mel.handleMyEvent(someEvent);

  • SAPgui.exe is running even after closing the GUI components

    Hello All,
    Even after closing the SAP GUI components like Bex, WAD or RSA1 etc... i am able to see these processes are running under the Task Manager--> Processes....
    even if i try to restart the system, error messages are occuring...saying that SAP is still opend...
    Why it is happening, any ideas?
    Thanks,
    Ravi

    Hi Dirk,
    Thanks for your infomation. Infact, apart from this problem, i have the problem with saving the webtemplate. As it is taking much time to save a template after modifications, i had to terminate the wad process. It seems above 2 problems are related....any ideas?
    Thanks
    ravi
    Message was edited by: Ravi Pasumarty

  • Customer gui components needed?

    I require to build a program with which allows the user to add representations of objects onto the main GUI by adding a seperate square for each object. each square should be capable of being moved, resized, deleted as well as have text displayed in it, and another object associated with it (but I'm currently just dealing with the GUI side of things). Each square will also need to be connected to others by means of an arrow from one square to another. Any suggestions as to where to start as there does not seem to be any appropriate widgets provided by java for this and I am having trouble finding stuff on the net about it. Will creating my own custom GUI components be the best option? If so any tips on how to do this?
    Regards

    Hello Ravi,
    Create a Variable for 0CALMONTH, and use this code,
    ' Declare this in the top
    data : v_startmon(6) type n,
    v_endmon(6) type n,
    ' Include this in the case statement
    when 'VarName'.
    ' Step 2 will execute after the user Input
    if i_step = 2.
    v_year = sy-datum(4).
    v_mon = sy-datum+4(2) - 1.
    ' If the month is Jan
    IF v_mon = '00'.
    CONCATENATE v_year '01' INTO v_startmon.
    CONCATENATE v_year '01' INTO v_endmon.
    ELSE.
    CONCATENATE v_year '01' INTO v_startmon.
    CONCATENATE v_year v_mon INTO v_endmon.
    EndIF.
    clear l_s_range.
    l_s_range-low = v_startmon.
    l_s_range-high = v_endmon.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    append l_s_range to e_t_range.
    Endif.
    Please see this for
    [User Exits in SAP BW|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/23f2f094-0501-0010-b29b-c5605dbdaa45]
    [User Exit Examples|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6378ef94-0501-0010-19a5-972687ddc9ef]
    Also see this
    [Dependencies for Variables of Type Customer Exit |http://help.sap.com/saphelp_nw04/helpdata/en/1d/ca10d858c2e949ba4a152c44f8128a/content.htm]
    Thanks
    Chandran
    Edited by: Chandran Ganesan on Mar 17, 2008 1:57 PM

  • Unique GUI Components

    How do I go about creating my own Unique GUI Components.
    For instance I would like to create a volume knob, that turns clockwise and couterclockwise.
    Best regards,

    Start off with extending JComponent, add methods for turning the knob, and have paintComponent show the turning knob. Add methods to be able to add listeners that you want. That should get you started.

  • Clearing GUI components displayed in a JFrame window

    Hi Programmers and Developers,
    Good day to y'all!
    My application displays a number of GUI components on the screen. I intend to design a JButton that can clear the window of all these GUI components when it is clicked. Is there a method that can erase already displayed GUI's or is their a technique i can implement to achieve this??
    Many Thanks and Merry Xmas!

    You clear components the in much the same way that you added them
    See Container.remove(Component)
    You will of course want to call validate(); repaint() after removing a component.
    Make a small dummy app to test this out.
    You might also want to look at tjacobs.ui.util.ComponentMapper (which you can find in TUS). It may make finding the components you want to remove easier

  • Flyweight Pattern use with multiple GUI components

    Hi,
    I am creating a simple application and I would like your advice on wether I should use the flyweight pattern or not.
    My application is essentially a GUI front to a repository of small images. The GUI (in its simplest form) is a single window that will display all the images with their names in a clickable thumbnail format. The user will be able to select an thumbnail icon, drag it and move it around pretty much like the icons on your computer desktop.
    The easiest way to do that is probably to load each image and its name into a JLabel, add it in a JFrame and write just few lines of code (say by extending the JLabel class) to handle mouse pressed/dragged events in order to move the label around. The rest will be taken care of by the swing functinality (e.g. painting etc).
    However, I am considering using the flyweight pattern for efficiency but I am not sure if it is appropriate. So far I have seen simplistic examples of its use (apart from JTree) where the pattern is used to paint dozens of lines on the screen or the borders of components. But what happens if instead of lines or borders the objects in question are interactive GUI components such as my thumbnails? how does the flyweight pattern work in this case?
    For example if I create just a single JLabel and use it to paint all my icons that's great! but what happens with mouse events? what happens when I want to drag a thumbnail over another one and how the partial repainting of the thumbnail below should be handled?
    Am I missing something here, or in order to implement the flyiweight pattern in this case I will have to write endless lines of code to replicate the functionality that swing arleady provides in each JComponent? (e.g. targetting of mouse events, repainting etc)
    Cheers,
    Kyri

    I don't think Flyweight applies, because you really don't want to share any UI component that generates events unless the response is the same for all of them.
    If you read Flyweight, I think it was intended for things like caching the first 128 Integers, etc. - think finite, countable, immutable things. I don't think UI elements apply.
    %

  • Save GUI components in a XML format

    I am looking for a technoology that can help to create a my own file format using java. That mean currently im working with implementing a mind mapping tool (like mindjet) which will help to do basic mind mapping actions like add, edit, delete topics.
    But I have faced for a ig problem when im saving a created map. because it should save as a new file format and should be able to re-open for editing.
    What I planned is to retrive the GUI component's(elements of the map) properties from the map and write those values to the XML file(using XML DOM or SAX). Then read those saved values and create the GUI components under retrieved data.
    what I want to know is that. Is my approach is correct? or is there any better solution for this matter?
    please clarify me and I would really appreciate your help?
    Regards
    Lakshitha Ranasinghe

    You presumably have some state, in memory, that you want to persist. From your post, though I must confess that the terms you use are not really clear in terms of what type of data you actually want to say, my guess is that you have some graph of objects in memory that you have parsed that you want to serialize and persist and then later deserialize and restore for reuse in a subsequent execution of your program.
    If yes, then your goal is really simple: how do I save the state of my application and then restore it?
    Go to the filesystem: store as a properties file (key-value pairs), Java's default serialization, XML or a totally custom format
    Go do the database: map your object to a proper database table and column (via JDBC or an O/R mapper ala Hibernate), or store what you would have stored in the filesystem in a databaseXML is a valid option. So is a simple properties file. It depends on your requirements. If you are reading from and writing to a Java application, and frequent versioning is not an issue, then Java's default serialization could be a possibility. Going to the database would be the 'enterprise' solution, but requires testing and the successful functioning and communication between two technologies and machines. It depends on your requirements.
    - Saish

  • [SOLVED] Slow Desktop GUI components

    Arch Linux 64
    i5 -2500k  / 8GB Ram /  Nvidia with the closed source drivers
    OpenBox
    LXPanel
    compton-git (from AUR)
    I am running into a strange recurring problem for some time now.
    Even though running and launching applications is fast, various GUI components of individual apps are lagging.
    For example moving through the preferences tabs of Pidgin, or preferences tabs of firefox, or changing between open tabs in Firefox( does not happen in Chrome) or generally using the GUI dialogs of certain applications might take 2-3 seconds from the time I clicked to the gui component to the time the change occurs (for example changing from one preference tab to another).
    I do not have any performance issues generally in the system, except those gui components that are painfully slow.
    Things i have tried so far:
    -Initially i thought it was only manifesting in firefox so I reseted the profile but that did not improve the situation.
    -I thought it might have to do with GTK so I deleted the .gtk-bookmarks from home dir (in order to be recreated) but that did not improve the situation. I still believe it might have something to do with GTK.
    any suggestions are greatly appreciated.
    Last edited by mastorak (2014-05-19 19:56:16)

    After more experimentation I am now fairly certain that the issue is caused by compton.
    I looked into the bugs reported for compton and apparently there are some issues caused by it when used with the nvidia driver having set the backend option to "glx".
    With the following compton config it seems to be working correctly with no slowness.
    backend = "xr_glx_hybrid"
    vsync = "opengl-swc"
    glx-no-rebind-pixmap = true
    glx-no-stencil = true
    paint-on-overlay = true
    unredir-if-possible = true
    Note that the backend "xr_glx_hybrid" config option is only available(for now) from the "compton-git" package and not "compton" package.
    I do not mark it yet as "Solved" as I want to use it for sometime to be certain.
    edit:for syntax errors
    Last edited by mastorak (2014-05-19 08:38:28)

  • Adding custom GUI components to a panel

    <sorry about the 'Hello All' subject in the previous post>
    I am creating a Backgammon game for my JAVA programming class. I would like to design a board and have certain checker pieces that can be dragged around on the board. In the course I am taking, I still have not been able to understand how a GUI interface has GUI components that is "custom built" like my checker class. My checker class below draws a picture of a checker on a JPanel. I want it to exist inside a JPanel(that has a board painted in it) with 30 checkers that can be moved around. Any feedback would be appreciated including helpful packages, classes, trails, etc.
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.util.Random;
    import javax.swing.JPanel;
    import java.awt.BasicStroke;
    // Checker.java - This will draw the checkers used in the game
    public class Checker extends JPanel
    private Color checker_color; // color of checker
    private int abs_pos;
    private int player; // player 1 or player 2
    Checker(Color check_color, int pos, int plyr)
         checker_color = check_color;
         abs_pos = pos;
         player = plyr;
    public void paintComponent(Graphics g)
         super.paintComponent(g);
         Graphics2D g2d = (Graphics2D) g; // cast g to Graphics2D
         this.setBackground(Color.WHITE);
         // make a circle
         g2d.setColor(checker_color);
         g2d.setStroke(new BasicStroke(1.0f));
         g2d.fillOval(47,47, 35, 35);
         g2d.setColor(Color.BLACK);
         g2d.setStroke(new BasicStroke(2.0f));
         g2d.drawOval(47, 47, 35, 35);
    public int getPlayer(){
         return player;
    public Color getCheckerColor(){
         return checker_color;
    public int getPosition(){
         return abs_pos;
    public void setPosition(int pos){
         abs_pos = pos;
    }

    Um... pretty much the way you are doing it in the code you already posted. What is the problem? Not that there's not problems....
    1) setBackground called in paintComponent doesn't do much. Just set the background outside paint and super.paintComponent() will fill the BG color if the component isn't opaque.
    2) a checker, I would expect, would be opaque, actually.
    3) the oval size you draw would probably be better off being based on the size of the component (getSize()) instead, that way it scales easily.
    But other then that, you are doing it right. You probably need to set the size and location of each checker object explicitly, since most likely it's being used in a container with a null layout.

  • Change in Access Control components on the Service Marketplace

    Hello GRC community:
    We would like to inform you that as of yesterday (5/30) the Access Control components for support messages/SAP Notes have been changed (they have actually been replaced so all messages/notes logged under the old component will be moved/replaced to the new).
    The main 4 components are now:
    New: GRC-SAC-ARA     Access Risk Management
    Old: GRC-SAC-SCC          Risk Analysis & Remediation (formerly Compliance Calibrator) 
    New: GRC-SAC-ARQ     Access Request
    Old: GRC-SAC-SAE          Compliant User Provisoning (formerly  Virsa Access Enforcer) 
    New: GRC-SAC-EAM     Emergency Access Management
    Old: GRC-SAC-SFF          Superuser Privilege Management (formerly Virsa Firefighter) 
    New: GRC-SAC-BRM     Business Role Management
    Old: GRC-SAC-SRE          Enterprise Role Management (formerly Virsa Role Expert)
    There are also NEW components specific to areas of functionality. If you are not sure of what component to log your message under, please use the main components above.
    GRC-SAC-ADS          Directory Services
    GRC-SAC-BI             Access Control BW
    GRC-SAC-CONF       Configuration
    GRC-SAC-DAS          Dashboard
    GRC-SAC-REP          Repository
    GRC-SAC-RPT          Reporting
    GRC-SAC-UAR          User Access Review
    GRC-SAC-UPG          Installation & Upgrade
    GRC-SAC-WF           Workflow
    Ramelyn Paredes
    AGS Primary Support

    Hello COmmunity,
    To Summarise in Short: New features introduced to V10.0 : GRC 10.0 is ABAP based, so extraction of data from users is fast & analysis as well.
    As usual, the names for the Access control tool has been changed
    A. Access Risk Analysis (RAR)
    1. USOBT & object information will be automatically updated with GRC rather than manual upload (earlier version)
    2. Mass Users can be imported from .CSV file for risk analysis, Role analysis etc.,
    3. Variant creation / reuse for any report analysis
    4. Option of having multiple rule sets & simulating users across multiple rule sets at same time
    5. Risk analysis for CUA, Composite roles
    6. Mitigation by system, risk id, mass mitigation for users, audit trail etc.,
    7. Risk analysis for HR objects
    B. Emergency Access Management (SPM)
    1. Mass reporting for all FF users, Ids, Executions
    2. Centrally maintained for all systems rather than individual ERPs.
    C. User Access Management (CUP)
    1. Customizable Access request forms
    2. HR based role assignment for position, org unit
    3. IDM integration using GRC Web services
    D. Business Role Management (ERM)
    1. Concept of Business role mapping for Technical roles.
    2. Audit Trails & PFCG Change history.
    Finally, the look, reporting format has been changed to provide additional information for analysis.
    More important - GRC V5.3 support is till 2015 & SAP has planned to push the customers to upgrade to 10.0. Eventually SAP is also planning to release GRC 11.0 by mid next year. So we have to wait & watch the show

  • Positioning of GUI components

    a question for the java veterans out there,
    i am a student of programming and i wish to learn how to place/position GUI components in java by hard coding it. Is there any trick/technique that this could be done easily? I don't want to rely on netbeans's GUI maker to make my programs's GUI for the rest of my life.
    any help is appreciated.
    (please don't make it quite complicated. ^_^)

    Hi,
    The link to the tutorial you requested is [Laying out Components within a Container|http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html], more specific [Doing Without a Layout Manager (Absolute Positioning)|http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html]. But I would suggest you start to learn using the default layout managers first before you venture out into the wild lands named 'absolute positioning'. The layout mangers supplied by Sun (and made by a big bunch of seasoned Sun Java Programmers) help you when something happens in your screen, like resizing the window. If you use absolute positioning you have to handle such cases yourself.
    Abel

Maybe you are looking for

  • A better way to Re-Order the Sort in Pivot view ?

    Hello, Question first- Is there a better way to do this? Background- Have a simple pivot table w/ requirements to put the Status column in order that makes sense to the business not alphabetical. Example, # of Service Req with Status needs to be list

  • I can't open my psd

    i have trouble when i'm opening my psd file Error "could not complete your request because it is not a valid Photoshop document." the trouble is happen after i save and shutdown the computer i work 2 days in these psd i m using Photoshop cs 5 .

  • Couldn't open Lightroom trying to remove it from a Mac

    I have made a big mistake apparently and could use some help. I tried to open Lightroom on my Mac and nothing happened. Thinking I had changed some setting and being new to the Mac I thought I would delete and reinstall Lightroom. No such luck. I mov

  • Issues with AppleTV/iTunes sync since Lion upgrade

    I am not sure if this realted to Lion, however sometime after the time of ky recent upgrade itunes started only recognizing some of my Aperture library to sync.  I have about 10k images in Aperture and iTunes is only showing about 2,900 photos availa

  • ChoiceBoxBuilder. String create() is error. How to fix?

    Hello everyone ChoiceBox<String> choiceBox = ChoiceBoxBuilder.<String>create() .items( FXCollections.observableArrayList("New", "Open", "Save", "Exit") ) .build(); The method create() is ambiguous for the type ChoiceBoxBuilder at Java8. It is OK at J