Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3551 > unrolled thread

Drop-Down-Menu in JToolba

Started by"Thorsten Kiefer" <thorsten.kiefer@THRWHITE.remove-dii-this>
First post2011-04-27 15:45 +0000
Last post2011-04-27 15:45 +0000
Articles 5 — 5 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Drop-Down-Menu in JToolba "Thorsten Kiefer" <thorsten.kiefer@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
    Re: Drop-Down-Menu in JTo "John" <john@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
    Re: Drop-Down-Menu in JTo "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
    Re: Drop-Down-Menu in JTo "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
      Re: Drop-Down-Menu in JTo "Evans" <evans@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000

#3551 — Drop-Down-Menu in JToolba

From"Thorsten Kiefer" <thorsten.kiefer@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectDrop-Down-Menu in JToolba
Message-ID<483a9ae2$0$25949$6e1ede2f@read.cnntp.org>
  To: comp.lang.java.gui
Hi,
I've seen drop-down menus in e.g. eclipse, but I don't know how
to create that. It's not possible to add JPopupMenu to JToolbar.

Best Regards
Thorsten

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#3554 — Re: Drop-Down-Menu in JTo

From"John" <john@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: Drop-Down-Menu in JTo
Message-ID<483bb764$0$863$ba4acef3@news.orange.fr>
In reply to#3551
  To: comp.lang.java.gui
Thorsten Kiefer a ocrit :
> Hi,
> I've seen drop-down menus in e.g. eclipse, but I don't know how
> to create that. It's not possible to add JPopupMenu to JToolbar.

You cann add a MouseListener on JToolbar, so you must be able to show a 
popup menu. If isPopupTrigger always return false on JToolbar, you can 
show the popup on mouseReleased for example.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3555 — Re: Drop-Down-Menu in JTo

From"Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: Drop-Down-Menu in JTo
Message-ID<551d8f09-e9f6-4c64-83c6-f2ac8b77bd1e@l28g2000prd.googlegroups.com>
In reply to#3551
  To: comp.lang.java.gui
On May 26, 9:13 pm, Thorsten Kiefer <thorstenkie...@gmx.de> wrote:
...
> ...It's not possible to add JPopupMenu to JToolbar.

Which Java are you using?

Or perhaps I should ask, which JavaDocs are you
*failing* to use?

<sscce>
import javax.swing.*;

class ToolBarWithPopupMenu {

  public static void main(String[] args) {
    Runnable r = new Runnable() {
      public void run() {
        JFrame f = new JFrame();

        JToolBar tb = new JToolBar();
        JPopupMenu popup = new JPopupMenu();
        tb.setComponentPopupMenu( popup );

        for (int ii=0; ii<4; ii++) {
          tb.add( new JButton("" + ii) );
          popup.add( "" + ii);
        }
        f.add( tb );

        f.pack();
        f.setVisible(true);
      }
    };
    java.awt.EventQueue.invokeLater(r);
  }
}
</sscce>

--
Andrew T.
PhySci.org

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3599 — Re: Drop-Down-Menu in JTo

From"Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: Drop-Down-Menu in JTo
Message-ID<k4KdnSy9GuYkUN7VnZ2dnUVZ8tninZ2d@saix.net>
In reply to#3551
  To: comp.lang.java.gui
Thorsten Kiefer wrote:
> Hi,
> I've seen drop-down menus in e.g. eclipse, but I don't know how
> to create that. It's not possible to add JPopupMenu to JToolbar.
> 
> Best Regards
> Thorsten
> 

Sounds like you don't really want a JPopupMenu, but rather a JComboBox?

Rogan

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3600 — Re: Drop-Down-Menu in JTo

From"Evans" <evans@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: Drop-Down-Menu in JTo
Message-ID<e1d87afb-c791-424c-86ff-15d0fa24355e@79g2000hsk.googlegroups.com>
In reply to#3599
  To: comp.lang.java.gui
On Jun 2, 11:37 am, Rogan Dawes <disc...@dawes.za.net> wrote:
> Thorsten Kiefer wrote:
> > Hi,
> > I've seen drop-down menus in e.g. eclipse, but I don't know how
> > to create that. It's not possible to add JPopupMenu to JToolbar.
>
> > Best Regards
> > Thorsten
>
> Sounds like you don't really want a JPopupMenu, but rather a JComboBox?
>
> Rogan

There's a very nice example on how to use JComboBox if that's what
you're after.
http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html

Evans
http://www.onyxtic.com
----
Kettle-Pot-Black

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web