Buttons doesnt show on the applet

I wrote a code which takes coordinates of buttons from another class and set it to buttons bounds and then add it to contentpane but the problem is buttons doesnt show on the applet.
Here is my code
any help would be usefull
package applet;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.ImageIcon;
import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import images.*;
import hareket.*;
public class backgammon extends JApplet
public Icon puls_icon,bgicon,pulk_icon;
private Image pul_s,background,pul_k;
private JLabel bg;
private JButton[] butonlar;
private sari sariplayer;
private kahverengi kahveplayer;
private kareler board;
    public void init()
        getContentPane().setLayout(null);
        this.setSize(744, 536);
        butonlar = new JButton[31];
        board = new kareler();
        sariplayer = new sari(board);
        kahveplayer = new kahverengi(board);
        sariplayer.setkahverengi(kahveplayer);
        kahveplayer.setsari(sariplayer);
        kahveplayer.baslangic("kahverengi");
        sariplayer.baslangic("sari");
        pul_s = getImage(getCodeBase(),"images/pul_sari.gif");
        pul_k = getImage(getCodeBase(),"images/pul_kahverengi.gif");
        background = getImage(getCodeBase(),"images/background.jpg");
        puls_icon = new ImageIcon(pul_s);
        pulk_icon = new ImageIcon(pul_k);
        bgicon = new ImageIcon(background);
        bg=new JLabel(bgicon);
        bg.setBounds(0,0,getWidth(),getHeight());
        getContentPane().add(bg);
        butoninitialize();
    public void butoninitialize()
            for (int i=1;i<31;i++)
                if (i<16)
                    butonlar[i] = new JButton(pulk_icon);
                    butonlar.setBounds(kahveplayer.pullar_x[i],kahveplayer.pullar_y[i],42,42);
else
butonlar[i] = new JButton(puls_icon);
butonlar[i].setBounds(sariplayer.pullar_x[i],sariplayer.pullar_y[i],42,42);
butonlar[i].setContentAreaFilled(false);
butonlar[i].setBorderPainted(false);
this.getContentPane().add(butonlar[i]);
Thanks

