|
||||||
| Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||||
|
post your attempt and ill correct it
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||
|
this is my attempt, why the button doesn't appear??
***** import javax.swing.JApplet; import java.awt.Graphics; import java.awt.Color; import javax.swing.JButton; import javax.swing.ImageIcon; public class yahoo extends JApplet{ private JButton button,picture; public void init(){ setBackground(Color.PINK); button = new JButton("clilck here"); pic = new ImageIcon("flower.jpg"); picture=new JButton(pic); } public void paint(Graphics g){ add(button); add(picture); } } ************************* there is 2 buttons one with string and one with Image Icon,,, |
|
|||||
|
paint() and Swing don't often get along
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||
|
Quote:
did you you mean that JButton doesn't appear in JApplet window because it is Swing?? Can I put JPanel above JApplet window to appear the JButton?? |
| Sponsored Links |
|
|
|
|||||
|
Code:
import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
import javax.swing.JButton;
public class yahoo extends JApplet {
private JButton button,picture;
public void init() {
setBackground(Color.PINK);
button = new JButton("clilck here");
ImageIcon pic = new ImageIcon("flower.jpg");
picture=new JButton(pic);
add(button);
add(picture);
}
}
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java:Tutorial - Tic-Tac-Toe | John | Java Tutorials | 25 | 02-27-2008 07:41 PM |
| question about LAN & java applet | stack | Java Help | 1 | 08-01-2007 05:51 PM |
| java applet window size?? | stack | Java Help | 5 | 07-24-2007 10:00 AM |
| Java Facts | techni68 | Java Help | 0 | 01-17-2007 02:41 PM |
| Java Help Files | xXHalfSliceXx | Java Help | 3 | 11-29-2006 12:30 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |