Results 1 to 9 of 9
Thread: empty menuItem in the menu
- 06-08-2010, 10:22 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 7
- Rep Power
- 0
empty menuItem in the menu
Hello,
I use netbeans 6.8,
when I put a menuItem that I called Examen, it is not shown in the menu (it is shown but without text)
NB: the code of menus is in blue then we could not change it
also, other menuItem are good (their text are shown in the execution)
thank you for your responseLast edited by anix; 06-08-2010 at 11:41 AM.
-
Without code, I'm not sure how anyone can tell what you're doing wrong.
Luck.
- 06-08-2010, 05:43 PM #3
Member
- Join Date
- Jun 2010
- Posts
- 7
- Rep Power
- 0
The code is in blue color then we could not change it
the problem is with Examen and RechRDV
Moderator Edit: Code tags addedJava Code:// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { mainPanel = new javax.swing.JPanel(); menuBar = new javax.swing.JMenuBar(); javax.swing.JMenu fileMenu = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); recherchePatient = new javax.swing.JMenuItem(); RDV = new javax.swing.JMenuItem(); rechRDV = new javax.swing.JMenuItem(); Examen = new javax.swing.JMenuItem(); javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); javax.swing.JMenu helpMenu = new javax.swing.JMenu(); javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); statusPanel = new javax.swing.JPanel(); javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator(); statusMessageLabel = new javax.swing.JLabel(); statusAnimationLabel = new javax.swing.JLabel(); progressBar = new javax.swing.JProgressBar(); jTextField1 = new javax.swing.JTextField(); mainPanel.setName("mainPanel"); // NOI18N javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 429, Short.MAX_VALUE) ); mainPanelLayout.setVerticalGroup( mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 177, Short.MAX_VALUE) ); menuBar.setName("menuBar"); // NOI18N org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(ris1.Ris1App.class).getContext().getResourceMap(Ris1View.class); fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N fileMenu.setName("fileMenu"); // NOI18N jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N jMenuItem1.setName("jMenuItem1"); // NOI18N jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); fileMenu.add(jMenuItem1); recherchePatient.setText(resourceMap.getString("recherchePatient.text")); // NOI18N recherchePatient.setName("recherchePatient"); // NOI18N recherchePatient.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { recherchePatientActionPerformed(evt); } }); fileMenu.add(recherchePatient); RDV.setText(resourceMap.getString("RDV.text")); // NOI18N RDV.setName("RDV"); // NOI18N RDV.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RDVActionPerformed(evt); } }); fileMenu.add(RDV); rechRDV.setText(resourceMap.getString("rechRDV.text")); // NOI18N rechRDV.setName("rechRDV"); // NOI18N rechRDV.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { rechRDVActionPerformed(evt); } }); fileMenu.add(rechRDV); Examen.setText(resourceMap.getString("Examen.text")); // NOI18N Examen.setName("Examen"); // NOI18N Examen.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ExamenActionPerformed(evt); } }); fileMenu.add(Examen); javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(ris1.Ris1App.class).getContext().getActionMap(Ris1View.class, this); exitMenuItem.setAction(actionMap.get("quit")); // NOI18N exitMenuItem.setName("exitMenuItem"); // NOI18N exitMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); fileMenu.add(exitMenuItem); menuBar.add(fileMenu); helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N helpMenu.setName("helpMenu"); // NOI18N aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N aboutMenuItem.setName("aboutMenuItem"); // NOI18N helpMenu.add(aboutMenuItem); menuBar.add(helpMenu); statusPanel.setName("statusPanel"); // NOI18N statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N statusMessageLabel.setName("statusMessageLabel"); // NOI18N statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N progressBar.setName("progressBar"); // NOI18N javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel); statusPanel.setLayout(statusPanelLayout); statusPanelLayout.setHorizontalGroup( statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 429, Short.MAX_VALUE) .addGroup(statusPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(statusMessageLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 243, Short.MAX_VALUE) .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(statusAnimationLabel) .addContainerGap()) ); statusPanelLayout.setVerticalGroup( statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(statusPanelLayout.createSequentialGroup() .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(statusMessageLabel) .addComponent(statusAnimationLabel) .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(3, 3, 3)) ); jTextField1.setName("jTextField1"); // NOI18N setComponent(mainPanel); setMenuBar(menuBar); setStatusBar(statusPanel); }// </editor-fold>Last edited by Fubarable; 06-08-2010 at 05:48 PM. Reason: Moderator Edit: Code tags added
-
I've added code tags to allow your code to be more easily read, but yet even with the tags, it's almost impossible to tell what your problem as you still have lots of netbeans code clogging up your post. Can you create a small Swing app without using NetBeans, by doing it by hand? If so, do so, create a small JMenuBar and JMenu, and try to reproduce your error.
Also, have you gone through the Sun Swing tutorial on how to create menus with Swing? If not, you'd better do so so you understand what's going on here. You can find it here: How to Use Menus (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)
-
Also, are you sure that your resource bundle resourceMap has a String that maps to "Examen.text"?
- 06-08-2010, 06:36 PM #6
Member
- Join Date
- Jun 2010
- Posts
- 7
- Rep Power
- 0
I thank you for your reply
I am not sure that my resource has a String that maps to "Examen.text"
-
- 06-08-2010, 06:51 PM #8
Member
- Join Date
- Jun 2010
- Posts
- 7
- Rep Power
- 0
I fixed the problem,
I have copied the function initComponents() into another one initComponents1
where I don't use Examen.setText(resourceMap.getString("Examen.text" ));
but simply Examen.setText("Examen");
it works very well now
thank you for your post
-
Similar Threads
-
How to create ActionListners for dynamically created MenuItem?
By anilshelar in forum AWT / SwingReplies: 3Last Post: 10-27-2009, 02:19 PM -
various actions in menuitem of popupmenu
By Peggy in forum Java AppletsReplies: 0Last Post: 12-11-2008, 11:50 AM -
MenuItem
By Sarinam in forum New To JavaReplies: 1Last Post: 07-15-2008, 10:30 AM -
how to create Popup Menu with Sub Menu while right-clicking the JTree Node??
By Kabiraa in forum AWT / SwingReplies: 7Last Post: 05-09-2008, 07:54 AM -
presse 1 menuitem execute 4 times the same JFrame
By marcvb in forum New To JavaReplies: 0Last Post: 12-27-2007, 09:48 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks