Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
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
Forum:
Swing / AWT / SWT
Jwindow
kelly devon
Ranch Hand
Posts: 78
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi can anyone give me an example on how to add an image to jwindow.
i have been trying to use imageicon to get the image. pls hlp
kel
Michael Dunn
Ranch Hand
Posts: 4632
posted 18 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
works OK in this
import java.awt.*; import java.awt.event.*; import javax.swing.*; class Testing extends JFrame { public Testing() { JWindow window = new JWindow(this); JLabel lbl = new JLabel(new ImageIcon("Test.gif")); JButton btn = new JButton("Exit"); btn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent ae){ System.exit(0);}}); window.getContentPane().add(lbl,BorderLayout.CENTER); window.getContentPane().add(btn,BorderLayout.SOUTH); window.pack(); window.setVisible(true); } public static void main(String[] args){new Testing();} }
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to change mouse cursor during drag and drop?
Displaying image on JWindow
how to disable minimize option in JFrame
Can i add an image directly to a JLabel or JWindow?
how to close the previous JWindow
More...