Transparent TextField with Synth Look and Feel

I am trying to use synth to implement a textfield with a transparent background, and having some problems with it. I can see my panel and the transparent field fine enough in the beginning, but when the text in the field changes, it writes right over the previous text and becomes a pile of unreadable white marks. I've experimented with varying degrees of transparency, but you can still see the old field underneath slightly. Does anyone have any suggestions? My code is below.
Thanks.
synth.xml
<synth>
<!-- PANEL -->
<style id="panelStyle">
    <state>
        <imagePainter method="panelBackground" path="../../../lafImages/papyrus_bkgd.gif" sourceInsets="10 15 10 15"/>
    </state>
</style>
<bind style="panelStyle" type="name" key="PAPYRUS_PANEL"/>
<!-- TEXTFIELD -->
<style id="textFieldStyle">
    <font name="Kudasai" size="12"/>
    <state>
        <color type="TEXT_FOREGROUND" value="#FFFFFF"/>
        <!-- set the alpha value for transparency in 1st two digits -->
        <color type="BACKGROUND" value="#00000000"/>
    </state>
    <opaque value="false"/>
</style>
<bind style="textFieldStyle" type="region" key="TEXTFIELD"/>
</synth>
my tester
class SynthTester {
    private JTextField field;
    public SynthTester(){
        initLookAndFeel();
        JFrame main = new JFrame();
        JPanel panel = new JPanel();
        panel.setName("PAPYRUS_PANEL");
        field = new JTextField(3);
        field.setText("0");
        panel.add(field);
        JButton button = new JButton("+");
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                int val;
                try {
                    val = Integer.parseInt(field.getText());
                } catch( Exception ex ) {
                    val = 0;
                val++;
                field.setText(Integer.toString(val));
        panel.add(button);
        main.add(panel);
        main.pack();
        main.setVisible(true);
    private void initLookAndFeel() {
        SynthLookAndFeel lookAndFeel = new SynthLookAndFeel(); 
        try {
            InputStream is = getClass().getResourceAsStream("synth.xml");
            if( is == null) {
                System.err.println("unable to load resource stream");
            } else {
                lookAndFeel.load(is, getClass());
                UIManager.setLookAndFeel(lookAndFeel);
        } catch (Exception e) {
            System.err.println("Couldn't get specified look and feel ("+ lookAndFeel+ "), for some reason.");
            System.err.println("Using the default look and feel.");
            e.printStackTrace();
            System.exit(1);
}

As its name implies, an imagePainter element creates a SynthPainter that paints from an image. For example:
<synth>
<style id="example">
<state>
<color value="white" type="BACKGROUND"/>
</state>
<imagePainter method="panelBackground" path="background.png"
sourceInsets="5 6 6 7" paintCenter="false"/>
<insets top="5" bottom="6" right="7" left="6"/>
</style>
<bind style="example" type="region" key="Panel"/>
</synth>

Similar Messages

  • Problem with java look and feel

    Hi! This is my first time posting here. Do apologize me if I am not familiar with the regulations here. Thanks!
    Currently, I am developing a project using NetBeans IDE. It is using RMI, and some basic UI. I am facing the following error when I tried applying the java look and feel code. Please see below for the code used and the error message.
    try {   UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    } catch (Exception e) { }
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.plaf.ColorUIResource cannot be cast to java.util.List
    at javax.swing.plaf.metal.MetalUtils.drawGradient(MetalUtils.java:196)
    at javax.swing.plaf.metal.MetalInternalFrameTitlePane.paintComponent(MetalInternalFrameTitlePane.java:384)
    at javax.swing.JComponent.paint(JComponent.java:1027)
    at javax.swing.JComponent.paintChildren(JComponent.java:864)
    at javax.swing.JComponent.paint(JComponent.java:1036)
    at javax.swing.JComponent.paintChildren(JComponent.java:864)
    at javax.swing.JComponent.paint(JComponent.java:1036)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
    at javax.swing.JComponent.paintChildren(JComponent.java:864)
    at javax.swing.JComponent.paint(JComponent.java:1036)
    at javax.swing.JComponent.paintChildren(JComponent.java:864)
    at javax.swing.JComponent.paint(JComponent.java:1036)
    at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
    at javax.swing.JComponent.paintChildren(JComponent.java:864)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5129)
    at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
    at javax.swing.JComponent.paint(JComponent.java:1013)
    at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:21)
    at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:60)
    at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:97)
    at java.awt.Container.paint(Container.java:1797)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:734)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
    at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
    Java Result: 1

    Thanks for everyone's help!
    Below is the executable code generated using NetBeans which is enough to generate the error message. Sometimes you can get the error message just by running the program. Sometimes the error will occur when you go into the Menu and click on Item.
    * NewJFrame.java
    * Created on January 8, 2008, 1:11 PM
    package client;
    import javax.swing.UIManager;
    * @author  Yang
    public class NewJFrame extends javax.swing.JFrame {
        /** Creates new form NewJFrame */
        public NewJFrame() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jDesktopPane1 = new javax.swing.JDesktopPane();
            jInternalFrame1 = new javax.swing.JInternalFrame();
            jMenuBar1 = new javax.swing.JMenuBar();
            jMenu1 = new javax.swing.JMenu();
            jMenuItem1 = new javax.swing.JMenuItem();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
            jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
            jInternalFrame1Layout.setHorizontalGroup(
                jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 190, Short.MAX_VALUE)
            jInternalFrame1Layout.setVerticalGroup(
                jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 95, Short.MAX_VALUE)
            jInternalFrame1.setBounds(80, 40, 200, 130);
            jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);
            jMenu1.setText("Menu");
            jMenuItem1.setText("Item");
            jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jMenuItem1ActionPerformed(evt);
            jMenu1.add(jMenuItem1);
            jMenuBar1.add(jMenu1);
            setJMenuBar(jMenuBar1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 484, Short.MAX_VALUE)
                    .addGap(20, 20, 20))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 279, Short.MAX_VALUE)
            pack();
        }// </editor-fold>                       
        private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:
            jInternalFrame1.setVisible(true);
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new NewJFrame().setVisible(true);
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (Exception e) {
                e.printStackTrace();
        // Variables declaration - do not modify                    
        private javax.swing.JDesktopPane jDesktopPane1;
        private javax.swing.JInternalFrame jInternalFrame1;
        private javax.swing.JMenu jMenu1;
        private javax.swing.JMenuBar jMenuBar1;
        private javax.swing.JMenuItem jMenuItem1;
        // End of variables declaration                  
    }Edited by: Boxie on Jan 7, 2008 11:23 PM

  • How does one goes on building an Icon with the 'Look and Feel' of an Icon?

    Hello everybody, I work as a Graphic Designer for a company that is asking me to create an Icon for a software that we own, I am having trouble as to how do i go building one, I use Illustrator and Photoshop but I am not sure how to give the Icon the 'Look and Feel' of an Icon, the colors look a bit different and so the 'texture' of my vector image. If anyone can explain me or point me to a good website that explains how should I go on building an icon so it looks like an Icon that will be great. I thank you in advance for any reply that you can give me regarding the subject.

    don't know what you mean by "look and fell of an icon". You could go to vectortuts.com - it has lots of tutorials on the creation of different icons. Also check hicksdesign.co.uk for their presentations on icon concepts

  • Windows XP Look and Feel

    Hi,
    When I use Windows XP style Look & Feel on Windows XP Title Bar and Scroll Bar disappears or the color is set to transparent.
    I set Look and Feel using:
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    Even I run SwingSet2 on Windows XP and set the Look & Feel to Windows XP Style the result is the same.
    Is there any recommendation about this?
    Thanks...

    I forgot to say that I am using Java SDK v1.4.2_4

  • JFrame look and feel

    Hi everybody,
    I'm a beginner in working with Java Look and Feel. I want to customize a frame's title bar, border and buttons. For example I want to put some other icons for the close, minimize and maximize button, change the height and color of the titlebar, and put some other border to the window.
    My question is if I can do this by modifying the LAF. Maybe somebody can give me a link to some good and detailed documentation regarding LAF.
    Thanks.

    Hi,
    You have a better chance to get your question answered if you post this in the Swing forum. (Do also mention that it is a cross-post, and provide a link to this thread)
    Kaj

  • NetBeans: Dinamically changing Look and Feel Problem

    Hi there, Java lovers.
    I need some help here!
    I love java, and I used to program my graphical user interfaces by hand. In my applications, there is a dropdown for the user to chose the desired look and feel. Then I save the selected option to a file and on the startup I do something like this:
                UIManager.setLookAndFeel(savedUserSelectedLookAndFeel);That always worked really fine. The look and feel would change and everything worked really well.
    However, programing GUI by hand is really a PITA. So I was seduced by Netbeans. I am using Netbeans 6.0 on Windows XP, and I designed the GUIs really fast now.
    The problem is, the system look and feel works really well, but when I change the look and feel of my application to a different one (Java/Motif/etc..) the look and feel changes but the components positions and sizes becomes all messed up. It really becomes impossible to work with a different look and feel because some components are outside of frames.
    I believe the cause of this is because Netbeans generates the code automatically using Grids and stuff like that, and by doing so, the change of the look and feel becomes messed up. This is a thing that would not happen with my manually created code.
    This is really troubling me. Does someone has the same problem. Is there something I can do? Or do I need to create my GUIs by hand like before?

    Oyashiro-sama (&#23569;&#12375;&#26085;&#26412;&#35486;&#12434;&#30693;&#12387;&#12390;&#12356;&#12427;&#12375;&#12289;&#12381;&#12435;&#12394;&#12300;&#27096;&#12301;&#12387;&#12390;&#12356;&#12358;&#20351;&#12356;&#26041;&#12399;&#12385;&#12423;&#12387;&#12392;&#22793;&#12381;&#12358;&#12391;&#12377;&#12397;&#12288;(^_-) &#12300;&#20887;&#35527;&#12301;&#12387;&#12390;&#12356;&#12358;&#38996;&#25991;&#23383;&#12391;&#12377;&#12290;&#65289;
    Sorry for the delay in reply, but one problem for you is that this is not a NetBeans users forum, thus you will not necessarily receive speedy replies here to your NetBeans questions. The best place to send NetBeans questions is:
    [email protected]
    [email protected] (for NetBeans API issues)
    As for your question, you seem to already know quite a bit about NetBeans UI Look and Feel programming, but have you seen these:
    WORKING WITH SWING LOOK AND FEEL:
    http://java.sun.com/developer/JDCTechTips/2004/tt0309.html#1
    Java GUI Swing Programming Using NetBeans 5 (should apply to NetBeans 6):
    http://wiki.netbeans.org/JavaGUISwingProgrammingUsingNetBeans5
    Regards,
    -Brad Mayer

  • Can combine two look and feel into new one?

    Hi,
    I want to change the JProgressBarUI of NimbusLAF on other LAF. I means how to put two different components each with different look and feel in single JFrame.Any way to get this. Help. Thankz.
    Edited by: user13383557 on Nov 22, 2010 12:07 AM

    How about reading the api doc and then message the appropriate method on the diverging component instance?
    It's not recommended, though, and wont survive dynamic LAF changes.
    CU
    Jeanette

  • Changing the look and feel of the logon screen and portal themes.

    Dear all,
    we got some  requirements  in the portal  where i have implement the following things..
    1) when we give the portal url in the browser along with logon screen i have to display the some content related to the organaisation ,,, there i want to do logon screen customization also.
    2)once login to the portal i need display the some company related information along with  different ESS services .i want to remove the masthead area and in the  role area want to display different services.
    please guide me   to achive this.
    the client is not at all happy with  present look and feel,
    so what we can do t achieve ths?
    Thank you in advance.
    Swapna

    Hi Swapna,
    Portalapp.xml is the configuration file of portal application holding comonents and services. Where as authschemes.xml file is used to determin and tell portal which of the user authentication schemes is to be used. It also tells portal about which logon PAR file should be used. It is defined inside following tags.
    <frontendtarget>Logon PAR File Name</frontendtarget>.
    Take a scenario for example. You have created a custom logon PAR file and made some changes. You cannot see the changes before deploying it. You have to deploy it first. Now, you want that whenever somone logon to portal, your logon PAR should be referred and executed. Authschemes.xml does this work. It maintains a reference to the PAR file that should be used for logon.
    Now, still have to create a custom authschemes.xml file and upload it. (Follow this link for the authschemes file location http://help.sap.com/saphelp_nw04/helpdata/en/1a/3afd4e641b8f42ac07bb77fe30375b/content.htm)
    Refer this link for details on authschemes.xml file: http://help.sap.com/saphelp_nw04/helpdata/en/d3/1dd4516c518645a59e5cff2628a5c1/content.htm
    Let us see in brief what are the steps executed:
    1) You request a portal login
    2) Portal, after receiving a request, looks for a reference to which Authschemes file to be used. It finds it in Visual Admin
    3) Once portal have the name of authschemes file, it parse this file and determin what are the authentication schemes to be used and which logon PAR should be executed.
    4) Only after these steps, it renders logon page to you
    Once you do all these steps, you can see the result on logon page itself. You do not have to look for deployed PAR file.

  • Customised look and feel for B2B/B2C web shop.

    Dear experts,
                I would like to find out if there is an admin page for SAP E-commerce to customise the look and feel of the webshop?
    Thanks.
    Wein

    Hi Wein,
    To change Look and Feel for Web shop is depends on scenario of eCommerce application i.e. B2B or B2C. B2B has different structure than B2C.
    Web Channel application comes in SAP standard with SAP look and Feel. You have to change look and feel as per client requirement.
    To change look and feel of Both B2B/B2C scenario you have to deal with files like CSS, JSP, Properties, XLF and some time you have to add your custom JAVA, JSP, CSS, Properties files etc...
    To change standard SAP logo youhave to make change in CSS files. Also you have to consider Browser type while changing look and feel because to display your B2B/B2C application correctly in different browser you have to make changes in different CSS.
    You will get better idea with example how to change look and feel in "Dev & Ext. Guide" for Web Shop. You will get this from Service Market place.
    eCommerce Developer.

  • Problem With ButtonUI in an Auxiliary Look and Feel

    This is my first post to one of these forums, so I hope everything works correctly.
    I have been trying to get an axiliary look and feel installed to do some minor tweaking to the default UI. In particular, I need it to work with Windows and/or Metal as the default UI. For the most part I let the installed default look and feel handle things with my code making some colors lighter, darker, etc. I also play with focus issues by adding FocusListeners to some components. I expect my code to work reasonably well no matter what the default look and feel is. It works well with Motif, Metal, and Windows, the only default look and feels I've tested with. What I'm going to post is a stripped down version of what I have been working on. This example makes gross changes to the JButton background and foreground colors in order to illustrate what I've encountered.
    I have three source code files. The first, Problem.java, creates a JFrame and adds five buttons to it. One button installs MyAuxLookAndFeel as an auxiliary look and feel using MyAuxButtonUI for the look and feel of JButtons. The next button removes that look and feel. The next button does nothing except print a line to System.out. The next button installs MyAuxLookAndFeel as an auxiliary look and feel using MyModButtonUI for the look and feel of JButtons. The last button removes that look and feel.
    The problem is, when I install the first auxiliary look and feel, buttons are no longer tabable. Also, they cannot be invoked by pressing the space button when they're in focus. When I remove the first auxiliary look and feel everything reverts to behaving normally. When I add the "Mod" version, button tabability is fine. The only difference is I've added the following code:
    if ( c.isFocusable() ) {
       c.setFocusable(true);
    }That strikes me as an odd piece of code to profoundly change the program behavior. Anyway, after adding and removing the "Mod" look and feel, the tababilty is forever fixed. That is, if I subsequently re-install the first look and feel, tababilty works just fine.
    The problem with using the space bar to select a focused button is more problematic. My class is not supposed to mess with the default look and feel which may or may not use the space bar to press the button with focus. When the commented code in MyModButtonUI is uncommented, things behave correctly. Even the statement
    button.getInputMap().remove( spaceKeyStroke );doesn't mess things up after the auxiliary look and feel is removed. So far I've tested this with JRE 1.4.2_06 under Windows 2000, JRE 1.4.2_10 under Windows XP, and JRE 1.5.0_06 under Windows XP and the behavior is the same.
    All of this leads me to two questions.
    1. Is my approach fundamentally flawed? I've extended TextUI and ScrollBarUI with no problems. This is the only problem I've encountered with ButtonUI. My real workaround for the space bar issue is better than the one I've supplied in the example, but it certainly is not guaranteed to work for any arbitrary default look and feel.
    2. Assuming I have no fundamental problems with my approach, it's possible I've found a real bug. I searched the bug database and couldn't find anything like this. Of course, this is the first time I've tried seasrching the database for a bug so my I'm doing it badly. Has this already been reported as a bug? Is there any reason I shouldn't report it?
    What follows is the source code for my example. It's in three files because the two ButtonUI classes must be public in order to work. Thanks for insight you can provide.
    Bill
    File Problem.java:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Problem extends JFrame {
       public boolean isAuxInstalled = false;
       public boolean isModInstalled = false;
       public LookAndFeel lookAndFeel = new MyAuxLookAndFeel();
       private static int ctr = 0;
       public static void main( String[] args ) {
          new Problem();
       public Problem() {
          this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          setSize(250, 150);
          setTitle("Button Test");
          JButton install = new JButton("Install");
          JButton remove = new JButton("Remove");
          JButton doNothing = new JButton("Do Nothing");
          JButton installMod = new JButton("Install Mod");
          JButton removeMod = new JButton("Remove Mod");
          this.getContentPane().setLayout(new FlowLayout());
          this.getContentPane().add(install);
          this.getContentPane().add(remove);
          this.getContentPane().add(doNothing);
          this.getContentPane().add(installMod);
          this.getContentPane().add(removeMod);
          install.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                if ( !isAuxInstalled ) {
                   isAuxInstalled = true;
                   UIManager.addAuxiliaryLookAndFeel( lookAndFeel );
                   SwingUtilities.updateComponentTreeUI( Problem.this );
          remove.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                if ( isAuxInstalled ) {
                   isAuxInstalled = false;
                   UIManager.removeAuxiliaryLookAndFeel( lookAndFeel );
                   SwingUtilities.updateComponentTreeUI( Problem.this );
          doNothing.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                System.out.println( "Do nothing " + (++ctr) );
          installMod.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                if ( !isModInstalled ) {
                   isModInstalled = true;
                   UIManager.addAuxiliaryLookAndFeel( lookAndFeel );
                   SwingUtilities.updateComponentTreeUI( Problem.this );
          removeMod.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                if ( isModInstalled ) {
                   isModInstalled = false;
                   UIManager.removeAuxiliaryLookAndFeel( lookAndFeel );
                   SwingUtilities.updateComponentTreeUI( Problem.this );
          setVisible(true);
       class MyAuxLookAndFeel extends LookAndFeel {
          public String getName() {
             return "Button Test";
          public String getID() {
             return "Not well known";
          public String getDescription() {
             return "Button Test Look and Feel";
          public boolean isSupportedLookAndFeel() {
             return true;
          public boolean isNativeLookAndFeel() {
             return false;
          public UIDefaults getDefaults() {
             UIDefaults table = new MyDefaults();
             Object[] uiDefaults = {
                "ButtonUI", (isModInstalled ? "MyModButtonUI" : "MyAuxButtonUI"),
             table.putDefaults(uiDefaults);
             return table;
       class MyDefaults extends UIDefaults {
          protected void getUIError(String msg) {
    //         System.err.println("(Not) An annoying error message!");
    }File MyAuxButtonUI.java:
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.plaf.*;
    import javax.swing.plaf.multi.*;
    import javax.accessibility.*;
    public class MyAuxButtonUI extends ButtonUI {
       private Color background;
       private Color foreground;
       private ButtonUI ui = null;
       public static ComponentUI createUI( JComponent c ) {
          return new MyAuxButtonUI();
       public void installUI(JComponent c) {
          MultiButtonUI multiButtonUI = (MultiButtonUI) UIManager.getUI(c);
          this.ui = (ButtonUI) (multiButtonUI.getUIs()[0]);
          super.installUI( c );
          background = c.getBackground();
          foreground = c.getForeground();
          c.setBackground(Color.GREEN);
          c.setForeground(Color.RED);
       public void uninstallUI(JComponent c) {
          super.uninstallUI( c );
          c.setBackground(background);
          c.setForeground(foreground);
          this.ui = null;
       public void paint(Graphics g, JComponent c) {
          this.ui.paint( g, c );
       public void update(Graphics g, JComponent c) {
          this.ui.update( g, c );
       public Dimension getPreferredSize(JComponent c) {
          if ( this.ui == null ) {
             return super.getPreferredSize( c );
          return this.ui.getPreferredSize( c );
       public Dimension getMinimumSize(JComponent c) {
          if ( this.ui == null ) {
             return super.getMinimumSize( c );
          return this.ui.getMinimumSize( c );
       public Dimension getMaximumSize(JComponent c) {
          if ( this.ui == null ) {
             return super.getMaximumSize( c );
          return this.ui.getMaximumSize( c );
       public boolean contains(JComponent c, int x, int y) {
          if ( this.ui == null ) {
             return super.contains( c, x, y );
          return this.ui.contains( c, x, y );
       public int getAccessibleChildrenCount(JComponent c) {
          if ( this.ui == null ) {
             return super.getAccessibleChildrenCount( c );
          return this.ui.getAccessibleChildrenCount( c );
       public Accessible getAccessibleChild(JComponent c, int ii) {
          if ( this.ui == null ) {
             return super.getAccessibleChild( c, ii );
          return this.ui.getAccessibleChild( c, ii );
    }File MyModButtonUI.java:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.plaf.*;
    public class MyModButtonUI extends MyAuxButtonUI
       static KeyStroke spaceKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0 );
       public static ComponentUI createUI( JComponent c ) {
          return new MyModButtonUI();
       public void installUI(JComponent c) {
          super.installUI(c);
          c.setBackground(Color.CYAN);
          if ( c.isFocusable() ) {
             c.setFocusable(true);
    //      final JButton button = (JButton) c;
    //      button.getInputMap().put( spaceKeyStroke, "buttonexample.pressed" );
    //      button.getActionMap().put( "buttonexample.pressed", new AbstractAction() {
    //         public void actionPerformed(ActionEvent e) {
    //            button.doClick();
    //   public void uninstallUI(JComponent c) {
    //      super.uninstallUI(c);
    //      JButton button = (JButton) c;
    //      button.getInputMap().remove( spaceKeyStroke );
    //      button.getActionMap().remove( "buttonexample.pressed" );
    }

    here is the code used to change the current look and feel :
    try {
                   UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
             catch (InstantiationException e)
                  System.out.println("Error occured  "+ e.toString());
             catch (ClassNotFoundException e)
                  System.out.println("Error occured  "+ e.toString());
             catch (UnsupportedLookAndFeelException e)
                  System.out.println("Error occured  "+ e.toString());
             catch (IllegalAccessException e)
                  System.out.println("Error occured in .. " + e.toString());
             Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
             Fenetre fen = new Fenetre();
             fen.setSize(dim.width, dim.height);
             fen.setResizable(false);
                 fen.setLocation(0, 0);
                  fen.setVisible(true);

  • PushButton with Windows XP Look and Feel

    Hi all,
    I am looking for a way to give my buttons in my Oracle Forms 10gR2 (with Sun JPI 1.5) a Windows XP look and feel. In my formsweb.cfg I can choose between a generic and an oracle look and feel. The generic look and feel claims to have the windows look and feel, but unfortunatly, this is a Windows 3.11 L&F. Because of the overall look and feel of the Oracle L&F we decided on using this L&F but we would like our buttons to look like other buttons in Windows XP. I think this can be done by building a specific java implementation class but I have no experience with this.
    Did anybody already build such an implementation class and willing to share it with me?
    Thanks in advance,
    Harold

    The only way to accomplish this is with a Java Bean or PJC. Refer to the Oracle Forms Demos for some examples of what can be done with Beans and PJCs. Also, refer to the following page:
    http://forms.pjc.bean.over-blog.com/categorie-450786.html
    Forms Demos on OTN:
    http://www.oracle.com/technology/sample_code/products/forms/index.html
    One other suggestion would be to use:
    LookAndFeel=oracle
    colorScheme=blaf
    This will not resemble XP, but does offer a more professional looking application over the standard colors. BLAF was originally created for Oracle Applications, but works in all versions of Forms 6i and newer. BLAF = Browser Look And Feel

  • Does java has "Transparent" look and feel?????

    I want to know whether there is a transparent look and feel developed for java,
    if it is there please post an link to download the API
    Thank you very much..

    As far as I know, NO.
    There is a way to do this, using robot to get desktop image and draw it using paint object when you render your component, but, performance is not good.

  • I want to restore the look and feel of Firefox 3.6 etc with large icons for last page next page reread and home page located off the toolbar in the upper left like 3.6

    I want 4.0 to look like 3.6 with large separate icons for last page, next page, reread current page and go to home page, in lieu of the little icons to the right of the
    default navigation toolbar. I tried setting up a separate toolbar but it never reappeared. There should be a way to just restore 3.6 look and feel. Otherwise I will go back to 3.6.

    You can make Firefox 4 look and behave more like Firefox 3.6, for details see http://www.computertechtips.net/64/make-firefox-4-look-like-ff-3-6

  • Creating an messagebox in forms with look and feel of Windows

    I wanted to create an message box in my form with look and feel of windows.For this i used the package ORA.FFI...but i am getting an error....and i am not bale to clear it...the code is as follows
    Package Specification: -
    PACKAGE messagebox IS
    /*Function message_box calls windows MessageBox function. */
    FUNCTION message_box(plptext IN VARCHAR2,plpcaption IN VARCHAR2)
    RETURN PLS_INTEGER;
    END;
    Package body : -
    PACKAGE BODY messagebox IS
    lh_window ORA_FFI.LIBHANDLETYPE;
    fh_mb ORA_FFI.FUNCHANDLETYPE;
    lh_forms ora_ffi.libHandleType;
    /* Function i_mbx acts as the interface to the Messagebox
    function in windows
    FUNCTION i_mbx(funchandle IN ORA_FFI.FUNCHANDLETYPE,
    plptext IN OUT VARCHAR2,
    plpcaption IN OUT VARCHAR2)
    RETURN PLS_INTEGER;
    PRAGMA interface(C,i_mbx,11265);
    FUNCTION message_box(plptext IN VARCHAR2,
    plpcaption IN VARCHAR2)
    RETURN PLS_INTEGER IS
    ltext VARCHAR2(500) := plptext;
    lcaption VARCHAR2(500) := plpcaption;
    BEGIN
    RETURN(i_mbx(fh_mb,ltext,lcaption));
    END;
    BEGIN
    lh_window := ORA_FFI.LOAD_LIBRARY('d:\','DclMsgBox.dll');
    fh_mb := ORA_FFI.REGISTER_FUNCTION(lh_window,'DclMsgBox',ORA_FFI.C_STD);
    ORA_FFI.REGISTER_RETURN(fh_mb,ORA_FFI.C_CHAR_PTR);
    ORA_FFI.REGISTER_RETURN(fh_mb,ORA_FFI.C_CHAR_PTR);
    --ORA_FFI.REGISTER_RETURN(fh_mb,ORA_FFI.C_INT);
    END;
    Now when i call this function in When-New-Form-Instance as
    declare
    p number;
    begin
    p:=messagebox.message_box('hello','test');
    end;
    I had created an dll for message box and placed the .dll and .lib files in the d:\ of my system.
    I get an error message when i run the app. The error is:
    The instruction at "0x005a3b24" referenced memory at "0x00000006".The memory could not be "read".
    Can anybody please tell me where have i gone wrong....

    Colin Martin wrote:
    I agree the leather look is horrible. It's just not a reflection of the cutting edge modern design we have all got to love over the years. If it has to be there at least give us a choice of looks.
    There is a word for this (not that one) - skeuomorph. Wikipedia defines this as 'a derivative object that retains ornamental design cues to a structure that was necessary in the original. Skeuomorphs may be deliberately employed to make the new look comfortably old and familiar'.
    Common examples are found in audio software with pictures of actual knobs that you turn, as here; and the leather-bound tear-off look of calendar and contacts on the iPad is the same principle: the intention is to make it familiar and friendly to people who might otherwise be frightened off by a modern look because they are not used to modern technology. The whole concept and look of the iOS operating system is being brought into use on Macs for the same reason, to encourage non-tech-savvy people not to be frightened of them.
    This is all very well in its way, but in these two particular cases the result is unfortunate, particularly for experienced users, and it really ought to be possible to choose between the looks (as you can with the Mail layouts), even if the skeuomorph is the default.

  • Is there a way I can add be background image to my sharepoint site with look and feel?

    Whenever i add any background image with "look and feel" it stretches the image. I've tried modifying the CSS file (in body and tried .ms-backgroundImage setting "background-size:inherit !important;") to fix it, but it doesn't seem to
    have any effect. I there anyway i can add a background image to the master html or css code and get it to not stretch?
    Thanks
    James T.F

    Hi,
    According to your post, my understanding is that you wanted to add background image to sharepoint site with look and feel.
    We can define the Image Url  in the Composed looks (Site Settings > Web Designer Galleries > Composed looks) to add background.
    However, the image will be stretched to fill the viewport at 100%.
    Though we can override the CSS attributes which would allow the image to repeat, but instead I recommend to go the no CSS route and switched the background to a much larger one that would fill the viewport nicely without looking pixelated.
    More information:
    SharePoint 2013 Branding: A New Approach
    SharePoint 2013's Branding – My first three lessons
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

Maybe you are looking for

  • Error during the creation of a Substitution (GGb0)

    Dear all, I'm facing the following problem. I'm tring to create a new Substitution (GGB0). But when I have tried to create the STEP, the system display this error " You may not substitute any fields for this Event" I think that I have to define the f

  • Vga cooler on cq43

    in my hand has  a presario cq43. i  dissassembled it and saw has no vga cooler.vga chip is naked. is it right? model is hosting those parts; amd e350, 2gb ram, amd 6310

  • Pricing calculating issue

    Hi, I have a specific issue regarding pricing:- The requirement is that the following entry should be passed in accounting while billing:- Dr. Revenue 100 Cr. AR 100 Dr. Cost of sales 5 Cr. TAX payable 5 For this requirement we have maintained a cond

  • Cannot unlock iPhone 4

    I have tried everything I can find on this forum and the web and I cannot unlock my iPhone 4.  I cannot get the "congratulations you iPhone is unlocked" in iTunes. I submitted the form to AT&T and got an email back saying they had granted my unlock r

  • Iphone case markup up

    New iPhone 5S case for gold phone all marked black after 2 weeks, tan leather case, defective?