Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners How to add icons on a button or any component in java
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


tarun1
How to add icons on a button or any component in java
1 Answer(s)      6 years and 3 months ago
Posted in : Java Beginners



Advertisement
View Answers

October 14, 2008 at 4:16 PM


Hi,


import javax.swing.*;
import java.awt.*;

public class IconButtonDemo{
public static void main(String[] args){
JFrame frame = new JFrame("Icon on button");
JButton button = new JButton("Roseindia.net");
Icon imgicon = new ImageIcon("icon_confused.gif");
JPanel panel = new JPanel();
button.setIcon(imgicon);
panel.add(button);
frame.add(panel, BorderLayout.NORTH);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

------------------------------------------

Visit for more information.

http://www.roseindia.net/java/example/java/swing/

Thanks.


Related Tutorials/Questions & Answers:
How to add icons on a button or any component in java - Java Beginners
How to add icons on a button or any component in java  How to add icons on a button or any component in java?  Hi, import... main(String[] args){ JFrame frame = new JFrame("Icon on button
Icons - Java Beginners
Icons  How to add icons on button and on a label   Hi friend, Please specify the problem in details. Thanks
Advertisements
how to add components (like button , checkbox etc) in a table column in core java
how to add components (like button , checkbox etc) in a table column in core java  plz tell me how to add components(like button, checkbox, radiobutton etc)in a table column in core java
how to add a update button in the following jsp
how to add a update button in the following jsp  Once the excel from the following jsp is loaded to the broswer, how to add a button in the jsp to allow the user to update the excel? thanks, <%@page import="java.io.*"%>
how to add to numbers in java
how to add to numbers in java  how to add to numbers in java
how to add save,discard,& cancel button in a message box - Struts
how to add save,discard,& cancel button in a message box  how to add save,discard,& cancel button in a message box
How to add a columns with a button set to a Jtable built with database result set
How to add a columns with a button set to a Jtable built with database result..., there should be another button to get further details of a account such as transactions... that button column to the table which is built with database result set. i would thank
dynamicly add component to jsf page.
dynamicly add component to jsf page.  i want display image or text from database on jsf page. so i want to add components dynamicly. how am i do this. thanks for answers...   Please visit the following link: http
How to add radio button value in a table for particular field?
How to add radio button value in a table for particular field?  Hi,I... dynamically from other table and two radio button one for present and the second... one radio button for text field then it insert only one value absent OR present
how to add database in Java Applet
how to add database in Java Applet  hi every java master or Java Professional my name is vincent i'm java beginners hope u all can ,tech me how to add database in Java Applet below this code is my applet source code . thank
Java component
Java component  What is the preferred size of a component
How to add dynamic table in java
How to add dynamic table in java  How to add dynamic table in java   import java.awt.*; import java.sql.*; import java.util.*; import javax.swing.*; import java.awt.event.*; import javax.swing.table.*; public class
Selecting a Radio Button component in Java
Selecting a Radio Button component in Java       In this section, you will learn how to set the radio... on any radio button from a ButtonGroup the text of the selected radio button
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
How to find java jobs at any where in india
How to find java jobs at any where in india   Hi, I want information about java related jobs in india.where can i find that details
How to call java method on Button click in jsp?
How to call java method on Button click in jsp?  How to call java method on Button click in jsp
How to add
How to add   Hi, I want to make a website which will recommend users... to be viewed after clicking a link/button/whatever mentioning -"Next 10 recommendations". Please tell me what code should I use. Or is there any workaround
Create a JRadioButton Component in Java
Create a JRadioButton Component in Java   ... button in java swing. Radio Button is like check box. Differences between check... it once. Here, you will see the JRadioButton component creation procedure in java
add button to the frame - Swing AWT
add button to the frame  i want to add button at the bottom...); JScrollPane scrollPane = new JScrollPane(table); frame.getContentPane().add... JFrame implements ActionListener { JButton button = new JButton("Button
how to add date and change date in java - netbeans
how to add date and change date in java - netbeans  I need to code use to increase date How to get date after 30 days using netbeans
How to add key value pair in Java
How to add key value pair in Java  Hi, I have to store the key and value pair in Java. How to store key value pair in Java? Thanks   Hi, You can use the put method of Hashtable. Check the tutorial Creating a Hash
How to Hide Button using Java Swing
How to Hide Button using Java Swing  Hi, I just begin to learn java programming. How to hide the button in Java programming. Please anyone suggest... Programming application how to hide the buttons using Java Swing. Please Visit
struts2 how can we add an radio button to form using a class(doa)
struts2 how can we add an radio button to form using a class(doa)  Hi I had created an class of subscription,and iam trying to add an radio button on the registration form how to do plz help me out here is my code model
struts2 how can we add an radio button to form using a class(doa)
struts2 how can we add an radio button to form using a class(doa)  Hi I had created an class of subscription,and iam trying to add an radio button on the registration form how to do plz help me out here is my code model
How to Add JComboBox on JPanel - Java Beginners
How to Add JComboBox on JPanel  How to Add JComboBox on JPanel D:\java>javac ViewElements.java ViewElements.java:181: expected...(){ JFrame f = new JFrame("Frame in Java Swing"); f.getContentPane().setLayout(null
Container or Component - Java Beginners
about the realtionship between Components and Containers in Java GUI? 1) a component is a subclass of a container which means any container can hold a component 2) a component is allowed to hold other components including containers. 3
How to solve button problem - Java Beginners
How to solve button problem  I have created button (Open File Dialog) , List, JTabbedpane and MenuBar . By clicking btnBrowse button I am getting... equal space So button size also increasing. Could you please guide me how
Icons - MobileApplications
Icons  I want to create one folder in j2me for storing images.How to create it and how to allocate memory for that folder
Java component class
Java component class  Which method of the Component class is used to set the position and size of a component
How to Create any type of Reports in Java - Java Beginners
How to Create any type of Reports in Java  Hello Sir ,How I can create any type of Reports like Crystal Reports etc(Student Result Report) in Java Application,plz Help Me Sir
Creating Flex ActionScript Custom Component extending Button
; } Creating Flex ActionScript Custom Component extending Button  ...,  a custom button component is created by extending Button class.  ... CompRI will be used to refer any component in mycomp package.  
Advertisements
 

 

 

DMCA.com