• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Adding Buttons in JDesktoPane

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

i am lost in adding Buttons to JDesktoPane i need help this is wat i did for adding the buttons but the buttons doesn't show.

private Container cpane;
privateJDesktopPane desktopPane = new JDesktopPane() ;

desktopPane.setBackground(Color.lightGray);
cpane = getContentPane();
cpane.setLayout(new FlowLayout());

JButton button = new JButton("Locker 1");

desktopPane.add(button);
cpane.add(desktopPane);

show()

this is wat i did for adding the button to a JDesktopPane.

If i am wrong pls guide me thanks you very much

also i need help in sloving this problem thanks

regards
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JDesktopPane is new to me, but after looking at the API and writing some test code, it appears that...
  • You still need to add the JDesktopPane to a top-level container, like a JFrame.
  • You add JInternalFrames to the JDesktopPane.
  • You can then add JButtons directly to the JInternalFrame (unless you want a JPanel).
  • Here's my test code...
    I think the bigger question is: Are you sure it's a JDesktopPane that you want?
    [ November 10, 2005: Message edited by: marc weber ]
     
    reply
      Bookmark Topic Watch Topic
    • New Topic