|
||||||
| 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 |
|
|||
|
hi,
how can I put JButton in java applet window?? write a small lines of code(containing only java applet window and Button) to Know how to put it please? |
| Sponsored Links |
|
|
|
|||||
|
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 06:41 PM |
| question about LAN & java applet | stack | Java Help | 1 | 08-01-2007 04:51 PM |
| java applet window size?? | stack | Java Help | 5 | 07-24-2007 09:00 AM |
| Java Facts | techni68 | Java Help | 0 | 01-17-2007 01:41 PM |
| Java Help Files | xXHalfSliceXx | Java Help | 3 | 11-28-2006 11:30 PM |
| Xav | ........ | 1335.07 |
| MeTh0Dz|Reb0rn | ........ | 1059.99 |
| morefood2001 | ........ | 898.18 |
| John | ........ | 887.37 |
| marwex89 | ........ | 875.28 |
| WingedPanther | ........ | 864.22 |
| Brandon W | ........ | 764.23 |
| chili5 | ........ | 312.39 |
| Steve.L | ........ | 256.16 |
| dcs | ........ | 231.11 |
Goal: 100,000 Posts
Complete: 83%