Only for real programmers...

I have this problem of changing the look and feel of my application. I am not using any readymade theme but applying my own color combination to whole application. I am stuck in changing the background color of dialog boxes, filechoosers. basically the pop-ups. The sample code is shown below:
public class TestDialog extends javax.swing.JDialog {
/** Creates new form TestDialog */
public TestDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
/** This method is called from within the constructor to
* initialize the form.
private void initComponents() {
jOptionPane1 = new javax.swing.JOptionPane();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("Test Dialog");
setUndecorated(true);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
closeDialog(evt);
jOptionPane1.setBackground(new java.awt.Color(239, 239, 239));
jOptionPane1.setBorder(null);
jOptionPane1.setForeground(new java.awt.Color(0, 0, 0));
jOptionPane1.setMessageType(javax.swing.JOptionPane.QUESTION_MESSAGE);
jOptionPane1.setOptionType(javax.swing.JOptionPane.YES_NO_OPTION);
jOptionPane1.setPreferredSize(new java.awt.Dimension(200, 90));
getContentPane().add(jOptionPane1, java.awt.BorderLayout.CENTER);
pack();
/** Closes the dialog */
private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
setVisible(false);
dispose();
* @param args the command line arguments
public static void main(String args[]) {
new TestDialog(new javax.swing.JFrame(), true).show();
// Variables declaration
private javax.swing.JOptionPane jOptionPane1;
// End of variables declaration
Now I dont want that irritating gray background, so i am changing it to some Color(239,239,239). buts its not coming up only on the border area.. and not on the full screen. Now what do I have to change.. here i have three components.. JDialog, JOptionPane, and a parent frame... i have triend changing background of all three but for no use. Please help me out.. its urgent. Thanx in advance.

If you want to create a color combination, you'll be better off creating a theme. This can be done by extending the DefaultMetalTheme and changing the colors. Here's a theme to use. Note: I typed in random rgb values, this is not a real color set (meaning it should not look nice :)
import java.awt.*;
import javax.swing.*;
import javax.swing.plaf.*;
import javax.swing.plaf.metal.*;
public class MyLookAndFeel extends MetalLookAndFeel
    public MyLookAndFeel()
        super();
        MetalTheme myLookAndFeel = new MyTheme();
        setCurrentTheme(myLookAndFeel);
class MyTheme extends DefaultMetalTheme
    public String getName() { return "My Theme"; }
    private final ColorUIResource primary1 = new ColorUIResource(255, 0, 0);
    private final ColorUIResource primary2 = new ColorUIResource(40, 190, 240);
    private final ColorUIResource primary3 = new ColorUIResource(20, 140, 105);
    private final ColorUIResource secondary1 = new ColorUIResource(75, 180, 125);
    private final ColorUIResource secondary2 = new ColorUIResource(75, 180, 125);
    private final ColorUIResource secondary3 = new ColorUIResource(255, 255, 200);
    private final ColorUIResource black = new ColorUIResource(200, 210, 230);
    private final ColorUIResource white = new ColorUIResource(65, 90, 90);
    protected ColorUIResource getPrimary1() { return primary1; }
    protected ColorUIResource getPrimary2() { return primary2; }
    protected ColorUIResource getPrimary3() { return primary3; }
    protected ColorUIResource getSecondary1() { return secondary1; }
    protected ColorUIResource getSecondary2() { return secondary2; }
    protected ColorUIResource getSecondary3() { return secondary3; }
    protected ColorUIResource getBlack() { return black; }
    protected ColorUIResource getWhite() { return white; }
}Then to apply this to your program, here's it is:
import javax.swing.*;
public class TestDialog extends javax.swing.JDialog {
/** Creates new form TestDialog */
public TestDialog(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
/** This method is called from within the constructor to
* initialize the form.
private void initComponents() {
jOptionPane1 = new javax.swing.JOptionPane();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("Test Dialog");
setUndecorated(true);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
closeDialog(evt);
//jOptionPane1.setBackground(new java.awt.Color(255, 0, 0));
jOptionPane1.setBorder(null);
jOptionPane1.setForeground(new java.awt.Color(0, 0, 0));
jOptionPane1.setMessageType(javax.swing.JOptionPane.QUESTION_MESSAGE);
jOptionPane1.setOptionType(javax.swing.JOptionPane.YES_NO_OPTION);
jOptionPane1.setPreferredSize(new java.awt.Dimension(200, 90));
getContentPane().add(jOptionPane1, java.awt.BorderLayout.CENTER);
pack();
/** Closes the dialog */
private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog
setVisible(false);
dispose();
* @param args the command line arguments
public static void main(String args[]) {
try // CHANGE HERE
    UIManager.setLookAndFeel("MyLookAndFeel");
} catch(Exception e) {}
new TestDialog(new javax.swing.JFrame(), true).show();
// Variables declaration
private javax.swing.JOptionPane jOptionPane1;
// End of variables declaration
}This is one way to do it. It's simple even if if it looks like a lot of code. The only thing is that you need your own icons when creating your theme. If you want to use the defaults, extract them from rt.jar and put them in MyLookAndFeel/icons . You can see examples like these in MetalWorks.

Similar Messages

  • Looking for Java programmers for a new project

    I am currently looking to find about 5 people to start a new company to develop some ebusiness related business ideas. Location does not matter, only creativity and a willingness to change the status quo. If you are interested email me at [email protected] I am just a guy with some really unique ideas looking for people that share my vision and that are looking to start a company from the ground up.

    Hi,
    Are you still looking for Java programmers? Can we participate in your work offline? I am in France now. Tell me what exactly you need? I am 5yers experienced in Java technlogy.
    Reply back to [email protected]
    Regards,
    Murthy

  • HT4060 Cannot get iPad 2 charged beyond 1%.  All charging ports tried: AC adapter(s), USB 2 port on MacBook Pro. ITunes shows iPad only for a few seconds. iPad displays alternately: Apple logo, battery w/slim red band, then battery w/1% charged informatio

    Cannot get iPad 2 charged beyond 1%.  All charging ports tried: AC adapter(s), USB 2 port on MacBook Pro. ITunes shows iPad only for a few seconds. iPad displays alternately: Apple logo, battery w/slim red band, then battery w/1% charged information. How can I get it to charge beyond 1% so I can proceed to troubleshoot?

    I have had your exact problem with my old 3GS, now I cannot even get it to turn on, I still see that it is supposed to be charging though, but it never charges any so it seems.
    I replaced the Lower Dock Connector Assembly back when it still charged while hooked to my PC, and it found it made no real difference.
    http://www.amazon.com/gp/product/B003Y5YXLK/ref=oh_details_o05_s00_i00?ie=UTF8&p sc=1 
    At this point I am not sure if I should replace the battery and hope for the best, or just junk the phone, I cannot really sell it if I cannot reset it...

  • RemovingContext only for One level(Message Mapping)

    Hi,
    Is it possible to remove context only for one level?
    For Eg:If I apply [RemoveContext] function to <Item>
    I will get {A1,A2,B1,B2,C1,C2,C3,C4}
    <SourceRoot>
    <A>
    <Item r="a">A1</Item>
    <Item r="b">A2</Item>
    </A>
    <A>
    <Item r="a">B1</Item>
    <Item r="b">B2</Item>
    </A>
    <A>
    <Item r="a">c1</Item>
    <Item r="b">c2</Item>
    <Item r="c">c3</Item>
    <Item r="d">c4</Item>
    </A>
    </SourceRoot>
    But I need only those coming under a particluar <A> .
    Like {B1,B2}.
    Any way to do this?
    Can anyone help.
    Thanks in Advance
    Message was edited by: Chemmanz

    Hi,
    I was just trying to give an example. In my real case
    SOURCE - INVOIC01 IDoc
    TARGET - cXML Structure for Invoice.
    When it goes to Line item level the complexity comes.
    A similar situation as i explained needs to be solved.
    [REMOVECONTEXT] helped me a lot.
    But I this situation I want to restrict it to a single level.
    For Ex:
    <INVOIC02>
    <IDOC>
    <EIEDP01>
    <EIEDP02 QUALF="001">.. </EIEDP02>
    <EIEDP02 QUALF="002">.. </EIEDP02>
    <EIEDP02 QUALF="0xx">.. </EIEDP02>
    </EIEDP01>
    <EIEDP01>
    <EIEDP02 QUALF="001">.. </EIEDP02>
    <EIEDP02 QUALF="002">.. </EIEDP02>
    <EIEDP02 QUALF="0xx">.. </EIEDP02>
    </EIEDP01>
    </IDOC>
    </INVOIC02>
    1.<EIEDP01>
    <=== mapped directly to ==> <InvoiceDetailOrder>
    Then internal things are organized differently in
    <InvoiceDetailOrder> compared to IDoc element<EIEDP01>
    Ex:
    I want to take all the <EIEDP02>s coming under one line Item <EIEDP01>
    <EIEDP02> cannot be mapped diectly to cXML element. It can be done only after checking it's own attribute QUALF.
    For this I applied [REMOVECONTEXT], but i am getting all the QALF values.
    I need to restrict it to <EIEDP01> level.
    Regards
    Chemmam

  • How to configure Reconciliation only for a particular resource

    Hi All,
    I have a requirement to configure target reconciliation from AD only for a client. For that i have installed the conector as per documentation (both prov and recon). Now how can i make sure that:-
    1. When i disable/enable the user in OIM, corresponding target resource will not be disabled/enabled.
    2. If i make any changes on resource form corresponding change should not flow back to AD.
    Does removing the prov related jar able to ensure these things or i need to remove the corresponding prov lookup or any changes required in configuration lookup? Please suggest...TIA

    Change the drop down option to "Disable Process..."
    Attach tcComplete event handler there.
    In Task to Object Status Mapping, select Disabled in front of completed.
    Now suppose user is PROVISIONED to a resource say Test. So whenever user gets DISABLED in OIM, it will disabled the target resource Test. But in actual the target resource will not be disabled for that user. He/She can access that resource after getting disabled as you haven't put the logic to disable the target resource (as you have used tcComplete here).
    As you are saying that it should show disabled only if Disabled is coming from Trusted Resource. Then it's fine till now.
    If you don't want to show status as Disabled then in Task to Object Status Mapping, do not select Disabled in front of completed. In this case, it will show status as PROVISIONED only. This is wrong.
    I'll try to understand what you have written here ->
    BUT NOW THE ISSUE. IT DISABLED MY ASSOCIATED RESOURCE (not in target resource actually but on oim side under resources tab). THIS IS ACTUALLY NOT DESIRABLE.
    - > It will do as you are using tcComplete. If you put your java code which disables the target resource in integration tab (in form of process task adapter instead of tcComplete) then it will disables the actual target resource for user.
    REAL REQUIREMENT IS THAT FOR NOW (*till provisioning is not configured*) OIM DISABLE SHOULD NOT INVOKE THE DISABLE OF ASSOCIATED TARGET RESOURCE NOR IT CHANGED THE STATUS UNDER RESOURCES TAB FOR PARTICULAR RESOURCE. THE STATUS UNDER RESOURCES TAB SHOULD ONLY BE CHANGED WHILE RECONCILIATION.
    -> As you have written, "Till provisioning is not configured", So if provisioning is not configured then it will not show disabled under Resource tab for that particular resource.
    You can see disabled only after resource is provisioned to that user.
    If this doesn't answer your question, it would be better if you explain your requirement clearly. It's not clear.

  • "Waiting for real-time target (RT PXI target) to respond" error when the program waits interrupts

