Results 1 to 10 of 10
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Google Style Button - Has it been done before?

  1. #1
    SilentSoul is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default Google Style Button - Has it been done before?

    Hello,

    I hope this question hasn't been answered yet, I'm kind of uncertain as to how to search for what I want.

    Everyone using gmail has probably noticed those nice buttons that enable you to select/deselect all/some emails. Now my question is, is there a Swing component that behaves like that?

    For those of you without a gmail account, here a short description of what this button should do:

    After a click of the button a drop-down list opens and the user can make a selection. Other than in regular drop-down menus, there is no TextField where the selection is shown (just a plain button).

    Admittedly, I could probably just create my own implementation of JComboBox to achieve something similar than that, but I'm kind of stuck on how to remove the TextField from this component.

    Any Ideas? I'll be glad for any suggestions.

    ~Clemens

  2. #2
    JavaForums's Avatar
    JavaForums is offline Administrator
    Join Date
    Dec 2006
    Posts
    876
    Rep Power
    10

    Default

    I did not understand the unique property of the component you are trying to describe. But Google web services use GWT. Check GWT components. You might find your answer there. But i guess it is not possible to use GWT in a swing application. In that case you can try SWT :) In the worst case, you can implement it in Swing starting from the lowest level as you described...

  3. #3
    SilentSoul is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default

    Sorry for my bad description, I just noticed that this behaviour is very similar to some buttons on this very forum - for example the 'Forum Actions' and 'Quick Links' Buttons at the top navigation bar. How would I do this in Java (without going from the bottom up if possible)?

  4. #4
    JavaForums's Avatar
    JavaForums is offline Administrator
    Join Date
    Dec 2006
    Posts
    876
    Rep Power
    10

    Default

    I didnt think it is a bad description...

    In swing, if you cant obtain what you are looking for by customizing an existing component with its own methods, you should develop your own component or find one that is already developed somewhere else.

    Check following page for third-party swing components:

    Swing Depot: Component Suites

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    They're JMenus (or equivalent) aren't they?
    Here's the tutorial.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

  7. #7
    SilentSoul is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default Thanks

    Thanks that put me on the right track, I'm gonna take a look at Jidesoft's components.

    Appreciate all the help,

    cheers,
    C

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default

    I still don't see why a bog standard JMenu doesn't work for you:
    Java Code:
        private static JMenuBar createMenuBar() {
            JMenuBar bar = new JMenuBar();
            JMenu menu = new JMenu();
            bar.add(menu);
            menu.setIcon(new ImageIcon("arrow_down_blue.gif"));
            JMenuItem menuItem = new JMenuItem("Something");
            menu.add(menuItem);
            return bar;
        }
    That will create a menu bar, with a menu in it that is identified solely by that graphic, with a text menu item.

  9. #9
    SilentSoul is offline Member
    Join Date
    Jun 2011
    Posts
    4
    Rep Power
    0

    Default

    Hi,

    Admittedly that works just as the button I described, but the 'look and feel' would be different. Anyways, I decided to use NetBeans DropDownButton, which looks exactly like I expected.

    ~C.

  10. #10
    jbk
    jbk is offline Member
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Default Re: Google Style Button - Has it been done before?

    Hi,

    I think I need exactly what is discribed here. Could someone provide me with the code snippet ??

    ~JBK

Similar Threads

  1. Change GUI Window Style in netbeans
    By helptoall in forum NetBeans
    Replies: 1
    Last Post: 03-23-2011, 06:31 AM
  2. Replies: 1
    Last Post: 10-31-2010, 08:41 PM
  3. Making a picture Warhol Style
    By chick in forum New To Java
    Replies: 4
    Last Post: 04-13-2010, 10:08 PM
  4. Long boolean coding style
    By Aldius in forum New To Java
    Replies: 10
    Last Post: 10-23-2009, 01:51 AM
  5. Cascading Style Sheets
    By smart in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 12-27-2008, 06:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •