A problem; please help.
From: H. Sommers (H.Sommers_at_freeler.nl)
Date: 12/30/04
- Next message: Ryan Stewart: "Re: A problem; please help."
- Previous message: thufir: "Re: GUI error: Could not find the main class. Program will exit."
- Next in thread: Ryan Stewart: "Re: A problem; please help."
- Reply: Ryan Stewart: "Re: A problem; please help."
- Reply: Andrew Thompson: "Re: A problem; please help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Dec 2004 15:01:22 +0100
The picture will not appear, but why??????????
When I use a simple applet, it works.
-------------------------------------------------------------------------------------------------------------------------
package test;
public class TestClass
{
public TestClass()
{
}
public static void main(String[] args)
{
TestClass testClass = new TestClass();
TestFrame test = new TestFrame();
test.show();
}
}
-----------------------------------------------------------------------------------------------------------------------------
package test;
import java.awt.*;
import javax.swing.*;
public class TestFrame extends JFrame
{
JButton jButton1 = new JButton();
public TestFrame()
{
try
{
jbInit();
}
catch(Exception e)
{
e.printStackTrace();
}
}
private void jbInit() throws Exception
{
jButton1.setText("jButton1");
jButton1.setBounds(new Rectangle(67, 37, 182, 114));
this.getContentPane().setLayout(null);
this.setSize(new Dimension(300, 300));
this.getContentPane().add(jButton1, null);
}
// ????????????????????????????
// ????????????????????????????
// ????????????????????????????
private void picture()
{
ImageIcon pic = new ImageIcon("images/duke.gif");
jButton1.setIcon(pic);
}
}
- Next message: Ryan Stewart: "Re: A problem; please help."
- Previous message: thufir: "Re: GUI error: Could not find the main class. Program will exit."
- Next in thread: Ryan Stewart: "Re: A problem; please help."
- Reply: Ryan Stewart: "Re: A problem; please help."
- Reply: Andrew Thompson: "Re: A problem; please help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]