    Hi there,
    I have developed an application to detect interrupts generated by a electronic card and act in consequence. The program has been developed in labview but it calls a dll; that was created with labwindows. The dll is programmed to open the visa communication, enable events and install the interrupt handler and when an interrupt is detected, it reads the value of the different registers of the card and returns it to labview to visualize them. 
    The problem is that when the program waits for an interrupt, a prompt appears with the message "Waiting for real-time target (RT PXI target) to respond" and the only option I have is to click on the button to disconnect from the pxi or just wait. If I wait and I generate an interrupt, the prompt disappears and the application visualize the data like it was expected. 
    To wait for the interrupt the following code has been programmed in the function:
                    while (flag == 0)
                                    Sleep (1000);
    When an interrupt occurs, the value of flag changes to 1 and the function continue without any problem. I am not really sure, but probably here is the problem and probably this is not the best way to wait for an interrupt because the sleep function suspends the thread for the configured time, but at least the computing load in the PXI is between 0% and 1%. I was wondering if somebody knows how to wait for an interrupt without "lost" the communication with the PXI and if there is a better way to do it. 
    Any answer will be welcome and thanks for them,
    Jaime
    Solved!
    Go to Solution.

    Hello Naity,
    First of all, in which thread runs the waiting process? Is it scheduled in another thread than the function setting the flag?
    It scheduled in the same thread that I use to configure the communications and configure the card. Anyway, here is the pseudo code of the function interrupt that I programmed under labwindows,.
    char* interrupt(void)
    1. Open visa communications
    2.Install handler interrupt --> status = viInstallHandler (instr, VI_EVENT_PXI_INTR, IntrHandler, VI_NULL);   // the function IntrHandler will be called when an interrupt occurs
    3. Enable event PXI interrupt
    4. Wait
    while (flag == 0)
                  Sleep (1000);
    5. Visualize the data coming from the interrupt (registers and values measured with the card)
    6. Uninstall handler interrupt
    7. Close visa session
    The interrupt handler function IntrHandler is called immediately when an interrupt occurs and the pseudo code is like this
    ViStatus _VI_FUNCH IntrHandler(ViSession instr, ViEventType etype, ViEvent event, ViAddr userhandle)
    1. Disable some functions of the card to avoid damages. 
    2. Read registers and put them in a buffer
    3. Change the value of flag ---> flag = 1;
    In labview, I call the function interrupt with a call library function node (see the capture attached) and the program reads and saves the data from returned from the function.
    Secondly, I am not sure this method is the most elegant. You could for example register an event with the function and, insteand of setting a flag to 1, trigger the event and schedule it in another thread (if the function is thread safe). This could reduce your CPU Load even more and seem a bit cleaner to me.
    I've never used events before in labwindows but I will try to do it in this way. But anyway, I suppose that I should; somehow, wait the event to occurs in labview while the waiting for the event is programmed inside the dll...and probably the same prompt that i am trying to avoid is going to appear again, because I am not returning the "control" to labview (I mean, labview executes the dll and waits for the event to occur. Then the execution of the labview program is stopped in the call library function node executing the dll)
    Third point, which environment of development are you using?
    I am working with LV 2010 sp1 and Labwindows cv 10.0.1 and with the real time module.
    I did also another test, I divided the program in different functions, one to initialize the communication, another to wait until a interrupt has been detected and the other to obtain the data from the interrupt and close communications. With labview I call first with the call library function node the function to initialize, later I call inside a while loop the wait function like this
    int waitAseconds (double seconds, short stop_waiting)
    if(flag==1 || stop_waiting == 1)
    flag = 1; //to detect the stop_waiting button
    printf("flagAA =1 stop waiting = %d time = %d\n", stop_waiting, clock());
    return flag;
    else
    SleepUS(seconds*1000000);
    //a++;
    printf("flag a= %d stop waiting = %d time = %d\n", flag, stop_waiting, clock());
    return flag;
     and when the program detects an interrupt, the function returns to labview the flag and stops the loop. Finally, it reads the values and close communications. 
    In this way, the prompt appears but after running the application for 10 or 20 minutes and also i checked that there is a time gap between the executions in the loop.
    Thanks for your reply and your help,
    Jaime
    Attachments:
    capture.png ‏40 KB

  • Is table maintenance generator only for custom table?

    hi ,
    i have doubt is table maintenance generator only for custom table?

    hi swamya,
    Table Maintanance Generator is used to create/change/delete table entries in a particular table.
    In the production system, end-users will not be having access to transaction codes like SE11 and SE16. Developers will not be having access to many transaction codes including the above two.To view the contents of the database table, we will use SE16n in Production system. All these authorizations will be maintained by BASIS team, by creating access profiles.So in order to edit or create the contents of a database table, we should go for table maintenance generator. In real time, authorizations will be maintained in production system.
    The second reason is, we can edit or create multiple entries at a time, using tablemaintenance generator.
    Apart from that we have options like 'Enter conditions' in table maintenance screen SM30.
    hope this helps in clearing ur doubt.
    Regards
    Saurabh

  • Business packages for real estate

    Hi,
      Any one know whether we have any business packages for real estate.If anyone know please send me the link or mail documentation to this mail id [email protected]
    Thanks,
    kumar

    Hi Kumar,
       I only found one business package about real estate in the portal content portfolio.  It is by a third party.  If you go to this link: https://www.sdn.sap.com/irj/sdn/developerareas/contentportfolio
    and search on real estate you will find it.
    Good luck,
    John

  • Are analytic functions usefull only for data warehouses?

    Hi,
    I deal with reporting queries on Oracle databases but I don't work on Data Warehouses, thus I'd like to know if learning to use analytic functions (sql for anaylis such as rollup, cube, grouping, ...) might be usefull in helping me to develop better reports or if analytic functions are usually usefull only for data warehouses queries. I mean are rollup, cube, grouping, ... usefull also on operational database or do they make sense only on DWH?
    Thanks!

    Mark1970 wrote:
    thus does it worth learning them for improving report queries also not on DHW but on common operational databases?Why pigeonhole report queries as "+operational+" or "+data warehouse+"?
    Do you tell a user/manager that "<i>No, this report cannot be done as it looks like a data warehouse report and we have an operational database!</i>"?
    Data processing and data reporting requirements not not care what label you assign to your database.
    Simple real world example of using analytical queries on a non warehouse. We supply data to an external system via XML. They require that we limit the number of parent entities per XML file we supply. E.g. 100 customer elements (together with all their child elements) per file. Analytical SQL enables this to be done by creating "buckets" that can only contain 100 parent elements at a time. Complete process is SQL driven - no slow-by-slow row by row processing in PL/SQL using nested cursor loops and silly approaches like that.
    Analytical SQL is a tool in the developer toolbox. It would be unwise to remove it from the toolbox, thinking that it is not applicable and won't be needed for the work that's to be done.

  • How to not only use real BAPI functions?

    Hi,
    I'm trying to get the value of leave entitlement of an employee.
    Browsing through the BAPI explorer I found the BAPI_TIMEQUOTA_GETDETAILEDLIST,
    but this only works for infotype 2006 and I need infotype 0005.
    Now I searched with transaction SE37 and found the function
    HR_DE_GET_HOLIDAY, which is able to get either 2006 or 0005.
    But how can I implement this function in php?
    If I enter the Bapi call in the saprfc_test.php, I get a form with input parameters like all other calls I tried.
    But entering the hr_de_get_holiday, nothing happens.
    Looks like the saprfc module only supports 'real' bapi calls?
    Thanks in advance for your assistence.

    Hi Knud,
    Yes.. once you have created the copy.. in SE37 go into change mode.. click on the 'Attributes' tab & select the radio button 'Remote-enabled module' under 'Processing type'. Save & activate.. your custom function module will now be as good as any other RFC/BAPI..
    Regards,
    Suresh Datti

  • I bought this MacBook Pro 15.4" 1.83 GHz MA463LL/A with 2gb of RAM for real cheap on eBay because I'm poor and can't afford a new MACBOOK PRO and was wondering what everyone thinks about these laptops and what can and should I upgrade when I get money?

    I bought this older MACBOOK PRO 15.4" 1.83 GHz with 2gb of RAM and Leopard 10.5 on eBay for real cheap because I don't have the money to buy a new one like I would like to  do, and it comes with a disk to upgrade the OS to 10.6 and I was wondering what all I can and should upgrade (short of the whole computer) as I have the money to do so? Or did I just get really hosed?

