Using UML while designing Object oriented design in ABAP

Hi,
Is it a general practice in projects to use UML diagrams when you do OO design for a report in ABAP ? Or do people start writing th OO code directly ?
Reards,
Rajesh

Hi Rajesh,
In my particular case, I use to start writing the code directly after I read and check the documentation. Right now i'm starting to looking around in order to get more experience in OO programming.
I think that UML is the best option right now, also SAP recommends it. They worked with Rational Software in order to provide an external modeling tool to supports SAP's class.
Check this link in order to get more information.
<a href="http://www.sapinsideronline.com/archive/volume_03_(2002)/issue_03_(july-september)/v3i3a11.cfm?session=&promo=iz1321">http://www.sapinsideronline.com/archive/volume_03_(2002)/issue_03_(july-september)/v3i3a11.cfm?session=&promo=iz1321</a>
Regards,
Eric

Similar Messages

  • Exception Handling in Object Oriented Design

    I am developing a huge web based project using Object Oriented design and java,srvlets ,jsp etc ,I am using 3-tier archtecture.I dont understand,how i should handle exceptions in my project.ie.If there is some exception in the base modules how should it be handled.What kind of excpetion Structure should i use,How many exception classes should be made etc,
    Can someone help me in this regard

    A couple things I have found to be good practices for exception handling in an n-tier architecture:
    1. Don't expose all the internal exceptions of a tier to the client of the tier. Create a more useful, descriptive set of exceptions (or use the appropriate predefined exceptions) to throw up to the client.
    For example, on one project, we are doing database access among other things in the "service" tier, which is accessed by the web tier. We catch the SQLExceptions, PersistenceExceptions (a custom exception), and others, and throw a more useful exception that the client will know how to handle such as a NoMeasurementResultsException if the client asks for measurement results when we have none.
    2. Chain your exceptions and/or log the root cause in the tier that re-throws a different exception. There is nothing more aggravating than not knowing why, when you are debugging a problem, you are getting a NoMeasurementResultsException when you know that there ARE results in the database.
    Hope these ideas help in your design.
    Cheers,
    Colin

  • Good book on Object Oriented Design?

    Can you recommend a good book on Object Oriented Design with lots of practical examples? I already have:
    http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612/ref=sr_1_1?ie=UTF8&qid=1238324375&sr=8-1
    But currently I need a book with a more basic approach.

    corlettk wrote:
    I like Thinking In Java... Also: google for "yawmark's list"TIJ is useless, especially for teaching OO design. It teaches (or tries to) Java as a procedural language.

  • Notes on using Object  oriented concept in ABAP

    Hi ,
    I want somes notes on how to use Object  oriented concept in ABAP.
    Thanks in advance.
    Chetan

    Hi, this may help you
    OOPs ABAP uses Classes and Interfaces which uses Methods and events.
    If you have Java skills it is advantage for you.
    There are Local classes as well as Global Classes.
    Local classes we can work in SE38 straight away.
    But mostly it is better to use the Global classes.
    Global Classes or Interfaces are to be created in SE24.
    SAP already given some predefined classes and Interfaces.
    This OOPS concepts very useful for writing BADI's also.
    So first create a class in SE 24.
    Define attributes, Methods for that class.
    Define parameters for that Method.
    You can define event handlers also to handle the messages.
    After creation in each method write the code.
    Methods are similar to ABAP PERFORM -FORM statements.
    After the creation of CLass and methods come to SE38 and create the program.
    In the program create a object type ref to that class and with the help of that Object call the methods of that Class and display the data.
    Example:
    REPORT sapmz_hf_alv_grid .
    Type pool for icons - used in the toolbar
    TYPE-POOLS: icon.
    TABLES: zsflight.
    To allow the declaration of o_event_receiver before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    G L O B A L I N T E R N A L T A B L E S
    *DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
    To include a traffic light and/or color a line the structure of the
    table must include fields for the traffic light and/or the color
    TYPES: BEGIN OF st_sflight.
    INCLUDE STRUCTURE zsflight.
    Field for traffic light
    TYPES: traffic_light TYPE c.
    Field for line color
    types: line_color(4) type c.
    TYPES: END OF st_sflight.
    TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
    DATA: gi_sflight TYPE tt_sflight.
    G L O B A L D A T A
    DATA: ok_code LIKE sy-ucomm,
    Work area for internal table
    g_wa_sflight TYPE st_sflight,
    ALV control: Layout structure
    gs_layout TYPE lvc_s_layo.
    Declare reference variables to the ALV grid and the container
    DATA:
    go_grid TYPE REF TO cl_gui_alv_grid,
    go_custom_container TYPE REF TO cl_gui_custom_container,
    o_event_receiver TYPE REF TO lcl_event_receiver.
    DATA:
    Work area for screen 200
    g_screen200 LIKE zsflight.
    Data for storing information about selected rows in the grid
    DATA:
    Internal table
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    C L A S S E S
    CLASS lcl_event_receiver DEFINITION.
    PUBLIC SECTION.
    METHODS:
    handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
    IMPORTING
    e_object e_interactive,
    handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
    IMPORTING e_ucomm.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    METHOD handle_toolbar.
    Event handler method for event toolbar.
    CONSTANTS:
    Constants for button type
    c_button_normal TYPE i VALUE 0,
    c_menu_and_default_button TYPE i VALUE 1,
    c_menu TYPE i VALUE 2,
    c_separator TYPE i VALUE 3,
    c_radio_button TYPE i VALUE 4,
    c_checkbox TYPE i VALUE 5,
    c_menu_entry TYPE i VALUE 6.
    DATA:
    ls_toolbar TYPE stb_button.
    Append seperator to the normal toolbar
    CLEAR ls_toolbar.
    MOVE c_separator TO ls_toolbar-butn_type..
    APPEND ls_toolbar TO e_object->mt_toolbar.
    Append a new button that to the toolbar. Use E_OBJECT of
    event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
    This class has one attribute MT_TOOLBAR which is of table type
    TTB_BUTTON. The structure is STB_BUTTON
    CLEAR ls_toolbar.
    MOVE 'CHANGE' TO ls_toolbar-function.
    MOVE icon_change TO ls_toolbar-icon.
    MOVE 'Change flight' TO ls_toolbar-quickinfo.
    MOVE 'Change' TO ls_toolbar-text.
    MOVE ' ' TO ls_toolbar-disabled.
    APPEND ls_toolbar TO e_object->mt_toolbar.
    ENDMETHOD.
    METHOD handle_user_command.
    Handle own functions defined in the toolbar
    CASE e_ucomm.
    WHEN 'CHANGE'.
    PERFORM change_flight.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMETHOD.
    ENDCLASS.
    S T A R T - O F - S E L E C T I O N.
    START-OF-SELECTION.
    SET SCREEN '100'.
    *& Module USER_COMMAND_0100 INPUT
    MODULE user_command_0100 INPUT.
    CASE ok_code.
    WHEN 'EXIT'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Module STATUS_0100 OUTPUT
    MODULE status_0100 OUTPUT.
    DATA:
    For parameter IS_VARIANT that is sued to set up options for storing
    the grid layout as a variant in method set_table_for_first_display
    l_layout TYPE disvariant,
    Utillity field
    l_lines TYPE i.
    After returning from screen 200 the line that was selected before
    going to screen 200, should be selected again. The table gi_index_rows
    was the output table from the GET_SELECTED_ROWS method in form
    CHANGE_FLIGHT
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines > 0.
    CALL METHOD go_grid->set_selected_rows
    EXPORTING
    it_index_rows = gi_index_rows.
    CALL METHOD cl_gui_cfw=>flush.
    REFRESH gi_index_rows.
    ENDIF.
    Read data and create objects
    IF go_custom_container IS INITIAL.
    Read data from datbase table
    PERFORM get_data.
    Create objects for container and ALV grid
    CREATE OBJECT go_custom_container
    EXPORTING container_name = 'ALV_CONTAINER'.
    CREATE OBJECT go_grid
    EXPORTING
    i_parent = go_custom_container.
    Create object for event_receiver class
    and set handlers
    CREATE OBJECT o_event_receiver.
    SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
    SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
    Layout (Variant) for ALV grid
    l_layout-report = sy-repid. "Layout fo report
    Setup the grid layout using a variable of structure lvc_s_layo
    Set grid title
    gs_layout-grid_title = 'Flights'.
    Selection mode - Single row without buttons
    (This is the default mode
    gs_layout-sel_mode = 'B'.
    Name of the exception field (Traffic light field) and the color
    field + set the exception and color field of the table
    gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
    gs_layout-info_fname = 'LINE_COLOR'.
    LOOP AT gi_sflight INTO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    Value of traffic light field
    g_wa_sflight-traffic_light = '1'.
    Value of color field:
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    ENDIF.
    MODIFY gi_sflight FROM g_wa_sflight.
    ENDLOOP.
    Grid setup for first display
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING i_structure_name = 'SFLIGHT'
    is_variant = l_layout
    i_save = 'A'
    is_layout = gs_layout
    CHANGING it_outtab = gi_sflight.
    *-- End of grid setup -
    Raise event toolbar to show the modified toolbar
    CALL METHOD go_grid->set_toolbar_interactive.
    Set focus to the grid. This is not necessary in this
    example as there is only one control on the screen
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
    ENDIF.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0200 INPUT
    MODULE user_command_0200 INPUT.
    CASE ok_code.
    WHEN 'EXIT200'.
    LEAVE TO SCREEN 100.
    WHEN'SAVE'.
    PERFORM save_changes.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    *& Form get_data
    FORM get_data.
    Read data from table SFLIGHT
    SELECT *
    FROM zsflight
    INTO TABLE gi_sflight.
    ENDFORM. " load_data_into_grid
    *& Form change_flight
    Reads the contents of the selected row in the grid, ans transfers
    the data to screen 200, where it can be changed and saved.
    FORM change_flight.
    DATA:l_lines TYPE i.
    REFRESH gi_index_rows.
    CLEAR g_selected_row.
    Read index of selected rows
    CALL METHOD go_grid->get_selected_rows
    IMPORTING
    et_index_rows = gi_index_rows.
    Check if any row are selected at all. If not
    table gi_index_rows will be empty
    DESCRIBE TABLE gi_index_rows LINES l_lines.
    IF l_lines = 0.
    CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
    EXPORTING
    textline1 = 'You must choose a line'.
    EXIT.
    ENDIF.
    Read indexes of selected rows. In this example only one
    row can be selected as we are using gs_layout-sel_mode = 'B',
    so it is only ncessary to read the first entry in
    table gi_index_rows
    LOOP AT gi_index_rows INTO g_selected_row.
    IF sy-tabix = 1.
    READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
    ENDIF.
    ENDLOOP.
    Transfer data from the selected row to screenm 200 and show
    screen 200
    CLEAR g_screen200.
    MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
    LEAVE TO SCREEN '200'.
    ENDFORM. " change_flight
    *& Form save_changes
    Changes made in screen 200 are written to the datbase table
    zsflight, and to the grid table gi_sflight, and the grid is
    updated with method refresh_table_display to display the changes
    FORM save_changes.
    DATA: l_traffic_light TYPE c.
    Update traffic light field
    Update database table
    MODIFY zsflight FROM g_screen200.
    Update grid table , traffic light field and color field.
    Note that it is necessary to use structure g_wa_sflight
    for the update, as the screen structure does not have a
    traffic light field
    MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
    IF g_wa_sflight-paymentsum < 100000.
    g_wa_sflight-traffic_light = '1'.
    C = Color, 6=Color 1=Intesified on, 0: Inverse display off
    g_wa_sflight-line_color = 'C610'.
    ELSEIF g_wa_sflight-paymentsum => 100000 AND
    g_wa_sflight-paymentsum < 1000000.
    g_wa_sflight-traffic_light = '2'.
    clear g_wa_sflight-line_color.
    ELSE.
    g_wa_sflight-traffic_light = '3'.
    clear g_wa_sflight-line_color.
    ENDIF.
    MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
    Refresh grid
    CALL METHOD go_grid->refresh_table_display.
    CALL METHOD cl_gui_cfw=>flush.
    LEAVE TO SCREEN '100'.
    ENDFORM. " save_changes
    chk this blog
    /people/vijaybabu.dudla/blog/2006/07/21/topofpage-in-alv-using-clguialvgrid
    Reward if helpfull.
    Regards Madhu.

  • Who has the book:Object-Oriented Programming with ABAP Objects

    Hello everyone
    Now i want to learn ABAP OO,and Lots' of guys told me that the book  Object-Oriented Programming with ABAP Objects is realy a good book.but i searched on the net,and could not got PDF of this book,could some one gave me the net address if you know where to download the book or send me to my Mailbox:<email id removed by moderator>,I will very glad to receive any response from you,
    of course,if you have some advise on how to learn ABAP OO or some other material ,hope you could share your meaning with me, hope to receive your response.
    Best regards!
    From Carl
    Moderator message : Moved to career center.
    Edited by: Vinod Kumar on Aug 27, 2011 9:21 AM

    I'm sure you're not asking for illegal, "free" downloads. You can legally purchase the book, also in electronic format, at sap-press.com
    Thomas

  • Material for Object Oriented Concepts in ABAP

    Hi,
          Please provide me the material for Object Oriented Concepts in ABAP.

    Hi
    Please check this link, may be helpful
    http://www.sap-img.com/ab029.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    regards
    Srinivas

  • Question about Object Oriented Design in Oracle

    Hi everyone,
    Right now I'm updating my oracle skills, years ago without programming (last time with Oracle 7.3 :O)
    Well, if I have to design a new system with this features:
    1.- Using Oracle as DB
    2.- Web enable
    3.- OO Design
    My questions:
    1.- What is the best practice to make database design? E-R + Object Types? I mean is better making the design on Oracle directly or in Java-UML environment?
    2.- I was thinking in programming with Forms, but it works well with OO design?
    3.- If I want to program some web services based, Could I do it with PL/SQL and Jdeveloper?
    please if you know about articles and whitepapers about OO design approach with Oracle let me know!
    Thanks.

    I have been involved in some of these projects that have used Java, C#, VB, C++ etc. as front-end languagaes. I have been able to implement these projects successfully using the following approach:
    1. create a relational model of the database - third-normal form (assuming it is an OLTP application)
    2. Write PL/SQL code (packages and procedures mainly)
    3. Interact with the front-end layer by sending and receiving ref curosors and/or PL/SQL tables
    If you want to use Forms (I am assuming Oracle Forms) then there may not be much need for an OO design. Embeeding SQL in the forms will do most of what you want.
    Shakti
    http://www.impact-sol.com
    Developers of Guggi Oracle - Tool for DBAs and Developers

  • Backing Beans Object Oriented Design

    Hello,
    Are there any best practices for using Backing Beans?
    How to make managed beans thread-safe for concurrent requests,
    without compromising on efficiency/speed?
    2. How to enforce the J2EE security with backing-beans?
    3. How to decide the scope of these beans to ensure minimal data-storage
    in session?
    4. How to decide the granularity at which a managed-bean should be used
    for example :
    4.1 One bean-per-component
    4.2 One bean-per-form
    4.3 One bean-per-page
    Also i would like to know how to design managed beans from reusability perspective.
    Regards,
    Smita

    It quite hard to give a brief answer on all your questions.
    I think that you should take into account bean's scope when think about thread safety.
    Request scope bean is single threaded while for session scope you should provide locking mechanism because this bean can be accessed from different threads but only in case when one user simultaneously submit request from multiply browser windows.
    As for security you can use standard security API from within bean through javax.faces.context.ExternalContext
    It is convenient to use one backing bean for some or all components in web form.
    Do not mix form component and business data in one bean. Thus it is good design to have one set of beans for presentation logic and another one for business logic.

  • Theoretical object oriented design question

    Hi,
    I am just getting into the design of some software that will take either one or two numbers and perform identical operations on them. It will then create a label that will be different depending on whether 1 or 2 serial numbers are used.
    In the example it looks like I could make a vehicle class that would contain the serial number, and child classes for car, truck and boat that would define how the sticker was laid out.
    The trouble I am having is that the control for serial number 1 and serial number 2 need to accept any of the three numbers for car truck and boat.
    So I am not sure how to build classes to cover this, and what design pattern would be best.
    So I am looking for ideas.
    I have no real code yet to post, and a lot of the attributes are confidential, which is why I made the simple diagram.

    Search this site for...
    Factory Pattern
    It basiclly uses a case sctructure to to select a Class constant of the proper type.
    Have fun!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Object oriented design problem concerning abstract classes and interfaces

    I have an abstract class (class A) that takes care of database connections. It cannot be made into an interface as other classes extend it and all these other classes require the functionality in the methods it has (i.e. I cannot make all the methods abstract and then make this class an interface).
    I have a class that contains data (Customer class) that I will create from the data I extract from the database. This class will also be created by the User and submitted to the database portion of the program. The Customer class has functionality in its methods which is required by the rest of the program (i.e. I cannot make all the methods abstract and then make this class an interface).
    I have a factory class (CustomerFactory) that extends the Customer class. This has been created to restrict access to the creation and manipulation of Customers.
    I have a class (DatabaseQuery) that extends class A. But now that I have retrieved all of the information that comprises a Customer from the database, I cannot construct a Customer without making reference to UserFactory. But UserFactory is a class that I don't want the database portion of the program to know about.
    What I would like to do is have my DatabaseQuery class extend both Customer class and A class. But they are both classes and Java won't allow that.
    I can't make either of the two classes that I want to make parents of DatabaseQuery into interfaces... so what can I do other than just keep a reference to UserFactory in my DatabaseQuery class?
    Thanks,
    Tim

    >
    What I would like to do is have my DatabaseQuery class
    extend both Customer class and A class. But they are
    both classes and Java won't allow that.
    I can't make either of the two classes that I want to
    make parents of DatabaseQuery into interfaces... so
    what can I do other than just keep a reference to
    UserFactory in my DatabaseQuery class?Just a guess...
    The description sounds a little vague but it sounds like the correct solution would be to refactor everything. The first clue is when I see "database connection" as an "abstract class". The only hierarchy that a database connection might exist in is in a connection pool and even that is probably shaky. It should never be part of data records, which is what your description sounds like.
    That probably isn't what you want to hear.
    The other solution, which is why refactoring is better (and which also makes it apparent why the original design is wrong) is to create an entire other hierarchy that mirrors your current data hierarchy and wraps it. So you now have "Customer", you will now have "Customer" and "DBCustomer". And all the code that currently uses "Customer" will have to start using DBCustomer. Actually it is easier than that since you can simply make the new class be "Customer" and rename the old class to "DBCustomer". Naturally that means the new class will have to have all of the functionality of the old class. Fortunately you can use the old class to do that. (But I would guess that isn't going to be easy.)

  • Object Oriented Design in Java

    I am an RPGIV programmer trying to switch to Java. I have some experience with Java syntax and basic fundamentals. My question pertains to OOP specifically. I am trying to write a version of the old C-robots program in java. It was an AI simulation project written in C years ago where you could modify the actual AI code and then implement it to test results with 3 other robots with different AI. My question is this: When trying to break down the methods for an interface client to control the robot objects, how do you know what messages that particular client should take care of. In a GUI version I imagine that all the interface client would need to know is basically getPosition() and getDamage() for the display. Then the robot objects would handle all of the other methods including moving(), scanning() and shooting() just to keep it simple. (many more methods are needed, I know). i guess in a nutshell i am trying to determine good program design when it comes to object responsibility. how much responsibility should the interface have as opposed to the other. thank you

    Hi! Welcome to Java. You have a rather broad-based question which primarily deals with good o-o design.
    I'd recommend reading the chapters relating to o-o design from Bruce Eckel's "Thinking In Java". The electronic edition of the book is available for free download at http://www.bruceeckel.com.
    Now, regarding the interface client, you need to determine what other entities it will interact with and from that determine what methods it must have in order to permit those interactions. That's a rather short way of putting it, I know. However, hopefully that's enough to get you going.
    Hope this helps! Feel free to ask if something's not too clear.
    Cheers!

  • Object oriented design -book

    Hi
    I'm looking for a good book about oo design. I'm interested in a book showing how to divide real-life probleminto set of classes and methods. Explaining few oo design's methods and so on... I would be really greatful if could recommend me such a kind of book?

    LOL, thank you scarlet for cheering up my ever so
    painful monday morning.Read again. Rene = Frenchman. Scarlet = Limey. I'm
    not him.oops, like i said, "i don't like mondays"
    humming "...I don't like jamaica, i love it ya...".
    I have "Teach yourself the Washing Machine in 21
    Days", but I think there's a misprint somewhere. My
    clothes don't look like 600�C were a good idea... but
    OTOH, maybe I'm doing something wrong. I'm still at
    Day 3 (how to undress before washing the clothes).That misprint sucks.
    But i'm very interested in how you did wash your clothes on 600�C without finishing day 3 first.
    A small hint: I have found the perfect solution so I didn't had to buy that book (I saw it was actually one of the expensive ones in the serie), I got engaged, thinking that would be cheaper.
    I couldn't be more off on that one.

  • Question about Object-Orientated design for GUI'S

    Hi everyone,
    I am designing a simple GUI, which basically enables a user to input and retreive data.
    So I have a prototype GUI lets call it "myFrame". It extends JFrame, and I place my components onto myFrame, JButtons, JTextfields etc. I have the GUI set up the way I want it, so I move onto implementing the actionListeners.
    The problem is that one of the components I have placed on myFrame has its own mouseListener. Its a type of Icon (i created in a seperate class)which extends JComponent, and I thought it would be sensible to give it control of its own mouseListener, so it cuts down on the code within the myFrame class.
    But I now realise that I can't alter the other components on myFrame from within the mouseListener in the icon class. I know the icon class doesn't have access to any of myFrames methods or instance fields, so how do I correctly implement this. Surely the answer isn't to bung all the code together into one class?
    visually what I have so far looks like this
    SERVER <---Requests---> myFrame --------> IconList ---------> Icon
    the IconList class looks up a server to update its array of Icons[]. But when one individual Icon is clicked on myFrame, i want its mouseListener to load some of its values onto myFrame's GUI components.
    I hope I'm making myself clear, im sorry if this seems like a muddled incoherent question, but any advice would be great. I only need to be shown the correct way to design, and then i carry on coding happily. If this kind of design is way off, please let me know!!
    Thanks

    You can absolutely do work on the frame from the mouse listener--It just needs an instance. i.e.
    public class MyMouseListener implements MouseListener {
      private MyFrame frame;
      public MyMouseListener(MyFrame frame) {
        this.frame = frame;
    }Does that make sense?
    That said, what you'll see more often is a Model-View-Control approach, wherein the Control (the mouse listener in your case) effects the Model and the Model notifies the View to update its display, rather than the Control updating the view directly. That's the extreme overview version, lots of good hits on google if you're interested beyond that

  • Proper object oriented design for factory class

    I have a factory class (UserFactory) it is capable of creating two types of classes (Customer and Employee) that extend User. User is an abstract class.
    At present any class could create a Customer of an Employee.
    How do I restrict access to the constructors of Customer and Employee only to UserFactory?
    I don't want to make both of these classes interfaces (in which case I could just have UserFactory implement both of them).
    Here is an example of how they are set up at present:
    public abstract class User {
    public class Customer extends User{
    public Customer{
    public class Employee extends User {
    public Employee {
    public class UserFactory ???? {
    private static UserFactory c_userFactory = null;
    private UserFactory (){
    public UserFactory getInstance(){
    //private clone method too
    public Customer createCustomer(){
    public Employee createEmployee(){
    Oh and I don't want to create two separate factory classes for Employee and Customer. In C++ there is a concept of friend classes that would have worked nicely in this case.
    Thanks for any and all suggestions,
    Tim

    So correct me if I'm wrong but your suggestion would be something along the lines of:
    public abstract class User {
    public class Customer extends User{
    protected Customer(){
    public class Employee extends User {
    protected Employee (){
    public class UserFactory ???? {
    private static UserFactory c_userFactory = null;
    private UserFactory (){
    public UserFactory getInstance(){
    //private clone method too
    public Customer createCustomer(){
    public Employee createEmployee(){
    public class AccessForCustomer extends Customer {
    public class AccessForEmployee extends Employee {
    Is the above about what you were talking about? I haven't used inner classes before, so I'm a bit curious. Does this mean no class other than UserFactory or derivatives thereof can access the two classes AccessForCustomer and AccessForEmployee?
    Thanks,
    Tim

  • UML diagrams and Object Oriented programming

    In a project for CSC120 at school we have to program a casino using java. We were given a UML diagram of how the professor wants it set up, and I am having some difficulty understanding exactly what some of this means, code wise.
    Part of the UML diagram:
    Game
    userMoney: int
    bet: int
    playAgain() : bool
    askBet() : int
    Payout(amt: void) : void
    takeBet(amt:void) : bool
    I understand the first two blocks, but the last one confuses me. I get that these are the different functions the class will use, but what does the text inside the parentheses mean, and the text after the colon? And what would this look like in code? If someone could post a link to an example program it would greatly help, or just post a simple example here.
    Here is what I have so far in the class file:
    * ASCIIcasino.java
    * Version 1.0
    * Alachine
    * Last Modified: 01/19/2006
    public class Game
         int usermoney;
         int bet;
        public boolean playAgain()
        public int askBet ()
             do
                   System.out.println("How much do you wish to bet?");
                   scannergameinput = new Scanner(System.in);
              while(!scannergameinput.hasNextInt());
              bet = scannergameinput.nextInt();
              System.out.print("Your bet: ");
             return bet;
        public void Payout ()
             int amt;
        public boolean takeBet ()
             int amt;
    }Am I doing this correctly so far, or what am I not getting? Thank you for your time.
    Edited to update code.
    Message was edited by:
    Alachine

    playAgain() : bool
    askBet() : int
    Payout(amt: void) : void
    takeBet(amt:void) : boolThese are methods of the "Game" class, and what is inside parentheses are called parameters.
    "void" and "bool" are return types.
    public boolean playAgain()
        }In this code you have specified boolean as a return type, so you need to return a value of type bool.
    As for the void part, you don't need to return anything.
    Code should look like:
    public boolean playAgain()
             return true; //Or return false
    public void Payout ()
             int amt;
        }You need to get :int amt" in the parameters, and since its voide nothing needs to be returned.
    public void Payout (int amt)
        }

Maybe you are looking for

  • Solutions Center not working. Photosmart C306g. Windows 7 64 bit. "Parsing Error"

    HP Photosmart C306g Windows7 64 bit When I click on the HP Solutions Center on laptop to scan, I get the Error message "Parsing Error in file C:\ProgramFiles (86)\HP\DigitalImaging\bin\hpqscloc\1033.xml" Worked just fine in the past,not sure when it

  • RCIPE00: GLT2 201 Balancing field bus.area in line item not filled

    Dear Guru, We transfer posting payroll to FI with journal Dr    Vendor Non Trade 1 Dr    Vendor Non Trade 2 Dr    Vendor Non Trade 3 Cr    Cross welfare (balance sheet acct.)    Bus.area SBY Cr    Cross welfare (balance sheet acct.)    Bus.area CMO T

  • Reinstall Adobe Standard 7.0.

    My computer was recently changed. I am trying to reinstall Adobe Standard 7.0. It will not let me activate the software. I have tried everything the Adobe site has suggested.

  • Same files, two different play sequences

    This is probably a stupid question, but I don't know DVD Studio that well. The situation: I have 8 separate video files. They need to be able to be played individually (coming back to a menu at the end of each video), and to be played through complet

  • Frame to Servlet Communication

    Hi Friends, I can connect to the servlet through applet by using URLConnection, but the same code I am using for the Frame. I am unable to enter in to servlets it self. I am not getting any error.Any out put.The request is not entering into servlet .