Jump to content
xisto Community
Sign in to follow this  
negativezero

How To Create Java Button Or Frame to be customized

Recommended Posts

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

Share this post


Link to post
Share on other sites

Yes i would Prefer this way because its much easier than doing a own Look and Feel but when you create a own look and Feel you can change the Design of all Buttons in you Programm even the Buttons that are used in the programm bevore you created the new Look and Feel
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

Share this post


Link to post
Share on other sites
buttons with same nameHow To Create Java Button Or Frame

good evening.

if we have 2 buttons with the same name and each button related to an event

how could the system distinguish between them if we select one?

thanks

-reply by rasha

Share this post


Link to post
Share on other sites
Buttons too large, text replaced by ellipsis...How To Create Java Button Or Frame

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

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.