    You have the original Core Duo model. 2 GBs is the most RAM you can install, so the only thing you could upgrade would be the hard drive. Doing so is not a trivial task but you can find suitable hard drives and installation tutorials at OWC.
    Since yours is a Core Duo model you can upgrade OS X to Snow Leopard, but not to Lion which requires a Core 2 Duo or better.

  • Canon 100m f/2.8 L IS USM Macro Lens - What's in the Box for real?

    I want to purchase the Canon 100m f/2.8 L IS USM Macro Lens, and the website says the only thing in the box is the lens itself and a manual.
    I realize that at the very least the Lens Cap and Cover MUST be included, but then I called customer service to confrim the rest, and they said the contrary, "only the manual and lens, with no cap or cover".
    Obviously that was an non-conscientious rep who didn't care if the answer was accurate or not, so I need some help from those of you who are owners... or at least a BestBuy rep who is conscientious.
    Canon confirms that what is supposed to be in the box with this "L" series lens
    Lens + Lens Cap + Lens Cover + LENS HOOD + LENS POUCH (the capitalized items are included because its an "L" Series lens.
    Can someone confirm What's in the Box for real?  Does it have these items or not?
    Thanks
    Solved!
    Go to Solution.

    Hi mikewinburn,
    I definitely apologize for the inaccurate information given to you from the customer service representative you spoke to. This lens is sent to us directly from Canon, and should have everything inside their packaging that they told you would be in the box. I have no direct knowledge of what comes packaged with this lens (although I wish I did, and this is actually one of the lenses that I intend on purchasing in the near future). If Canon told you that there would be the lens, the lens cap, the lens cover, a lens hood, and a lens pouch inside the packaging then that is what should be inside the box if you purchase this lens from us. I hope this clears this up for you, but if you need any personal assistance from me just send me a private message by clicking on the link in my signature.
    Thanks for posting,
    Allan|Senior Social Media Specialist | Best Buy® Corporate
     Private Message

  • Process speed necessary for real time livetype & Motion

    Does anybody remember the minimum processor speed necessary to
    run LIVETYPE and MOTION from WITHIN FCP5...not as seperate apps?
    The online spec sheets indicate the speeds necessary for running as seperate apps,
    but not for real time from withing FCP5...at least, not the ones I can find.
    Thanks.

    Where did you encounter the promise of real time in FCP?
    Can't be done AFAIK.
    Even if possible, you'd only get a few misleading preview frames.
    We've got our new biga$$ Macs arriving in a few weeks. I'll let ya know if anything happens real time in FCP.
    bogiesan

  • GarageBand only for Mac?

    hello everyone,
    Im interested in Apple's GarageBand software and I went to the website but it only mentioned it for a Mac computer. Can you also get it for window's as well?
    Thanks

    Unfortunately, it is only for Macs. However, there are similar programs for Windows.
    If you are interested in buying a Mac, there is a new software for the Intel computers that allows Macs to run Windows XP and the Mac Software, if you have the real XP install disk. This would allow you to have garageband, and other Mac programs, while allowing you to use Windows for everything else.

  • MPLS-TE Guarantee Bandwidth only for ?

    Hello ^_^
    Does the MPLS-TE can used in guarantee Bandwidth only for Voice or Video Conference at 3750-ME or 6524ME or 7206 Router ?

    Hello Hsin,
    if you don't use mpls autoroute announce you can decide what traffic you put in a mesh of MPLS TE tunnels.
    This can be done by using static routes or combining them with BGP (using per service next-hop loopbacks).
    Then, another matter is the volume of traffic you put over an MPLS TE tunnel: there is no real time effective CAC but CAC is performed on RSVP TE reversations.
    In other words if a tunnel declares a bandwidth of 2 Mbps you can still put 20 Mbps of traffic over it!
    It is not like it has been on ATM.
    Hope to help
    Giuseppe

Maybe you are looking for