SETTING SECOUND GUI

HI FRIENDS
YESTERDAY I HAVE CREATED AN INTERACTIVE LIST.
FIRST I HAVE TWO SELECT OPTIONS ACCORDING TO WHICH WITH CHECKBOXES LIST GENERATED THEN ON PRESSING APPLICATION BUTTON DISPLAY IT DISPLAY'S ACCORDING INFORMATION.
AFTER THAT NOW I WANT THAT FOR THAT RESULTS WHEN I DOUBLE CLICK ON THAT PARTICULAR RECORD IT SHOULD GO TO A TRANSACTION.
I TRIED USING LINE SELCTION BUT IT IS NOT WORKING.
MY CODE.
REPORT YTEST_REP9 NO STANDARD PAGE HEADING.
TABLES: EKKO , EKPO.
DATA: BEGIN OF IT_EBELN OCCURS 0,
EBELN TYPE EKKO-EBELN,
LIFNR TYPE EKKO-LIFNR,
CHECK(1) TYPE C,
END OF IT_EBELN.
DATA: BEGIN OF IT_EBELN1 OCCURS 0,
EBELN TYPE EKKO-EBELN,
LIFNR TYPE EKKO-LIFNR,
END OF IT_EBELN1.
DATA: CHK TYPE C,
W_LINES TYPE I,
W_RECORD TYPE I VALUE 6.
SELECT-OPTIONS: S_PO FOR EKKO-EBELN.
SELECT-OPTIONS: S_DATE FOR EKKO-BEDAT DEFAULT '20060912'.
*PARAMETERS PO(10) TYPE C.
*PARAMETERS PO_DATE TYPE D.
START-OF-SELECTION.
SET PF-STATUS '100_S'.
SELECT EBELN LIFNR
FROM EKKO
INTO TABLE IT_EBELN
WHERE EBELN IN S_PO
AND BEDAT IN S_DATE.
END-OF-SELECTION.
LOOP AT IT_EBELN.
AT FIRST.
WRITE:/ 'CHK' , 15 'PO_NUMBER' , 30 'ACCOUNT_NUMBER'.
ULINE.
SKIP.
ENDAT.
WRITE:/ IT_EBELN-CHECK AS CHECKBOX, 15 IT_EBELN-EBELN , 30
IT_EBELN-LIFNR.
ENDLOOP.
*AT LINE-SELECTION.
*WRITE:/ IT_EBELN-EBELN .
AT USER-COMMAND.
IF SY-LSIND LT 2.
CASE SY-UCOMM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
WHEN 'DISPLAY'.
DESCRIBE TABLE IT_EBELN LINES W_LINES.
DO W_LINES TIMES.
READ LINE W_RECORD : FIELD VALUE IT_EBELN-CHECK INTO CHK,
FIELD VALUE IT_EBELN-EBELN INTO IT_EBELN1-EBELN,
FIELD VALUE IT_EBELN-LIFNR INTO IT_EBELN1-LIFNR.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
IF CHK EQ 'X'.
APPEND IT_EBELN1.
ENDIF.
CLEAR : CHK , IT_EBELN1.
ADD 1 TO W_RECORD.
ENDDO.
LOOP AT IT_EBELN1.
SET PF-STATUS '101_S'.
AT FIRST.
WRITE:/ 'EBELN' , 15
'BEDAT'.
ULINE.
SKIP.
ENDAT.
WRITE:/ IT_EBELN1-EBELN , 15 IT_EBELN1-LIFNR.
HIDE IT_EBELN1-EBELN.
ENDLOOP.
ENDCASE.
ENDIF.
IF SY-LSIND EQ 2.
CASE SY-UCOMM.
WHEN 'CANCEL'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDIF.
AT LINE-SELECTION.
WRITE:/ IT_EBELN1-EBELN.
*SET PARAMETER ID: 'BES' FIELD IT_EBELN1-EBELN.
*CALL TRANSACTION 'ME23'.
TOP-OF-PAGE.
WRITE:/ 'THIS IS THE PURCHASE ORDER'.
SKIP.

