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
Forums
Register
Login
Java
»
Swing / AWT / SWT
JWindow in the taskbar
shawn larkin
,
Ranch Hand
Feb 21, 2002 14:38:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Is there a way to make a JWindow show up in a taskbar? Maybe some JNI code. If you know of a previous post on the subject, just point me to it.
Thanks
Nathan Pruett
,
Bartender
staff
Feb 22, 2002 10:01:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Actually, here's some short code that effectively does this in pure
Java
...
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class TaskbarWindow extends JWindow { JFrame ref; TaskbarWindow( String name ) { ref = new JFrame( name ); ref.setResizable( false ); setBounds( 300, 300, 300, 300 ); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); ref.setBounds( -30, -30, 20, 20 ); JPanel p = new JPanel(); JButton b = new JButton( "Close" ); b.addActionListener( new ActionListener() { public void actionPerformed( ActionEvent e ) { System.exit( 0 ); } } ); p.add( b ); getContentPane().add( p ); ref.addWindowListener( new WindowAdapter() { int x = getLocation().x; int y = getLocation().y; public void windowActivated( WindowEvent e ) { setVisible( true ); toFront(); } public void windowIconified( WindowEvent e ) { x = getLocation().x; y = getLocation().y; setLocation( x, screenSize.height + 10 + y ); } public void windowDeiconified( WindowEvent e ) { TaskbarWindow.this.setVisible( true ); setLocation( x, y ); } } ); ref.setVisible( true ); setVisible( true ); } public static void main( String[] arg ) { new TaskbarWindow( "Window" ); } }
-Nate
Post by:
autobot
It's exactly the same and completely different as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
This thread has been viewed 1610 times.
Similar Threads
JWindow problem....
How maximize window in java 1.3 without going under taskbar?
JWindow and selecting text
how to disable minimize option in JFrame
SystemTray and task bar
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:53:27
.