Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > JDialog to appear in Windows Taskbar

Reply
Thread Tools

JDialog to appear in Windows Taskbar

 
 
RVince
Guest
Posts: n/a
 
      08-21-2007
I have an application whose only gui is to invoke a JDialog and
display it. On Windows machines, I need to have an the usual taskbar
button, typically at the bottom of the screen on Windows systems,
appear. It seems that simply invoking a modal JDialog wont put
anything into the Windows taskbar, and thus if a user puts another
Window in front of this JDialog -- they can even forget it's there!.

Does anyone know of a workaround to this? Thanks, R.Vince

 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      08-21-2007
RVince wrote:
> I have an application whose only gui is to invoke a JDialog and
> display it. On Windows machines, I need to have an the usual taskbar
> button, typically at the bottom of the screen on Windows systems,
> appear. It seems that simply invoking a modal JDialog wont put
> anything into the Windows taskbar, and thus if a user puts another
> Window in front of this JDialog -- they can even forget it's there!.
>
> Does anyone know of a workaround to this? Thanks, R.Vince
>


As of 1.6 that is easy to do. Create a JDialog with the
DialogModalityType of TOOLKIT_MODAL.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class test8 {
public static void main(String[] args) {
Runnable r = new Runnable() {
public void run() {
JDialog d = new JDialog(
(Frame)null,Dialog.ModalityType.TOOLKIT_MODAL);
d.setTitle("title");
d.setSize(300,200);
d.setVisible(true);
System.exit(0);
}
};
EventQueue.invokeLater(r);
}
}

--

Knute Johnson
email s/nospam/knute/
 
Reply With Quote
 
 
 
 
RVince
Guest
Posts: n/a
 
      08-21-2007
Thanks Knute,

Unfortunately I have to be 1.4.2 compatible here. -R. Vince

 
Reply With Quote
 
Knute Johnson
Guest
Posts: n/a
 
      08-21-2007
RVince wrote:
> Thanks Knute,
>
> Unfortunately I have to be 1.4.2 compatible here. -R. Vince
>


Why would you want to use a compiler that in a very few months will be
obsolete?

Use a Frame/JFrame instead of a dialog.

--

Knute Johnson
email s/nospam/knute/
 
Reply With Quote
 
vishnudhoodhan vishnudhoodhan is offline
Junior Member
Join Date: May 2012
Posts: 3
 
      05-03-2012
hi, i am new to this forum. so hope you all will forgive my mistakes if any....
Thank you in advance.

This is a answer for Rvince's question.
it is simple process though.

Just now before posting this reply I found the way. I was too searching internet for this answer. after all i found it my self.

i am doing an application for my personal use. it came up with the same issue when opening a dialog box, it hided the jframe. so i did a little bit of change to the code. and found workin better enough

this is the code which found erronic.
------------------------------------------------------

Code:
this.setVisible(false);
        
frmcompiler = new frmCompiler(this,true);
frmcompiler.setLocationByPlatform(true);
frmcompiler.setLocationRelativeTo(this);
frmcompiler.setVisible(true);

this.setVisible(true);
the statement
Code:
this.setVisible(true/false);
made it worst
it hided the jframe and the taskbar button vanished. so i made a little bit of change like the following
Code:
//this.setVisible(false);    
    
frmcompiler = new frmCompiler(this,true);
frmcompiler.setLocationByPlatform(true);
frmcompiler.setLocationRelativeTo(this);

this.setState(javax.swing.JFrame.ICONIFIED);

frmcompiler.setVisible(true);

//this.setVisible(true);
this.setState(javax.swing.JFrame.NORMAL);
see the difference? i just commented the visiblity statement and
used the setState function to the parent form. so i can iconify the parent form, and the taskbar button stayed alive...


hope this will help you....


oops forget to type.
frmCompiler is the JDialog window. and "this" denotes the parent form.
 

Last edited by vishnudhoodhan; 05-03-2012 at 06:02 PM.. Reason: missed a statement
Reply With Quote
 
vishnudhoodhan vishnudhoodhan is offline
Junior Member
Join Date: May 2012
Posts: 3
 
      05-03-2012
Mr. Rvince,

one more thing is i used Netbeans 7.1 and jdk 1.7. so i am not sure about how much it could work for you with java 1.4

Thank you
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delphi 2007 + Themed support + WinXP64Pro + Side Taskbar = System Crash + Taskbar not working. Skybuck Flying Windows 64bit 4 08-27-2007 02:17 PM
NetBeans - JDialog does not appear as a choice Dom Java 2 11-28-2006 01:54 PM
Day shown on taskbar and unable to make settings on taskbar displays. Charlie Evans Computer Support 4 05-31-2005 03:01 PM
Controlling where JDialog opens Larry Coon Java 3 10-24-2003 07:21 AM
Re: JDialog in taskbar under Linux Alexandr Molochnikov Java 0 07-31-2003 12:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57