JCombobox with JMenuBar (as drop down menu)

Hello, i'm trying to make a new component (as generic as possible) to display a tree structure in a combo-like style.
So i finally choose a JTextfield to display the current item + a JMenuBar with Menu and MenuItem generated from a TreeModel (i'm not sure this is the better choice to make, but tha's not my present problem).
2 questions :
1) am I reinventing the wheel ???
2) i've got a problem of pack when displaying the compent and i don't find where.
Thanks. Cyril.
So, the code... two main classes : TreeComboBox + ArrowMenu
the TreeComboBox :
package fr.emanation.util.gui.treeComboBox;
import javax.swing.*;
import javax.swing.tree.TreeModel;
import java.awt.*;
import java.awt.event.FocusListener;
public class TreeComboBox<TNode> extends JPanel
  private TNode theSelectedNode;
  private ArrowMenuBar theMenuBar;
  private JTextField theTextField;
  private int theCompactWidth;
  public TreeComboBox(TreeModel aTreeModel)
    new BorderLayout(0, 0);
    theTextField = new JTextField();
    theTextField.setEditable(true);
    theTextField.setBackground(Color.white);
    setFocusable(false);
    add(theTextField, BorderLayout.CENTER);
    MyArrowMenuInvoker anInvoker = new MyArrowMenuInvoker();
    theMenuBar = new ArrowMenuBar<TNode>(anInvoker, aTreeModel);
    JPanel menuBarPanel = new JPanel(new BorderLayout(0, 0));
    menuBarPanel.add(theMenuBar, BorderLayout.CENTER);
    add(menuBarPanel, BorderLayout.EAST);
  public TNode getNode()
    return (TNode) theSelectedNode;
  public void setSelectedNode(TNode aNode)
    theSelectedNode = aNode;
    theTextField.setText(aNode.toString());
  public TreeModel getModel()
    return theMenuBar.getModel();
  public JComponent[] getFocusableComponents()
    return new JComponent[]{theTextField, theMenuBar};
  //-- JComponent overriden methods
  public Dimension getMinimumSize()
    final Dimension minSize = super.getMinimumSize();
    minSize.width = theCompactWidth;
    return minSize;
  public void setCompactWidth(final int aCompactWidth)
    theCompactWidth = aCompactWidth;
  public void setPreferredSize(Dimension aSize)
    super.setPreferredSize(aSize);
    if (theTextField != null)
      theTextField.setPreferredSize(aSize);
  public void setForeground(Color fg)
    super.setForeground(fg);
    if (theMenuBar != null)
      for (int index = 0; index < theMenuBar.getComponentCount(); index++)
        theMenuBar.getComponents()[index].setForeground(fg);
    if (theTextField != null)
      theTextField.setForeground(fg);
  public void setBackground(Color bg)
    super.setBackground(bg);
    if (theMenuBar != null)
      for (int index = 0; index < theMenuBar.getComponentCount(); index++)
        theMenuBar.getComponents()[index].setBackground(bg);
    if (theTextField != null)
      theTextField.setBackground(bg);
  public void setFont(Font aFont)
    super.setFont(aFont);
    if (theMenuBar != null)
      theMenuBar.setFont(aFont);
    if (theTextField != null)
      theTextField.setFont(aFont);
  public void setToolTipText(String aToolTip)
    super.setToolTipText(aToolTip);
    if (theTextField != null)
      theTextField.setToolTipText(aToolTip);
  public void setEnabled(final boolean bEnabled)
    super.setEnabled(bEnabled);
    if (theTextField != null) return;
      theTextField.setEnabled(bEnabled);
      if (bEnabled)
        theTextField.setBackground(Color.WHITE);
      else
        JLabel tmpLabel = new JLabel();
        tmpLabel.setEnabled(false);
        theTextField.setBackground(tmpLabel.getBackground());
    if (theMenuBar != null)
      theMenuBar.setEnabled(bEnabled);
  public synchronized void addFocusListener(FocusListener l)
    super.addFocusListener(l);
    if (theMenuBar != null)
      theMenuBar.addFocusListener(l);
    if (theTextField != null)
      theTextField.addFocusListener(l);
  public synchronized void removeFocusListener(FocusListener l)
    super.removeFocusListener(l);
    if (theMenuBar != null)
      theMenuBar.removeFocusListener(l);
    if (theTextField != null)
      theTextField.removeFocusListener(l);
  public boolean isFocusOwner()
    if (theMenuBar == null || theTextField == null) return super.isFocusOwner();
    boolean bM = (theMenuBar == null) && theMenuBar.isFocusOwner();
    boolean bT = (theTextField == null) && theTextField.isFocusOwner();
    return (bM || bT);
  //-- inner classes
  private class MyArrowMenuInvoker implements IArrowMenuInvoker<TNode>
    public Component getComponent()
      return theTextField;
    public void setNode(TNode aNode)
      setSelectedNode(aNode);
}the ArrowMenuBar :
package fr.emanation.util.gui.treeComboBox;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
import javax.swing.plaf.UIResource;
import javax.swing.tree.TreeModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ArrowMenuBar<TNode> extends JMenuBar
  private NodeMenu theMenu;
  private TreeModel theModel;
  private IArrowMenuInvoker<TNode> theInvoker;
  public ArrowMenuBar(IArrowMenuInvoker<TNode> anInvoker, TreeModel aModel)
    super();
    theModel = aModel;
    theInvoker = anInvoker;
    TNode root = (TNode) theModel.getRoot();
    if (!theModel.isLeaf(root))
      theMenu = new ArrowMenu(root);
      theMenu.setBackground(new JPanel().getBackground());
    MenuItemListener listener = new MenuItemListener();
    setListener(theMenu, listener);
    add(theMenu);
  private void setListener(JMenuItem anItem, ActionListener aListener)
    if (anItem instanceof JMenu)
      JMenu menu = (JMenu) anItem;
      int n = menu.getItemCount();
      for (int index = 0; index < n; index++)
        setListener(menu.getItem(index), aListener);
    else if (anItem != null)
      // null means separator
      anItem.addActionListener(aListener);
  public TreeModel getModel()
    return theModel;
  public Action getLaunchArrowMenuBarAction()
    return new LaunchArrowMenuBarAction();
  //-- overrides JComponent
  public Dimension getPreferredSize()
    return theMenu.getPreferredSize();
  private Dimension getItemSize(JMenu aMenu)
    Dimension dimension = new Dimension(0, 0);
    int n = aMenu.getItemCount();
    for (int index = 0; index < n; index++)
      Dimension itemD;
      JMenuItem item = aMenu.getItem(index);
      if (item instanceof JMenu)
        itemD = getItemSize((JMenu) item);
      else if (item != null)
        itemD = item.getPreferredSize();
      else
        itemD = new Dimension(0, 0); // separator
      dimension.width = Math.max(dimension.width, itemD.width);
      dimension.height = Math.max(dimension.height, itemD.height);
    return dimension;
  //--- inner classes
  private class LaunchArrowMenuBarAction extends AbstractAction
    public LaunchArrowMenuBarAction()
      super("...");
    public void actionPerformed(ActionEvent e)
      if (e.getActionCommand() == "Launch")
        System.out.println("Launch");
  private class MenuItemListener implements ActionListener
    public void actionPerformed(ActionEvent anEvent)
      NodeMenuItem item = (NodeMenuItem) anEvent.getSource();
      theInvoker.setNode(item.getNode());
      theMenu.requestFocus();
  private class NodeMenu extends JMenu
    private TNode theNode;
    public NodeMenu(TNode aNode)
      this(aNode.toString(), aNode);
    public NodeMenu(String theText, TNode aNode)
      super(theText);
      theNode = aNode;
      add(new NodeMenuItem("[.]", aNode));
      for (int index = 0; index < theModel.getChildCount(aNode); index++)
        TNode childNode = (TNode) theModel.getChild(aNode, index);
        if (theModel.isLeaf(childNode))
          add(new NodeMenuItem(childNode));
        else
          add(new NodeMenu(childNode));
    public void setNode(TNode aNode)
      theNode = aNode;
    public TNode getNode()
      return theNode;
  private class NodeMenuItem extends JMenuItem
    private TNode theNode;
    public NodeMenuItem(TNode aNode)
      super(aNode.toString());
      theNode = aNode;
    public NodeMenuItem(String aText, TNode aNode)
      super(aText);
      theNode = aNode;
    public TNode getNode()
      return theNode;
  private class ArrowMenu extends NodeMenu
