Hi can sombody help me I cant add the actionlistener to my application
hi
I write a code in java whit the JMenuBar and MenuBarIthem the problem is when I click to my MenuBarIthm I must to get a JPanel in the same window code but when i click to the MenuIthel dnt work
* @(#)re.java
* @author
* @version 1.00 2009/5/30
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.*;
import javax.swing.*;
public class re extends JFrame {
public JFrame f=new JFrame();
private JMenuItem blueMenuItem;
private JMenuItem orangeMenuItem;
private JMenuItem greenMenuItem;
private JMenu SweetMenu;
private JMenuItem Chambre12MenuItem;
private JMenuItem Chambre13MenuItem;
private JMenuItem Chambre14MenuItem;
private JMenuItem Chambre15MenuItem;
private JMenu TripleMenu;
private javax.swing.JMenu singleMenu;
private JMenuItem Chambre6;
private JMenuItem Chambre7MenuItem;
private JMenuItem Chambre8MenuItem;
private JMenuItem Chambre9MenuItem;
private JMenuItem Chambre10MenuItem;
private JMenuItem Chambre11MenuItem;
private JMenu DoubleMenu;
private javax.swing.JMenuItem chambreMenuItem;
public re() {
JMenuBar menuBar = new JMenuBar();
menuBar.setMargin(new java.awt.Insets(30, 40, 30, 50));
menuBar.setMinimumSize(new java.awt.Dimension(500, 550));
singleMenu = new JMenu();
singleMenu.setText("Single");
menuBar.add(singleMenu);
chambreMenuItem = new JMenuItem();
chambreMenuItem.setText("Chamber1");
singleMenu.add(chambreMenuItem);
menuBar.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
menuBar.setMargin(new java.awt.Insets(30, 40, 30, 50));
menuBar.setMinimumSize(new java.awt.Dimension(500, 550));
chambreMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JPanel jpanel_1 = new JPanel(new GridLayout(0,1));
jpanel_1.setBackground(Color.cyan);
for(int i=0;i<7;++i) jpanel_1.add(new JLabel(" label"+i+" "));
Container cp = f.getContentPane();
cp.add(jpanel_1,BorderLayout.EAST);
f.setVisible(true);
f.setJMenuBar(menuBar);
// f.setSize(500,300);
f.setExtendedState(f.MAXIMIZED_BOTH);
f.setDefaultCloseOperation(3);
public static void main (String[] args) {
new re();
}
1. When posting code here or on any forum, please remove useless comments and format the code correctly. ([http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html]) -- use 2 to 4 spaces for indents, not tabs, as the forum doesn't handle tab characters very well.
2. Always launch a GUI on the EDT using SwingUtilities / EventQueue#invokeLater.
3. When adding or removing components to/from a visible component hierarchy, it is necessary to revalidate() and sometimes, to also repaint() the container(s) whose contents are changed.
db
edit
4. Don't use 'Magic Numbers'.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE), not 3.
Edited by: DarrylBurke
Similar Messages
-
I have a wireless keyboord. But i can find out to type @ in may new keyboord, to may imac can sombody help me. Erik
with a shift being held @
-
Help I just moved my music files to a external hard drive and am using the new crappy version ( i know my opinion) of itunes and cant add the files to my libray it gives me the add file to library option but not the add folder to library option what am i doing wrong?
In iTunes 11 uncheck the preferences setting in in the iTunes Preferences panel "Advanced > Copy Files to iTunes Media folder when adding to Library"
-
How do you add musci to the Iphone? I just installed itunes 11.1.5.5. Now the format in Itunes is changed. when I am trying to add music to my iphone, there is no longer an add button under the Iphone device. Why did they have to change this? Can anyone help, Im tryiong to add music.
Correct. When you purchase devices, they would have stated the OS they needed to work, on the box. This can be overlooked, but it is very important to check when purchasing.
You current OS, is so old, that they technology build into the new devices, is not something your OS understands. It didn't exist when your OS was created, and therefore you need to upgrade the OS to work with the newer technology of these devices.
10.6 software is not downloadable. You must purchase a DVD disc. You can order it from the on-line apple store
- http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard. -
Safari Quits Unexpectedly On Start up OS X 10.10.2 can anyone help? I cant find any malware or any virus I updated to 10.10.2 also to try to fix the problem.
Launch the Console application in any of the following ways:
☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
☞ Open LaunchPad and start typing the name.
Step 1
For this step, the title of the Console window should be All Messages. If it isn't, select
SYSTEM LOG QUERIES ▹ All Messages
from the log list on the left. If you don't see that list, select
View ▹ Show Log List
from the menu bar at the top of the screen.
In the top right corner of the Console window, there's a search box labeled Filter. Initially the words "String Matching" are shown in that box. Enter the name of the crashed application or process. For example, if Safari crashed, you would enter "Safari" (without the quotes.)
Each message in the log begins with the date and time when it was entered. Select the messages from the time of the last crash, if any. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
☞ The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
Please don't indiscriminately dump thousands of lines from the log into this discussion.
Please don't post screenshots of log messages—post the text.
☞ Some private information, such as your name, may appear in the log. Anonymize before posting.
Step 2
In the Console window, select
DIAGNOSTIC AND USAGE INFORMATION ▹ User Diagnostic Reports
(not Diagnostic and Usage Messages) from the log list on the left. There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points down. You'll see a list of crash reports. The name of each report starts with the name of the process, and ends with ".crash". Select the most recent report related to the process in question. The contents of the report will appear on the right. Use copy and paste to post the entire contents—the text, not a screenshot.
I know the report is long, maybe several hundred lines. Please post all of it anyway.
If you don't see any reports listed, but you know there was a crash, you may have chosen Diagnostic and Usage Messages from the log list. Choose DIAGNOSTIC AND USAGE INFORMATION instead.
In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
Please don’t post other kinds of diagnostic report—they're very long and rarely helpful. -
I can't get my music to play in my itunes. It comes with a exclamation mark next to the song numbers and says that the original songs can't be played cause cant find the file. How do I get the songs back? (I found the files
You get exclamation marks or dead tracks because iTunes can’t find the file. This can happen for a number of reasons:
The song file or a folder in its path was renamed
The song file or the folder it is in has been moved
The song file has been deleted
The device containing the song files e.g. external drive is not accessible or the drive letter has changed.
If you use an external drive, a change in drive letter is a common cause and you need to change it back.
AS a way of working out what has happened, right click on a track and select the summary tab (you will have to go past an error message). The summary tab will tell you where iTunes thinks the track is located. How does that compare with where the track actually is?
The xml library file is not used by iTunes, it is created to allow other programs to access the library. You can recreate the iTl file from the xml file, but there is no point if the location of the files is wrong.
There is a simple way of getting you music back in iTunes, but it loses all playlists counts and rating. To do this drag iTunes library.itl and iTunes Library.xml to your desktop. Then open iTunes and an empty library is created. Add you iTunes Media folder to it.
If you can't work out what went wrong and how to fix it, you may have to do this. -
Problem with iOS7 : I have a message on my screen "This phone is not registred as a developper phone..." or something like that, can you help me because I download the iOS7 Beta even if I was not a developper. Thank you very much if you help me.
JaillotJb wrote:
I download the iOS7 Beta even if I was not a developper.
if you downloaded it and are not a developer, then we are not allowed to help you here. sorry. -
Can anyone help I want to remove the voice alert from icalendar in Mac Pro?
Can anyone help I want to remove the voice alert from icalendar in Mac Pro?
Please post a screenshot of the Dictation & Speech preference pane with the Text to Speech tab selected.
Start a reply to this message. Click the camera icon in the toolbar of the editing window and select the image file to upload it. You can also include text in the reply. -
I get this about every 10 minutes and I have to restart my Mac and start again.
It is so annoying can anyone help me?
Invalid URL The requested URL "/", is invalid. ReferenceFor which browser and version? If Safari, there may be a solution found in the "More Like This" section over in the column on the right side of this website.
-
Hi ! I have a problem whit my iTunes card . I scratch the cod but is been of also the number and letter so I can't activate any more that card . Can you help me how to fiind the good code please Thank you
Click here and request assistance, supplying as much of the code as you can.
(74543) -
Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount
THanks...but some days they have all the episodes right back to the very first show...ive downloaded a few but they are only available every now and then which makes no sense...why not have them available the whole time ??
-
hi i have updated the 8.1 in my i phone 4s . then i got in my home screen i tunes and charging symbol only . its not getting on . can you help me out to solve the issue with my phone ?? thanks.
Hi vijayanandhtkp,
It sounds like you are getting the Connect to iTunes screen as discussed in this article.
If you can't update or restore your iPhone, iPad, or iPod touch - Apple Support
If so, please check out this article as linked from there.
Use iTunes to restore your iOS device to factory settings - Apple Support
Thank you for using Apple Support Communities.
Nubz -
i have an iphone 4 that its contract has been expired. i want to know if it is unlockable? if yes,can anyone help me with it?The contract was with sweden telia company
So you are not in Sweden then ???
According to this Apple list
iPhone: Wireless carrier support and features - Apple Support
Telia do NOT offer unlocking so it is most unlikely that the iPhone is unlocked and even more unlikely you wold convince them to unlock it -
Help pls i cant use the secondary camera of my nok...
pls help me i cant use the secondary camera of my nokia n96.. i dont what happened pls help...just when i updated in 20.050 and when i use the secondary camera it says " unexpected error occured." help pls what will i do?
first of all, remove your battery and leave it out for five minutes then replace it. see if this solves the problem. if it does not, backp all your data to memory card or the mass storage (16gb) in the phone, or as a backup file .nbu in Nokia PC Suite. then perform a hard reset (*#7370 and *#7780#) to clear the phone to default factory settings. if this still does not work, then try the three-finger hard reset. if this still does not work, you will have to take your phone to your local Nokia Care Centre for them to look at.
remember to do appropriate backup of all your files first. let us know how it goes.
If you found this or someone's comments helpful or like what that person has to say, please give some Kudos to their post! -
I have an Apple I Phone 4S which is great but, can someone help me how to get the photos and videos to my PC which runs on MS XP. I would like to be able to edit and copy photos and videos to a DVD.
Connect your iPhone to your computer. Tp your pc should recognize your iPhone as a camera. Use what ever application you have on the pc to transfer files from a camera to your computer.
Maybe you are looking for
-
How to import flat file with date in filename on a regular basis
Hi, Using OWB 11gR1 I have a file that will be delivered to an FTP each night with the date in the filename having the form YYYYMMDD-FILE.txt (ex: 20100326-FILE.txt) that I want to import to an external table. Now I've set up the import to the extern
-
HELP! cannot find WATCHES pane in workshop
hi, all, my problem is that since i accidently closed the WATCHES pane when i was debugging some piece of code, i could never opened that WATCHES pane again. while i was debugging by using break points, i could see the menu: view->debug windows->watc
-
Can i update all my title and subtitle placeholders at one time with new text for the project?
This seems like a simple thing to do, but I can't copy/paste.
-
What are the benefits to enabling 3G?
It says it allows for faster mobile internet and I also heard that it provides better reception(?) Since I don't really have any plans to be using mobile internet should I just turn 3G off?
-
Hi all! I have a question for you. I want to detect white text that doesn't knock out. I already detect overprinting when the text is black, and less then 12px. Now I think by detecting white text, with OPM set to 1 and OP set to true, that's knockou