Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / July 2004

Tip: Looking for answers? Try searching our database.

Window icon in Dialogs

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike Smith - 10 Jul 2004 23:51 GMT
Does anyone know how to get rid of the little generic window icon in the
title bar of Dialogs?  My application has an icon and I use
Frame.setIconImage() to set the same icon in the title bar of all my Frames
so I know how to set a window icon and that works fine.  The problem is
Dialogs do not have a setIconImage() method, yet they have a generic icon.

Strangely enough the JVM's from Sun and IBM do not show this generic icon in
Dialogs (or any icon at all for that matter), but J# created Dialogs do, and
so do the Dialogs created under the Microsoft VM from the J++ days.  So
maybe there is a way to set this icon that is specific to the Microsoft VM
(and J#)?  Any help would be appreciated.

Mike
Lars-Inge T?nnessen - 11 Jul 2004 00:37 GMT
> Does anyone know how to get rid of the little generic window icon in the
> title bar of Dialogs?

Please use a "FixedToolWindow" or "SizableToolWindow".

You will find this under the "FormBorderStyle" in the properties window in
the design view.

If you want to set this property with the API:

this.set_FormBorderStyle(System.Windows.Forms.FormBorderStyle.FixedToolWindo
w);

Regards,
Lars-Inge T?nnessen
www.larsinge.com
Mike Smith - 11 Jul 2004 01:21 GMT
> Please use a "FixedToolWindow" or "SizableToolWindow".
> You will find this under the "FormBorderStyle" in the properties window in
> the design view.

My problem is with a java.awt.Dialog.  Sorry, I should have been more
specific.  I assume you are talking about a System.Window derived object
here.  I see no such property under any java.awt derived objects.

Mike
Lars-Inge T?nnessen - 14 Jul 2004 10:51 GMT
Sorry , I didn't read you question good enough, and sorry for the late
response (I'm packing all my things, beacuse I'm moving).

I get the small icon on a Sun Java 1.4.2 java.awt.Dialog dialog on WinXP Pro
too.
Do you have a small sample that can show us your scenario.

Regards,
Lars-Inge T?nnessen
Mike Smith - 16 Jul 2004 07:18 GMT
> I get the small icon on a Sun Java 1.4.2 java.awt.Dialog dialog on
> WinXP Pro too.  Do you have a small sample that can show us your
> scenario.

Sorry, there was one more piece of info.  When you construct the dialog you
need to add two lines to make it modal and fixed size:

 dialog.setModal(true);
 dialog.setResizable(false);

Doing this make the icon go away on the Sun VM but it remains on the MS VM
(or J#).  If I want a modeless dialog I use Frame which has a setIconImage()
method, so I have a workaround for the modeless case.

Here is the complete code:

import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Label;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class DialogTest {

public static void main(String args[]) {
 Dialog dialog = new Dialog(new Frame(), "Applet Frame");
 dialog.setLocation(50, 50);
 dialog.addWindowListener(new WindowAdapter() {
  public void windowClosing(WindowEvent e) {
   System.exit(0);
  }
 });

 dialog.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
 dialog.add(new Label("Hello World"));
 dialog.setModal(true);
 dialog.setResizable(false);

 dialog.pack();
 dialog.setVisible(true);
}
}

Thank,

Mike

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.