Lost Password?

Go Back   CodeCall Programming Forum > Software Development > Java Help

Vote on your favorite hash algorithm here!

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.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-15-2007, 10:09 AM
stack stack is offline
Learning Programmer
 
Join Date: Mar 2007
Posts: 39
Credits: 0
Rep Power: 6
stack is on a distinguished road
Question JButton & java applet

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-15-2007, 03:20 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,238
Last Blog:
Passwords
Credits: 887
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John Send a message via MSN to John
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-16-2007, 04:16 AM
stack stack is offline
Learning Programmer
 
Join Date: Mar 2007
Posts: 39
Credits: 0
Rep Power: 6
stack is on a distinguished road
Default

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,,,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-16-2007, 04:20 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,238
Last Blog:
Passwords
Credits: 887
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John Send a message via MSN to John
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-17-2007, 04:38 AM
stack stack is offline
Learning Programmer
 
Join Date: Mar 2007
Posts: 39
Credits: 0
Rep Power: 6
stack is on a distinguished road
Default

Quote:
paint() and Swing don't often get along
i don't understand what did you mean??!!

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??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 08-21-2007, 11:19 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,238
Last Blog:
Passwords
Credits: 887
Rep Power: 20
John has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud ofJohn has much to be proud of
Send a message via AIM to John Send a message via MSN to John
Default

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);
    }
}
Just note you have no layout manager so each successive component will be placed over the previous one. Also for future posts, make use of the CODE tags - http://forum.codecall.net/faq.php
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-15-2007, 08:21 AM
stack stack is offline
Learning Programmer
 
Join Date: Mar 2007
Posts: 39
Credits: 0
Rep Power: 6
stack is on a distinguished road
Default

thank you

Last edited by stack; 09-15-2007 at 08:24 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -5. The time now is 11:17 AM.

Contest Stats

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

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 83%

Ads