How to override the BasicFileChooserUI?

i have been override the BasicFileChooserUI, but why the icon still not change?
main class:
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.filechooser.FileNameExtensionFilter;
class custom_fc extends JFrame{
    public String source = "c:/";
    myUIFileChooser mui;
    public custom_fc(){
     init();
     create_comp();
    public void create_comp(){
        JButton bOpen = new JButton("open");
        bOpen.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {       
                JFileChooser fileChooser = new JFileChooser();
                myUIFileChooser mui = new myUIFileChooser(fileChooser);
                mui.createUI(fileChooser);                         
                int returnValue = fileChooser.showOpenDialog(null);
                if (returnValue == JFileChooser.APPROVE_OPTION) {                   
                    File myFile = fileChooser.getSelectedFile();
                    source = myFile.getAbsolutePath();                                                          
         add(bOpen);
    public void init(){
        setLayout(new FlowLayout());
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(400,400);
    public static void main(String[] args){
        new custom_fc();
}myui class
import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.*;
public class myUIFileChooser extends BasicFileChooserUI
public myUIFileChooser (JFileChooser c)
     super (c);
    @Override
    protected void installIcons(JFileChooser fc) {
     directoryIcon    = new ImageIcon("new_directoryIcon.png");
        newFolderIcon    = new ImageIcon("new_newFolderIcon.png");
     upFolderIcon     = new ImageIcon("new_upFolderIcon.png");
        homeFolderIcon   = new ImageIcon("new_olderIcon.png");
    public static ComponentUI createUI (JComponent c)
         JFileChooser fc = (JFileChooser) c;
         myUIFileChooser ui = new myUIFileChooser (fc);
         ui.installIcons (fc);
         return (ui);
}thxx..

If you want to change the icons for your entire application then you can use the UIManager.
Check out my [UIManager Defaults|http://www.camick.com/java/blog.html?name=uimanager-defaults] blog entry.

Similar Messages

  • How to override the default height of tree component...

    Hi,
    Can anyone please tell me how to override the default height of <af:tree> component.
    Actual Problem:
    I have a PanelBox in which I have a ShowDetail component. ShowDetail contains Tree component. When I click on ShowDetail item the Tree component have to be displayed. But, PanelBox is expanding to TREE default height(27.27 ems) instead of expanding to exact height of Tree.
    How to manage this issue?
    Thanks
    -Sukumar

    Did you already try
               <af:treeTable value="#{bindings.DashProjectPhasesDev.treeModel}"
                                  var="node"
                                  selectionListener="#{bindings.DashProjectPhasesDev.treeModel.makeCurrent}"
                                  rowSelection="none" rowBandingInterval="0"
                             inlineStyle="width:810px; height:1100px;"> Check the last line with inlineStyle...
    Julian

  • One of my kids changed my password, and now i can't access my mail accounts. Any ideas on how to override the password and set up a new one?

    one of my kids changed my password, and now i can't access my mail accounts. Any ideas on how to override the password and set up a new one?

    A mail account password or you login password?
    Which OS by the way?

  • How to override the create method invoked by a create form?

    Hello everyone, I'm using ADF Faces and have the next question:
    How can I override the create method which is invoked by a create form to preset an attribute in the new row (the preset value is not fixed, I have to send it to the method as a parameter as it is obtained using an EL expression)?
    In the ADF guide I read how to override a declarative method (Section 17.5.1 How to override a declarative method), but this explains how to do it with a method that is called by a button. I don't know how to do the same with a method which is called automatically when the page is loaded.
    I also tried overriding the view object's createRow() method to receive a parameter with the preset values but it didn't work, I believe that was because the declarative create method is not the same as the view object's createRow. This caused the form to display another row from the viewobject and not the newly created one (I also set the new row into STATUS_INITIALIZED after setting the attribute).
    Well, I hope my problem is clear enough for somebody to help me.
    Thank you!

    Hello,
    I'm not sure you can do it with standard generated Create Form.
    In your view object you'll need to create your own create method with parameters, publish it to client interface and invoke instead of standard generated create action in page definition.
    Rado

  • How to override the default "required" attribute for the UIComponent?

    Hi, consider the following markup: <h:inputText id="txt_firstName" value="#{myBean.firstName}" required="true"/>
    if I leave this field empty and hit the submit button, the required validator will fire an error msg. If however, I leave an empty space in the text box and hit submit button, it will go through no problem.
    I'd like to override the required attribute, so it will trim the spaces first before decide if it really is empty:
    //whatever the name of the method i'm overriding....
    String value = (String)value;
    if(value==null)throw new ValidatorException(whateverDefinedInTheBundle);
    value = value.trim();
    if(value.length==0)throw new ValidatorException(whateverDefinedInTheBundle);
    How can I go about doing that?
    Thank you.

    Did you already try
               <af:treeTable value="#{bindings.DashProjectPhasesDev.treeModel}"
                                  var="node"
                                  selectionListener="#{bindings.DashProjectPhasesDev.treeModel.makeCurrent}"
                                  rowSelection="none" rowBandingInterval="0"
                             inlineStyle="width:810px; height:1100px;"> Check the last line with inlineStyle...
    Julian

  • How to override the default delete operation

    Hi,
    I am new to Jheadstart, java coding for that matter.
    Here's my situation,
    I have a view which is based on a function (function returns a collection).
    I have created instead of triggers on this view to perform insert/update/delete operations.
    All these DML operations work as expected in Oracle database.
    Now, I created an Entity object and a view object on this view in my jheadstart project.
    When I run this Jheadstart application my insert and search operations run fine but update and delete operations fail with JBO-26080 error.
    The underlying oracle error is "ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc."
    I know that delete and update operations work fine in Oracle and hence I would like to override the default Jheadstart operations. Can any body tell me how can I do it or point me in right direction?

    Hi,
    From the JHeadstart Developer's Guide, chapter TroubleShooting - Problem Assessment:
    If you are getting a JBO error (Business Components for Java error), try to perform the same data retrieval or data manipulation action using the BC4J Tester. You can
    invoke the tester through a right-mouse-click on the BC4J application module. If you get the same error using the BC4J tester, the problem is in the BC4J object definitions. If you added business rules, or other custom code to your BC4J objects that executes during your data retrieval or data manipulation action, you can debug this code line-by-line by running the tester in debug mode. You can also look up the JBO error in the JDeveloper online help, for each error possible causes and how to solve them are described.
    It sounds to me like you will also get this error in the BC4J Tester. This means that the problem is not related to JHeadstart. You can go to the JDeveloper discussion forum http://otn.oracle.com/discussionforums/jdev.html and ask your question there without mentioning JHeadstart. Maybe there is some switch you can set in the BC4J object to let BC4J not use SELECT FOR UPDATE.
    Hope this helps,
    Sandra Muller
    JHeadstart Team

  • How to override the renderer of af:selectManyCheckbox to add images

    My goal is to add an image and the handler of the image for each SelectItem of af:selectManyCheckbox.
    I'm defining the customized renderer like below, but I'm not sure about the "???" part. Any advice/sample will be appreciated. Runnable project will be even better.
    public class MyCheckboxRenderer extends SelectManyCheckboxRenderer{
    @Override
    public void encodeBegin(FacesContext context,
    UIComponent component) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    for(SelectItem item : component.getChildren()){
    if(item instanceof MySelectItem){
    ???writer.write(the checkbox);
    ???writer.write(item.image);
    ???register the handler for the image
    ???writer.write(item.label);
    }else if(item instanceof SelectItem){
    ???render as default;
    super.encodeBegin(context, component);
    public class MySelectItem extends SelectItem{
    String image;
    In faces-config.xml
    <render-kit>
    <renderer>
    <component-family>???</component-family>
    <renderer-type>???</renderer-type>
    <renderer-class>MyCheckboxRenderer</renderer-class>
    </renderer>
    </render-kit>
    Thanks.
    Edited by: Leon Zeng on Jul 19, 2012 9:55 AM

    Seems I need override the encodeSelectItem() method.
    But not sure which class is the renderer for af:selectManyCheckbox. And how to set below
    <component-family>???</component-family>
    <renderer-type>???</renderer-type>
    Edited by: Leon Zeng on Jul 19, 2012 2:18 PM

  • How to override the renderer for ADF component?

    I want to overide the renderer for ADF components, without using <default-render-kit>, I defined every render class. But It does not work.
    Always told me: Could not find renderer for CoreOutputText[UIXFacesBeanImpl, id=_id0], rendererType = oracle.adf.Text
    How can I config custom renderer for exsiting component or new components?
    Thanks a lot!
    <render-kit>
    <render-kit-id>oracle.adf.core</render-kit-id>
    <renderer>
    <component-family>oracle.adf.Output</component-family>
    <renderer-type>oracle.adf.Formatted</renderer-type>
    <renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.OutputFormattedRenderer</renderer-class>
    </renderer>
    <renderer>
    <component-family>oracle.adf.Choose</component-family>
    <renderer-type>oracle.adf.Date</renderer-type>
    <renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.ChooseDateRenderer</renderer-class>
    </renderer>
    <renderer>
    <component-family>oracle.adf.Input</component-family>
    <renderer-type>oracle.adf.Text</renderer-type>
    <renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.InputTextRenderer</renderer-class>
    </renderer>
    <renderer>
    <component-family>oracle.adf.SelectInput</component-family>
    <renderer-type>oracle.adf.Date</renderer-type>
    <renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.SelectInputDateRenderer</renderer-class>
    </renderer>
    <renderer>
    <component-family>oracle.adf.Object</component-family>
    <renderer-type>oracle.adf.Separator</renderer-type>
    <renderer-class>oracle.adfinternal.view.faces.uinode.UINodeRendererBase</renderer-class>
    </renderer>
    <renderer>
    <component-family>oracle.adf.Command</component-family>
    <renderer-type>oracle.adf.Link</renderer-type>
    <renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.CommandLinkRenderer</renderer-class>
    </renderer>
    <renderer>
    <component-family>oracle.adf.Panel</component-family>
    <renderer-type>oracle.adf.Group</renderer-type>
    <renderer-class>oracle.adfinternal.view.faces.renderkit.core.xhtml.PanelGroupRenderer</renderer-class>
    </renderer>
    </render-kit>

    Seems I need override the encodeSelectItem() method.
    But not sure which class is the renderer for af:selectManyCheckbox. And how to set below
    <component-family>???</component-family>
    <renderer-type>???</renderer-type>
    Edited by: Leon Zeng on Jul 19, 2012 2:18 PM

  • How to override the where clause (Bind Variables) in Backing Bean.

    HI
    I am using bind variables in VO and using exeutewithparam to pass the values to bind. Which is working fine.
    But what i want now to override the values pro grammatically from backing_bean of that page.
    How can i pass the values to bind variables from bean.
    M Niaz.

    Hi
    Try this if it works. this is from 10g
    1)create value binding in the backing bean on any action
    FacesContext ctx=FacesContext.getCurrentInstance();
    ValueBinding vb= ctx.getApplication().createValueBinding("#{bindings['account_name1'].inputValue}");
    2) and then set the value for binding
    vb.setValue(ctx,(String)accountInput.getValue());
    Now execute the method with method binding and execute it
    ctx.getApplication().createMethodBinding("#{bindings.ExecuteWithParams.execute}",null).invoke(ctx,null);
    Regards
    Rohit

  • How to override the NUMBER format in BEX?

    Hi,
    I want to override the number formats in BEX queries (Excel).
    In the Query Designer -> Query Properties -> Value Display,
    or in 3.x: Query Properties -> Display -> Number Format,
    the setting "Display of +/- Signs" affects how the numeric values in Excel will be displayed. This setting seems to take effect after everything else is done.
    I can change any cell formatting (pattern, border, color, etc.) except the number format. I have tried redefining Styles, assign different styles to the Result Area, setting up a default template, even Visual Basic (Sub SAPBEXonRefresh), nothing works, my settings always get overwritten by the query setting.
    For example:
    I am trying to assign the Number Format "Accounting", with a "$" sign in the far left of the fields, to the amounts in my workbook.
    It should look like this: "$     (123,456.00)"
    The results: my settings are replaced by the format "Currency" with the "$" sign.
    "    ($123,456.00)"
    It must be due to that number format setting in the query designer.
    I was hoping the number format setting in the query designer could be switched off. But apparently it is not possible. Not even the "Adjust Formatting after Refreshing" setting affects this behavior. It always takes effect.
    Does anyone have any idea what could be done about it?
    Thank you,
    Vince

    OK, I think I have just found the answer to my own question...
    I had done something in the VB editor that created this whole problem. Now it is fixed and works as it should.
    Thanks anyway.

  • How to override the built in functions

    hi,
    how can we override the built-in functions like create, delete in ADF. I need to write a code that would work for the entire data model instead of only the view object in question. There are a set of actions and operations that should be dealt thru the template and only few operations thru the main/master screen.
    thanks all,
    Jyothi

    You can override specific methods for EOs see here:
    http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcservices.htm#CHDEIFFG
    Or if you want to change the behavior for all your EOs create an extension as described here:
    http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcadvgen.htm#sm0291

  • How to override the onTouchUp in the user control which can be used to fire the event not only on this user control, but whole application

     I am a new to the C# and WPF. Right now, I want to override onTouchUp event in my user control. Then I can add user control in
    the references for reuse. The problem is each time I want to test this event on the application, the event only fire at area of user control, not whole screen. Anyone has solution for this?

    You cannot just add a UserControl to a window and expect its OnTouchUp method to get invoked when a TouchUp event occurs outside of the user control. That is not how routed events work.
    The OnTouchUp method of the UserControl will only be invoked when a TouchUp event occurs from within the UserControl.
    The event will indeed bubble up to the parent elements of the UserControl and you could for example handle the event in the parent window:
    <Window x:Class="WpfApplicationSlider.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" TouchUp="Window_TouchUp">
    The OnTouchUp method of the UserControl will however never get invoked when you touch an element outside of the UserControl because an event only travels between the source element and the handler(s). This is how routed events work.
    If you want a "global" TouchUp event handler you should override the OnTouchUp of the top-level
    window:
    public partial class MainWindow : Window
    public MainWindow()
    InitializeComponent();
    protected override void OnTouchUp(TouchEventArgs e)
    base.OnTouchUp(e);
    //do your thing...
    If you want to be able to reuse the functionality across all of your windows in case you have several you could for example create an abstract window class and make all your windows inherit from this one:
    namespace WpfApplication1
    public abstract class BaseWindow : System.Windows.Window
    protected override void OnTouchUp(System.Windows.Input.TouchEventArgs e)
    base.OnTouchUp(e);
    //do your thing...
    MainWindow:
    public partial class MainWindow : BaseWindow
    public MainWindow()
    InitializeComponent();
    <local:BaseWindow x:Class="WpfApplicationSlider.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:WpfApplication1"
    Title="MainWindow" Height="350" Width="525">
    </local:BaseWindow>
    Hope that helps.
    Please remember to mark helpful posts as answer to close your threads and please start a new thread if you have a new question.

  • How to override the event loop

    As a windows game developer, I have always overridden the application message loop to make sure that graphics were rendered when the CPU was idle, and still being able to process windows messages like keyboard/mouse events. CPU is then maxed out (except when a forced sleep or v-sync is enabled) to give highest performance on graphics, making a simple clear opengl window render at 3500 frames per second (I know this is idiotic but I'm trying to make a point).
    Now that I'm porting my game engine (c++ code) to cocoa, I  am struggling with how to implement the main loop. I could use a timer but this will fix the framerate and might be slow. It will prevent me to use the CPU to its full extent.
    So: is there some kind of OnIdle event I can override? Or do I have to do the Event loop processing myself? And can anyone tell me how to do something like this? Is there a tutorial or a book or anything I can study to learn about this? I presume this is lower level API.
    Any help is appreciated!
    Dirk.

    etresoft wrote:
    Michael may profess ignorance about MacOS X applications, but he is still 100% correct. You need to study the architecture and find the best way to work with it. The first thing to know is that the CPU is irrelevant. Let the GPU handle your graphics - that is what it does best. You do want your CPU to be as idle as possible. Approach it from a device-driver or event-driven perspective.
    Just to clarify that I'm not a total noob trying to write his first program: of course I will not overly use the CPU if not necessary. I completely agree with what you guys say about maximizing CPU usage. My game engine on windows will put the CPU to sleep when it's not necessary making my engine perform very good with almost no CPU usage.
    But... when I want to test if changes to my engine/shaders/... improve or degrade performance of the renderings, I want to be sure that everything is maxed out so that I can be sure that the difference is correct. On maxed out CPU/GPU, I will notice the difference when framerate goes for example from 2000 to 1900 while this will not be visible when just at 60 fps and a lot of free time. I will see 60 fps even when my code is worse. That's why I need to be able to test this.
    Anyway, as I said, I completely agree and I will certainly do my very best to make sure that CPU is not overly used. So my question remains: how can I make sure that I have everything I need at the time I need it while I will do my best to make sure nothing more is used?
    Timer-events at 1/60th of a second is not the answer...
    Using threads for these things is not the answer... I use them for other things (loading from disk/processing data/generating data)
    But are there other options?
    Can you point me to where I can learn more about the architecture and its possibilities?

  • JRE 1.4.2: how to override the default xml parser?

    Hi all,
    I have JRE 1.4.2_03 and I need to replace the default xml "crimson" parser with xerces because the former one doesn't properly handle utf-8 BOM.
    Does anyone have an idea where I should look at for this kind of configuration?
    I skimmed thorugh the oracle docs but couldn't find anything.
    I found a link describing how to change the xml parser in OC4J, but my understanding is that this has little to do with what I am looking for.
    I need to force Saxon 8.6.1, that is invoked by means of java.exe from the command line, to pick up the right xml parser.
    Has anyone else tried this out already?
    Alternatively, is it safe to install JRE 1.5 in place of JRE 1.4.2 on a Oracle 10.1.0.4 database?
    I am told that JRE 1.5 uses a different xml parser that should fix my problem.
    Bye,
    Flavio

    I sorted this out myself.
    Downloaded the latest stable xerces binary (2.5.0) from http://xml.apache.org/dist/xerces-j/
    Then I extracted xercesImpl.jar and put it under:
    %ORACLE_HOME%\LIB\endorsed
    I had to create the endorsed folder as it didn't exist.
    Then, when invoking Saxon using java.exe, I added the following switch:
    -Djava.endorsed.dirs=%ORACLE_HOME%\LIB\endorsed
    That's it.
    You can find some background info on:
    https://jaxp.dev.java.net/Updating.html
    Bye,
    Flavio

  • How to override the functionality of a method which is embedded in an swf

    Hi,
    I have an swf for my application for which i do not have the source code. Now i want to override the functionality of a method (say doIt()) in a class (say MyClass.as).
    Is there any way to achieve the classloader functionality that similar to the tomcat classloading functionality for java files.
    i.e Tomcat's classloader searches the WEB-INF/classes directory before the WEB-INF/lib/*.jar. That means my original code is in lib folder, and the orerriden code is in the classes folder. In this case, tomcat will see the classes folder first, if my class does not exist in this folder, then it looks for the lib folder.
    Can we achieve the same class loading functionality in Flex. The overall idea is to change the functionlity of a feature without touching the original swf and by creating an external swf and by calling it.
    Regards,
    Sangeeta Kalyani

    Sangeetha Kalyani,
    Use SWF de-compiler.. and get the source of your SWF.. i think this will simplyfy your JOB...!
    Thanks,
    Pradeep

Maybe you are looking for