JTable X System_Look-And-Feel Interaction

Friends,
I'm developing an application that is centered around a JTable. The column header labels are centered and have a yellow background.
When I use the Metal look-and-feel, no problem. However, if I switch to the system look-and-feel, the column labels will no longer be centered, and their yellow background does not show up.
I've attached some code below that will duplicate this problem. Just un-remark one look-and-feel (line 16), and then the other (line 18), and see how this affects the JTable's header.
I've searched a lot of documentation, tutorials, and forums and have not seen a reference to this problem. I hope that you can help.
Thank you.
Victor
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.UIManager;
public class testLNF {
public static void main(String[] args) {
// set look-and-feel to the local system:
String systemLookAndFeel = UIManager.getSystemLookAndFeelClassName();
System.out.println(systemLookAndFeel);
try {
// include this for Metal Look-And-Feel
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
// include this line for System Look-And-Feel
//UIManager.setLookAndFeel(systemLookAndFeel);
} catch (Exception e) {
System.out.println("Exception: " + e);
// Display the simple JTable
tempFrame ff = new tempFrame();
ff.setSize(300, 150);
ff.setLocationRelativeTo(null);
ff.setVisible(true);
ff.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} // main
private static class tempFrame extends JFrame {
private tempFrame() {
// Create a simple JTable to work with
JTable t = new JTable(4, 4);
t.getTableHeader().setBackground(Color.YELLOW);
t.getTableHeader().setForeground(Color.BLACK);
t.getTableHeader().setOpaque(true);
t.setShowGrid(true);
t.setGridColor(Color.DARK_GRAY);
// Add it to a JScrollPane
JScrollPane s = new JScrollPane(t);
add(s);
} // class tempFrame
} // class testLNF

Thank you for your guidance on this issue. I've started work with cell renderers in this table -- I'm using one to center my numbers in each cell. I'll get back to work on learning the basics.
Can you help me with what you mean by "delegate to the L&F renderer?" Can you give me an example?
Thank you!

Similar Messages

  • F2 Edit in JTable -- standard for all look and feel ?

    hi,
    I use a robot to simulate a F2 when a column is in focus in a JTABLE so that user can just type without having to type the <F2> key.
    My question is:
    Is F2 (to get a column in edit mode) for JTABLE standard for all look and feel (metal, X-windows ..) ?
    Thanks.
    Tony

    Read the JTable API. There is a link the gives the
    standard key assignments for the standard LAF's.thanks. got it.

  • Look and Feel Issues from NWDS 7.0.9 on Windows 7

    Dear Experts,
    I have successfully installed a new NWDS 7.0.9 on my 18' inch laptop:
      Windows 7 (64Bit)
      JDK 1.4.18 (32Bit)
    The NWDS starts without any problems however, i am begining to experience some erratic behavior from the projects i have created.
    For instance, when i attempt to Edit the Application  Properties for a WDJ project, the neccessary fields (and tabs) are not displayed hence i am unable to edit properties like the 'ExpirationTime' or create new one for that matter.
    In some cases,i am unable to embed a View into a Window because the neccessary fields to aid my selection of the view i want to embed are not visible for interaction.
    The same challenge occurs with EAR project; i am unable to edit 'application-j2ee-engine.xml' fields because they are not visible.
    After some troubleshooting,i discovered that the screen resolution may be affecting the 'Look and Feel' of the NWDS itself,
    If i reduced the resolution from 1024*768 to a value much more lower, some of these controls are displayed but with the desktop completely messed up.
    Does anybody have a solution to my problem because this challenge is affecting my productivity?
    Could my issue be as a result of my laptop screen size (i am using an 18'inch laptop)?
    Best regards,
    Bakau Onafuwa
    Oceanic Bank Int'l PLC

    Hi Vishal,
    first go to the download section in SMP.
    Roughly follow this path (translated from german ;-):
    SAP Software Distribution Center -> Download -> Further Download-Infos -> SAP Support Package Stacks -> SP Stack Download
    From list select SP Stack SAP NetWeaver 2004s
    A new window will pop up:
    1. Select your stack
    2. Usage Selection: Application Server Java
    3. Next Step
    4. Under SAP Kernel xx bit select your DB and OS
    5. Next Step
    6. You get a list of all components of you selected items.
    Here you'll find NWDS with a filename like JIDE09P_1-10003480.SAR
    You know the rest, right?
    Regards,
       ok

  • Is there a separate download for iMac.  I bought and downloaded what I thought was the right download but it is not working and feel it might be a windows version.  How doe I get it right

    s there a separate download for iMac.  I bought and downloaded what I thought was the right download but not working and feel it might be a windows version.  How doe I get it right

    Check the link below for requirements and instructions for upgrading to Snow Leopard (10.6)
    http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard

  • Windows look and feel instead, in InternalFrameDemo.java

    Hi all, I am learning swing and I am trying to modify the
    InternalFrameDemo.java source from
    http://docs.oracle.com/javase/tutorial/uiswing/examples/components/index.html#InternalFrameDemo
    My idea is to add the line
    JFrame.setDefaultLookAndFeelDecorated(true); in the constructor, but it doesn't work
    and I don't understand why.
    Could somebody please help me?
    Kindest regards,
    Lasse
    public InternalFrameDemo() {
    super("InternalFrameDemo");
    //Make the big window be indented 50 pixels from each edge
    //of the screen.
    int inset = 50;
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setBounds(inset, inset,
    screenSize.width - inset*2,
    screenSize.height - inset*2);
    //FDoesn't work
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Set up the GUI.
    desktop = new JDesktopPane(); //a specialized layered pane
    createFrame(); //create first "window"
    setContentPane(desktop);
    setJMenuBar(createMenuBar());
    //Make dragging a little faster but perhaps uglier.
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    }

    Uh I think you're mistaken. Whenever in doubt or something doesn't work as expected, check the javadocs. The link to the javadocs can usually be found really easily by typing "java 6 classname". In this case:
    http://docs.oracle.com/javase/6/docs/api/javax/swing/JFrame.html
    If you want to set the Windows look & feel as your thread title suggests, this was not the method you were looking for as the javadocs will tell you. That method controls if a frame is decorated or not (as the name suggests), which it is by default. Setting it to true will not change anything.
    So what then? You type into Google "java swing windows look and feel". Without quotes of course.

  • Problems installing the new 'Look And Feel' done by Francios Degrelle

    I have download the new verison of the new 'Look And Feel' from
    http://sheikyerbouti.developpez.com/forms-pjc-bean/LAF/sources/v133/LAF_133.zip
    1- I defined a new section in formsweb.cfg named summit in the middle tier (AS 10g Rel2):
    [Summit]
    baseHTML=base.htm
    baseHTMLjinitiator=basejpi.htm
    baseHTMLjpi=basejpi.htm
    baseHTMLie=baseie.htm
    HTMLdelimiter=%
    workingDirectory=e:\app\summit
    envFile=default.env
    IE=JInitiator
    escapeparams=true
    form=customers_laf
    debug=no
    otherparams=buffer_records=%buffer% debug_messages=%debug_messages% array=%array% obr=%obr% query_only=%query_only% quiet=%quiet% render=%render% record=%record% tracegroup=%tracegroup% log=%log% term=%term% useSDI=yes
    buffer=no
    debug_messages=no
    array=no
    obr=no
    query_only=no
    quiet=yes
    render=no
    pageTitle=Summit
    serverURL=/forms/lservlet
    codebase=/forms/java
    imageBase=DocumentBase
    width=100%
    height=100%
    separateFrame=false
    splashScreen=no
    lookAndFeel=oracle
    colorScheme=blue
    logo=no
    restrictedURLparams=HTMLbodyAttrs,HTMLbeforeForm,pageTitle,HTMLafterForm,log,allow_debug,allowNewConnections
    serverApp=default
    archive_jini=frmall_jinit.jar
    archive=frmall.jar,laf.jar
    WebUtilArchive=
    jpi_download_page=http://java.sun.com/products/archive/j2se/1.4.2_09/index.html
    jpi_classid=clsid:8AD9C840-044E-11D1-B3E9-00805F499D93
    jpi_codebase=http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0
    2- then I put a copy of the file 'forms.css' in the middle tier in the folder :
    apache\apache\htdocs
    so as to be on the path and then modified PM$CSS_FILENAME in all forms to be 'forms.css' instead of 'c:\forms.css' and recompiled.
    3-I put a copy of the file 'laf.jar' in the folder : 'd\Ora_AS\forms\java' in the middle tier and added this path to the classpath environment variable.
    4- I restarted the middle tier and wrote this URL:
    http://test/forms/frmservlet/config=summit
    the customers form opened but with no background images,I added the following to the URL '&form=test_laf_color_scheme.fmx',the form opened with the default color scheme to 'purple',I changed it from a drop down list to orange and all buttons background color degraded to orange.
    My questions:
    1-where are the background images ?
    2- I cannot compile the 'laf.pll' file to 'laf.plx',when I compile I get this error:
    FRm-91507 -internal error
    P.S. I read this thread :
    FRM-91507 when compiling a library with Forms 6i
    and I didn't understand it,where do I change the Forms_Path? in the forms Home release 1 or Forms home release 2?!!!
    3-Is the 'forms.css' file properly located? if not? where do I put it?
    Sorry for the long scenario but I'm really confused?
    Thanks
    Mohammad

    Hello,
    I'm curently out of everything so I cannot answer this one. All I can tell is that images are read from the client machine or jar file. If you want read images from the application server, you need the http:// syntax.
    Francois

  • How to change the default look and feel

    Hi.
    Does anyone knows how to change the default Caspian look and feel to, for example, Nimbus ?
    Or the skin feature turns look and feel setting, as We know in java, unnecessary in javafx ?
    I´m using javafx 1.2.
    Cheers

    Canspian is not a look&feel, it's a skin.
    Look&feel only change the SwingComponent,
    regards.

  • 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

  • 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);

  • How to give BSP Iview look and feel of portal??

    Hi All,
    I've created a BSP application that I use to create an Iview for portal.
    I thought that if i used htmlb tags that the look and feel of portal would be automatic to my app but its not.
    I've tried assigning portal css classes to a html table but there's no effect.
    I've previewed one of the standard ivews and viewed the source and found the path of the css file.  But when i looked for it on the server, while the out folder was there (com.sap.portal.design.portaldesigndata) , there was no css files in this folder.
    So i'm at a loss.  In summary, how do i get my bsp app to have the portal look and feel?????  I would prefer to use the css files so that if any changes are made to the standard, the changes will be reflected in my custom iviews too.
    Any help, would be most welcome,
    Liz.

    Hi Liz,
    on the properties tab for the BSP application try selecting the "Supports Portal Integration" checkbox.
    Cheers
    Graham Robbo

  • Accessing File/Folder icons for current Look and Feel

    Hi,
    I'm looking to get the Icon for files and folders that the current UIManager uses for some work I'm doing. Please could you help.
    I'm getting strange results from the method I'm using, which is to create a temporary file and do: Icon i = FileSystemView.getFileSystemView().getSystemIcon(tempFile);
    I don't like the idea of having to create a temporary file to do this - isn't there another way to do it? - for instance asking "get default file icon"/"get default folder icon".
    I could download a jpg image of the file/folder icons, but this is static - and I want my method to get the icons used for the current look and feel I'm using.
    There must be a simple way to do this right? I mean, java uses a method to get the icons for the current look and feel.. Oh.. Please help!
    - Edd.

    Try these:
    UIManager.getIcon("FileView.directoryIcon");
    UIManager.getIcon("FileView.fileIcon");Leif Samuelsson
    Java Swing Team
    Sun Microsystems, Inc.

  • 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>

  • I just updated iOS on my iPhone 5. What a shock!! Where is the premium look and feel I bought my iPhone for? If I wanted the lokale feel of iOS 7.0 I would have bought a much cheeper taiwanese smartphone. Please let me know how I can return to the origina

    I just updated iOS on my iPhone 5.
    What a shock!! Where is the premium look and feel I bought my iPhone for?
    If I wanted the lokale feel of iOS 7.0 I would have bought a much cheeper taiwanese smartphone.
    Please let me know how I can return to the original look and feel of the iPhone surface I bought my phone for.

    You had plenty of time to look at screenshots on the internet and read various blog posts about iOS 7.

  • 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

  • MDOP 2013: App-V 5 SP2 Application Publishing and Client Interaction Guide Now Available

    Hello App-V forum users,
    Do you want to understand the details of how App-V publishes and runs applications? See
    this Springboard Series blog post, which describes the newly available App-V 5 SP2 Application Publishing and Client Interaction Guide.
    Enjoy!
    -Tony
    IT Pro Audience Manager for Web Forums

    Hello,
    I am truely confused by how you are attempting to achieve things.
    1. The Office 2013 package is only supported if deployed globally
    2. AppLocker is the way to restrict users from starting different applications
    3. Office 2013 is not supported to be published to users
    It seems you have issues with #3. Which is not supported. I am not saying it "doesn't" work, but considering you have issues with it - perhaps we can start by not doing it?
    Ok, so what do we have left;
    Per your statement, Office 2013 is published globally. Ergo, all shortcuts and applications should be available to all users.
    Is this true?
    Nicke Källén | The Knack| Twitter:
    @Znackattack

Maybe you are looking for