//    private ArrowIcon theIconRenderer;
    private Color shadow = UIManager.getColor("controlShadow");
    private Color darkShadow = UIManager.getColor("controlDkShadow");
    private Color highlight = UIManager.getColor("controlLtHighlight");
    public ArrowMenu(TNode aNode)
      super("", aNode);
//      theIconRenderer = new ArrowIcon(SwingConstants.SOUTH, true);
      setBorder(new EtchedBorder());
//      setIcon(new BlankIcon(null, 11));
      setHorizontalTextPosition(JButton.LEFT);
      setFocusPainted(true);
    public void paint(Graphics g)
      Color origColor;
      boolean isEnabled;
      int w, h, size;
      w = getSize().width;
      h = getSize().height;
      origColor = g.getColor();
      isEnabled = isEnabled();
      g.setColor(getBackground());
      g.fillRect(1, 1, w - 2, h - 2);
      /// Draw the proper Border
      if (getBorder() != null && !(getBorder() instanceof UIResource))
        paintBorder(g);
      else
        // Using the background color set above
        g.drawLine(0, 0, 0, h - 1);
        g.drawLine(1, 0, w - 2, 0);
        g.setColor(highlight);  // inner 3D border
        g.drawLine(1, 1, 1, h - 3);
        g.drawLine(2, 1, w - 3, 1);
        g.setColor(shadow);     // inner 3D border
        g.drawLine(1, h - 2, w - 2, h - 2);
        g.drawLine(w - 2, 1, w - 2, h - 3);
        g.setColor(darkShadow);   // black drop shadow  __|
        g.drawLine(0, h - 1, w - 1, h - 1);
        g.drawLine(w - 1, h - 1, w - 1, 0);
      // If there's no room to draw arrow, bail
      if (h < 5 || w < 5)
        g.setColor(origColor);
        return;
      // Draw the arrow
      size = Math.min((h - 4) / 3, (w - 4) / 3);
      size = Math.max(size, 2);
      paintTriangle(g, (w - size) / 2, (h - size) / 2,
              size, SwingConstants.SOUTH, isEnabled);
      // Reset the Graphics back to it's original settings
      g.setColor(origColor);
    public Dimension getPreferredSize()
      return new Dimension(16, 16);
    public Dimension getMinimumSize()
      return new Dimension(5, 5);
    public Dimension getMaximumSize()
      return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
    public void paintTriangle(Graphics g, int x, int y, int size,
                  int direction, boolean isEnabled)
      Color oldColor = g.getColor();
      int mid, i, j;
      j = 0;
      size = Math.max(size, 2);
      mid = (size / 2) - 1;
      g.translate(x, y);
      if (isEnabled)
        g.setColor(darkShadow);
      else
        g.setColor(shadow);
      switch (direction)
        case NORTH:
          for (i = 0; i < size; i++)
            g.drawLine(mid - i, i, mid + i, i);
          if (!isEnabled)
            g.setColor(highlight);
            g.drawLine(mid - i + 2, i, mid + i, i);
          break;
        case SOUTH:
          if (!isEnabled)
            g.translate(1, 1);
            g.setColor(highlight);
            for (i = size - 1; i >= 0; i--)
              g.drawLine(mid - i, j, mid + i, j);
              j++;
            g.translate(-1, -1);
            g.setColor(shadow);
          j = 0;
          for (i = size - 1; i >= 0; i--)
            g.drawLine(mid - i, j, mid + i, j);
            j++;
          break;
        case WEST:
          for (i = 0; i < size; i++)
            g.drawLine(i, mid - i, i, mid + i);
          if (!isEnabled)
            g.setColor(highlight);
            g.drawLine(i, mid - i + 2, i, mid + i);
          break;
        case EAST:
          if (!isEnabled)
            g.translate(1, 1);
            g.setColor(highlight);
            for (i = size - 1; i >= 0; i--)
              g.drawLine(j, mid - i, j, mid + i);
              j++;
            g.translate(-1, -1);
            g.setColor(shadow);
          j = 0;
          for (i = size - 1; i >= 0; i--)
            g.drawLine(j, mid - i, j, mid + i);
            j++;
          break;
      g.translate(-x, -y);
      g.setColor(oldColor);
}

