I'm having trouble trying to add a button to a frame.

I've been using f.add(myButton) but it gives me an error saying: Can't convert java.awt.Button to java.awt.PopupMenu. Also when I try to add a flow layout it says it can't find the java.awt.FlowLayout class. It would be nice if someone could help me out on this.
Thanks.

Here try this code compile it and see if it works.next time give us your code so we can look at it so we can see what you are doing wrong but see if you can compile this code here
import java.awt.*;
import javax.swing.*;
public class ball extends JFrame{
public ball() {
  super("My button");
  setSize(400,400);
  setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  JButton button = new JButton("My button");
  Container pane = getContentPane();
  FlowLayout flow = new FlowLayout();
  pane.setLayout(flow);
  pane.add(button);
  setVisible(true);
public static void main(String[] args) {
     ball ba = new ball();
} good luck

Similar Messages

  • HT4623 in settings and then general i do not have the option of software update...? How do I know if I am on IOS6 I also seem to be having trouble trying to use icloud i think this is because my apple id is not in the form of an email address...? can anyo

    in settings and then general i do not have the option of software update...? How do I know if I am on IOS6 I also seem to be having trouble trying to use icloud i think this is because my apple id is not in the form of an email address...? can anyone help

    stell80 wrote:
    in settings and then general i do not have the option of software update...?
    That is only present if you have already updated to iOS 5 or later.  If you're on iOS 4 you can only update while connected to your computer's iTunes.
    stell80 wrote:
    How do I know if I am on IOS6
    Settings/ General/ About
    stell80 wrote:
    I also seem to be having trouble trying to use icloud i think this is because my apple id is not in the form of an email address...? can anyone help
    You can't access iCloud from your iPhone unless you're on iOS 5 or later.  Otherwise, refer to this article:
    http://support.apple.com/kb/HT4436

  • Having trouble trying to install itunes 10.5. Receive message saying 'There is a problem with this installer package. A program required for this install to complete could not be found. Please contact product vendor'

    Having trouble trying to install itunes 10.5. Receive message saying 'There is a problem with this installer package. A program required for this install to complete could not be found. Please contact product vendor'

    Managed to get the installation sorted. Go to Control Panel, and where you have a list of all installed programs, repair all the Apple/Itunes related programs. Installation worked fine after that. Hopefully it helps you out too!

  • Im having troubles trying to download desktop apps, the blue wheel still spinning in the app tab, i've already try the solutions i've read here, uninstall CC and installed it again, uninstall it, download it again and install ir, and nothing works, I'm wo

    im having troubles trying to download desktop apps, the blue wheel still spinning in the app tab, i've already try the solutions i've read here, uninstall CC and installed it again, uninstall it, download it again and install ir, and nothing works, I'm worried because i have a course of some software tomorrow (oct 10). I have a mac, and it has all the system requirements. Can someone help me please?

    I think I had the same problem. I've also tried a lot but I found my way out.
    Follow every step of this:
    Creative Cloud Help | Install, update, or uninstall apps

  • Hi, I having trouble trying to connect to the wifi, I know the passwords and checked with others divises but with the mac os x 10.7.5  mac os x lino

    Hi, I having trouble trying to connect to the wifi, I know the passwords and checked with others divises but with the mac os x 10.7.5  mac os x lion is not working
    One of the wifi connections said "time out" or did not recongnise the password

    Hi andrea122,
    Thanks for visiting Apple Support Communities.
    If you're not able to connect to Wi-Fi on your iMac, the troubleshooting steps in this article can help:
    Wi-Fi: How to troubleshoot Wi-Fi connectivity
    http://support.apple.com/kb/HT4628
    Regards,
    Jeremy

  • HT4759 i am having trouble trying to locate my lost Ipad

    I am having trouble trying to locate my lost Ipad

    What To Do If Your iDevice Is Lost Or Stolen
    If your iPhone, iPod, iPod Touch, or iPad is lost or stolen what do you do? There are things you should do in advance - before you lose it or it's stolen - and some things to do after the fact. Here are some suggestions:
    This link, Re: Help! I misplaced / lost my iPhone 5 today morning in Toronto delta Chelsea hotel downtown an I am not able to track it. Please help! [email protected], has some good advice regarding your options when your iDevice is lost or stolen.
      1. Reporting a lost or stolen Apple product
      2. Find my lost iPod Touch
      3. AT&T. Sprint, and Verizon can block stolen phones/tablets
      4. What-To-Do-When-Iphone-Is-Stolen
      5. What to do if your iOS device is lost or stolen
      6. 6 Ways to Track and Recover Your Lost/Stolen iPhone
      7. Find My iPhone
    It pays to be proactive by following the advice on using Find My Phone before you lose your device:
      1. Find My iPhone
      2. Setup your iDevice on iCloud
      3. OS X Lion/Mountain Lion- About Find My Mac
      4. How To Set Up Free Find Your iPhone (Even on Unsupported Devices)

  • I am having trouble trying to boot from my lion osx install disk on a 2007 macbook.  The disk ejects when I start up with the option key depressed.  Anyone have any ideas?

    I am having trouble trying to boot from my lion osx install disk on a 2007 macbook.  The disk ejects when I start up with the option key depressed.  Anyone have any ideas?
    Thank you.

    How did you get a Lion OSX install disc? They don't exist. Do you mean the gray disks that came with your 2007 MacBook?
    If you mean the gray disks, try starting up with the "c" key held down.
    What version of OSX is on your MacBook now? Have you tried booting from the Recovery partition?

  • Having trouble trying to open links on my recieved mail.  The only response I get when I click on the link is, "No associated application could be found".

    Having trouble trying to open links on my recieved mail.  The only response I get when I click on the link is, "No associated application could be found".
    How can I correct this problem?

    What type of file is it? What is the extension (the 3 letters after the . (DOT)) of the file?
    Could be it is a Windows Exe file and simply will not run on a Mac. Which is good because anyone that would send you a excute (.EXE) file is up to no good. just my opinion.

  • (iTunes 11.2) Anyone having trouble trying to quickly jump to an artist in the albums view?

    Anyone having trouble trying to quickly jump to an artist in the albums view by pressing the first letter or the first few letters of that artist's name?
    With this update it's like that feature doesn't work anymore or doesn't work like it used to.

    I came here to write just this. The bug was introduced in 11.2 and not fixed in 11.2.1. When I start typing the artist's name in the albums view, it selects the first album by that artist correctly but scrolls to the wrong part of the library making the feature useless. To get around the bug, I press command+enter to start playing the selected album and then command+L to go to the now playing song.
    Is there any way to downgrade in the meantime?
    EDIT: More people having the problem here https://discussions.apple.com/message/25810622

  • Having trouble trying to reach levels in mailboxes

    having trouble trying to find levels in my mailboxes

    Hi peterfrombellmere,
    By asking about levels in mailboxes, it sounds like you are speaking about nested mailbox folders.
    If so, see if this is the issue.
    iOS: If IMAP Mail folders are not visible - Apple Support
    If you sync IMAP mail account settings from your computer to iPhone, iPad, or iPod touch, and the IMAP folders on your computer are all shown under your Inbox folder, then it might not work as expected on the device.
    If this is the case, you may need to specify what is called an IMAP path prefix. You can enter the IMAP path prefix by choosing Settings > Mail, Contacts, Calendars > [ Tap your account] > [Tap your account again] > Advanced > IMAP Path Prefix. Here's an example of an IMAP mail account that requires a path prefix:
    ISPs that require IMAP path prefixes usually provide instructions for configuring them, so check with your ISP or network administrator for additional information.
    Thank you for visiting Apple Support Communities.
    Nubz

  • , I am having trouble trying to view remote web camera as safari cannot locate server

    Can anybody tell me if it is possible to download internet explorer to iphone 4, I am having trouble trying to view CC remote web camera, safarie cannot locate server?? Im a bit techno phobic so go easy?

    no.
    well, i mean, there are emulating apps like Bolt.... not worth it though

  • I have Final Cut Pro X (10.0.9) and would like to change my project settings but I am having trouble finding the 'Modify Settings button.'  Where exactly is it located?

    I have Final Cut Pro X (10.0.9) and would like to change my project settings but I am having trouble finding the 'Modify Settings button.'  Where exactly is it located?  Here is the link which gives the instructions but doesn't seem to say where the 'Modify Settings Button' is located: http://support.apple.com/kb/PH12526?viewlocale=en_US

    You have to choose – one settigf or another.
    The thing is.your HD clips will look better in an SD project than your SD clips will in an HD project.
    WIthout knowing much more about your project and the kind of content, it's really hard to be specific. But generally I'd let my project settings be guided by what fraction of my timeline will be made up of HD clips and how much SD clips. If it's 75% HD, I'd probably do an HD project…and so on,
    Good luck.
    Russ

  • Having trounle trying to add my aol mailbox to mail

    im trying to add aol to my mail so i dont have to keep going to aol.com to check my mail. I went through the set up that aol has but it still doesnt work. anyone have any suggestions?
    iBook G4   Mac OS X (10.4.9)  

    Hi John!
    "I went through the set up that aol has..."
    Did you use the AOL Services Assistant?
    ali b

  • 7.1 having trouble hitting call and end button

    I hate the buttons and grey background on my apps in 7.1!

    Thank for the quick reply!
    There were 2 things I did wrong and both of them you pointed out.
    I left off sid in the url and did not include the jar in my
    project. Now it works!
    Thanks again!
    Frank
    JDeveloper Team (guest) wrote:
    : Hi Frank,
    : couple of things to look out for
    : - >create a database connection through the connection manager
    in
    : JDeveloper using your parameters 127.0.0.1 (host ) 900 (port)
    : 2481test(sid). ( I grepped this from your error message)
    : See if the connection is successful and you are able to see the
    : deployed ejb.
    : -> second make sure you have added the client side generated
    jar
    : files as part of your project properties for the project.
    : regards
    : raghu
    : Frank Zhang (guest) wrote:
    : : Hi All:
    : : I used JDeveloper 2 to deploy the helloworld EJB sample. The
    : : deployment wnet well and I am able to see test/Hello object
    : under
    : : Published JServer Objects. However, I am having trouble to
    call
    : : Hello thru the Client application and got the following
    error:
    : : javax.naming.CommunicationException: Unknown service:
    : : 127.0.0.1:900:2481test
    : : at
    oracle.aurora.jndi.sess_iiop.SessionCtx.initialContext(Compiled
    : : Code)
    : : at
    : : oracle.aurora.jndi.sess_iiop.SessionCtx.<init>(Compiled Code)
    : : at
    oracle.aurora.jndi.sess_iiop.ServiceCtx.createSession(Compiled
    : : Code)
    : : at oracle.aurora.jndi.sess_iiop.ServiceCtx.login(Compiled
    : : Code)
    : : at
    oracle.aurora.jndi.sess_iiop.ServiceCtx.defaultSession(Compiled
    : : Code)
    : : at
    : : oracle.aurora.jndi.sess_iiop.ServiceCtx.lookup(Compiled Code)
    : : at
    oracle.aurora.jndi.sess_iiop.sess_iiopURLContext.lookup(Compiled
    : : Code)
    : : at
    oracle.aurora.jndi.sess_iiop.sess_iiopURLContext.lookup(Compiled
    : : Code)
    : : at javax.naming.InitialContext.lookup(Compiled Code)
    : : at Client.main(Compiled Code)
    : : Any helps are greatly appreciated!
    : : Frank
    null

  • Having trouble trying to print off my iPad

    Hello I'm trying to set up my iPad to print wirelessly to my epson xp 215 and not having much luck would like some help and advice please

    The Epson XP215 is not a AirPrint enabled printer.
    http://support.apple.com/kb/ht4356

Maybe you are looking for

  • Lion email does not work with Verizon FIOS - Eudora does

    Recently I have not been able to send email using my Verizon outgoing server on the Lion email client. I can receive OK, but the server keeps rejecting something and a window pops up asking me to select a different SMTP server. Before I called Verizo

  • Organizational structure in export mode

    hi all,        pls help me out in knowing abt the organizational structure in  expert mode in detail. thank you.

  • Billing Header Field

    Hello gurus, Please help me knowing from where system picks teh particular field in Billing . Billing Header Taxes    Field : Country Sls Tax No  <>  [ from where it picks this ] Regards

  • How to do channel settings on the labview when acquiring thermocouple temperatures

    Hello, Am new iin using Labview, and am now using version 5.1.My problem is how do i set the number of channels that corresponds to the number of channel connected on the board. Also how do i specify the type of thermocouple to be used.

  • AL32UTF8

    CMS install docs (http://download-west.oracle.com/docs/html/B13614_01/database.htm#i634543) say: Select Unicode (UTF8) as the database character set to enable full multi-language functionality in Oracle CM SDK. Specifying a different database charact