-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.4
-
None
-
x86
-
windows_95
robi
Name: joT67522 Date: 10/24/97
I am having trouble with the frame icon in my
application. I am using setIconImage() in the
constructor for my class. It functions properly
until I destroy() any frame using the image.
Then, the icon doesn't show up when the next
new window is constructed. I am using
Toolkit.getDefaultToolkit().getImage("Moto.gif")
to get the image.
It also seems to be returning the same image
object each time I call the above getImage()
method. It must be buffering the image for
multiple uses.
I am using JDK 1.1.4 on Windows 95.
Any help would be appreciated.
// This test program will show a problem with setting the icon image.
// To duplicate, click the "Create New Window" button, then close the window
// after that point, with any new window openings, the icon will fail to load
import java.awt.*;
import java.awt.event.*;
public class FrameTest extends Frame implements WindowListener,ActionListener
{
static int instances = 0;
public static void main(String args[])
{
FrameTest f = new FrameTest();
f.show();
}
public FrameTest()
{
// set the layout manager
setLayout(new FlowLayout(FlowLayout.CENTER));
// set the default icon
setIconImage(getMyIconImg());
// listen for window events
addWindowListener(this);
Button b1=new Button("Create New Window");
add("South",b1);
b1.addActionListener(this);
instances++;
pack();
}
private final Image getMyIconImg()
{
return( Toolkit.getDefaultToolkit().getImage("Moto.gif") );
}
public void actionPerformed(ActionEvent ev)
{
String sel = ev.getActionCommand();
if (sel == "Create New Window")
{
FrameTest f = new FrameTest();
f.show();
}
}
public void windowClosed(WindowEvent event)
{
}
public void windowDeiconified(WindowEvent event)
{
}
public void windowIconified(WindowEvent event)
{
}
public void windowActivated(WindowEvent event)
{
}
public void windowDeactivated(WindowEvent event)
{
}
public void windowOpened(WindowEvent event)
{
}
public void windowClosing(WindowEvent e)
{
instances--;
if (instances == 0)
{
System.exit(1); // exit the program
}
else
{
dispose(); // call dispose to terminate the window
}
}
}
begin 600 Moto.gif
M1TE&.#=A(0`@`/<``````( ```" `(" ````@( `@ " @,# P,#<P*;*\ @(
M"#$Q,3DY.4)"0DI*2E)24EI:6F-C8ZVMK;V]O<;&QJU*2HP``+4``/]*0MY2
M.;TY(<XI"/]C,<9[6O^$2F,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$+\ASHDB#.H 1]VDQZ<"A$GT:5FOPW]-_2@4I_'D5Z\J9,
MK$IE/H4J5.C4K5RS_A3(TZE:@6C7MC3YM:?:BF-]UCU ]Z9/OA.M1G1(EBA=
MNE<AXBRYEN])DW(E"OW*TS'<JU@-XNQ:ENU4N$U!UJ7*4:["HE5=;N[8LW5H
MU@:K8OULL2C"U;!MAZ2-\"%KWPV!L\8I>R-LHQ,E2N1]?"[SYM#MJE :`( `
8`(("L I01D"N`->W"7_/WOTZ`0`!`0`[
`
end
======================================================================
Name: joT67522 Date: 10/24/97
I am having trouble with the frame icon in my
application. I am using setIconImage() in the
constructor for my class. It functions properly
until I destroy() any frame using the image.
Then, the icon doesn't show up when the next
new window is constructed. I am using
Toolkit.getDefaultToolkit().getImage("Moto.gif")
to get the image.
It also seems to be returning the same image
object each time I call the above getImage()
method. It must be buffering the image for
multiple uses.
I am using JDK 1.1.4 on Windows 95.
Any help would be appreciated.
// This test program will show a problem with setting the icon image.
// To duplicate, click the "Create New Window" button, then close the window
// after that point, with any new window openings, the icon will fail to load
import java.awt.*;
import java.awt.event.*;
public class FrameTest extends Frame implements WindowListener,ActionListener
{
static int instances = 0;
public static void main(String args[])
{
FrameTest f = new FrameTest();
f.show();
}
public FrameTest()
{
// set the layout manager
setLayout(new FlowLayout(FlowLayout.CENTER));
// set the default icon
setIconImage(getMyIconImg());
// listen for window events
addWindowListener(this);
Button b1=new Button("Create New Window");
add("South",b1);
b1.addActionListener(this);
instances++;
pack();
}
private final Image getMyIconImg()
{
return( Toolkit.getDefaultToolkit().getImage("Moto.gif") );
}
public void actionPerformed(ActionEvent ev)
{
String sel = ev.getActionCommand();
if (sel == "Create New Window")
{
FrameTest f = new FrameTest();
f.show();
}
}
public void windowClosed(WindowEvent event)
{
}
public void windowDeiconified(WindowEvent event)
{
}
public void windowIconified(WindowEvent event)
{
}
public void windowActivated(WindowEvent event)
{
}
public void windowDeactivated(WindowEvent event)
{
}
public void windowOpened(WindowEvent event)
{
}
public void windowClosing(WindowEvent e)
{
instances--;
if (instances == 0)
{
System.exit(1); // exit the program
}
else
{
dispose(); // call dispose to terminate the window
}
}
}
begin 600 Moto.gif
M1TE&.#=A(0`@`/<``````( ```" `(" ````@( `@ " @,# P,#<P*;*\ @(
M"#$Q,3DY.4)"0DI*2E)24EI:6F-C8ZVMK;V]O<;&QJU*2HP``+4``/]*0MY2
M.;TY(<XI"/]C,<9[6O^$2F,Q`,ZUE,Z<(??>E,ZU:Y1[*;64*?_..>_>E/?>
M<Z642N_6:[VE.7-C(>?&0CDQ$-Z].:6,*>_..?_.`-;&<_?>8][&2DI"&/?O
MO>?>G*VE:UI2&-[6E/_O0O_O`/_W8^_G,>_G$'-S:[6UG-[>O2$A&!@8$(R,
M6F-C`-;G$-[O:\;O6K7G.92].;W.I8S.,5IS.8S&4G.M.6.<,5JE&$*,`'O.
M2C%K&$J,,5+..1!C`!![`(36>^?OYS%C,6/.8RF,.1AS*5*M:RG&<T+6E#G.
MG)R]M0#.I0B]K1#&QC&]Q@!K<S&MO9S&SG/&UEJ]SDK6[QC&YP"4K6N]S@"]
MYP#&[W/>]TK&YXS>]W/.YVO.[V.]WE*MSBFMWI2]SG/&YW.$C*W.WI3&WF.M
MSAASG&.UWDJMWL[>YXS&YX2]WJW&UJW6[Y2]UE)K>YS.[V.,I83&[S&,QH2<
MK8R]WHS&[T)C>W.MUBE:>YR]UH2]YUJ<SDJ4SJ7.[XRUUH2MSI3&[W.ESH2]
M[T*$O0`I2@`Y:P!">[7&UE)C<TIC>T*,SB%KK0A2E._W_\[6WHR4G&-K<Z6U
MQL;>]Z6]UK76]ZW.[W.,I6-[E$):<VN4O6.,M2ECG!!KQ@`Q8U):8SEKI2%:
MG!!:K1!CO0A2I0!"C*7&[W.<SC%2>Q!:M0A2K0A:O0!*I;W6][7.[U)KC%J,
MS@A2M2E:I0!"I5I[M5)SK7.,O0@QA !2_TI28U)KI2E">S%CSF-[M6M[K3E2
MK<;.[Z6MSGN,UB$YM3%"I4)2YUICUK6UO7-SQF-CM0``I0``QEI*QEI*M3$A
M>T(AO5HQSDHQC'M*WGMCI5HIK<ZM_THI>\:E[V-*A/_[\*"@I(" @/\```#_
M`/__````__\`_P#______RP`````(0`@```(_@#_"1Q(L*#!@P@3*ERX\ `^
M? `>0L1W@&%"AQ0/8JQH<>!#CA<S=@0`$B1!?!Y1,A3YS^%!`"=5)B1Y$F;!
M`S13)F0I$$!.CQ$+\ASHDB#.H 1]VDQZ<"A$GT:5FOPW]-_2@4I_'D5Z\J9,
MK$IE/H4J5.C4K5RS_A3(TZE:@6C7MC3YM:?:BF-]UCU ]Z9/OA.M1G1(EBA=
MNE<AXBRYEN])DW(E"OW*TS'<JU@-XNQ:ENU4N$U!UJ7*4:["HE5=;N[8LW5H
MU@:K8OULL2C"U;!MAZ2-\"%KWPV!L\8I>R-LHQ,E2N1]?"[SYM#MJE :`( `
8`(("L I01D"N`->W"7_/WOTZ`0`!`0`[
`
end
======================================================================
- duplicates
-
JDK-4100793 Java 1.1.x on win32: frame dispose destroys shared icon resource
- Closed