JButton help, icon +text position

Hi, is it possible to have JButton with icon on far left and text between the icon and far right hand side?

Yo can do it by using the setHorizontalTextPosition() method.
here is one example
import java.awt.*;//Frame
import javax.swing.*;
public class Test extends JFrame
     public Test()//Constructer. Creates the frame
          JButton bt = new JButton("Done", new ImageIcon("image.gif"));
          bt.setHorizontalTextPosition(AbstractButton.LEFT);
          setBounds(300,300,300,300);
          getContentPane().setLayout(new FlowLayout());
          getContentPane().add(bt);
          setVisible(true);//shows on the screen
     public static void main(String[] args)
          new Test();//Creates a new Instance of our class
}

Similar Messages

  • JButton text position without an icon

    Hi,
    I'm trying to set the text on my JButtons to be in the top left corner. I've read many of the topics on JButton text position, but they all assume you have an icon with your text. I want to be able to do it without icons (as my buttons don't need them). I tried using the setHorizontalTextPosition and setVerticalTextPosition methods, but the text is still in the same spot.
    Does anyone have any ideas?
    Message was edited by:
    raardvark

    Hi,
    I'm trying to set the text on my JButtons to be in
    the top left corner. I've read many of the topics on
    JButton text position, but they all assume you have
    an icon with your text. I want to be able to do it
    without icons (as my buttons don't need them). I
    tried using the setHorizontalTextPosition and
    setVerticalTextPosition methods, but the text is
    still in the same spot.
    Does anyone have any ideas?
    Message was edited by:
    raardvarkPut a new border on the button that has some space on the bottom and right. Or add insets with the new border.

  • Help! Mail menus and icon text are all showing in Chinese/Asian characters!

    I am helping someone with their iMac G5 computer. A couple of days ago, all of a sudden the Mail program (v. 2.13) has all the menus, icon text, and mail folder descriptions (Inbox, Trash, Drafts, Sent, etc.) all showing in what looks to be Chinese (or other oriental language). I checked in System Prefs and language still set to US. None of the other program menus or text seem to be effected--just Mail. Anyone know what caused this or how to fix?? Thanks!

    Thanks for your reply. I am looking at the links you posted, but the problem here seems different. If you go into Mail, in the menu at the top, the word Mail is in English, then all of the other menu choices are written in what definitely appears to be an oriental language. If you click on a menu, all of the choices in the drop down menu are also oriental language. The e-mails themselves are in English, however the date of the e-mail is showing in oriental. On the left side, the words Inbox, Trash, etc. are all written in oriental as are the words under the icons. And, it's only in Mail. It just started doing this yesterday and the computer owner doesn't know why.
    Thanks so much for any further ideas/suggestions. I am going back to read more in the links you sent, but this seems a different problem.

  • How to get text position in a pdf?

    I need to get text position such has width, height, x, y and base position in a pdf.
    Can one help me to work further.

    i solved PDEForm issue thank you. Now i need to get the text from PDEElement.
    Can you help for this?
      PDEElement pdeElement;
        ASInt32 numElems = PDEContentGetNumElems (pdeContent);
        ASFixedRect bBox;
        for (ASInt32 i = 0; i < numElems; i++) {
            pdeElement = PDEContentGetElem (pdeContent, i);
            if (PDEObjectGetType((PDEObject)pdeElement) == kPDEForm)
                PDEForm form = (PDEForm)pdeElement;
                PDEContent content = PDEFormGetContent(form);
                GetCoOrdinate(content);
            else if(PDEObjectGetType((PDEObject)pdeElement) == kPDEText)
                PDETextState objPDETextState;
                PDEText aotextObject;
                memset(&objPDETextState, 0,sizeof(PDETextState));
                aotextObject = (PDEText)pdeElement;
                PDETextGetTextState(aotextObject,kPDETextRun,0,&objPDETextState,sizeof (PDETextState));
                if(objPDETextState.renderMode == kPDETextInvisible)
                    AVAlertNote("Invisible");
                else
                    PDEElementGetBBox (pdeElement, &bBox);
                    os.str("");
                    os << ASFixedRoundToInt32 (bBox.top) <<":" << ASFixedRoundToInt32 (bBox.bottom) << ":" << ASFixedRoundToInt32 (bBox.left) << ":" << ASFixedRoundToInt32 (bBox.right);
                    AVAlertNote(os.str().c_str());
            else
                os.str("");
                os << "Type: "<< PDEObjectGetType((PDEObject)pdeElement);
               // AVAlertNote(os.str().c_str());
                // Get the bounding box of the PDEElement and fill out the
                // selection structure to highlight the image.
                PDEElementGetBBox (pdeElement, &bBox);
                os.str("");
                os << ASFixedRoundToInt32 (bBox.top) <<":" << ASFixedRoundToInt32 (bBox.bottom) << ":" << ASFixedRoundToInt32 (bBox.left) << ":" << ASFixedRoundToInt32 (bBox.right);
                //AVAlertNote(os.str().c_str());

  • Help icon

    Hello
    Does anyone out there know of any way, via Apple or 3rd party app where I can download a help Icon. Or any rumours that Apple may integrate a feature like this in there "Core Software"
    Interactive icon when clicked upon - it will bring up a list of options of how to...stricly how to questions/answers
    How do I - Turn on/off airplane mode
    How do I highlight , copy text
    How do I - Help with Apps, install, remove
    How do I - Get/install latest software
    How do I - Visit Support Forums
    Apple devices have a book mark in browser for the userguide. I realize this. What about a icon for self serve as opposed to the userguide
    Blackberry devices have a help icon on the device that opens a how to section
    ...What about Android devices...any rumours????

    Just download your iPhone's manual from here:
    http://support.apple.com/manuals/
    Then add it to iBooks on your iPhone.

  • I need to reset Firefox, but the Help icon (first step) does not appear in the Menu.

    I am attempting to reset Firefox (for Linux/Ubuntu 12.04 LTS), which has gone a bit wonky... but following the procedure, the first thing is to select "Help" (icon "Question Mark) and proceed from there. Unfortunately, there is no help icon displayed in the choices as it is shown on the Firefox website.
    It's rather like trying to find a corner in a round room.
    As an aside, amongst the problems I am experiencing, is the appearance of green, grey, and black rectangular boxes in the browser window. Visually, it is like the text that usually appears there is being "masked" or something.
    (Perhaps) A propos of nothing.. this seems to have happened on the heels of a regular Ubuntu Update.
    Thanks for any advice/guidance.
    Jaguar
    PS - I wanted to u/l a screen shot, but was unable to do.

    hello Jaguar07, you can also access that page directly by entering '''about:support''' into the address bar of your firefox browser.

  • Safari 5 doesn't memorize my toolbar icon's position

    Hello,
    I first set my toolbar icon's positions using the menu 'View > Customize toolbar'.
    But when I restart Safari, the icon's positions haven't been memorized and they are repositioned in a disorganized way!
    Is this a bug? What am I to do to have this fixed?
    Thanks and regards,
    Olivier.

    Hi,
    Third party plugins......
    Since it's your Toolbar that's the issue...
    Go here for instructions to uninstall Evernote may be compatible with Snow Leopard but not with Safari 5.
    http://www.otanistudio.com/journal/2009/11/13/uninstalling-evernote-os-x-snow-le opard/
    And 1Password should be ok. If you can update CosmoPod, uninstall Evernote, relaunch Safari.
    If you still have problems go there for 1Password help. http://blog.agile.ws/post/674703181/safari-5-arrives-and-1password-3-2-is-live
    Try updating CosmoPod here: http://cocoamug.com/cosmopod/index.html
    Carolyn

  • Search help icon for select option

    hello all...
    can some one let me know , how to attach F4 help icon to select option..??
    in select option im referrin to a data element, this data element has a domain which has value range.
    if i press F4 on the select option, im gettin the values in the search help but the icon is not appearing..
    any suggestions...
    regards..
    vishal

    Hi,
    Select TABLE-FIELD GOTO>Search help>For field.
    If you have Search help you can assign here or else you need to create search help through SE11.
    Or programatically you can code like below.
    See below code........
    selection-screen: begin of block B1 with frame title text-001.
    select-options: s_pernr for zfdmr_records-pernr,
    selection-screen end of block B1.
    data: begin of t_itab occurs 0,
          pernr like zfdmr_records-pernr,
          end of t_itab.
    DATA: t_return like ddshretval occurs 0 with header line.
    *at selection-screen on value-request for s_pernr-low.
    perform get_values changing s_pernr-low.
    *at selection-screen on value-request for s_pernr-high.
    perform get_values changing s_pernr-high.
    *&      Form  get_values
          text
         -->P_S_PERNR_LOW  text
    FORM get_values CHANGING    P_S_PERNR.
      refresh t_itab.
      clear t_return.
      select pernr  from zfdmr_records into table t_itab.
      delete adjacent duplicates from t_itab.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
      DDIC_STRUCTURE         = ' '
          RETFIELD               = 'PERNR'
      PVALKEY                = ' '
         DYNPPROG               = sy-cprog
         DYNPNR                 = sy-dynnr
         DYNPROFIELD            = 'ZFDMR_RECORDS-PERNR'
      STEPL                  = 0
      WINDOW_TITLE           =
      VALUE                  = ' '
         VALUE_ORG              = 'S'
         MULTIPLE_CHOICE        = ' '
         DISPLAY                = 'F'
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
        TABLES
          VALUE_TAB              = t_itab
      FIELD_TAB              =
         RETURN_TAB             = t_return
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      READ TABLE t_return INDEX 1.
      p_s_pernr = t_return-fieldval.
    ENDFORM.                    " get_values
    Thanks.
    If this helps you award points and close the thread.
    Message was edited by: Deepak333 k
    Message was edited by: Deepak333 k

  • Removing help icon from LoginProvider

    I am new to Sun Portal Server 7.1 Update 1, and am looking for a way to remove the 'help' icon from the LoginProvider for the devauthlessanonymous user. I am making use of the Developer's Sample portal that comes bundled with the product, and want to eliminate all icons that appear in providers/containers/channels.
    Within PSConsole, for the have updated the helpURL property to be "" instead of the default en/desktop/login.htm, per the Portal Server 7.1 Technical Reference guide. After doing so, the icon remains but instead directs the user to login to the web server doc root (e.g. /porta/docs).
    Are there any other parent provider/container/channel helpURL fields that I need to update as well, or do I need to enter a different value for the helpURL field in the LoginProvider for the devauthlessanonymous user?
    Thanks.

    are you building a custom one? Couldn't understand what text you have around it. I dont have anything in my portal (default one).
    Welcome <User Name> My Account Log Off                    <help image> Help | Search
    This is what i have in my out of box.
    Bharat Karthik
    [email protected]
    http://www.eminenttech.com/
    Edited by bharatkarthik at 03/27/2008 2:21 PM
    Edited by bharatkarthik at 03/27/2008 2:22 PM

  • Remove Help Icon

    Hi,
    I am customizing the TopBar View and I was wondering how you would remove the help icon?? I want to keep the link but not have the image.
    Any help would be greatly appreciated.
    Thanks

    Hi Satish,
    What I usually do is check the element in the browser's developer tools - for e.g. Chrome's "Inspect Element". This way I can identify the id of the element in the ADF Faces source file (.jsff).
    In the folderViewer case the element id was "cilhelp" and the tag in the .jsff is below
    <af:commandImageLink rendered="#{o_w_doclib_UIUtils.inSpaces}"
                                       partialSubmit="true"
                                       icon="/adf/webcenter/helptopics_ena.png"
                                       hoverIcon="/adf/webcenter/helptopics_ovr.png"
                                       depressedIcon="/adf/webcenter/helptopics_dwn.png"
                                       shortDesc="#{dlBndl.HELP_BUTTON_TEXT}"
                                       id="cilhelp">
                    <rh:helpLauncher helpTopicId="doclib_cs_doctf"/>
                  </af:commandImageLink>Also, I have all the webcenter jars (from JDeveloper) extracted into a folder. This way I can quickly do a text search to find the file that I need and makes it easier to find the file in the customization project.

  • Removing Help Icon

    We are trying to remove the help icon in the header, can someone provide the steps to do ths?

    are you building a custom one? Couldn't understand what text you have around it. I dont have anything in my portal (default one).
    Welcome <User Name> My Account Log Off                    <help image> Help | Search
    This is what i have in my out of box.
    Bharat Karthik
    [email protected]
    http://www.eminenttech.com/
    Edited by bharatkarthik at 03/27/2008 2:21 PM
    Edited by bharatkarthik at 03/27/2008 2:22 PM

  • How to remove help icon in Webcenter Spaces

    Hi All,
    There is a help icon in every taskflow in webcenter spaces, please let me know how to remove it?
    Thanks in Advance.

    Hi Satish,
    What I usually do is check the element in the browser's developer tools - for e.g. Chrome's "Inspect Element". This way I can identify the id of the element in the ADF Faces source file (.jsff).
    In the folderViewer case the element id was "cilhelp" and the tag in the .jsff is below
    <af:commandImageLink rendered="#{o_w_doclib_UIUtils.inSpaces}"
                                       partialSubmit="true"
                                       icon="/adf/webcenter/helptopics_ena.png"
                                       hoverIcon="/adf/webcenter/helptopics_ovr.png"
                                       depressedIcon="/adf/webcenter/helptopics_dwn.png"
                                       shortDesc="#{dlBndl.HELP_BUTTON_TEXT}"
                                       id="cilhelp">
                    <rh:helpLauncher helpTopicId="doclib_cs_doctf"/>
                  </af:commandImageLink>Also, I have all the webcenter jars (from JDeveloper) extracted into a folder. This way I can quickly do a text search to find the file that I need and makes it easier to find the file in the customization project.

  • How to retrieve all outputed graphic(jpg,bmp,icon) rect position in a window form?

    Is there a way to retrieve all outputed graphic(jpg,bmp,icon) rect position in a window form?
     Thx

    No. I don't think there will be such API to do so. Hooks may help do something related stuff.
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms644959(v=vs.85).aspx

  • Horizontal text positioning of DrawString method

    I am trying to reproduce the below XPS XAML using the GDI+:
    <FixedPage xmlns="http://schemas.microsoft.com/xps/2005/06" xmlns:x="http://schemas.microsoft.com/xps/2005/06/resourcedictionary-key"
    xml:lang="und" Width="816" Height="1056">
    <Path Fill="#FFFFFFFF" Data="M0,0L816,0 816,1056 0,1056Z" />
    <Canvas Clip="M0,0L816,0 816,1056 0,1056Z">
    <Path Fill="#FFFFFFFF" Data="M0,0L816,0 816,1056 0,1056Z" />
    <Path Fill="#FF008000" Data="M0,0L816,0 816,1056 0,1056Z" />
    <Canvas RenderTransform="1,0,0,1,10,10">
    <Path Fill="#FFFFFF00" Data="M0,0L796,0 796,120 0,120Z" />
    <Canvas Clip="M0,0L796,0 796,120 0,120Z">
    <Glyphs OriginX="0" OriginY="87.5866666666667" FontRenderingEmSize="96" FontUri="/Resources/1057478c-ad6c-46da-af29-3e00c349c111.ODTTF" UnicodeString="Rutger
    Koperdraad" Fill="#FF000000" xml:lang="en-us" />
    </Canvas>
    </Canvas>
    </Canvas>
    </FixedPage>
    I manage to get the rectangles and the vertical text position correctly printed to the XPS document writer using the code below:
    Private Sub OnPrintPageEx(sender
    As Object, e
    As PrintPageEventArgs)
    If m_intPageNumber < m_objPaginator.PageCount
    Then
    Using objGraphics
    As System.Drawing.Graphics = e.Graphics
    ' Correction factor between WPF and printer units
    Dim f As
    Single = 100 / 96
    ' Set the graphics quality
    objGraphics.SmoothingMode = Drawing.Drawing2D.SmoothingMode.None
    objGraphics.InterpolationMode = Drawing.Drawing2D.InterpolationMode.NearestNeighbor
    ' Draw the green background
    Dim stcRect1 As
    New Drawing.RectangleF(0, 0, 816 * f, 1056 * f)
    Call objGraphics.FillRectangle(Drawing.Brushes.DarkGreen, stcRect1)
    ' Draw the yellow rectangle
    Dim stcRect2 As
    New Drawing.RectangleF(0, 0, 796 * f, 120 * f)
    Call objGraphics.TranslateTransform(10 * f, 10 * f)
    Call objGraphics.FillRectangle(Drawing.Brushes.Yellow, stcRect2)
    ' Draw the text
    Dim objFont As
    New Drawing.Font("Times New Roman", 72)
    Dim intEmHeight As
    Integer = objFont.FontFamily.GetEmHeight(objFont.Style)
    Dim intCellAscent
    As Integer = objFont.FontFamily.GetCellAscent(objFont.Style)
    Dim sngOffset As
    Single = 87.58667F - 96.0F / intEmHeight * intCellAscent
    Dim stcRect3 As
    New Drawing.RectangleF(0, sngOffset * f, 796 * f, 120 * f)
    Call stcRect3.Inflate(100 / 96, 100 / 96)
    Call objGraphics.DrawString("Rutger Koperdraad", objFont, Drawing.Brushes.Black, stcRect3)
    End Using
    m_intPageNumber += 1
    e.HasMorePages = (m_intPageNumber < m_objPaginator.PageCount)
    End If
    End Sub
    However, the horizontal text positioning is still different. The first letter starts too far to the right and the overall text is wider. How can I reproduce the XAML correctly in the GDI+?
    To give some background: I have a WPF application that can print using WPF/XPS technology. Since this print path gives quality problems on many legacy printer driver (bad image resolution due to a bug in the XPS to GDI+ conversion), I am building an
    alternative print engine based on the GDI+. So effectively, I need to convert my WPF graphics to the GDI+.
    Rutger Koperdraad.

    OK, I found the answer myself. By adding the string format as below, I get the correct result.
    ' Draw the text
    Dim objFont As
    New Drawing.Font("Times New Roman", 72)
    Dim intEmHeight As
    Integer = objFont.FontFamily.GetEmHeight(objFont.Style)
    Dim intCellAscent
    As Integer = objFont.FontFamily.GetCellAscent(objFont.Style)
    Dim sngOffset As
    Single = 87.58667F - 96.0F / intEmHeight * intCellAscent
    Dim stcRect3 As
    New Drawing.RectangleF(0, sngOffset * f, 796 * f, 120 * f)
    Dim objFormat As
    New Drawing.StringFormat(Drawing.StringFormat.GenericTypographic)
    Call objGraphics.DrawString("Rutger Koperdraad", objFont, Drawing.Brushes.Black, stcRect3, objFormat)
    Rutger Koperdraad.
    Thank you for sharing your solutions and experience here. It will be very beneficial for other community members who have similar questions.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • JButton with Icon question

    In the Toolbar I have a JButtons. I created the JButtons with Icons.
    When I click on a button it is putting a dotted line right around the Icon. How can I get rid of that? Thanks.

    You're talking about the focus rectangle. If memory serves in the SwingSet demo there's an entire panel devoted to buttons and such. You can find something there to help you. The toggle in the example is labeled "Paint Focus", and it does what you want.

Maybe you are looking for

  • Automatic PO from PR

    Hello, I have a requirement while generating auto PO from PR.Normally while using ME59N for auto generation of PO from PR,conditions from info records will be copied into PO. As incoterms are maintained at purchase org /general level, at times wrong

  • Advance features available in sql server 2008 R2 compared with SQL 2008 SP2

    Hi, Can some one brief me the advance features available in sql server 2008 R2 compared with SQL Server 2008 SP2. I am planning to upgrade my existing sql server 2008 SP2 to sql server 2008 R2, before that i need the advantages to proceed , if the ad

  • Creating Caches for faster browsing experiences

    I really like the functionality with spry tabbed panels.  I am creating an online portfolio and in one of my pages, I would like to put up many documents that I have created over the years.  These documents (mainly pdfs) come from the root folder at

  • Battery expanded and burst open-What caused this?

    Hello, I have an early 2008 MacBook Pro.  It still had  the original battery in it which a few months ago started expanding.  At  first I thought it wasn't a big deal but later on it started getting  much bigger until the actual casing of the battery

  • Is Invisishield the only way to keep ur nano perfect?

    I want it to look like a nano, not a mini, and with zcover, its the same size as a mini...