Can't get menu items to be displayed

Hello,
The answer to my problem is probably quite simple but I can't see it and its driving me crazy, basically I can't get my menu items to be displayed like file, create and search. But what ever I add to the file menu items like open or save isn't displayed and I don't know why I think it may have to do with the action listeners but I'm not sure how or why or it could be because of where it is placed in the code, but again I'm not sure. Any help will be appreciated thanks!
import javax.swing.*;
import javax.swing.event.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.GeneralPath;
import java.awt.geom.*;
import java.awt.image.*;
class CharacterEditor2 extends JFrame implements ActionListener
  private Container pane;
  public JPanel sidebar = new JPanel();
public JPanel library;
  public JPanel interface1 = new JPanel();
  private JPanel interface2 = new JPanel();
  public JPanel cards = new JPanel();
  public CardLayout layout = new CardLayout();
  public JButton headb = new JButton ("Head");
  public JButton bodyb = new JButton ("Body");
  private JButton legsb = new JButton ("Legs");
  private JButton handsb = new JButton ("Hands");
  private JButton freeHandb = new JButton ("Free Hand");
  private JButton eyesb = new JButton ("Eyes");
  private JButton mouthb = new JButton ("Mouth");
  private JButton earsb = new JButton ("Ears");
  private JButton noseb = new JButton ("Nose");
  private JButton hairb = new JButton ("Hair");
  public CharacterEditor2()
    addWindowListener(new WindowAdapter(){
      public void windowClosing(WindowEvent e){
        System.exit(0);}});
    pane = getContentPane();
    setTitle("JHH");
    library = new library();
    interface2.setBackground(Color.red);
    interface1.setBackground(Color.green);
    Panel p1 = new Panel();
    p1.setLayout(new GridLayout(2,0));
    sidebar.setLayout(new GridLayout(3,0));
    addButton(sidebar, headb);
    addButton(sidebar, bodyb);
    addButton(sidebar, legsb);
    addButton(sidebar, handsb);
    addButton(sidebar, freeHandb);
    addButton(sidebar, eyesb);
    addButton(sidebar, mouthb);
    addButton(sidebar, earsb);
    addButton(sidebar, noseb);
    addButton(sidebar, hairb);
    JMenuBar menuBar = new JMenuBar();
    this.setJMenuBar(menuBar);
    JMenu fileMenu = new JMenu("File");
    menuBar.add(fileMenu);
    JMenuItem openMI = new JMenuItem("Open");
    openMI.addActionListener(this);
    fileMenu.add(openMI);
    JMenuItem saveMI = new JMenuItem("Save");
    saveMI.addActionListener(this);
    fileMenu.add(saveMI);
    JMenuItem closeMI = new JMenuItem("Close");
    closeMI.addActionListener(this);
    fileMenu.add(closeMI);
    fileMenu.addSeparator();
    JMenuItem exitMI = new JMenuItem("Exit");
    exitMI.addActionListener(this);
    fileMenu.add(exitMI);
    JMenu createMenu = new JMenu("Create");
    menuBar.add(createMenu);
    JMenuItem entryMI = new JMenuItem("Entry");
    entryMI.addActionListener(this);
    createMenu.add(entryMI);
    JMenu searchMenu = new JMenu("Search");
    menuBar.add(searchMenu);
    JMenuItem searchCharacterMI = new JMenuItem("Search by Character");
    searchCharacterMI.addActionListener(this);
    searchMenu.add(searchCharacterMI);
    JMenuItem searchBackgroundMI = new JMenuItem("Search by Background");
    searchBackgroundMI.addActionListener(this);
    searchMenu.add(searchBackgroundMI);
    JMenuItem searchMovieMI = new JMenuItem("Search by Movie.");
    searchMovieMI.addActionListener(this);
    searchMenu.add(searchMovieMI);
    p1.add(sidebar);
    p1.add(interface1);
    p1.add(interface2);
    p1.add(library);
   //add scroller to library
   JScrollPane scroller =
         new JScrollPane(library,    
                   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
                   JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
     scroller.setPreferredSize(new Dimension(100,100));
     p1.add(scroller, library);
    pane.add(p1, BorderLayout.CENTER);
  private void addButton (Container c, JButton b)
    b.addActionListener(this);
    c.add(b);
  public void actionPerformed(java.awt.event.ActionEvent evt)
((CardLayout)library.getLayout()).show(library, evt.getActionCommand());
  public static void main(String[] args)
    CharacterEditor2 window = new CharacterEditor2();
    window.setTitle("Character Editor");
    window.setSize(900, 700);
    window.setVisible(true);
}