Darkness and blindness are away !
First line of the constructor :
public TreeComboBox(TreeModel aTreeModel)
    new BorderLayout(0, 0);
}I will reborn as a pumpkin !

Similar Messages

  • Problems with mm_menu.js (drop-down menu)

    I've made a couple of sites with mm_menu.js (drop-down menu) made by Dreamweaver. It works fine in Firefox, Google Chrome. It worked fine in Internet Explorer up to version 9. In version 10 the mm_menu.js doesn't show at all, and in version 11 it does
    show up, but places itself in the upper left corner of the browser. Can anyone explain why this is so? Is there any fix one can put in the code to make the drop-down menu look correct?

    This is the TechNet Forum for Questions regarding Internet Explorer 8, 9, 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions.
    For better assistance please ask for help in the MSDN IE Development Forums.
    Thanks & Regards,
    Vincenzo Di Russo
    Microsoft® MVP Windows Internet Explorer, Windows & Security Expert - since 2003.
    Moderator in the Microsoft Community and TechNet Forums
    My MVP Profile

  • I can't seem to open additional tabs with the +, the drop down menu, or Command T? Is this a bug, or am I missing something?

    Hello,
    I can't seem to open additional tabs with the +, the drop down menu, or Command T? Is this a bug, or am I missing something?
    I'm running Firefox 30.0 in OS 10.8.5 on a Mac Book Pro with the 2.7 GHz Intel Core i7 and 8GB 1333 MHz DDR3 memory.
    Thanks in advance,
    Pat

    BOOM! You have hit the nail on the head, sir!
    I disabled my Vuze Remote Community Toolbar and the problem was fixed.
    Thank you, the-edmeister!!!!

  • Problem with checkbox and drop down menu

    I am using DW8 with PHP/MySQL.
    I made a insertion form and a couple of the fields are
    checkboxes and another is a drop down menu. Everything works fine,
    however, when I create an update form and the recordset calls the
    data it doesn't retain its values on those items.
    For example, if I checked a box when inserting the record and
    then call the data up for the update form, the box is not checked,
    making the user believe it was never checked in the first place.
    The same thing goes for the drop down menu. If I have 3
    options in the menu and someone selects the third one, when the
    update form is used it defaults to the first option automatically
    instead of actually calling up the original value selected.

    The fact that two scripts do not work together does not mean
    there is a bug in the RH script. It is simply that they were not
    designed by their respective developers to work together. This
    happens with multiple scripts in any html file.
    Try creating a new project and then importing just this topic
    into it. Does it still have the problem?

  • Problems with flash transparent drop down menu over html in some browsers

    Hi everyone... this is my first post and it's about an issue
    that's causing me a few problems.
    I'm currently designing/ building my company's web site, the
    test page be viewed here: www.musflashtv.com/test.htm
    1) This layout contains an embeded flash movie (.swf) with a
    transparent background, this is the main navigation.
    The flash navigation has a drop down menu that animates down
    and covers the html page (containing links) below.
    The problem is that in most current browsers such as; Firefox
    2.0.05 (links below template don't work), Netscape 8.1.3
    (navigation drop down and links don't work) and Opera 9.10 (links
    below template don't work), any links just below the 'invisible'
    transparent area coverd by the navigation can't be clicked 'through
    the flash file'. The exception is IE 7.0, everything is fine there.
    (it hasn't been tested in any mac browsers though).
    Because the area below the navigation on
    www.kitachi.info/work is one large dummy jpeg file, the link below
    would be a much better example to look at.
    http://www.musflashtv.com/shows/ind...tlight-Sessions
    The flash navigation is embedded in the html (tlp) template
    file using the code below and aligned using an external style
    (.css) sheet, this html code not only embeds the flash movie but it
    also tells the browser to display it's background and as
    transparent. The flash movie is embedded in a layer that sits above
    the table.
    3) The flash embed code:
    <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
    name="shows-navigation-tranparent" width="851" height="300"
    align="top" class="flash-navigation"
    id="shows-navigation-tranparent">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie"
    value="flash/navigation-tranparent.swf" />
    <param name="quality" value="high" />
    <param name="wmode" value="transparent" />
    <param name="bgcolor" value="#000000" />
    <param name="SCALE" value="exactfit" />
    <embed src="flash/navigation-tranparent.swf" width="851"
    height="300" align="top" quality="high" wmode="transparent"
    bgcolor="#000000" name="navigation-tranparent"
    allowscriptaccess="sameDomain" type="application/x-shockwave-flash"
    pluginspage="
    http://www.macromedia.com/go/getflashplayer"
    scale="exactfit" />
    </object>
    Does anybody know of any code that can solve this problem or
    know a different way of creating a flash navigation with a drop
    menu that can be embeded over html?
    Any help or advice would be greatly appreciated especially as
    this issue is holding back progress in a big way.
    Thanks in advance guys!
    Adie

    It's IE-only behaviour as a result of changes Microsoft made
    last
    year to their browser, regarding how Active Content (Flash,
    Quicktime etc)
    is handled, after losing a high profile court case.
    http://blog.deconcept.com/2005/12/15/internet-explorer-eolas-changes-and-the-flash-plugin/
    Background:
    http://en.wikipedia.org/wiki/Eolas
    See also
    http://www.adobe.com/devnet/activecontent/
    If you're running Dreamweaver 8.0.2, the fix is already built
    into DW's
    interface.
    If not, try
    http://blog.deconcept.com/swfobject/
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "swizzle_16" <[email protected]> wrote in
    message
    news:eqr0ib$48r$[email protected]..
    > Help please, I've put together a website using a drop
    down menu system
    > that
    > needs to drop down over a flash animation - I've managed
    to get the drop
    > downs
    > to go in front of the animation using the transparent
    tag - but each
    > option has
    > to be clicked on twice to get the link to work.
    >
    > Does anyone know how I can change it so the link needs
    to be only clicked
    > once?
    > The drop down menu system I've used is : * AnyLink Drop
    Down Menu- ©
    > Dynamic
    > Drive (www.dynamicdrive.com)
    >

  • Can't Block Person in iChat, with task bar drop down menu in Buddies.

    Hello : )
    I was wondering if anyone knows how i can use my "Block Person", on iChat (task bar with drop down menu in Buddies). I am pretty sure this worked has worked before , the command is there it just seems to stay greyed out. I know it can be done in the Security tab / ichat preferences, I would like it to work under the Buddies drop down as well. I know it did before, my HD was replaced. Help would be most appreciated.
    Thank you for your time.
    Eme;~[)

    Hi Eme,
    Ok. iChat 3 has a setting that needs to be set if you are going to use the same screen name on two copmuters or on two apps on the same computer.
    Go to iChat > Preferences > Accounts
    Select the AIM account in question in the left hand column
    Select the Account Info tab.
    Log out of AIM (iChat menu)
    Check the check box "Allow Multiple Logins for This Account"
    Log back into AIM.
    If this is not checked starting iChat 3 will boot off (log out) any other AIM Client using the same screen name whether it is on the same computer or not
    From what the ISP says and what you have posted here it seems the modem is in Bridge mode.
    I take it if you open System Preferences > Network > Select Airport from the second drop down > TCP/IP tab you IP is shown as 10.0.1.2 ?
    And the drop down just above that says "USING DHCP" ?
    This would mean the Airport is in default mode and Issuing Addresses.
    Also by default an Airport would do NAT. (Network Address Translation)
    This measn the Airport sorts out where each bit of data has to go.
    It is different from other routers as you don't have the specify which ports are going to whch ports on one IP (Port Forwarding)
    Which Netopia device is it ?
    3347 ?
    If it is this one you may need to look at the QoS settings.
    These are setings that are supposed to protct you form reciveing data too quickly. (helpful if you are running a busy web site but restrictive sometimes for iChat).
    As you are omly talking about sorting out Block lists it is prpobably the multiple login option that needs doing.
    5:40 PM Wednesday; June 14, 2006

  • Help with jsp  and drop down menu

    hi, im tryin to put a drop down menu using javascript, is the example in the page:
    http://tutorials.alsacreations.com/deroulant/
    but creator detects a error:
    The content of elements must consist of well-formed character data or markup.
    int creator and when i deply the proyect, here is the code:
    <script type="text/javascript">
    <!--
    window.onload=show;
    function show(id) {
    var d = document.getElementById(id);
         for (var i = 1; i<=10; i++) {        -------------------------------------- Here is the error -----------------
              if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
    if (d) {d.style.display='block';}
    //-->
    </script>
    Can anybody tell me what im doing wrong?

    hi,
    Creator does not recognize (or whatever you say) characters like '<'. You can import js file which includes your script or change these characters for example put "<" instead of "<".
    regards...

  • Help with multi column drop down menu

    HI all,
    I am attaching an image from the ESPN web site, in the hopes that someone sheds some light on what is the name of the pull down menu that is shown there?
    and how you go about creating such menus, even larger (even as wide as the Navigation bar itslef)?
    thanks!

    Multi-Column Drop-Down Menus:
    Plug-in for jQuery -
    http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm
    CSS Play has another version -
    http://www.cssplay.co.uk/menus/multi-column.html
    DHTML - multicolumn menu: (30 day trial + purchase)
    http://dhtml-menu.com/menu/dhtml-pulldown-menu-multicolumn-sample.html
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • My iphone 5 running with latest os drop down menu does not work sometimes and i have to reset settings to get it back working..Anyone can tell me why?Your help will be highly appreciated.

    Help! Help! Help!

    The one which we slide our finger down from top. The one with weather info,stock info etc etc..

  • "Open With" drop-down menu has multiple instances of apps

    When I right-click on a file and select "Open With", the resulting drop-down menu contains many, many multiple instances of the same app - five Firefox's, five Quicktime Player's, at least three instances of every relevant app. Why is that happening, and how can I clean that menu up?

    I happen to have the same problem. However I cannot find the two files in step two:
    2.
    Trash the following two files in the Macintosh HD > Library > Caches folder:
    * com.apple.LaunchServices-0140.csstore
    * com.apple.LaunchServices-014nnn.csstore
    I did input my UID number as you are told to do so in the instructions. The only I can find is the one in step six a:
    6.
    Verify that the problem is solved. If not:
    1. Trash the com.apple.LaunchServices.plist file in the Home > Library > Preferences folder of the affected account. See Note [3].
    Is there a reason as to why I cannot find those files? Oh and I did delete it; all it did was reset the file associations.
    Thank you for taking the time to read this post. May your loins be blessed with fertility.
    PowerBook6,8   Mac OS X (10.4.8)  

  • Can't synch my new iPod nano to itunes - the drop down menu is grayed out - what can I do?

    Can't synch my new ipod nano with itunes - the drop down menu is grayed... what am I doing wrong?

    Hello Bridgie\'s girl
    Try out the 5r’s section to resolve issues with your iPod nano not syncing. A simple restart my fix it or you may need to restore it all together.
    iPod nano (7th generation): Hardware troubleshooting
    http://support.apple.com/kb/TS4433
    Regards,
    -Norm G. 

  • Using a drop down menu as navigation

    Good morning all!
    I have been struggling with making a drop down menu work as navigation for a while and finally need to reach out to all you brilliant people on this forum. 
    I currently have a drop down menu with three items(Nav1, Nav, 2, Nav3) corresponding to three pages(Screen1, Screen2, Screen3). When I first created the menu it seemed I could only use the OnChange option to use navigation with the menu because, when using
    the OnSelect I only get these options:
    If(Datasource!Selected!Title
    /// and ///
    If(Datasource!Selected!Value
    If I use the first option the title listed on my data source doesn't work, I get the red squiggly line. If I use the second option (Value) I have no value listed in my data source. 
    Therefore I used the OnChange option, I can get the menu to navigate to the first page, however I realized that this option chances to one single page no matter what the menu option changes to.
    Does anyone know how to make a drop down into a fully functioning navigation menu?
    The other issue I ran into was resetting the drop down to the first list item upson returning to the screen however,   ptr.chovan,
    offered this working solution:
    set a variable in screen1 property OnVisible
    UpdateContext({active: true})
    and in screen1 property OnHidden
    UpdateContext({active: false})
    Then in dropdown visual add this in Items
    If(active=true, .... your data source here ...)
    Or perhaps easiest way is instead of resetting datasource of dropdown, you can reset  dropdown default by adding this into Default property
    of dropdown
    If(active=true, "Screen1")

    If your Items in dropdown1 are
    ["Nav1", "Nav2", "Nav3"]
    Then use OnChange property of the dropdown1
    If(Dropdown1!Selected!Value="Nav1", Navigate(Screen2,""), Dropdown1!Selected!Value="Nav2", Navigate(Screen3,""), Dropdown1!Selected!Value="Nav3", Navigate(Screen4,""))
    Does the other solution of resetting dropdown helped you?

  • Creating a new drop down menu when an option in an existing one is chosen

    I’m using Coldfusion 9,0,0,251028 on Windows 7 64-bit, with a Microsoft Access 97 database. 
    I’m having a problem with using a drop-down menu to create another one below it once a certain option is selected
    (in this case, the option named “Breaking News”, which has an id of 31).
    What event trigger should I use to create a drop-down menu underneath the first one when “Breaking News” is selected? 
    Should I be using Javascript for something like this, or can Coldfusion handle it?
    Here’s the code:
    <cfquery name="get_info" datasource="#db#">
    select * from lists
    order by department asc, list asc
    </cfquery>
    <div align="left">
              <select name="list">
                     <option value="-1" selected> --------------------------------------  
                     <cfoutput query="get_info" group="department">
                            <cfoutput group="list">
                 <cfif list neq "Breaking News Cell Phone">
                         <option value="#id#">#list#
                 </cfif>
                            </cfoutput>
                  <option value="-1"> --------------------------------------
                     </cfoutput>
              </select>
    </div>

    Depending on the details, I might use ColdFusion to create the content of the second drop down.
    The second drop-down is supposed to be an expiration date that gets attached to the message so it can be self-removing.
    The first drop-down is to specify a category for a message to be sent out on.
    In this case, the only one that needs the secondary expiration drop-down is a single category (Breaking News),
    so all other options on the drop-down would have to not trigger the expiration date drop-down showing.
    In that situation, would you use ColdFusion to create the second drop down?

  • Updating drop down menu depending on another drop down menu

    Hi!
    I'm making this questionnaire, and it has 10 questions (q01 to q10).
    Each question has 4 sub-questions with an associated drop-down menu (q01L1 to q01L4, q02L1 to q02L4, etc.).
    The values available to select from the drop-down menu are: 1, 2, 3, and 4.
    For each sub-question, the user has to select a value (1, 2, 3, or 4), and that value can only be selected once for each question as a whole.
    I suppose that JavaScript will be able to remove, update, or rebuild the other drop-down menus according to the answer given to each sub-question. How can it be achieved? I have no idea how to make that happen. Could you help?
    Thanks.
    For example :
    This is what the user actually see BEFORE filling the question :
    Question 1 : When disagreeing on points of view, I get influenced by
    [Drop-down menu 1] : The tone/volume of voice of the person with whom I speak.
    [Drop-down menu 2] : My capability or incapability to understand the point of view of the person with whom I speak.
    [Drop-down menu 3] : The logic and the rationale on which the person with whom I speak bases his/her opinion.
    [Drop-down menu 4] : Whether or not the person with whom I speak is sensible to what I may feel.
    The following is for you to visualise the way I named the fields in the PDF questionnaire :
    q01 : When disagreeing on points of view, I get influenced by
    q01L1 {1,2,3,4} : The tone/volume of voice of the person with whom I speak.
    q01L2 {1,2,3,4} : My capability or incapability to understand the point of view of the person with whom I speak.
    q01L3 {1,2,3,4} : The logic and the rationale on which the person with whom I speak bases his/her opinion.
    q01L3 {1,2,3,4} : Whether or not the person with whom I speak is sensible to what I may feel.
    q01 = the name I gave to the question 1
    L1 = the name I gave to the sub-question 1
    q01L1 = the name I gave to the drop-drop menu of the sub-question 1 of the question 1
    {1,2,3,4} = the answers the user can select from the menu.
    The user can answer :
    4 : The tone/volume of voice of the person with whom I speak.
    2 : My capability or incapability to understand the point of view of the person with whom I speak.
    1 : The logic and the rationale on which the person with whom I speak bases his/her opinion.
    3 : Whether or not the person with whom I speak is sensible to what I may feel
    But cannot answer :
    4 : The tone/volume of voice of the person with whom I speak.
    2 : My capability or incapability to understand the point of view of the person with whom I speak.
    1 : The logic and the rationale on which the person with whom I speak bases his/her opinion.
    4 : Whether or not the person with whom I speak is sensible to what I may feel
    This is where the JavaScript comes into play. What can be done to remove, update, or rebuild the other drop-down menus according to the answer given to each sub-question?
    If the user answers 4 to q01L1, the 3 other drop-down menus should look like this
    4 : The tone/volume of voice of the person with whom I speak.
    q01L2 {1,2,3} : My capability or incapability to understand the point of view of the person with whom I speak.
    q01L3 {1,2,3} : The logic and the rationale on which the person with whom I speak bases his/her opinion.
    q01L3 {1,2,3} : Whether or not the person with whom I speak is sensible to what I may feel.
    And then, if the user answers 2 to q01L2, the 2 last drop-down menus should look like this
    4 : The tone/volume of voice of the person with whom I speak.
    2 : My capability or incapability to understand the point of view of the person with whom I speak.
    q01L3 {1,3} : The logic and the rationale on which the person with whom I speak bases his/her opinion.
    q01L3 {1,3} : Whether or not the person with whom I speak is sensible to what I may feel.
    And so on.
    Message was edited by: einsteinbqat

    I'm sure that question is an FAQ in whatever language you're asking about. But you should really find the forum for that language. This is the forum for Java programming and that ain't Java.

  • Responsive Drop Down Menu Issues

    I'm having a few issues with my responsive drop down menu.  I'm trying to make one row with 2 separate menus that show up next to each other.  The left side is general a menu and the right side is social media links.  I have them functioning with 2 major issues.  First, I can't seem to get my background (black) go across the entire page.  It stops between the 2 menus.  Second, When I shrink down to a phone size browser and replace the menu with a drop down menu, my images (I'm using images instead of text so that I can use a specific font) expand to fit the space.  I want them all to show up as the proper size and want the drop down menu to be right next to the social media links.  Here's a link to the page so you can see what I am talking about.  My HTML and CSS are below.  Thanks.
    HTML
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>J.Rad</title>
    <link type="text/css" rel="stylesheet" href="main.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
    <header><img src="Background-Images/Sick-Fantasy-Banner.png" alt="Banner Image"></header>
    <div id="menus">
    <nav id="nav" role="navigation">
        <a href="#nav" title="Show navigation"><img src="Background-Images/Menu.png" alt="Menu"></a>
        <a href="#" title="Hide navigation"><img src="Background-Images/Menu.png" alt="Menu"></a>
        <ul>
            <li><a href="/"><img src="Background-Images/News.png" alt="News"></a></li>
            <li><a href="/"><img src="Background-Images/Bio.png" alt="Bio"></a></li>
            <li><a href="/"><img src="Background-Images/Tour.png" alt="Tour"></a></li>
            <li><a href="/"><img src="Background-Images/Store.png" alt="Store"></a></li>
            <li>
                <a href="/" aria-haspopup="true"><img src="Background-Images/Media.png" alt="Media"></a>
                <ul>
                    <li><a href="/"><img src="Background-Images/Music.png" alt="Music"></a></li>
                    <li><a href="/"><img src="Background-Images/Photos.png" alt="Photos"></a></li>
                    <li><a href="/"><img src="Background-Images/Videos.png" alt="Videos"></a></li>
                </ul>
            </li>
            <li><a href="/"><img src="Background-Images/Contact.png" alt="Contact"></a></li>
        </ul>
    </nav>
    <nav id="social" role="navigation">
        <ul>
            <li><a href="/"><img src="Background-Images/Instagram.png" alt="Instagram"></a></li>
            <li><a href="/"><img src="Background-Images/YouTube.png" alt="YouTube"></a></li>
            <li><a href="/"><img src="Background-Images/Twitter.png" alt="Twitter"></a></li>
            <li><a href="/"><img src="Background-Images/Facebook.png" alt="Facebook"></a></li>
        </ul>
    </nav>
    </div>
    <div class="clearfix"></div>
    <div id="container">
    <section id="left-column">
      This is the left column session for main content
    </section>
    <aside id="right-column">
    <div class="widget_iframe" style="display:inline-block;width:100%;height:185px;margin:0;padding:0;border:0;"><iframe class="widget_iframe" src="http://www.reverbnation.com/widget_code/html_widget/artist_420387?widget_id=54&amp;posted_ by=artist_420387&pwc[design]=customized&pwc[background_color]=%23000000&pwc[size]=fit" width="100%" height="100%" frameborder="0" scrolling="no"></iframe><div class="footer_branding" style="margin-top:-5px;font-size:10px;font-family:Arial;"></div></div><br />
    <div class="widget_iframe" style="display:inline-block;width:100%;height:185px;margin:0;padding:0;border:0;"><iframe class="widget_iframe" src="http://www.reverbnation.com/widget_code/html_widget/artist_420387?widget_id=53&amp;posted_ by=artist_420387&pwc[design]=customized&pwc[background_color]=%23000000&pwc[size]=fit" width="100%" height="100%" frameborder="0" scrolling="no"></iframe><div class="footer_branding" style="margin-top:-5px;font-size:10px;font-family:Arial;"></div></div>
    </aside>
    </div>
    <footer>
    </footer>
    </body>
    </html>
    CSS
    @charset "UTF-8";
    /* CSS Document */
        margin: 0; 
        padding: 0; 
    body {
      height:100%;
      background-attachment: fixed;
      background-image: url(Background-Images/Sick-Fantasy-Background.png);
      background-position: center top;
      background-size:cover;
    header {
      overflow:auto;
      background-size:cover;
      background-image: url(Background-Images/Rust-and-Foamy-Blood-Texture.png);
      background-position: center;
    header img { 
        display: block; 
        margin: auto; 
    img {
      max-width:100%;
    div {
      width:100%;
      background-color:#000000;
      background-size:cover;
    #nav
      width: 70%; /* 1000 */
      position: absolute;
      background-color:#000000;
      background-size:cover;
      #nav > a
      display: none;
      #nav li
      position: relative;
      #nav li a
      display: block;
      #nav li a:active
      background-color: #996600 !important;
      #nav span:after
      display: inline-block;
      position: relative;
      /* first level */
      #nav > ul
      background-color: #000000;
      margin-left:25px;
      #nav > ul > li
      float: left;
      list-style:none;
      #nav > ul > li > a
      height: 100%;
      #nav > ul > li:hover > a,
      #nav > ul:not( :hover ) > li.active > a
      background-color: #996600;
      /* second level */
      #nav li ul
      background-color: #e15a1f;
      display: none;
      position: absolute;
      #nav li:hover ul
      display: block;
      #nav li:not( :first-child ):hover ul
      left: -1px;
      #nav li ul a
      #nav li ul li a:hover,
      #nav li ul:not( :hover ) li.active a
      background-color: #996600;
    #social
      float:right;
      background-color:#000000;
      background-size:cover;
      #social > a
      display: none;
      #social li
      position: relative;
      #social li a
      display: block;
      #social li a:active
      background-color: #996600 !important;
      #social span:after
      display: inline-block;
      position: relative;
      /* first level */
      #social > ul
      background-color: #000000;
      margin-right:25px;
      #social > ul > li
      float: right;
      list-style:none;
      #social > ul > li > a
      height: 100%;
      #social > ul > li:hover > a,
      #social > ul:not( :hover ) > li.active > a
      background-color: #996600;
    .clearfix {
        clear:both;
        display:block;
    #container {
      max-width:960px;
      width:960px;
      margin-top:10px;
      margin-left:auto;
      margin-right:auto;
      margin-bottom:auto;
    #left-column {
      width:590px;
      float:left;
      background:#0000FF;
      padding:5px;
      margin:auto;
    #right-column {
      width:350px;
      float:left;
      padding:5px;
      margin:auto;
    .clearfix {
        clear:both;
        display:block;
    footer {
      background-color: #000;
      background-size:cover;
    @media screen and (max-width:959px) {
      #body {
         width:100%;
      #header {
         width:100%;
      #container {
      width:100%;
      #left-column {
      width:60%;
      #right-column {
      width:30%;
      img {
      width:100%;
    @media screen and (max-width:640px) {
      #nav
            width:50%;
      position: relative;
            #nav > a
            #nav:not( :target ) > a:first-of-type,
            #nav:target > a:last-of-type
                display: block;
        /* first level */
        #nav > ul
            display: none;
            position: absolute;
            #nav:target > ul
                display: block;
            #nav > ul > li
      float: none;
      list-style:none;
        /* second level */
        #nav li ul
            position: static;
      #left-column {
      width:100%;
      margin:0;
      padding:0;
      #right-column {
      width:100%;
      margin:0;
      padding:0;
    @media screen and (max-width:300px) {
      #header {
         width:100%;
      background-size:cover;
      #container {
      width:100%;

    #nav {
        <!--width: 70%;--> /* 1000 */
        width: 100%;
        position: absolute;
        background-color: #000;
        background-size:cover;

Maybe you are looking for

  • Creative Cloud wie auf zwei Rechnern nutzen?

    Hallo, ich habe gestern die Creative Cloud erworben. Ich arbeite im Büro mit einem iMac und zu Hause mit einem MacBook. Auf dem iMac konnte ich alles ohne Probleme installieren, auf dem MacBook bietet mir die Creative Cloud nur Testversionen des Crea

  • Troublesho​oting a paper jam and print cradle.

    Hi The print cradle cannot sometimes move to it's right position in my HP All-in-one Photosmart C3180 printer. I have tried several things and also been talking to customer support in Norway and in the U.S. about my isssues with the printer. It seems

  • Setting a label with the text from cmd

    I know that label.setText("sdf"); usually prints out what ever we set in the label. But what i need help in is actually to get the text from the command prompt and print it unto the label. I'm doing a school project that requires users to click a GUI

  • Sql script

    I am trying to create a partitioning script for my erg_kwh_log table and i have this table in many schemas, what i want is the before running the partitions command a pl/sql block should check whether the existing table is partitioned or not, so for

  • IPad2 will not connect to wifi unless it is in the same room

    I live in the UK. Yesterday I bought a new ipad2. It will only connect to my wifi when it is in the same room. When it is less than 2 metres form the router, it drops one bar, and when I go out of the room it drops connection completely. I have an ip