The second method will not work unless you have JDK 1.5.
I simplified your code a bit to make it compilable.
This solution should work:
package applet;
import javax.swing.*;
import java.awt.*;
public class backgammon_1 extends JApplet {
    public Icon puls_icon,bgicon,pulk_icon;
    private Image pul_s,background,pul_k;
    private JLabel bg;
    private JButton[] butonlar;
    public void init() {
        getContentPane().setLayout(null);
        this.setSize(744, 536);
        butonlar = new JButton[31];
        pul_s = getImage(getCodeBase(),"images/pul_sari.gif");
        pul_k = getImage(getCodeBase(),"images/pul_kahverengi.gif");
        background = getImage(getCodeBase(),"images/background.jpg");
        puls_icon = new ImageIcon(pul_s);
        pulk_icon = new ImageIcon(pul_k);
        butoninitialize();
        bgicon = new ImageIcon(background);
        bg=new JLabel(bgicon);
        bg.setBounds(0,0,getWidth(),getHeight());
        getContentPane().add(bg);
    public void butoninitialize() {
        for (int i=0;i<butonlar.length;i++) {
            if (i<16) {
                butonlar[i] = new JButton(pulk_icon);
                butonlar.setBounds(50*i,50,50,50);
} else {
butonlar[i] = new JButton(puls_icon);
butonlar[i].setBounds(50*(i-16),100,50,50);
butonlar[i].setContentAreaFilled(false);
butonlar[i].setBorderPainted(false);
this.getContentPane().add(butonlar[i]);

Similar Messages

  • When saving my illustrator file to a pdf it doesnt show all the artwork ie boxes are hidden in the pdf or only showing part of them. How can I fix this?

    when saving my illustrator file to a pdf it doesnt show all the artwork ie boxes are hidden in the pdf or only showing part of them. Even some text is hidden. I have flattened the artwork so everything is in one layer. How can I fix this?

    Hi John
    I have indicated on the attached jpeg where the problem is, basically a line of text is missing at the top and part of the feeding diagram is missing. I created the artwork in different layer and then flattened. All text has been converted to outlines, however the areas being affected have no transparency, I have used solid fills or no fills. I get the same result when I export the file as a jpeg. Hope you can help.

  • Hello! I have the Acrobat XI test version installed, got the registration Mail and confirmed it. When i have the program opened and try to convert the file from a pdf to a word and press the convert button, it shows a the message "application failed" (in

    Hello! I have the Acrobat XI test version installed, got the registration Mail and confirmed it. When i have the program opened and try to convert the file from a pdf to a word and press the convert button, it shows a the message "application failed" (in german "Fehler bei der Anmeldung"). I hope have explained the issue on the right way with my bad english. Do you have a solution for it?? Best regards, Marcus Wenk

    yes, you are right. it is the adobe reader via exportPDF. but it should be the acrobat. it was written on the internetpage...

  • My ipods external speaker suddenly stoped working...when i go to music without d earphones plugged in it doesnt show me the voluve controler...

    My ipods external speaker suddenly stoped working...when i go to music without d earphones plugged in it doesnt show me the voluve controler...

    Try backing it up in iTunes, then restoring software. Back up first, though.
    If problem is still there, then you may have to take this to a higher level. http://www.apple.com/support/ipodtouch/
    If you STILL can't get an answer from those people, then go to an Apple Store and talk with a Genius

  • TS2972 why is the import button not showing at the button right hand corner of iTunes?

    why is the import button not showing at the bottom right hand corner of my ITunes page.  I am trying to transfer files from my home share library onto a new computers library.

    See if it isn't hidden under the View menu. iTunes- Turning on iTunes menus in Windows 8 and 7.

  • How do I get buttons to show at the end of a menu

    I have a menu that should be played every time (contains disclaimers, etc) and then there should be a choice of which track to play. How do I either get buttons that ONLY show up at the end--or have the menu automatically go to a next item which only contains a background and the buttons. I thought I had done this a long time ago but cannot remember what I did.

    The buttons kept showing throughout the entire menu, no matter what I tried. I ended up doing a wierd setup, where I had the menu jump to a submenu at the end. The submenu then contained the buttons. Also, the tracks will jump back to that same submenu at their ends. Not as clean as I would like it, but it seems to work. I had tried doing a SetLoopPoint chapter marker in FCP, but the DVDSP menu just plain ended at the loop point and would not go into a looping setup.
    If anyone has any other ideas, I would love to hear them - I am not pleased with this setup.

  • I purchased a movie on my mac and now I am trying to download it on my iPad. When I go to do it, it doesnt show me the cloud icon, itonly shows the first 3 letters of download...

    I purchased a movie on my mac and now I am trying to download it on my iPad. When I go to do it, it doesnt show me the cloud icon, itonly shows the first 3 letters of download...

    call Apple Care and contact iTunes store support

  • Why this tree can not show on the Applet?

    hi, all, I try to create a java Applet show a tree, this following code has no error, but the tree can not show on the Applet, can any one tell me why? thanks!
    <code>
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import java.awt.dnd.*;
    public class AppletApp extends Applet {
         Date myDate;
         protected JTree m_tree = null;
         protected DefaultTreeModel m_model = null;
         protected JTextField m_display;
         public void init() {
         public void paint(Graphics g) {
              DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");          
              DefaultMutableTreeNode node1 = new DefaultMutableTreeNode("node1");          
              root.add(node1);                    
              node1.add(new DefaultMutableTreeNode("sub1_1"));                         
              node1.add(new DefaultMutableTreeNode("sub1_2"));                                        
         public static void main(String arg[]) {
              JFrame myFrame = new JFrame();          
              Container contentPane = myFrame.getContentPane();
              contentPane.setLayout(new GridLayout(1,2));          
              AppletApp app = new AppletApp();          
              contentPane.add(new JScrollPane(app), BorderLayout.CENTER);     
              myFrame.addWindowListener (new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              app.init();
              app.start();
              myFrame.setSize (400,400);                              
              myFrame.setVisible(true);          
    </code>

    Not quite sure what you are trying to do, but if you move the code from the paint() method into the init() method (then delete your paint() method), then add one new line to the init() method (after the code you just inserted) that reads:
    getContentPane().add(new JTree(root));
    - You should at least see a tree!

  • My menu button doesnt work half the time

    my menu button doesnt work half the time

    You can copy the photos and other data to your computer, the mentioned article tells you how to.
    The content of a backup is described here: iTunes: About iOS backups
    Copying personal photos and videos from iPhone, iPad, or iPod touch to your computer

  • I just switched to the new iOS5 and can't get the camera button to show on the lock screen, Anyone know how?

    How do you get the camera to show on the lock screen?

    No, double click home button dosent work, only music icon show up, what should I do?

  • Is there a setting in Firefox's about:config page that will allow the Bookmarks Drop Down Button to show while the Menu Toolbar is visible?

    I understand that someone asked a very similar question in this post: https://support.mozilla.org/en-US/questions/977490?esab=a&as=aaq but I want to accomplish my goal without adding another addon or extension to my browser.

    Add code to the userChrome.css file below the default @namespace line.
    *http://kb.mozillazine.org/userChrome.css
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #bookmarks-menu-button,
    #bookmarks-menu-button-container { display:-moz-box !important; }</nowiki></pre>
    The customization files userChrome.css (user interface) and userContent.css (websites) are located in the chrome folder in the Firefox profile folder.
    *http://kb.mozillazine.org/Editing_configuration
    You can use this button to go to the currently used Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder (Linux: Open Directory; Mac: Show in Finder)

  • My iphone 4 is not in service its deactivated the home button doesnt work and the front screen is cracked can i get a new iphone 4 for free

    my iphone 4 is not in service its deactivated the home button doesnt work meaning theres tape to keep it in its place, and the front screen is cracked can i get a new iphone 4 for free. what should i do.

    Take it to Apple for an out of warranty replacement for $149US.

  • HT3819 sometimes my home sharing doesnt show in the tool bar?

    I am not very good with computors, I am trying to sync my iphone to a new laptop with home sharing, sometimes the home sharing toolbar doesnt show?
    I cant seem to do the latest update on my phone on my main PC for some reason, it updates for about 1 hour and then just cuts off? I was going to try and do the update from my laptop but cant get the information from my PC onto it before doing the update?
    Can anyone give me advice?, my last update did not include the cloud sevice so I am not backed up on the cloud!

    goto the finder menu->finder-> preferences. Click on the "sidebar" tab and make sure that "connected servers" and "bonjour computers" boxes are checked. This will enable "Sharing" section in Finder sidebar. Mind you, it will only show up if there is anything to share. If not you won't see it.

  • Cant add PDF files, itunes doesnt show me the option to add the files

    Sometimes itunes dosnt show me the option to add files under the Aplications Menu.
    I have already installed ADOBE READER, and when trying to add PDF files, itunes dosnt show me the applications to add files.
    Below you will find the options that sometimes dissapear.

    This may help - http://www.simplehelp.net/2010/06/22/how-to-add-pdf-files-to-read-in-ibooks-on-y our-ipad-ipod-touch-or-iphone/.  It is for the older version of iTunes, however it should give you some good guidance.

  • I can't get the Bookmarks button (NOT the Display Your Bookmarks Button) to show in the Navigation Toolbar, except when I have the Customise window open.

    I think that covers it really. When I have the customise window open I can see the Bookmarks Button (like the Display Your Bookmarks Button but with a little arrow on the right hand side) but as soon as I click Done it vanishes. I've tried it in a number of positions on the Navigation toolbar but without success.

    My bookmarks button just moved itself out of the Navigation Toolbar and into the Bookmarks Toolbar. If there's a way to return it, let me know.
    It's using a whole new toolbar's worth of space (since the Bookmarks Toolbar is now double height) just for one dinky button...love the idea of maximizing real estate and this is messing that up.

Maybe you are looking for

  • I want to use .mov files on a pc

    I'm trying to play movie files I've created in Final Cut on PowerPoint in a PC. I've used Compressor to create different sizes of the movies, and iSkysoft Video Converter to make mpeg and wmv files. However, when I actually get the files to a PC, pro

  • No sound in flash!

    I am a web/flash developer, so I moved over to the Mac platform, I have had a few problems (fonts and the likes of) and these have been easliy fixed. Today i turned on my MBP I loaded one of my flash projects and the sound is missing, has this happen

  • HDR Time Lapse .mov flicker problems

    Using Lightroom 2.3 trying to create an HDR Time Lapse .mov with quicktimepro. I have slight shutter adjustments (flickers) to correct in many images. I was unable to use manual exposure as time was an issue so auto exp. and manual focus was my only

  • Prompts throwing javascript Error

    Hi All, My prompts are throwing error while selecting the values from the dropdown. 1)saw.isElementAttachToDocumentBody is not a function in Firefox and in other Browsers also. Any help in this regard

  • DUPLICATE (Ignore) - Are tooltips readable by software for the blind?

    So SORRY, my internet is messed up. Please don't bother with this duplicate post. ================================================== I have attached/created tooltips containing field descriptions to some item titles in my APEX forms. Does anyone know