How to custom my own gradient button independent of LAF?

I want ot custom own button style independent of LAF. It should be painted with
gradient colors. Something like metal LAF. Can you tell me how to do it?
Thank you.

There is a class called Gradiented and try and look at the source for the JButton in JDK1.5 this mite help
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JButton;
import javax.swing.JFrame;
public class GradientButton extends JButton {
        private Color color1;
        private Color color2;
        public GradientButton() {
                this(Color.WHITE, Color.LIGHT_GRAY);
        public GradientButton(Color c1, Color c2) {
                this.color1 = c1;
                this.color2 = c2;
        public void setColor1(Color c1) {
                this.color1 = c1;
                repaint();
        public void setColor2(Color c2) {
                this.color2 = c2;
                repaint();
//       Overloaded in order to paint the background
        protected void paintComponent(Graphics g) {
                final Graphics2D g2 = (Graphics2D) g;
                int w = getWidth();
                int h = getHeight();
                GradientPaint gradient = new GradientPaint(20, 0, color1, 20, h, color2,
                                false);
                g2.setPaint(gradient);
                g2.fillRect(0, 0, w, h);
        public static void main(String args[]) {
                JFrame frame = new JFrame();
                frame.setSize(600,400);
                GradientButton button = new GradientButton();
                button.setForeground(Color.BLACK);
                button.setText("Test");        
                frame.getContentPane().add(button);
                frame.pack();
                frame.setVisible(true);
}this is not my code i just cant remember the correct Thread of it i just saved it as i thought it would be of help some time down the line.
hope this is what you wanted

Similar Messages

  • How to set custom size of Close Button e.g. 32x32  of Title Window in Flex 4

    How to set custom size of Close Button e.g. 32x32 of Title Window in Flex 4?

    Hi
    Here is the code of the Button in the skin class of spark title window.
    <s:Button id="closeButton" skinClass="spark.skins.spark.TitleWindowCloseButtonSkin"
                              width="15" height="15" right="7" top="7" />
    So first change the default height and width from 15 to 32. Then in the Button Skin class i.e. spark.skins.spark.TitleWindowCloseButtonSkin change paths to modify the cross symbol.
    Hope this helps
    Rush-me

  • How can I permanently save my customized toolbars and navigation button settings? When I run Norton Utilities CleanUp, Firefox gets reset to 'factory'.

    I like to clean things out on a regular basis but when I run the Norton Clean-up utility all of my custom toolbar and navigation button settings get reset to 'factory' condition. How can I permanently save these changes to my config or preference settings?

    Cookies, Completed Forms, .tmp files are all that's set to be cleared. If I can identify the appropriate elements I can protect them from deletion. Does anyone know?

  • HOW TO: Your very own Adobe Update Server (Windows)

    Well, I thought I'd contribute something after wasting time sifting through info on how to get this done. It's not a hard process at all, once the steps get organized correctly.
    If you are reading this post, you most likely have already seen:
    http://helpx.adobe.com/creative-cloud/packager/update-server-setup-tool.html
    Maybe you’ve seen the dry (read: hard to stay awake and boring) video Adobe has posted as well and yet here we are… I found the materials Adobe provided informative yet riddled with inconsistencies and scatter brained writing. This guide will get you to a working install with minimal pain and effort. I’m sure plenty of you have Mac’s that you’d like to get running as an update server. Good luck, we’re a pc shop and that’s what this guide is going to be on. You can still update Mac’s with a windows based server. Mac users that want to setup an update server on a Mac will have to try and endure that video.
    I like complaining about things, so if you want the relevant info, I bolded it. If you need to change the command to fit your system, I highlighted the relevant section in red. You’re welcome.
    Requirements:
    Windows Operating System 64-bit (just so the file structure makes sense, if you are running 32-bit, that’s fine, but you’ll need to make the necessary changes to my write-up.)
    The requirements for CPU, Memory, and hard-drive free space are minimal (My freshly sync’d update directory is only 30.2GB). I’m going to lean on the safe side and say leave a few hundred gigs free on the hard-drive. All you are doing is making a file store that can be accessed via http from your clients. Any modern day computer can be your host. Have hundreds of client computer that will be downloading from your update server? That’s up to you on how you will want to handle it. Do DNS load balancing across multiple update servers, deploy different override files to different groups of clients that point those groups of clients to different servers, or use sas drives and team multiple gigabit Ethernet ports. I’m sure you’ll figure something out to handle your particular situation. I am just going to focus on a simple step-by-step to get you on your way.
    Step 1: Install Creative Cloud Packager
    This was the first thing that wasn’t clear to me. I’m new to Creative Cloud for Teams. I have 20 computers and knew that updating would be an issue with our internet connection. I intuitively searched for a way to set up an update server and came across the article linked earlier. “Note: AUSST is available in the utilities folder of Adobe® Creative Cloud™ Packager installation.“ Oh, that’s nice. No link. No help on where to get it…
    You can grab the download from your “Manage Your Team” control panel. It’s on the right side under “IT Deployment”. Download it, install it. This how-to isn’t about packages and how awesome they are for deployment or how to use them. So close the packager when you are done installing and move on to step 2.
    Step 2: Create a root directory to store all of your updates.
    I think it’s safe to assume that the root directory will only grow in size over time, so put it somewhere with a few hundred gigs of free space. The cloud is still young but I expect that amount to last you a while. To keep this easy, I created my directory as such:  G:/CreativeCloudUpdate
    Step 3: Run the AdobeUpdateServerSetupTool for the initial sync
    Open up command prompt as an administrator and type the following:
    cd "c:\Program Files (x86)\Common Files\Adobe\OOBE\PDApp\CCP\utilities\AUSST"
    AdobeUpdateServerSetupTool --root="G:/CreativeCloudUpdate" --fresh
    When it is done updating, leave the command prompt up, you’ll need it again.
    Step 4: Create the client config file
    For whatever reason, the AdobeUpdateServerSetupTool can’t create a config folder. So you’ll have to make it yourself if you want this to work.
    Go to G:/CreativeCloudUpdate and create a folder called   config
    Head back over to the command prompt and type the following:
    AdobeUpdateServerSetupTool --genclientconf="G:/CreativeCloudUpdate/config/AdobeUpdaterClient" --root="G:/CreativeCloudUpdate/" --url=http://192.168.1.4/
    If this worked, you should get something like the following:
    “Generate Client Configuration XML chosen.
    Files generated at specified path.”
    Double check to make sure the files are generated inside the G:/CreativeCloudUpdate/config directory.
    Step 5: Setup the Web Server
    We’ll use Apache 2.2 for this setup. Yes, I am aware 2.4 is out, and 64-bit is available and that there are different web servers and and and. If you want to set something else up, go for it, be my guest, but you won’t find compile or update directions here. Also, if you want to use IIS, again, go for it. I didn’t find anything wrong with the directions in the very first link in this post. Remember, this guide is simplicity focused. I expect you to know how to keep your own network up to date.
    ALLOW PORT 80 THROUGH WINDOWS FIREWALL OR ANY OTHER FIREWALL SOFTWARE YOU ARE RUNNING ON THE SERVER!
    Download and install the following:
    http://mirror.metrocast.net/apache//httpd/binaries/win32/httpd-2.2.25-win32-x86-no_ssl.msi
    You can keep all of the defaults during install.
    Once installed, you’ll have a little feather and play button in your system tray. Double click on that to bring up the server monitor. STOP the process.
    Navigate to C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf
    Open up httpd in a text editor like notepad, you’ve got a little editing to do. Do a search and replace. You’ll want to find EVERY OCCURANCE of the following sentence:
    C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs
    And replace it with the following sentence:
    G:/CreativeCloudUpdate
    Save the file. Go back to the Apache server monitor and start the process.
    Step 6: Setup the Clients
    The file is located here: G:\CreativeCloudUpdate\config\AdobeUpdaterClient\win
    And here: http://192.168.1.4/config/AdobeUpdaterClient/win
    It is called: AdobeUpdater.OVERRIDES
    And it needs to end up here on the client computers:
    In Windows XP:
    \Documents and Settings\All Users\ApplicationData\Adobe\AAMUpdater\1.0\AdobeUpdater.Overrides
    In Windows 7/Vista:
    \ProgramData\Adobe\AAMUpdater\1.0\AdobeUpdater.Overrides
    In Mac OS X:
    /Library/Application Support/Adobe/AAMUpdater/1.0/AdobeUpdater.Overrides
    It is your choice concerning how to get the overrides file onto the client computer. THE BEST WAY is to include it in the package you deploy from the Creative Cloud Packager(not covered in this guide). If you already have Creative Cloud installed and want to start updating via the server you just setup: You could use group policy to deploy the file. If you only have a handful of computers, you could put it on by hand. You could script it. You could email it to all your users and tell them to place the file. Pick whatever you feel will work best for you in your environment.
    IF you are just deploying the Creative Cloud in your environment and were smart enough to think ahead and setup the update server FIRST. Look up (If you have to, it’s really intuitive) how to use the package manager and make sure to change the package configuration to use this overrides file.
    Step 7: Check for and download updated files to your update server
    To manually do this, open up command prompt as an administrator and type the following:
    cd "c:\Program Files (x86)\Common Files\Adobe\OOBE\PDApp\CCP\utilities\AUSST"
    AdobeUpdateServerSetupTool --root="G:/CreativeCloudUpdate" --incremental
    To do this automatically you need to make a scheduled task to run the command above. The only issue I have run into is the task does not seem to run unless you are logged into the server. If no-one is logged in, the task triggers, but an update never happens.
    All in all, I am happy that there was a way to do this. I AM NOT HAPPY that Adobe made it an after thought. A system service would have been a very elegant solution or you know, a simple custom server app that does everything in this guide for you AND makes it easy to run the incremental updater on a schedule. But noooooo, they couldn’t be bothered to do that, I mean really, who wants their own update server anyways…

    Hi,
    in relation to on to the above could you please share some thoughts on using AUSST in an enterprise environment spread over 50 countries i relation how to setup the AUSST, taking WAN Lines into considerations. We are using SCCM for application deployment and patching. Is there a comparising model for AUSST vs. SCCM?
    i Get the picture using AUSST in a company with one huge Building using the LAN capacity, but what technologies are used to replicate over WAN etc?
    br
    Twinkle6862

  • How to define our own selection screen for logical database  in abap-hr?

    Hi Friends,
    Can u please help me
    How to define your own selection screens for  logical database.
    we use to do like(goto->attributes-HRReportcatagerious ).but How to desin using  customer table like t599c, t599f and how to add to my logical database?
    Thanks in advance
    charan

    check out this online help
    http://help.sap.com/saphelp_erp2004/helpdata/en/9f/dba65c35c111d1829f0000e829fbfe/frameset.htm
    Regards
    Raja

  • How do I use directional PDA buttons in LabVIEW programs?

    Hi all,
    I've been assigned to get a LabVIEW program to work on a Palm PDA with LabVIEW 7.0 and palm PDA module 7.0.  I am basically totally new to LabVIEW, and my possibly very simple problem is, the PC program requires input from a serially connected number pad for the 8, 4, 5, 6, and 2 keys which are used as four directions (8, 4, 6, and 2) and an enter (5). 
    I am trying to rewrite the input vi to use the directional buttons and middle enter button on the PDA itself but am having trouble figuring out what to use.  I am using a PDA simulator because of the PALM OS5 we own.  The input demo vi example provided will not build for PDA because of size so I am unsure of how to approach this.  Another thing is, we have LabVIEW and PDA module for pocket PC 8.0, and a Dell Axim PDA on order.  From what I understand off of this website, the latest PDA module has example button vi's.  I would still like to figure out the way to do this on 7.0 so I can have a better understanding of LabVIEW.  Eventually the program's endgoal is to be used on a PDA and inputting with a bluetooth keyboard, but we are going step by step right now.
    I guess my biggest questions are, how do I assign the directional buttons on the PDA in my program, and will this differ greatly when we switch to 8.0 and pocketPC.
    Oh and I did try to look at the example asteroid.vi but from looking at the input subvi, still couldn't figure out how they assigned the buttons.
    Thanks,
    Stephen

    I can't help with any specifics (no access to the PDA module at the moment and I didn't use the buttons anyway), but I would like to say that it probably would make a big difference if you used LV 8. 7.0 was the first version of the PDA module and was extemely limited and problematic (it didn't even have a tab control). 7.1 was somewhat better and I understand that 8 is even better (although still very limited and buggy).
    I also remember reading about several differences between Palm and PocketPC and I think you will generally be better off with the PocketPC as it's related to windows and will probably support more stuff.
    Try to take over the world!

  • How do I add a FullScreen button to Project Playback Skin?

    How do I add a fullscreen button to the project playback skin? I know how to load another skin (using Project -> Skin Editor) and how to add a custom playback skin (paste custom skin SWF into C:\Program Files\Adobe\Adobe Captivate 5\en_US\Gallery\Playbars) but I'm having a little trouble figuring out how to add a fullscreen button when editing the Flash AS3 so that it will show up in my custom playback skin when loaded into Captivate via Project->Skin Editor. Any ideas?

    Hi there
    I might assume that seeing as you were able to work the magick with the CC button it would be a simple task to pick apart the other elements and add the desired button without hijacking the CC button.
    I mean, if you are that deep in Flash territory and all, it doesn't seem like much of a stretch to figure out how the buttons are added, no?
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcererStone Blog
    Captivate eBooks

  • How can I disable the Voicemail button on an iPhone 4

    How can I disable the Voicemail button on an iPhone 4 or
    if that is not possible can i programme it to dial my own phone rather than my carrier's Voicemail box?

    No, it's not possible to disable that button and no, it's not possible to reprogram it to anything else.

  • How do you enable 'Create Content' button on 'Add Content' page?

    How do you enable ‘Create Content’ button on ‘Add Content’ page?
    There is new functionality to a ‘Layout’ type personalization page like ‘Sales Dashboard’.
    Bug 4503123 INCONSISTENT WAY OF ADDING USER-DEFINED REGIONS ON WYSIWYG PAGE:
    There’s no way to add custom content to a configurable page.
    Add a “Create Content” button and let the user create a piece of content that extends to a region he creates.
    It says: Fixed->11.5.10.3CU
    In Oracle® Application Framework Personalization Guide Release 11i Part No. B25439-02 it says:
    p 4-5
    If you personalize a non-configurable page (a page that does not have the necessary metadata to personalize its layout) or when you run your application in Accessibility mode (profile option Self Service Accessibility Features (ICX_ACCESSIBILITY_FEATURES) is set to Standard Accessibility), you will not see the Page Layout Personalization page, as shown below. Instead, you will see the Page Hierarchy Personalization page, page 4-12, where you can perform the same personalization functions, using a descriptive tabular user interface.
    It tried this and can’t get it to display.
    Has anyone run accross this before?

    user587952,
    Can you describe your issue in detail forgetting those references for the time being. What exactly are you trying to do?
    Check this from the dev guide:
    In order to be able to take full advantage of page layout personalization capabilities, it is important when you create your configurable page, to use flexibleLayout and flexibleContent regions at all levels when you create the page hierarchy structure under your page layout region. In Oracle Applications, this is required, as it is the coding standard.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How a custom component is called when we install a custom component in UCM.

    How a custom component is called when we install a custom component in UCM.
    On what event the component services will be activated and called.
    Suppose i create a Custom service name MULTIPLECHECKIN then this service will be called on what event and where it will be defined to call.

    Saurabh,
    the code is packed in the component (see component\Security Filter\java\Security Filter\ModifyAttributesFilter.java - the first Security Filter is the component name, the other Security Filter is the Java package name).
    What is important:
    - your class must implement the FilterImplementor interface (you will need UCM standard classes - server.zip in your classpath) and its doFilter method
    How the filter is executed?
    - actually, in this case you don't need any new service - you can use the standard 'hook', which is provided by standard checkin services
    - in Component Wizard create a new component, add your compiled class to it (make sure you follow the rules not to end up in classpath issues)
    - in Component Wizard click the 'Java Code' tab. Here you can add a Custom filter called validateCheckinData, which is executed by standard checkin services. If you parametrize the filter to call your class created above, you are done.
    'Working with Content Components' manual (e.g. here: http://download.oracle.com/docs/cd/E10316_01/cs/cs_doc_10/documentation/developer/using_components_10en.pdf) can give you a basic picture. A better resource is Bex Huff's book - I would recommend you to get it, because it has a step-by-step HelloWorld example which can guide you through Component Wizard. I could also send you my own component (send me an email at [email protected]) which implements a filter for user quotas, so you just need to "replace classes".
    As for the other half of your task, searching for the file in the database server will work only if you use database as your storage (ie. install and configure File Store Provider component accordingly). Of course, you could do a search for file in this case - just consider that you will be comparing two BLOBs rather than two relatively short check-sums (most likely strings or arrays of bytes). Besides, it will not work if you use filesystem as your storage.
    Jiri

  • How to make next and previous button function

    Hello
    Can anybody help me with how to achieve next and previous button function such as the one at www.bestbuy.com?
    I would appreciate any help or suggestion.
    Thank you!

    if you're not familiar with flash it might be easiest to place your initial "page" in frame 1, the 2nd (or next) page in frame 2, the 3rd/next page in frame 3 etc.
    place your previous and next buttons in their own layer that spans the main timeline (which will have as many frames as you have "pages").  give them instance names (say prevBtn and nextBtn).
    you can then use the following code placed in frame 1:
    var tl:MovieClip=this
    prevBtn.onRelease=function(){
    tl.prevFrame();
    nextBtn.onRelease=function(){
    tl.nextFrame();

  • How can I add a review button on my podcast

    How can I add a review button on my podcast, so I can see it on my iphone or itouch?

    You must create a custom signature.
    Find a guide here

  • How do I make a SEARCH button an image

    Does anyone know or can point me to a source how to implement
    a custom designed image into a SEARCH button.
    I found out how to make it a standard button but can not find
    a way to customize it.
    I am working in DW MX 2004

    Why don't you use scrollpane
    import fl.containers.ScrollPane;
    var myScrollPane:ScrollPane = new ScrollPane();
    myScrollPane.source = "http://localhost/strategist/images/image0.gif";
    addChild(myScrollPane);

  • How to add my own iview in Compliance Calibrator

    Hi Experts,
    can plaese tell me how to add my own iview in Compliance Calibrator 5.1.

    Anubha,
    If you are trying to add an iview or URL to Compliance Calibrator you have to login as an administrator go into the configuration tab, and go to Custom tabs toward the bottom of the left screen.  Here you can add custom URL links that will appear as tabs in Compliance Calibrator.
    Hope this helps
    Gabe

  • How to get my own EventHandler and EventListener working?

    I´m trying to learn how to write my own EventListener.
    I would do something like the ActionListener.
    import java.util.EventListener;
    import java.util.EventObject;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    public class Main extends JFrame {
        public static void main(String[] args) {
            new Main();
        private MyButton button = new MyButton();
        public Main() {
            this.setSize(200,200);
            this.setVisible(true);
            button.addMyEventListener(new MyEventListener(){
                public void action(MyEventHandler e) {
                    System.out.println("Changed");
            this.add(button);
        class MyButton extends JButton implements MyEventListener {
            private MyEventListener list;
            public void addMyEventListener(MyEventListener list){
                this.list = list;
            public void fireAction(MyEventHandler e){
                list.action(e);
            public void action(MyEventHandler e) {
                fireAction(e);
        interface MyEventListener extends EventListener{
            public void action(MyEventHandler e);
        class MyEventHandler extends EventObject{
            private Object obj;
            public MyEventHandler(Object obj){
                super(obj);
                this.obj = obj;
    }But when I press the button, the action is not performed. What else do I have to do?

    Follow the bouncing example
    package mil.army.logsa.sandbox.thread;
    import java.util.Observable;
    import java.util.Observer;
    public class RunnableExample implements Observer {
         public static void main(String[] args){
              RunnableExample e = new RunnableExample() ;
              e.exec() ;
         // This is here because you can't reference (this) in the static context of the main method
         private void exec(){
              System.out.println("Launching RunnableExample") ;
              System.out.println("Creating Thing") ;
              Thing t = new Thing(this) ;
              t.start() ;
              System.out.println("Shutting down RunnableExample") ;
         @Override
         public void update(Observable o, Object arg) {
              System.out.println(arg) ;
    class Thing extends Thread {
         private ObservableThing obsThing ;
         public Thing(Observer o){
              super() ;
              obsThing = new ObservableThing() ;
              obsThing.addObserver(o) ;
         public void run(){
              System.out.println("Starting Thing") ;
              for(int i=0; i<100; i++){
                   obsThing.notifyObservers(i + " is " + (i%2==0 ? "EVEN" : "ODD")) ;
              System.out.println("Thing is finished") ;
    class ObservableThing extends Observable{
         public void notifyObservers(Object o){
              setChanged() ;
              super.notifyObservers(o) ;
    }PS.

Maybe you are looking for

  • HT4864 I have to reset my password, ICloud message says the one I am trying to use is wrong. Can't find how to reset it.

    iCloud says I don't have the correct password. How do I reset the iCloud password?

  • Examples?

    I may be looking in the wrong place within Adobe Exchange but I only found 13 examples (CS4 and CS5) and most seem to be duplicates of placing a bunch of tools on a single palette. What am I missing by not playing with configurator? what's the best t

  • IPhoto automatically imported EVENT and its photos?

    I imported some photos into iPhoto on my MacBook Air this weekend while away. This morning (I'm back home), I started the MacBook Air with the intent of copying the imported photos to my iMac and eventually into the iPhoto library. So the Air is runn

  • Dynamically Selection Screen Change

    Hi Experts, I have 5 buttons on the application toolbar and on click of each button, i need to populate difference selection parameters. I have tried modifying the SCREEN table dynamically but maintaining SCREEN table for 5 different action seems ver

  • Problem with clearbox

    I want to disable in clearbox the function for change the picture with the mouse wheel but i don't know how.