Add a Button in JFrame Title Bar

How can I add a button in JFrame Title Bar. I want to put on more button for docking after the closing button in the title bar.

if you use JFrame.setDefaultLookAndFeelDecorated(true) then you can do it by extending the JRootPaneUI class of the L&F (the default is the metal L&F). that is not a easy task but if you want take a look at BasicRootPaneUI, there you will have to point it to a new TitlePane which you will have to create. to load all this you must use the UIManager class. if you need more explaination try reading on look and feel and customizing it.

Similar Messages

  • How to add a Button in JFrame title Bar ?

    Hi Folks,
    I want to add a button near to JFrame's Minimize Button(On the title bar). How can i do it ? Should i extend RootPaneUI and add custom button ? Any other easy ways to do this ?
    If anyone provides me Sample Code how to do it, It is much Appreciated.
    Thanks,

    There's no easy way to achieve this. You'll have to provide a RootPaneUI delegate with a custom title pane implementation. There, you'll have to provide a custom layout to position your button. In addition, this approach will not work on look-and-feels that do not support decorated mode (such as Windows or GTK) since under such LAFs the title pane always comes from the OS.

  • Need to add a link on Page title bar

    HI,
    Can i know how can i add a link on page title bar.
    When i click on that link, it should open  a page in a separate window.
    Regards,
    Raju

    Hi,
    i am talking about portal only.
    once you login, you can see history, back and forward links on top of page title bar.
    Now i need to add one more link just beside history.
    Can you please give me brief idea on customisation of page title bar.
    Regards,
    Raju

  • How to add push button in application tool bar in SAP transaction VA01

    How to add push button in application tool bar in SAP standard transaction VA01 and how to implement the code for that function code.

    There is no scope to create a push button in application tool bar. Instead of that we can add in a menu bar.

  • Add bookmark button and horizontal scroll bar - bugs on Snow Leopard

    Safari after update to 5.1.4, has a bug in interface on Snow Leopard (10.6.8): 'add bookmark' button (combined with addres bar), and horizontal scroll bar didn't look good.  I think, that shouldn't happend on flagship Apple browser, on just a little older OS X than 'Lion'.
    Clearing (deleting files) 'Cache.db' and .plist files didn't help.

    Ok..  maybe corrupted Safari preferences  (.plist )
    Quit Safari.
    Go to ~/Library/Preferences
    Move the com.apple.Safari.plist file from the Preferences folder to the Desktop.
    Relaunch Safari. If that helped, move the .plist file to the Trash.
    If not, move it back to the Preferences folder.
    If that didn't help, go to Safari > Preferences then select the Extensions tab. If you have any installed, turn that OFF, quit then relaunch Safari to test.
    If it's not a plugin, try troubleshooting Safari third party unsupported add ons >  Safari: Unsupported third-party add-ons may cause Safari to unexpectedly quit or have performance issues
    edited by:  cs

  • User-defined F4 Search - cancel button in the title bar

    Hi,
    I implement user-defined F4 search for my WD application. F4 view comes from another component (as described in the tutorial). Everything is fine, I see that view popuped when F4 is clicked for an input field. My problem is, how to make visible the Close button in the title bar of that popup window.
    I was able to set window's title text, but have no idea how to control those buttons. I only see maximize button which comes by default.
    Also would be nice to create kind of standard OK and Cancel buttons on the bottom bar instead of creating them manually on my view... I've tried set_button_kind(), it works somehow: displayes three empty buttons without icons - need more info about it too...
    Thanks

    Hi Serguei,
    The empty buttons are worth a ticket.
    The behavior for the close button in popups is that the application developer can determine its visibility independent from the buttons in the lower row.
    The second aspect is the action that is triggered if someone clicks that button. There the application developer is able to bind a separate action to that close button. If no action was bound and if a cancel button is visible, clicking the close button will trigger the same action as it would have been the case for the cancel button. A bit complicated, I know. We had to do the latter for backwards compatibility.
    Best regards,
    Thomas

  • How to add an icon in the title bar,next to the maximize and minimize icons

    I need to add an icon ( help icon; ?) in the JInternalFrame� title bar. Anyone could help me????
    Thanks

    have you get the answer ?? on how you add an icon to the title bar?? ...
    if you do please inform me..
    thanks

  • Render JFrame title bar using java not by os

    i need to render JFrame title bar text , any one help me, i need detail example
    with example code, pleae dont provide any sigle line help. cause i have tired all the way .

    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JFrame.html#setDefaultLookAndFeelDecorated(boolean)

  • Need to Add a button in ALV Tool Bar

    Hi,
    I have a requirement where in i need to add a button to a standard ALV report. Its using the class CL_GUI_ALV_GRID. There is a Badi for the report. The Report is co05n and the Badi is WORKORDER_INFOSYSTEM . I am getting the handle of
    CL_GUI_ALV_GRID object reference before screen display. Any guidance on how to add new button now to that toolbar?
    Any help will be rewarded.
    Thank you.
    regards,
    Deepthi lakshmi.A.

    Dear Deepthi Lakshmi.A.,
    Refer the standard program BCALV_GRID_05                  Add a Self-Defined Button to the Toolbar.
    PROGRAM BCALV_GRID_05.
    Purpose:
    ~~~~~~~~
    Demonstrate the creation of an own toolbar button.
    To check program behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~
    The report shows a list of flights of one airline.
    Select one or more lines and press the 'Detail'-Button to popup
    a dialog window with related bookings.
    Essential steps (Search for '§')
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1.Apply steps for event handling for events TOOLBAR and
      USER_COMMAND (see example for print events)
    2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
    3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
    4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
    INCLUDE .
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    DATA: ok_code LIKE sy-ucomm,
          gt_sflight TYPE TABLE OF sflight,
          gt_sbook TYPE TABLE OF sbook,
          g_repid LIKE sy-repid,
          g_max type i value 100,
          gs_layout   TYPE lvc_s_layo,
          cont_on_main   TYPE scrfname VALUE 'BCALVC_TOOLBAR_D100_C1',
          cont_on_dialog TYPE scrfname VALUE 'BCALVC_TOOLBAR_D101_C1',
          grid1  TYPE REF TO cl_gui_alv_grid,
          grid2  TYPE REF TO cl_gui_alv_grid,
          custom_container1 TYPE REF TO cl_gui_custom_container,
          custom_container2 TYPE REF TO cl_gui_custom_container,
          event_receiver TYPE REF TO lcl_event_receiver.
    Set initial dynpro
    SET SCREEN 100.
    LOCAL CLASSES: Definition
    *===============================================================
    class lcl_event_receiver: local class to
                            define and handle own functions.
    Definition:
    ~~~~~~~~~~~
    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.
      PRIVATE SECTION.
    ENDCLASS.
    lcl_event_receiver (Definition)
    *===============================================================
    LOCAL CLASSES: Implementation
    *===============================================================
    class lcl_event_receiver (Implementation)
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    § 2.In event handler method for event TOOLBAR: Append own functions
      by using event parameter E_OBJECT.
        DATA: ls_toolbar  TYPE stb_button.
    E_OBJECT of event TOOLBAR is of type REF TO CL_ALV_EVENT_TOOLBAR_SET.
    This class has got one attribute, namly MT_TOOLBAR, which
    is a table of type TTB_BUTTON. One line of this table is
    defined by the Structure STB_BUTTON (see data deklaration above).
    A remark to the flag E_INTERACTIVE:
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            'e_interactive' is set, if this event is raised due to
            the call of 'set_toolbar_interactive' by the user.
            You can distinguish this way if the event was raised
            by yourself or by ALV
            (e.g. in method 'refresh_table_display').
            An application of this feature is still unknown...
    append a separator to normal toolbar
        CLEAR ls_toolbar.
        MOVE 3 TO ls_toolbar-butn_type.
        APPEND ls_toolbar TO e_object->mt_toolbar.
    append an icon to show booking table
        CLEAR ls_toolbar.
        MOVE 'BOOKINGS' TO ls_toolbar-function.
        MOVE icon_employee TO ls_toolbar-icon.
        MOVE 'Show Bookings'(111) TO ls_toolbar-quickinfo.
        MOVE 'Detail'(112) TO ls_toolbar-text.
        MOVE ' ' TO ls_toolbar-disabled.
        APPEND ls_toolbar TO e_object->mt_toolbar.
      ENDMETHOD.
      METHOD handle_user_command.
    § 3.In event handler method for event USER_COMMAND: Query your
      function codes defined in step 2 and react accordingly.
        DATA: lt_rows TYPE lvc_t_row.
        CASE e_ucomm.
          WHEN 'BOOKINGS'.
            CALL METHOD grid1->get_selected_rows
                     IMPORTING et_index_rows = lt_rows.
            CALL METHOD cl_gui_cfw=>flush.
            IF sy-subrc ne 0.
    add your handling, for example
              CALL FUNCTION 'POPUP_TO_INFORM'
                   EXPORTING
                        titel = g_repid
                        txt2  = sy-subrc
                        txt1  = 'Error in Flush'(500).
            else.
                      perform show_booking_table tables lt_rows.
            ENDIF.
        ENDCASE.
      ENDMETHOD.                           "handle_user_command
    ENDCLASS.
    lcl_event_receiver (Implementation)
    *===================================================================
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    The instance grid2 is freed not until the program exits from the
    main screen.
    (It is created only once during the first selection of SBOOK,
    no matter how many times the second window is called).
      CALL METHOD custom_container1->free.
      IF not custom_container2 is initial.
        CALL METHOD custom_container2->free.
      ENDIF.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc ne 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = g_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in Flush'(500).
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.
    *&      Module  PBO_100  OUTPUT
          text
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      g_repid = sy-repid.
      IF custom_container1 is initial.
    select data from table SFLIGHT
        PERFORM select_table_sflight CHANGING gt_sflight.
    create a custom container control for our ALV Control
        CREATE OBJECT custom_container1
            EXPORTING
                container_name = cont_on_main
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc ne 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
               EXPORTING
                    titel = g_repid
                    txt2  = sy-subrc
                    txt1  = 'The control could not be created'(510).
        ENDIF.
    create an instance of alv control
        CREATE OBJECT grid1
               EXPORTING i_parent = custom_container1.
    Set a titlebar for the grid control
        gs_layout-grid_title = 'Flights'(100).
    allow to select multiple lines
        gs_layout-sel_mode = 'A'.
        CALL METHOD grid1->set_table_for_first_display
             EXPORTING i_structure_name = 'SFLIGHT'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_sflight.
    ->Create Object to receive events and link them to handler methods.
    When the ALV Control raises the event for the specified instance
    the corresponding method is automatically called.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_user_command FOR grid1.
        SET HANDLER event_receiver->handle_toolbar FOR grid1.
    § 4.Call method 'set_toolbar_interactive' to raise event TOOLBAR.
        CALL METHOD grid1->set_toolbar_interactive.
      ENDIF.                               "IF grid1 IS INITIAL
      CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.
    ENDMODULE.                             " PBO_100  OUTPUT
    *&      Module  PAI_100  INPUT
          text
    MODULE pai_100 INPUT.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                             " PAI_100  INPUT
    *&      Module  PBO_0101  OUTPUT
          text
    MODULE pbo_0101 OUTPUT.
      IF custom_container2 is initial.
    (the data from sbook is already selected)
    create a custom container control for our ALV Control
        CREATE OBJECT custom_container2
            EXPORTING
                container_name = cont_on_dialog
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc ne 0.
    add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
               EXPORTING
                    titel = g_repid
                    txt2  = sy-subrc
                    txt1  = 'The control could not be created'(510).
        ENDIF.
    create an instance of alv control
        CREATE OBJECT grid2
               EXPORTING i_parent = custom_container2.
    change title
        gs_layout-grid_title = 'Bookings'(101).
        gs_layout-sel_mode = ' '.
        CALL METHOD grid2->set_table_for_first_display
             EXPORTING i_structure_name = 'SBOOK'
                       is_layout        = gs_layout
             CHANGING  it_outtab        = gt_sbook.
      ELSE.
        CALL METHOD grid2->refresh_table_display.
      ENDIF.                               "IF custom_container2 IS INITIAL.
      CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid2.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc ne 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = g_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in Flush'(500).
      ENDIF.
    ENDMODULE.                             " PBO_0101  OUTPUT
    *&      Form  SELECT_TABLE_SFLIGHT
          text
         <--P_GT_SFLIGHT  text
    FORM select_table_sflight CHANGING p_gt_sflight LIKE gt_sflight[].
      SELECT * FROM sflight INTO TABLE p_gt_sflight up to g_max rows.
    ENDFORM.                               " SELECT_TABLE_SFLIGHT
    *&      Form  SELECT_TABLE_SBOOK
          text
         -->P_LS_SFLIGHT  text
         <--P_GT_SBOOK  text
    FORM select_table_sbook USING    p_ls_sflight LIKE LINE OF gt_sflight
                            CHANGING p_gt_sbook LIKE gt_sbook[].
      DATA: lt_sbook LIKE gt_sbook[].
    Select data from sbook according to a line of sflight
    and append that data to table p_gt_sbook
      SELECT * FROM  sbook INTO TABLE lt_sbook
             WHERE  carrid  = p_ls_sflight-carrid
             AND    connid  = p_ls_sflight-connid
             AND    fldate  = p_ls_sflight-fldate.
      APPEND LINES OF lt_sbook TO p_gt_sbook.
    ENDFORM.                               " SELECT_TABLE_SBOOK
    *&      Module  PAI_0101  INPUT
          text
    MODULE pai_0101 INPUT.
      CASE ok_code.
        WHEN 'RETURN'.
          LEAVE TO SCREEN 0.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                             " PAI_0101  INPUT
    *&      Form  show_booking_table
          text
         -->P_ET_INDEX_ROWS  text
    FORM show_booking_table TABLES p_et_index_rows
                                    STRUCTURE lvc_s_row.
      DATA: ls_selected_line LIKE lvc_s_row,
            lf_row_index TYPE lvc_index,
            ls_sflight LIKE LINE OF gt_sflight.
      CLEAR gt_sbook[].
      LOOP AT p_et_index_rows INTO ls_selected_line.
        lf_row_index = ls_selected_line-index.
    read selected row from internal table gt_sflight
        READ TABLE gt_sflight INDEX lf_row_index INTO ls_sflight.
    select corresponding lines of table sbook
    and append new lines to global table
        PERFORM select_table_sbook USING ls_sflight
                                   CHANGING gt_sbook.
      ENDLOOP.
    call dialog screen and display new alv control
      CALL SCREEN 101 STARTING AT 10 5.
    ENDFORM.                               " show_booking_table
    Regards,
    Naveen.

  • How to add custom buttons in the tool bar of the crystal reports viewer

    Hi,
    I'm using Crystal report viewer (Crystal 2008) in my report and I want to add custom buttons and handle them in the tool bar of the viewer. Is there anyway to achieve this?
    Please help me in this regard.
    Thanks in advance.
    Siva.

    I did this by adding a picturebox to the toolbar, the same size as the buttons, and loading in an image, and putting code into the Click event of the picturebox.
    I also put code into the MouseHover event to change the picture's background color and into the MouseLeave event to change it back.
    I have a couple of these buttons. They work very nicely and really look like part of the toolbar.

  • Adding a button to the title bar

    I need to place a button in the upper-right corner of an NSWindow's title bar. In Interface Builder, I can place a button in the correct spot, but it is always beneath the title bar. To work around this, I'm currently using a subclassed NSWindow with a borderless mask and creating the title bar, including the stoplight buttons, from scratch.
    Is there a better way to do this or a way to re-order my button on top of a title bar? It seems like there should be a simpler way to achieve this effect.

    > Is there anyway to change what the window is called when
    it's
    > minimized?
    The name you type into the file properties is the name you
    will see when the
    file is minimized.
    Steve
    ACE - Adobe Community Expert, Authorware
    My blog -
    http://stevehoward.blogspot.com/
    Authorware tips -
    http://www.tomorrows-key.com

  • Interrogation/help button on dialog title bar?

    Do you know any way to insert a button with an interrogation mark on the title bar of a JDialog, as to get help?

    Check out the link in this thread:
    http://forum.java.sun.com/thread.jspa?forumID=421&threadID=658852 -
    This API is for frames, not dialogs, but maybe you could make it work for you somehow.

  • Removing JFrame title bar WITHOUT removing window border

    I've been searching for a while now, and the only solutions I found were just using
    frame.setUndecorated(true);But this also removes the window border, which removes the ability to resize the window.
    I need the title bar removed while still retaining the ability to resize the window.
    There has got to be some way to do this.

    import javax.swing.*;
    import java.awt.*;
    class Testing
      public void buildGUI()
        JFrame.setDefaultLookAndFeelDecorated(true);
        JFrame f = new JFrame();
        f.getLayeredPane().remove(f.getLayeredPane().getComponent(1));
        f.setSize(400,300);
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
      public static void main(String[] args)
        SwingUtilities.invokeLater(new Runnable(){
          public void run(){
            new Testing().buildGUI();
    }

  • How to blink jframe title bar?

    hi, i have an application i dont know how to blink the title bar of the frame when it is minimized. I hope you can help me. Thanx in advance.

    When the frame doesnt have focus
    you can use
    yourFrame.setVisible(true);
    and it will blink similar to the MSN Messenger on the task bar..
    It works well on XP, 98 n ME.. I havent tried on 2000 but i use it for the messenger I developed and it works absolutely fine
    Hope it helped
    Boney S.
    [email protected]

  • Setting buttons in the title bar of JPanel

    Hi,
    Help me out! How do I set Minimize, Maximize and Exit buttons in a JPanel? Is there a option.
    Thanks,
    Kelly.

    0. you need 3 image file, one for each button
    1. set the panel P layout to borderlayout.
    2. create a new panel N and add it to the north of P.
    3. set the background of N to GradientPaint and use nice colors.
    4. add the buttons to N panel using FlowLayout RIGHT.
    5. add a nice border to P
    if you will add an image to left side of N you will have a JPanel that looks like a frame.
    Noah

Maybe you are looking for