If I run your program using standard gui status it all works fine, so my feeling is the problem is in your gui status.
What I did:
Comment out lines
SET PF-STATUS '100_S'.
and
SET PF-STATUS '101_S'.
Run the report, select a PO and enter DISPLAY in the transaction code box.
In the detail screen double click, and it works fine.
As you're creating your own GUI status I think you need to assign the function code PICK to the F2 function for standard drill-down to work.
Regards,
Nick
P.S. You may get better feedback by posting this problem in the ABAP forum, rather than this one which covers SAPgui

Similar Messages

  • Setting the GUI Status - URGENT

    Hi Experts,
    Is there any way for setting the GUI Status other than se41.
    What's the difference between Status and Status list?
    Can anyone help me out of this?
    Thanks and Regards,
    Swamy Kunche

    Hi Swamy Kunche  ,
      GUI Status :
    A GUI status is a subset of the interface elements used for a certain screen.The status comprises
    those elements that are currently needed by the transaction .The GUI status for a transaction may be composed of the following elements:
    -Title bar.
    -Mneu bar.
    -Application tool bar
    -Push buttons.
    GUI List:
    GUI List Displays a list of all GUI statuses for the current program
    Thanks,
    Greetson

  • Program Freezes when setting up GUI & can't figure why...

    Hi Folks,
    I'm having some serious problems with a program i've written, basically the program creates several threads.
    Each thread creates and uses a JFrame to play a movie.
    The problem i'm getting though is that the program keeps freezing(deadlocking) on me when i'm in the process of setting up each JFrame. I haven't even started the threads....
    This happens intermittedly too boot, what i mean is that the program could run all day, then when it tries to setup a new group of JFrames will freeze, or it could run for just one hour and then the same would happen. I don't know why it is happening... Below is all the relevant code.
    //code from the class which creates the Threads (the threads are called polly and passes the details
    // required to them
    private void createAndSendPollyDetails(){
            for(int i = 0; i < polly.length; i++){
                polly[i] = new Polly(basil);
                System.err.println(" created polly: " + (i+1));
                //get screen percentages
                for(int w = 0; w < 4; w++) {
                    if (w == 0){
                        sWidth = screenSizePercentages[i][w];
                    if (w == 1){
                        eWidth = screenSizePercentages[i][w];
                    if (w == 2){
                        sHeight = screenSizePercentages[i][w];
                    if (w == 3){
                        eHeight = screenSizePercentages[i][w];
                System.err.println("about to send setupScreen details");
                polly.setUpScreen(sWidth,eWidth,sHeight,eHeight);
    System.err.println("about to send array data");
    polly[i].setVals(AScreenDisplayDataHolder.getPlayList(i),
    AScreenDisplayDataHolder.getPlayListLengths(i),
    AScreenDisplayDataHolder.getSizeOfPlayList(i),
    AScreenDisplayDataHolder.getSizeOfPlayListLengths(i));
    if(AScreenDisplayDataHolder.getMainScreenInMainScreenDetails(i)) {
    boolean b = true;
    mainPollyNumber = i;
    polly[i].setMainTrue(b);
    polly[i].setMainLen(AScreenDisplayDataHolder.getMainLengthInMainScreenDetails(i));
    try{
    Thread.sleep(1300);
    }catch (InterruptedException ie) {
    ie.printStackTrace();
    // code from Thread, which just sends the details to screen for setup, the threads haven't even started....
    public void setUpScreen(final double sWidthIn, final double eWidthIn, final double sHeightIn, final double eHeightIn) {
    System.err.println("calling screen.setDisplay");
    Runnable doWorkRunnable = new Runnable() {
    public void run() { screen.setDisplay(sWidthIn, eWidthIn, sHeightIn, eHeightIn);  }
    //SwingUtilities.invokeLater(doWorkRunnable);
    try{
    SwingUtilities.invokeAndWait(doWorkRunnable);
    } catch(InterruptedException ie) {
    System.err.println("error");
    } catch(InvocationTargetException ite) {
    System.err.println("target exception");
    System.err.println("fin call to screen.setDisplay");
    public void setVals(final String[] movieArrayIn, final String[] movieLengthArrayIn, final int lengthOfMovieArray,
    final int lengthOfMovieLengthArray) {
    Runnable doWorkRunnable = new Runnable() {
    public void run() { screen.setValues(movieArrayIn, movieLengthArrayIn, lengthOfMovieArray, lengthOfMovieLengthArray);
    System.err.println("screen.setValues has finished in the void run method");
    //SwingUtilities.invokeLater(doWorkRunnable);
    try{
    SwingUtilities.invokeAndWait(doWorkRunnable);
    } catch(InterruptedException ie) {
    System.err.println("error");
    } catch(InvocationTargetException ite) {
    System.err.println("target exception");
    System.err.println("got to end of SetVals");
    //code from the JFrame which loads the data required by the JFrame into arrays and sets the size(bounds)
    // of the JFrame. Had to use setBounds as start location not always going to be 0,0 for all JFrames
    public void setValues(final String[] movieArrayIn, final String[] movieLengthArrayIn, final int lengthOfMovieArray,
    final int lengthOfMovieLengthArray) {
    Runnable doWorkRunnable = new Runnable() {
    public void run() {
    movieArray = new String[lengthOfMovieArray];
    System.err.println("done moviearray new");
    movieArray = movieArrayIn;
    System.err.println("done moviearray copy");
    movieLengthArray = new String[lengthOfMovieLengthArray];
    System.err.println("done movieaLengthArray new");
    movieLengthArray = movieLengthArrayIn;
    System.err.println("done movieLengthArray Copy");
    SwingUtilities.invokeLater(doWorkRunnable);
    // set the size of the screen
    public void setDisplay(final double sWidthIn, final double eWidthIn, final double sHeightIn, final double eHeightIn){
    Runnable doWorkRunnable = new Runnable() {
    public void run() {
    Dimension wholeScreenSize = getToolkit().getScreenSize();
    if(sWidthIn == 0){
    sWidth = 0;
    else {
    sWidth = wholeScreenSize.getWidth()/100 * sWidthIn;
    if(eWidthIn == 0){
    eWidth = 0;
    else {
    eWidth = (wholeScreenSize.getWidth()/100 * eWidthIn) - sWidth;
    if(sHeightIn == 0){
    sHeight = 0;
    else {
    sHeight = wholeScreenSize.getHeight()/100 * sHeightIn;
    if(eHeightIn == 0){
    eHeight = 0;
    else {
    eHeight = (wholeScreenSize.getHeight()/100 * eHeightIn) - sHeight;
    Screen.this.setBounds((int)sWidth, (int)sHeight, (int)eWidth, (int)eHeight);
    System.err.println("done SetBounds");
    screenSize = new Dimension((int)eWidth,(int)eHeight);
    System.err.println("done setting dimension screenSize");}
    SwingUtilities.invokeLater(doWorkRunnable);
    As you can see i've tried putting them all in SwingUtilities.invokeLater, and still freezes....
    I don't understand why it still does freeze... I'm also wondering when do you need to use the SwingUtilities.invokeLater and invokeAndWati, is it when you are changing/using any element/variable within a JFrame or just when you are changing/using and element/variable that effects the GUI display on a screen
    Please help,
    I'm very stuck,
    Andy.

    Keep it simple, start by removing all of the threads launches and frame builds and make sure it runs. Then have it build one frame and one thread and see if it runds. Then add another one and then ... you get the idea.
    The first thought I had when I was reading your post was that you might want the thread to spin up its own frame rather than have the frame done first and then the thread launched.
    Just a couple of thoughts on the subject.

  • Tell me the perameter to set maximum gui auto logout time for limited users

    hi gurus...
    i want to know the perameter to set the maximum gui auto logout time for limited users...
    at present i have auto logout time as 30 minutes..but i need to set the value as 10 minutes for some group of user...
    if any one know any perameter plz let me know..
    thanks in advance,
    chaitanya...

    Hi Chaitanya,
    I don't think theres a specific parameter to achieve this, but you can set the value of rdisp/gui_auto_logout to 10 in one of the instances and create a new logon group for this users.
    Hope this help!
    Juan
    Please reward with points if helpful

  • Setting Default GUI Properties for Opened Files?

    OK, so you can set up a template for AIs you create yourself, to include things like Layer Panel thumbnail size etc, but can this be done for opened files?
    I work on a very large screen and always want to increase the layers panel thumbnail size, but it's a few clicks to do it, and I'd like to be able to set this value for all opened files, if this is possible. The default thumb. size is way to small and always needs bumped up.
    Are these values stored in the AI (since templates are simply AI files) or can a default value be set? if so, how can I do this?
    Thanks
    Richard

    You cannot change this for all opened files, as this is a per document setting unfortunately.
    To make a new document profile as per Monika open one fo the profiles here:
    Users/ Username/ Library/Application Support/Adobe/Adobe Illustrator CS4/en_US/New Document Profiles
    Change your thumbnail size to larger, then save over that profile
    When you make a new document choose that profile.

  • Browsing result set in gui

    how do i browse resulr set one by one
    i try to do
    but it place me in last row
    stat = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
                    res = stat.executeQuery("Select * from netTable");
              while(res.next())
              l1.setText(res.getString(1));
                    l2.setText(res.getString(2));
              }stat Statement instance,res ResultSet Instance,l1,l2 labels

    Karamjeet, my East Midlands friend, I don't think you want to display each row, 'one by one'. Rather I think you meant to say that you want to display the result set in tabular form. Whether you choose to use a JTable, an HTML table, or a piece of paper on the dining room table is up to you but my esteemed colleague georgemc is correct. Don't use that loop!
    Jai Hind.

  • ActionEvent/Setting gui text in an infinite loop

    Hi,
    I have set up a gui that contains ~ 100 JTextFields and one JTextButton
    Pressing the JTextButton on the gui triggers an action event that
    1.     establishes a socket connection w/ a server
    2.     reads input from the server in an infinite loop
    3.     should use the server data to dynamically setText in the various JTextFields found on the gui.
    for example, during one iteration of the infinite loop, the data may set the text of JTextField #1 to ?foo? and in a later iteration of the loop, the new data from the input stream may set the text of the same field to something else (e.g. ?bar?). Thus, the gui should show a dynamically changing collection of TextFields after the user presses the JTextButton.
    Problem: because of the infinite loop, NONE of the fields is ever updated (see pseudocode below). If I remove the infinite loop and simply have 1 iteration of the block of code within the actionPerformed method, the gui updates properly.
    How might I alter the code to a) maintain the server connection, b) continuously read from the input stream and c) have a dynamic update of the textfields w/in the gui?
    I've tried adding "this.paint(this.getGraphics());" within the infinite loop and it sort of works, but the updates to the gui are FAR SLOWER than the data that are streaming in from the server.
    Thanks for any help!
    The code looks something like this
    Public class abc extends JFrame
    Public abc()
         {initialize components}
    instantiate all textfields & button
    create various arrays
    public void initialize components
         (set up gui using gridbaglayout
         add actionListener to button)
    private actionperformed
    (establish socket connection w/ server
         read data from server in an infinite loop
         parse data and use information to setText on the gui)
    public static void main(blah blah)
         show abc();

    have the reading loop in a different class which will have its own Thread running aside from the main program's thread. This way your application will do both at once :)

  • Set GUI Language to English

    Post Author: Ottenheim
    CA Forum: General
    Hello,
    I want to set de GUI Language of Crystal Reports to English. My regional settings are Dutch but I don't want to change that. Is there another way to change this. I'm using all my applications in English and only this one is Dutch.
    I've read somewhere that I have to delete my language DLL's from crystal report but than it only works when i start crystal directly from the executable, not when double - click the report and choose open with. All my colleagues have the same problem.
    Really strange because with all other developer software it is possible to select a GUI language.
    Hope someone can help me.

    Post Author: Ottenheim
    CA Forum: General
    I've found the solution. I've renamed the english resource file to the dutch and vice versa. Now Crystal starts without running the setup for installing the missing language. Still strange this isn't an option in Crystal Report.

  • [SOLVED] qtconfig unable to set GUI Style to GTK+

    Hi there. I'm running Openbox 3.4.7.2-4 with qt 4.5.3-3 and gtk-rezlooks-engine 0.6-8.
    When I run qtconfig and set the GUI style to GTK+, it gives the error QGtkStyle cannot be used together with the GTK_Qt engine. This makes no sense because I don't even have the gtk-qt-engine package installed.
    I read the post here http://wiki.archlinux.org/index.php/Uni … #QGtkStyle and added
    export GTK2_RC_FILES="`pwd`/.gtkrc-2.0"
    to my .xinitrc with no luck.
    You can see my .xinitrc at http://pastebin.org/54730
    Thanks
    Last edited by zozobra (2009-11-19 22:05:18)

    hmmm, Openbox here,
    and this is how mine all looks
    and here is my autostart.sh
    export OOO_FORCE_DESKTOP=gnome
    export GTK2_RC_FILES="$HOME/.gtkrc-2.0"
    You can see VLC and Openoffcice behaving badly and behaving differently to each other.
    qtconfig fails to help. I have tried all the tips I have found.
    SOLVED my problem by removing trolltech.conf and reinstalling qt package. qtconfig works great now.
    Last edited by tawan (2010-03-04 09:42:39)

  • How do I use both a GUI switch and a timer to control an output?

    Hi, I have no trouble setting up either a gui switch or a timer to switch a hardware output. However, now I am trying to use both to control the same output. That is, the latest change of either the timer or gui switch changes the output. I can do this by setting the gui switch output and the timer output into a software latch and connecting the latch to the hardware. The problem is that now the gui switch does not reflect the state of the hardware output (if the timer changed the state). One solution I can see is that there is both a push button 'change state' as well as an indicator at the gui but I would rather have all the functionality in the 1 switch. Any suggestions welcome!

    It looks like you should be using a flip-flop object. This object changes state each time your input transitions from false to true. Also you would probably be better off using a push button rather tham a switch.
    You can tie "your timer OR your pushbutton" to the input of your flip-flop. Then if you display the flip-flop on top of the push button you can easily see which state you are in. Then of course just tie your flip-flop to your output.
    **This will work fine as long as you are NOT running multiple client applications. If you are running multiple clients, then it has to be done completely different. If this is the case please let me know and I will explain.
    Hope this helps

  • How to create a gui pf status and guititle in module pool programming?

    hi frnds,
    how to create a gui pf status and gui title in module pool programming?
    my problem is i created a screen and wen execute the screen by a tcode.am nt able to activate SAVE BACK EXIT CANCEL COMMANDS?.how to do this can any one explain in detail procedure?
    plz gve step by step process.

    Hi,
    For Title:In PBO...just write
    SET TITLEBAR 'ZTITLE'.
    double click on 'ZTITLE'....give whatever title u want...save it...activate...and check...reward points if useful...
    PF means FUNCTION CODE
    ex; set pf-status 'zrstatus'.
    double click on the zrstatus expand the application server ,
    at the time of execution the default menu(ie system,help),application toolbar buttons like enter,help etc and function keys(by default there will be no function keys)as are there on the normal
    will appear on the screen.
    Details:
    PF-STATUS is used to set the GUI Status of a screen, ie you can control the options on your menu bar, application toolbar, the function keys assigned to various options etc.
    Implementing the status for a screen can be done in 2 ways:
    1) Create the GUI status using the object list of the program or by using the transaction SE41. Then, assign it to the screen using SET PF-STATUS statement.
    2) Create the GUI status by means of forward navigation, ie, use the SET PF-STATUS 'XXX' statement where 'XXX' is the name of the GUI status and double click on it to create it.
    Status names can have a maximum of 20 characters.
    After assigning a GUI status to a screen, this is inherited to all subsequent screens. In order to have a different status for each of the subsequent screens, you have to set a separate status for each screen.
    In transaction SE41,
    1) Give the program name and the status name and click on the Create button.
    2) Go to 'Function keys' and expand.
    3) On top of the save icon type SAVE, on top of the back icon type BACK, on top the the exit icon type EXIT etc ie on top of all the icons that you want to use, type the respective names that you want to give.
    Whatever you have typed now becomes the function codes of these icons and can be used in your program.
    For example you have a screen 100.
    In the 'Element list' tab of the screen, give "ok_code" as the name where "OK" is the type of screen element. Activate screen.
    The flow logic for the screen looks like this:
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    Create the modules STATUS_0100 and USER_COMMAND_0100 in the main program by simply double clicking on them.
    The code for these modules can be something like this:
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'Example'. "Example is the name of the GUI status
    ENDMODULE.
    MODULE user_command_0100 INPUT.
    CASE ok_code.
    WHEN 'SAVE'.
    "call a subroutine to save the data or give statements to save data.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE.
    Regards,
    Shiva Kumar (Reward If helpful)

  • After installed Solaris 10 X86 I CAN'T SEE GUI

    Hi,
    I have installed Solaris 10 X86. while installing the software from the CD
    I got a nice GUI . After install all 5 CD and reboot I got a choice to boot into Solaris or WIndows, I chose Solaris and wait to loads the GUI but I got only black screen and a monitor message saying the Frequency is low. I got only # prompt .
    run search forums about gui problem and no find specific help.
    run kdmconfig and change to Xsun, it's not solve the problem.
    I CAN'T SEE GUI.
    Do i need run any command or install any other program ?
    Thanks,
    NEED HELP!!!!!

    Hi ,
    try to run #kdmconfig at ur promt , it will ask u to set new gui settings
    select ur appropriate vga card , which is being supported ny ur os , n make a logoff , automatically it will drop u on a gui screen to make a login
    or u can use #/usr/X11/bin/xorgconfig to define all the new settings from the scratch , i think it should help u out
    regards
    Kinshuk

  • I need help in GUI

    Hi every one..
    I need help in this class. I want to do a modification to the project AddGUI so that it will do subtraction, multiplication and division of two integre numbers, in addition to addition.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class GUIAddition extends JFrame {
       private String output;
       private int number1, number2, sum;
       private JLabel number1Label, number2Label, sumLabel;
       private JTextField number1TextField, number2TextField;
       private JButton addButton, exitButton;
       private JTextArea textArea;
       public GUIAddition()   {
       super("Sum of Two Integer Numbers");
    // Create an instance of inner class ActionEventHandler
       ActionEventHandler handler = new ActionEventHandler();
    // set up GUI
       Container container = getContentPane();
       container.setLayout( new FlowLayout() );
       // set up Label Fields and Text Fields for number1
       number1Label = new JLabel( "Number1" );
       number1TextField = new JTextField( 10 );
       number1TextField.addActionListener( handler );
       container.add( number1TextField );
       container.add( number1Label );
       // for number2
       number2Label = new JLabel( "Number2" );
       number2TextField = new JTextField( 10 );
       number2TextField.addActionListener( handler );
       container.add( number2TextField );
       container.add( number2Label );
       // for sum
       sumLabel = new JLabel( "Sum" );
       textArea = new JTextArea( 1,10 );  // only output, no addAction
       textArea.setEditable( false );
       container.add( textArea );
       container.add( sumLabel );
       // set up Add Button
       addButton = new JButton( "Add" );
       addButton.addActionListener( handler );
       container.add( addButton );
       // set up Exit Button
       exitButton = new JButton( "Exit" );
       exitButton.addActionListener( handler );
       container.add( exitButton );
      }// end constructor
    // Display The Sum of the Two Numbers in displayfield
       public void displayAddition() {
           textArea.setText(output);
      }// end display method
       public static void main( String args[] )   {
          GUIAddition window = new GUIAddition();
          window.setSize(500, 100);
          window.setVisible( true );
      }// end main
       private class ActionEventHandler implements ActionListener {
         public void actionPerformed(ActionEvent event) {
           // process Text Fields: number1 and number2 as well as Add Button events
           if (event.getSource() == number1TextField)
               number1 = Integer.parseInt(event.getActionCommand());
           else if (event.getSource() == number2TextField)
               number2 = Integer.parseInt(event.getActionCommand());
           else if (event.getSource() == addButton){
                   sum = number1 + number2;
                   output = "" + sum;
                   System.out.println("The Result of adding number1: " + number1 +
                   " and number2: " + number2 + " is: " + sum);
           // process Exit Button event
           else if (event.getSource() == exitButton) System.exit(0);
    // Display Information
           displayAddition();
         } // end method actionPerformed
       }// end inner class ActionEventHandler
    }  // end Class GUIAddition

    I try to do it for subtraction, but it didn't work correctly.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class GUIAddition extends JFrame {
       private String output;
       private int number1, number2, sum, sub;
       private JLabel number1Label, number2Label, sumLabel, subLabel;
       private JTextField number1TextField, number2TextField;
       private JButton addButton, subButton, exitButton;
       private JTextArea textArea;
       public GUIAddition()   {
       super("Sum of Two Integer Numbers");
    // Create an instance of inner class ActionEventHandler
       ActionEventHandler handler = new ActionEventHandler();
    // set up GUI
       Container container = getContentPane();
       container.setLayout( new FlowLayout() );
       // set up Label Fields and Text Fields for number1
       number1Label = new JLabel( "Number1" );
       number1TextField = new JTextField( 10 );
       number1TextField.addActionListener( handler );
       container.add( number1TextField );
       container.add( number1Label );
       // for number2
       number2Label = new JLabel( "Number2" );
       number2TextField = new JTextField( 10 );
       number2TextField.addActionListener( handler );
       container.add( number2TextField );
       container.add( number2Label );
       // for sum
       sumLabel = new JLabel( "Sum" );
       textArea = new JTextArea( 1,10 );  // only output, no addAction
       textArea.setEditable( false );
       container.add( textArea );
       container.add( sumLabel );
       // for sub
       subLabel = new JLabel( "Subtraction" );
       textArea = new JTextArea( 1,10 );  // only output, no addAction
       textArea.setEditable( false );
       container.add( textArea );
       container.add( subLabel );
       // set up Add Button
       addButton = new JButton( "Add" );
       addButton.addActionListener( handler );
       container.add( addButton );
       // set up Sub Button
        subButton = new JButton( "Subtraction" );
       subButton.addActionListener( handler );
       container.add( subButton );
       // set up Exit Button
       exitButton = new JButton( "Exit" );
       exitButton.addActionListener( handler );
       container.add( exitButton );
      }// end constructor
    // Display The Sum of the Two Numbers in displayfield
       public void displayAddition() {
           textArea.setText(output);
      }// end display method
       public static void main( String args[] )   {
          GUIAddition window = new GUIAddition();
          window.setSize(500, 100);
          window.setVisible( true );
      }// end main
       private class ActionEventHandler implements ActionListener {
         public void actionPerformed(ActionEvent event) {
           // process Text Fields: number1 and number2 as well as Add Button events
           if (event.getSource() == number1TextField)
               number1 = Integer.parseInt(event.getActionCommand());
           else if (event.getSource() == number2TextField)
               number2 = Integer.parseInt(event.getActionCommand());
           else if (event.getSource() == addButton){
                   sum = number1 + number2;
                   output = "" + sum;
                   System.out.println("The Result of adding number1: " + number1 +
                   " and number2: " + number2 + " is: " + sum);
           else if (event.getSource() == subButton){
                   sub = number1 - number2;
                   output = "" + sub;
                   System.out.println("The Result of subtraction number1: " + number1 +
                   " and number2: " + number2 + " is: " + sub);
           // process Exit Button event
           else if (event.getSource() == exitButton) System.exit(0);
    // Display Information
           displayAddition();
         } // end method actionPerformed
       }// end inner class ActionEventHandler
    }  // end Class GUIAddition

  • Best way to set global environment variables?

    What is the best way to set global (i.e. for all users of the computer, ideally all shells as well) environment variables under Leopard?
    I know that they can be set via ~/.bashrc, ~/.profile or in my case ~/.zshrc files in the terminal on a per user basis.
    Also, they can be set for GUI apps as well via ~/.MacOSX/environment.plist on a per user basis.
    http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Artic les/EnvironmentVars.html
    The path can apparently be set globally by adding files to /etc/paths.d/*
    http://blog.plotdevice.org/2008/04/global-path-in-mac-os-x-leopard/
    Is there a way to set environment variables globally so that they are accessible to all users and all programs including nonstandard shells like zsh?
    My inclination is to set them in /etc/rc.common but that seems like it might be a bad idea. I'd prefer something more like the /etc/paths.d/* solution that only involves adding files, not modifying existing ones. They should be less likely to be overwritten in a system update later.

    They may be less likely to be overwritten than you fear. A lot of things depend on modifications to the system scripts like /etc/profile. Although I'd expect these to be broken by an upgrade to Leopard, for example, they have survived all Tiger upgrades on my machine. You could always have them source scripts in /usr/local, say, so that the work involved in reconfiguring them if they are overwritten is minimal. (Or you could just install your versions in /usr/local and make the system scripts symlinks to those versions - if anything is overwritten, it would be the symlink rather than the file itself. An automated start up script could even check and recreate the symlink if necessary.)
    - cfr

  • Is it possible to apply putClientProperty() to the entire GUI?

    Is it at all possible to apply something like: putClientProperty to the entire GUI rather then a specific object?
    I dislike the java style, and prefer to have my layout as the windows style, but don't know how to do this rather then setting each gui element to windows style...

            try {
                   UIManager.setLookAndFeel(
                           UIManager.getSystemLookAndFeelClassName());
              } catch (Exception e) {}This should change Swing UI to Windows Look & Feel (if your runing on windows).

Maybe you are looking for

  • Save and refresh after entering data inoto table.

    hello guys, im using abap webdynpro now. and im facing a problem with the saving and update " refresh function" I have entry table and some other text input. the thing im doing is to enter data in the filed, attachment, drop down selection. then the

  • How do I transfer Keychains from one mac to another mac?

    I recently got a new imac. I choose during the set-up process for the new imac to pass on pulling "all" the old information from my old G4 mac as there was stuff I just did not want to move and then have to find and delete on the new mac. However I w

  • HT1212 my daughter forgot her passcode to her ipad mini.  How do i get into the ipad mini and reset the passcode

    my daughter forgot her passcode to her ipad mini.  How do I get into the ipad so I can reset it. thanks

  • InDesign CS4 crash

    hi All I hope you can help! I have an InDesign CS4 file that has been working fine but today crashed and will not open now. I get the "file may be damaged" warning and when I hit OK to open anyway, then InDesign crashes (just the program, not my whol

  • Why is my "other" growing

    ipod touch 2nd gen, when i restore the touch, the "other" catagory is about .17 gb, after adding and deleting tv shows and movies after i watch them, in a couple weeks the "other" will grow to like .82 gb. the song playlist, pics, podcasts, and apps