It's because you are mixing Swing components and AWT components. The menu items are actually displayed, but they are hidden behind the panel with all the buttons. Things will work fine if you change the following line:
Panel p1 = new Panel();  // This is an AWT panel. Use this instead:
JPanel p1 = new JPanel();Read more about it here:
http://java.sun.com/products/jfc/tsc/articles/mixing/

Similar Messages

  • I can't access menu items, nor use mouse right click

    I'm using Ubuntu 9.10 and all of a sudden I cant use the mouse to access the menu items, nor use the right click menus. I can click on button and links with the left button, but right clicking on a link does not bring up the usual menu. I recall this happening in the past, but an exit and restart of the program cleared it up. Reboot are not fixing the problem, nor reinstallation ( after removal).

    It seems it could be a profile corruption issue, but not quite!
    I was having the same issue (I'm running Lucid Lynx) and after starting Firefox with the -profilemanager option and using the default profile, I was able to access the menu items and get a right-click options menu. I then shutdown Firefox and restarted with my regular profile and it is now working just fine!
    A little weird, but hey, I can access the menu items as per normal.
    FYI: I had to purge and reinstall Adobe Flashplugin just yesterday then today I got this problem soon after one application crashed in Wine - not sure if all these things are related though!
    Ciao,
    ak.

  • Adobe reader xi i am running 2 display screens and when i have a file open and go to print the print page opens on my second screen.  How can I get adobe reader to just display on one screen?

    adobe reader xi i am running 2 display screens and when i have a file open and go to print the print page opens on my second screen.  How can I get adobe reader to just display on one screen?
    I want the capability of adobe reader to just run on one screen.

    I had the same problem.
    Try this.
    https://igppwiki.ucsd.edu/groups/publichelpwiki/wiki/a1538/Howto_Disable_Acrobat _as_the_Safari_PDF_Viewer.html

  • How can I get an item that has the broadcast icon next to it into MP3 format so I can put it on my ipod nano?

    Question: how can I get an item in my itunes library, on my mac os 10.6.7 that has a broadcast icon next to it into MP3 format so I can play it on my ipod? right now it won't let me, and it's very frustrating!!!! thanks

    I might have misunderstood what you mean by the "broadcast icon," but if you are talking about an audio stream, then there is just no way you can convert a stream to MP3. What this would involve is either recording the stream, and then you would just be replaying the recorded audio on your iPod (is this what you are trying to achieve?), or reading the stream directly on your iPod, which an iPod nano does not support (it would need wireless connectivity).
    Hope this helps

  • How can i get my items to stay in place and not cross over each other when readjusting the browser s

    How can i get my items to stay in place and not cross over each other when readjusting the browser size.
    Basically on my site when i go from a small screen to a big screen everything doesn't adjust to the screen size. I don't know what im missing
    Here's the link to the page all the pages & they all do it
    http://theatricalworkslive.com/
    Thanks in advance

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, or by a peripheral device. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem.  Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Post for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • My phone froze and deleted two items in my reminders. How can I get those items back?

    I was writing some notes in my reminders and my phone froze for a second. When it unfroze I notice it had deleted two of the items I wrote in my reminders. How can I get those items back?

    They are only where you put them, if you did not download them on the computer or transfer them from the iDevice, there is no logical expectation for them to be on the computer.
    Downloading past purchases from iTunes

  • How can I get my instructional text to display when I open the pdf?

    I have some fields which I have set up which have help/instructions for completing the information required.  This is a questionnaire.  When I save it as a pdf, the instsructional text does not display.  I would really appreciate if someone can tell me how to fix this.

    Thanks for taking the time to respond to my query.  The text does not display when I hover my mouse over it.
    cheers    Deborah Frow
          From: Ajlan huda <[email protected]>
    To: Deborah Frow <[email protected]>
    Sent: Monday, 12 January 2015, 5:24
    Subject: Reply marked as helpful on How can I get my instructional text to display when I open the pdf?
    |
    How can I get my instructional text to display when I open the pdf?
    Ajlan huda marked SumitV's reply on How can I get my instructional text to display when I open the pdf? as helpful. View the full replyMarked as helpful:Hi Pacific Immigration, In Adobe Acrobat/ Adobe Reader there is no “?” shown for help, but if you mouse over the field for 1-2 seconds the Help text is shown.
    Following How can I get my instructional text to display when I open the pdf? in these streams: Inbox
    |

  • HT1766 I purchased an iPad air and chose a backup from my iPhone 5s.  The only issue is only 30 of my photos downloaded to my iPad and none of the music.  How can I get all items on the iPad?

    I purchased an iPad air and chose a backup from my iPhone 5s.  The only issue is only 30 of my photos downloaded to my iPad and none of the music.  How can I get all items on the iPad?

    you are using I tunes as the middle man for this back up, right?
    When you plug in the pad to i tunes, give it a unique name, like my pad.  I tune may be thinking it is talking to your phone.  It will keep track of what you what on each device.  Then plug your phone back in, and make sure your photos are uploaded to the computer - in i photo if you are using a mac, or in whatever photo program you are using on a windows device.  You also want to make sure you have uploaded to the computer all of your music.
    Once you get all that stuff there, plug the pad back in, and go through each of the tabs - selecting the music, photos etal that you want on the pad, then resync.

  • InDesign CS4 Library- can't get library items on to pages

    I'm fairly new to InDesign CS4.
    A book I'm reading has a tutorial telling me to drag library items from the library to a page.
    This is a library that the book author created that came with the book.
    However, I can't get material from the library to any of the pages.
    Anytime I try dragging any of the images or other items from the library to my page in InDesign CS4, I get a small "No" symbol (a circle with a slash through it).
    So I clicked on the image in the library that I wanted to add to the page, and using both the content menu (and later, the library panel's menu) to select "Place Item," nothing happened.
    How do I get content in a library on to a page?
    Dragging and using "Place Item" are not working for me.

    Hello, Lee Sarah, and thanks for answering.
    If I understand you correctly, this is what I did:
    I "right" clicked on the Library file icon on my hard drive, called "Healthy Pets CS4."
    This brought up a context menu.
    From there, I went to "Properties."
    Under "Properties" > "Attributes," "Read only" is not checked off, nor is "hidden" checked off.
    In the "Healthy Pets CS4 Properties" dialog box, I then clicked on the the "Security" tab, which brought up all sorts of stuff about permissions, read /write,  etc.
    I guess I should mention at this point that I'm on a computer running Windows Vista, since this might be pertinent to my issue (?)
    Although it's my computer, it has me on here as two different people (I'm on as Administrator and under my first name, which let's just say is "Graphics Cuddly Bear.")
    On the "Security" tab page of the dialog box is a heading called "Group or user names," and from there, depending on which name you pick from the user names, different options get high lighted in the ""Permissions for Authenticated Users" box below it.
    So, under "Permissions for Authenticated Users" (when the users "Autheticated Users" and "Admins" are selected) the following are checked off with a check mark,
    (as if to say, "These are the things you have permissions to do with this file"):
    Modify
    Read and Execute
    Read
    Write
    The only things I do not have permissions for when I check off  "Administrator" on that list is "Special Permissions."
    When AU (Autheticated Users) is checked it says I do not have "Full Control" or "Special Permissions."
    However, when I clicked on my name (GCB - "Graphics Cuddly Bear") under the heading of "Group of user names," these two things are the only ones checked off:
    Read and Execute
    Read
    So I went in to another area of this box and gave my account ("GCB") the "Write" ability.
    When I went back to the box, a check mark next to "Write" then appeared. So it appears to be telling me that under GCB, I can now write to that file.
    So when I opened and closed out of InDesign and re-opened it, it still will not allow me to drag the files/text/images from the library.
    I still get the little "No" symbol.
    It also still will not let me use the "place" command, either.
    I've gone ahead and worked thorugh this chapter without being able to use the author's library items, but it makes working on her tutorials very difficult.
    And it's rather pointless, since the entire chapter is about how to use the software's library.  
    I got a response from the book's publisher (Delmar / Cengage) to ask them for help, if they would provide me with working copies of the files, or some other work around, and they were NOT the least bit helpful.
    A representative from Delmar/ Cengage e-mailed me to say that because I purchased the book at Amazon's site (rather than from them directly) that they would not help me, which I thought was cruddy and not classy.
    I don't see that it entirely matters where I bought the book from; they're the ones who made it.

  • Using Export for Kindle, how can I get black body text to display inverse (white on black) on Kindle

    I'm using ID 5.5 on a Vista system.
    I've created a book file with some colored fonts and anchored gif images. Basic paragraph (body text) is black. The "Export to Kindle" mobi file displays fine on Kindle for PC and Kindle Previewer.
    Kindle PC alows viewing on white, sepia or black background. Works fine on white and sepia, but when the black color mode is selected (night viewing option) the black text does not display as white text. What can I do to have the black text automatically change to white?
    While trying to find a solution, I created an epub file of the book and, using Calibre, converted it to mobi. When this mobi file is loaded into Kindle PC, the black text does automatically change to white when viewed on the black screen. I would use this method of creating the mobi, but there are several other issues that make this process unsatisfactory (other text colors don't work well, image transparency losses, etc).
    So, how can I get the black to white text thing using only Export to Kindle?
    Jim

    Grayscale is probably the best (Settings>General>Accessibility>Grayscale)
    -Ethan
    EDIT: If you would like a black color scheme, use the suggestion in the reply above.

  • Can't get menu to work in brand new ipod classic.

         I cannot get the menu to say anything other than "video" at the top.  I can't get to where it says "music" on the menu.  I've reset 3 or 4 times, but it doesn't help.  I had it at first, but can't get it back. Help!

    Toggle your Hold switch at the top, make sure you cant see any RED, when you do the steps below
    Press Menu and Center Button simultaneously for about 10 secs till the Apple logo comes ON, then let go.
    Select the preferred language
    it will bring you to the Menu screen.
    Go down and select music.
    Have a nice day!

  • Can't get form items

    Hello everyone,
    I have a form that I loaded from a xml file created on Screen Painter.
    In my Item Event FORM_LOAD, I need to get it's items. I get the form with success, but the items count is always 0.
    Does anynoe has an idea why this is happening?

    When You load a form from XML all items are added after FORM_LOAD. That's why You don't have items frm.Items collection.
    You should acces to item just after vApp.Forms.AddEx(... YourNewFormCreationParameters ...).
          Dim fcp As SAPbouiCOM.FormCreationParams = vApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
          fcp.XmlData = My.Computer.FileSystem.ReadAllText("myNEwForm.srf"))
          Dim nFrm As SAPbouiCOM.Form = vApp.Forms.AddEx(fcp)
          nFrm.Items.Item("YourNewItemUID"). .....
    If You want to acces to items after Form_load You can use GOT_FOCUS Event (only if You have at least one editable item on this Form). BeforeAction should be False
      Public catchGF As Boolean = False
      Private Sub vApp_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles vApp.ItemEvent
          If pVal.FormTypeEx = "myNewFormUID" Then
            If pval.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And pval.BeforeAction Then
              catchGF = True
            End If
            If pval.EventType = SAPbouiCOM.BoEventTypes.et_GOT_FOCUS And catchGF And Not pval.BeforeAction Then
              'Now You can acces to your Item
              catchGF = False
            End If
          End If

  • Can't get menu.

    Okay...i installed openbox to use purely. Everythings good except i can't get a menu like i see it comes with. I've installed obmenu or w/e to configure it through gui look, but still get nothing when saving some menu'e. I guess should i just configure the config file manually or wats up with this..i just flat out dont see any menu...anywho thanks ahead of time for the help.
    -Peace

    You do mean the right click menu correct? Coz Openbox by default doesn't have a panel and a menu in the panel.
    Have you copied over the menu.xml, and rc.xml files to ~/.config/openbox?
    Last edited by Inxsible (2009-04-02 15:38:20)

  • Can't add menu item to showMenu panelCollection facet

    Is that a bug ? JDev does not allow to add a menu item inside a showMenu panelCollection's facet. If you manually add it, it shows an error:
    "Element at af:commandMenuItem not expected (missing required ancestor)".
    The application runs fine. That error also shows up on the searchUI.jsff page from the Handbook sample code.
    Jdev version is 11.1.1.2.0.
    Thanks & Regards.

    No, it's not a bug. You need a af:menu ancestor for your af:commandMenuItems:
                <af:panelCollection id="pc1">
                  <f:facet name="menus">
                    <af:menu text="Actions" id="m2">
                      <af:commandMenuItem text="Delete" id="cmi1"
                                          actionListener="#{deptBean.deleteRow}"
                                          partialSubmit="true" immediate="true"
                                          accessKey="D" accelerator="control alt R"
                                          partialTriggers="deptTable"/>
                      <af:commandMenuItem actionListener="#{bindings.Last.execute}"
                                          text="Last" accelerator="ctrl alt L"
                                          accessKey="L" partialSubmit="true"
                                          id="cmi2" partialTriggers="deptTable"/>
                    </af:menu>
                  </f:facet>
    {code}
    Whenever you have a doubt on how to use a component you can always check the  ADF Rich Faces Demo: http://jdevadf.oracle.com/adf-richclient-demo/faces/index.jspx
    HTH,
    Maiko                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Is it possible to get menu item checked state?

    In a script I need to know the state of a menu items checked state - e.g. the View/Proof Colors menu item.
    Is that possible? (and of cause if it is how do I do it?)
    Thanks,
    Jack

    The reason I need the state of "Proof Colors" is that I want to turn on/off the visibility of a layer set depending on its state.
    In the layer set I would have my printing adjustments layers. This way it is very easy to compare the image with the softproof. When "Proof Colors" is turned off the printing adjustment layer set would also be turned off - displaying the image without any printing corrections.
    When "Proof Colors" is turned on the printing adjustment layer set would also be turned on - displaying the softproof with printing corrections applied.
    Jack

Maybe you are looking for

  • Does Endeca Integrator Loads Attribute with Null value?

    I have a table in DB , with a column , lets say, supply_id. This is null for all rows. When i load data from this table using clover ETL graph and lets say source this data to another table , will my final table will have a column as supply_id? Or wi

  • For this Process is to less disk space f

    Hello! I have a Zen Touch with the new Firmware update! Now I can switch files smooth to the mp3 player into the folder Data. And when I switch the file again to the Desktop the alarm message: appear. What is the problem? The files are about 700Mb bi

  • Create sequence on report

    Help please. I am trying to create sequence on the report. I wrote following PLSQL on the field emp_no in order to show sequence number (1,2,3...)on the employee_no column. It did not work. CREATE SEQUENCE Emp_sequence INCREMENT BY 1 START WITH 1 NOM

  • Relationship between WebDynproContext and Interactive Form (WebDynpro ABAP)

    Hi, I created a WebDynpro application including an interactive form. The context of the view contains a node 'Employeeinfo' with a further node 'Employeerecords' and a Attribute pdfSource. The node Employeerecords contains 2 Attributes: Employeename

  • Error while calling activityPrepare:needs to be invoked through an API call

    I try to call activityPrepare using PAPI WS from SOAP UI. I get the following error : An error occurred while processing task '0' for instance '/MyProcess#Default-1.0/4/0' in activity '/MyProcess#Default-1.0/Interactive[AgeFilter]'. The task is exter