Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2004

Tip: Looking for answers? Try searching our database.

Using a JButton

Thread view: 
H. Sommers - 30 Dec 2004 14:04 GMT
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);
 }

}
Andrew Thompson - 30 Dec 2004 14:14 GMT
> The picture will not appear, but why??????????

This message will appear on a number of groups..
<http://www.physci.org/codes/javafaq.jsp#xpost>

Whereas the answer.. will appear on only one message you posted.

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Andrew McDonagh - 30 Dec 2004 14:49 GMT
> The picture will not appear, but why??????????
> When I use a simple applet, it works.
[quoted text clipped - 59 lines]
>
> }

The picture() method is not being called.


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.