| |
|
Welcome to KnowledgeSutra - Dear Guest | |
How To Create Java Button Or Frame
#14
Posted 06 August 2008 - 08:35 AM
How To Create Java Button Or Frame
How can I make my own customized button and put it in my program (JAVA)
Let's say I have predone program with a button and I have done my one button picture in Photoshop (and let's say it's form is a circle)
How can I change the regular look of a windows button or java button to this my own.
What code do I need?
-reply by solomon
#15
Posted 27 August 2008 - 02:33 PM
How To Create Java Button Or Frame
Replying to iGuest
You can use
JOptionPane.ShowMessageDialog(null,"YOUR MESSAGE HERe!!","NAME OF TITLE BAR HERE!!",JOptionPane.PLAIN_MESSAGE);//you can use JOptionPane.INFORMATION_MESSAGE if you want an information icon,JOptionPane.ERROR_MESSAGE if you want an error icon,JOptionPane.WARNING_MESSAGE if you want a warning icon, JOptionPane.QUESTION_MESSAGE if you want to pose a question to he user
-reply by joseph
#16
Posted 09 September 2009 - 08:55 AM
public class CustomeButton extends JButton{
public CustomeButton(){
setBorderPainted(false);
setContentFilled(false);
}
public void paintComponent(Graphics g){
g.SetColor(Color.White);
g.FillRoundRect(0,0,100,30,5,5);
}
}//end class
you can extend more features to this class and create more graphical button
baii
-reply by hacker#17
Posted 09 September 2009 - 04:50 PM
spieleforum, on Sep 3 2006, 11:32 PM, said:
i have a question too
he wanted to set up a background image to his new Button how can i do this? when i extend From "JButton" ?
overwrite the "paint(graphics g)" method
#19
Posted 04 March 2010 - 07:59 PM
Hi,
I've tried creating buttons with e.G. A single character in them, but find that I have to make them ridiculously large to show even such a short string. The height and width needs to be about 4 times the text dimensions, otherwise I just get "...". Is this internal padding something I can adjust or is this part of the "look and feel"?
Neil
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users














